complexity
int64
1
139
fun_name
stringlengths
1
80
code
stringlengths
101
62.2k
commit_id
stringlengths
40
40
ast_errors
stringlengths
0
3.11k
ast_levels
int64
6
36
file_name
stringlengths
5
79
n_ast_nodes
int64
17
19.2k
commit_message
stringlengths
3
15.3k
d_id
int64
12
121k
n_ast_errors
int64
0
9
n_whitespaces
int64
4
10.8k
token_counts
int64
5
3.06k
vocab_size
int64
4
1.11k
id
int64
20
338k
n_words
int64
4
4.82k
repo
stringlengths
3
22
n_identifiers
int64
2
176
path
stringlengths
7
134
language
stringclasses
1 value
nloc
int64
1
413
documentation
dict
url
stringlengths
31
59
4
hard_nms
def hard_nms(box_scores, iou_threshold, top_k=-1, candidate_size=200): scores = box_scores[:, -1] boxes = box_scores[:, :-1] picked = [] indexes = np.argsort(scores) indexes = indexes[-candidate_size:] while len(indexes) > 0: current = indexes[-1] picked.append(current) ...
ddaa2c2552e19635cd6cdf38619f1f176c358f89
13
picodet_postprocess.py
237
add SLANet
4,737
0
196
152
50
24,457
68
PaddleOCR
20
ppstructure/layout/picodet_postprocess.py
Python
20
{ "docstring": "\n Args:\n box_scores (N, 5): boxes in corner-form and probabilities.\n iou_threshold: intersection over union threshold.\n top_k: keep top_k results. If k <= 0, keep all the results.\n candidate_size: only consider the candidates with the highest scores.\n Returns:\n...
https://github.com/PaddlePaddle/PaddleOCR.git
4
get_module_by_name
def get_module_by_name(model, module_name): name_list = module_name.split(".") for name in name_list[:-1]: if hasattr(model, name): model = getattr(model, name) else: return None, None if hasattr(model, name_list[-1]): leaf_module = getattr(model, name_li...
d68c786ff81bad19c04619d6a999ff34aaa724e7
12
pruning.py
131
[Compression] remove pruning v1 & refactor directory (#5228)
25,005
0
107
82
24
113,688
35
nni
9
nni/compression/pytorch/utils/pruning.py
Python
12
{ "docstring": "\n Get a module specified by its module name\n Parameters\n ----------\n model : pytorch model\n the pytorch model from which to get its module\n module_name : str\n the name of the required module\n Returns\n -------\n module, module\n the parent module of...
https://github.com/microsoft/nni.git
2
check_keys_split
def check_keys_split(self, decoded) -> None: bad_keys = set(decoded.keys()).difference(set(self._split_keys)) if bad_keys: bad_keys_joined = ", ".join(bad_keys) raise ValueError(f"JSON data had unexpected key(s): {bad_keys_joined}")
734db4f1fde2566a02b3c7ff661a479b0a71633c
12
_json.py
85
TYP: Return annotations for io/{formats,json} (#47516) * TYP: Return annotations for io/{formats,json} * flake8 * explicitly check whether width is None
40,008
0
64
47
20
167,425
21
pandas
11
pandas/io/json/_json.py
Python
8
{ "docstring": "\n Checks that dict has only the appropriate keys for orient='split'.\n ", "language": "en", "n_whitespaces": 25, "n_words": 10, "vocab_size": 10 }
https://github.com/pandas-dev/pandas.git
7
connect
def connect(self, host='', port=0, timeout=-999, source_address=None): if host != '': self.host = host if port > 0: self.port = port if timeout != -999: self.timeout = timeout if self.timeout is not None and not self.timeout: raise...
8198943edd73a363c266633e1aa5b2a9e9c9f526
10
ftplib.py
264
add python 3.10.4 for windows
54,803
0
255
167
49
217,460
72
XX-Net
19
python3.10.4/Lib/ftplib.py
Python
18
{ "docstring": "Connect to host. Arguments are:\n - host: hostname to connect to (string, default previous host)\n - port: port to connect to (integer, default previous port)\n - timeout: the timeout to set against the ftp socket(s)\n - source_address: a 2-tuple (host, port) for the s...
https://github.com/XX-net/XX-Net.git
15
model_is_indexable
def model_is_indexable(cls, model, allow_child_models=False): if getattr(model, "wagtail_reference_index_ignore", False): return False # Don't check any models that have a parental key, references from these will be collected from the parent if not allow_child_models and an...
c8689acb3724dc12fb09a0bfc14d7e4755a1ea0f
13
reference_index.py
244
Check field for .extract_references method instead of field type Co-authored-by: Matt Westcott <matthew@torchbox.com>
16,955
0
466
156
59
79,676
91
wagtail
20
wagtail/models/reference_index.py
Python
28
{ "docstring": "\n Returns True if the given model may have outbound references that we would be interested in recording in the index.\n\n\n Args:\n model (type): a Django model class\n allow_child_models (boolean): Child models are not indexable on their own. If you are looking at...
https://github.com/wagtail/wagtail.git
3
test_write_tfrecords
def test_write_tfrecords(ray_start_regular_shared, tmp_path): import tensorflow as tf # The dataset we will write to a .tfrecords file. ds = ray.data.from_items( [ # Row one. { "int_item": 1, "int_list": [2, 2, 3], "float...
9fab504fe776f96fecf85e12ea006264cbe92f4a
23
test_dataset_tfrecords.py
885
[Datasets] Add writer for TFRecords. (#29448) This PR enables users to write TFRecords from datasets. In particular, the master branch already includes an API for reading TFRecords from datasets. Users have requested the ability to write these datasets back to TFRecords.
30,665
0
1,453
590
127
135,586
231
ray
40
python/ray/data/tests/test_dataset_tfrecords.py
Python
82
{ "docstring": "Test that write_tfrecords writes TFRecords correctly.\n\n Test this by writing a Dataset to a TFRecord (function under test),\n reading it back out into a tf.train.Example,\n and checking that the result is analogous to the original Dataset.\n ", "language": "en", "n_whitespaces": 48, ...
https://github.com/ray-project/ray.git
2
fix_script
def fix_script(path): # type: (str) -> bool # XXX RECORD hashes will need to be updated assert os.path.isfile(path) with open(path, 'rb') as script: firstline = script.readline() if not firstline.startswith(b'#!python'): return False exename = sys.executable.enc...
f638f5d0e6c8ebed0e69a6584bc7f003ec646580
12
wheel.py
185
upd; format
12,353
0
134
104
41
60,940
53
transferlearning
18
.venv/lib/python3.8/site-packages/pip/_internal/operations/install/wheel.py
Python
13
{ "docstring": "Replace #!python with #!/path/to/python\n Return True if file was changed.\n ", "language": "en", "n_whitespaces": 16, "n_words": 10, "vocab_size": 10 }
https://github.com/jindongwang/transferlearning.git
1
decrypt_data
async def decrypt_data(self, session): return await decrypt_fernet(session, self.data) @declarative_mixin
40309ccbc3b8c8474ae15293fbbecb28eded6ef5
@declarative_mixin
9
orm_models.py
35
Update Block API
10,992
1
22
18
9
54,156
9
prefect
6
src/prefect/orion/database/orm_models.py
Python
2
{ "docstring": "\n Retrieve decrypted data from the ORM model.\n\n Note: will only succeed if the caller has sufficient permission.\n ", "language": "en", "n_whitespaces": 39, "n_words": 17, "vocab_size": 16 }
https://github.com/PrefectHQ/prefect.git
2
assign
def assign(self, **kwargs) -> DataFrame: r data = self.copy(deep=None) for k, v in kwargs.items(): data[k] = com.apply_if_callable(v, data) return data
36dcf519c67a8098572447f7d5a896740fc9c464
10
frame.py
75
ENH/TST: expand copy-on-write to assign() method (#50010)
40,716
0
58
48
18
171,745
20
pandas
12
pandas/core/frame.py
Python
66
{ "docstring": "\n Assign new columns to a DataFrame.\n\n Returns a new object with all original columns in addition to new ones.\n Existing columns that are re-assigned will be overwritten.\n\n Parameters\n ----------\n **kwargs : dict of {str: callable or Series}\n ...
https://github.com/pandas-dev/pandas.git
2
in4_chksum
def in4_chksum(proto, u, p): # type: (int, IP, bytes) -> int if not isinstance(u, IP): warning("No IP underlayer to compute checksum. Leaving null.") return 0 psdhdr = in4_pseudoheader(proto, u, len(p)) return checksum(psdhdr + p)
20ac1d00389d0735e6d8cd1347f0a53f478144ba
10
inet.py
74
Support TCP-MD5 and TCP-AO (#3358) Support TCP-MD5 and TCP-AO
52,613
0
63
45
32
209,123
34
scapy
11
scapy/layers/inet.py
Python
6
{ "docstring": "IPv4 Pseudo Header checksum as defined in RFC793\n\n :param nh: value of upper layer protocol\n :param u: upper layer instance\n :param p: the payload of the upper layer provided as a string\n ", "language": "en", "n_whitespaces": 44, "n_words": 32, "vocab_size": 23 }
https://github.com/secdev/scapy.git
4
get_pe_matching_query
def get_pe_matching_query(amount_condition, account_from_to, transaction): # get matching payment entries query from_date = frappe.db.get_single_value("Bank Reconciliation Tool", "bank_statement_from_date") to_date = frappe.db.get_single_value("Bank Reconciliation Tool", "bank_statement_to_date") from_reference_dat...
408c89df030998fe36df135570c9edd90a522996
10
bank_reconciliation_tool.py
336
Feat:Filter on Payment Entries and Journal Entries Applying filters on Payement entries and Journal Entries as per reference date and posting date
15,095
0
91
149
60
69,776
124
erpnext
24
erpnext/accounts/doctype/bank_reconciliation_tool/bank_reconciliation_tool.py
Python
61
{ "docstring": "\n\t\tSELECT\n\t\t\t(CASE WHEN reference_no=%(reference_no)s THEN 1 ELSE 0 END\n\t\t\t+ CASE WHEN (party_type = %(party_type)s AND party = %(party)s ) THEN 1 ELSE 0 END\n\t\t\t+ 1 ) AS rank,\n\t\t\t'Payment Entry' as doctype,\n\t\t\tname,\n\t\t\tpaid_amount,\n\t\t\treference_no,\n\t\t\treference_date...
https://github.com/frappe/erpnext.git
2
_download_and_prepare
def _download_and_prepare(self, dl_manager): # TODO: Download external resources if needed bad_words_path = dl_manager.download_and_extract(BAD_WORDS_URL) self.bad_words = {w.strip() for w in open(bad_words_path, encoding="utf-8")}
21bfd0d3f5ff3fbfd691600e2c7071a167816cdf
12
new_metric_script.py
64
Run pyupgrade for Python 3.6+ (#3560) * Run pyupgrade for Python 3.6+ * Fix lint issues * Revert changes for the datasets code Co-authored-by: Quentin Lhoest <42851186+lhoestq@users.noreply.github.com>
21,781
0
49
38
20
104,200
21
datasets
11
templates/new_metric_script.py
Python
3
{ "docstring": "Optional: download external resources useful to compute the scores", "language": "en", "n_whitespaces": 8, "n_words": 9, "vocab_size": 9 }
https://github.com/huggingface/datasets.git
1
_cache_bytecode
def _cache_bytecode(self, source_path, cache_path, data): # For backwards compatibility, we delegate to set_data() return self.set_data(cache_path, data)
8198943edd73a363c266633e1aa5b2a9e9c9f526
7
_bootstrap_external.py
33
add python 3.10.4 for windows
55,160
0
37
21
16
218,142
16
XX-Net
6
python3.10.4/Lib/importlib/_bootstrap_external.py
Python
2
{ "docstring": "Optional method which writes data (bytes) to a file path (a str).\n\n Implementing this method allows for the writing of bytecode files.\n\n The source path is needed in order to correctly transfer permissions\n ", "language": "en", "n_whitespaces": 54, "n_words": 33, "voc...
https://github.com/XX-net/XX-Net.git
2
add_tip
def add_tip(self, tip=None, tip_shape=None, tip_length=None, at_start=False): if tip is None: tip = self.create_tip(tip_shape, tip_length, at_start) else: self.position_tip(tip, at_start) self.reset_endpoints_based_on_tip(tip, at_start) self.asign_tip_att...
e040bcacd38378386749db18aeba575b93f4ebca
10
arc.py
111
Improved structure of the :mod:`.mobject` module (#2476) * group graphing and update its references * group text and update its references * group opengl and update its references * group three_d and update its references * group geometry and update (most) references * move some chaning.py + updater fil...
46,154
0
96
73
21
189,648
25
manim
11
manim/mobject/geometry/arc.py
Python
9
{ "docstring": "\n Adds a tip to the TipableVMobject instance, recognising\n that the endpoints might need to be switched if it's\n a 'starting tip' or not.\n ", "language": "en", "n_whitespaces": 52, "n_words": 23, "vocab_size": 20 }
https://github.com/ManimCommunity/manim.git
8
check_graph_consistency
def check_graph_consistency(tensor=None, method="add_loss", force_raise=False): if force_raise or ( tf1.executing_eagerly_outside_functions() and hasattr(tensor, "graph") and tensor.graph.is_control_flow_graph ): if method == "activity_regularizer": bad_example =...
fa6d9107a498f7c2403ff28c7b389a1a0c5cc083
bad_example = """
12
base_layer_utils.py
96
reduct too long lines
81,922
1
70
130
19
277,267
21
keras
14
keras/engine/base_layer_utils.py
Python
111
{ "docstring": "Checks that tensors passed to `add_*` method match the Keras graph.\n\n When one of the `add_*` method is called inside a V2 conditional branch, the\n underlying tensor gets created in a FuncGraph managed by control_flow_v2.\n We need to raise clear error messages in such cases.\n\n Args:\...
https://github.com/keras-team/keras.git
1
_make_dist
def _make_dist(self): dist = tfp.distributions.MultivariateNormalTriL( self.theta, scale_tril=tf.linalg.cholesky(self.covariance) ) return dist
136c8d5e4d2fab6106f007f4ce5d5c321922ae17
12
bandit_tf_model.py
54
[RLlib] Tests for bandit convergence and solving cov matrix problem (#29666) Signed-off-by: Avnish <avnishnarayan@gmail.com> Signed-off-by: Kourosh Hakhamaneshi <kourosh@anyscale.com> Co-authored-by: Kourosh Hakhamaneshi <kourosh@anyscale.com>
30,601
0
49
33
9
135,341
10
ray
12
rllib/algorithms/bandit/bandit_tf_model.py
Python
5
{ "docstring": "Create a multivariate normal distribution with the current parameters", "language": "en", "n_whitespaces": 8, "n_words": 9, "vocab_size": 9 }
https://github.com/ray-project/ray.git
1
_kth_arnoldi_iteration
def _kth_arnoldi_iteration(k, A, M, V, H): eps = jnp.finfo(jnp.result_type(*tree_leaves(V))).eps v = tree_map(lambda x: x[..., k], V) # Gets V[:, k] v = M(A(v)) _, v_norm_0 = _safe_normalize(v) v, h = _iterative_classical_gram_schmidt(V, v, v_norm_0, max_iterations=2) tol = eps * v_norm_0 unit_v, v_...
df1ceaeeb11efc7c5af1ad2dd102857128c23b26
14
linalg.py
255
Deprecate jax.tree_util.tree_multimap
26,741
0
87
170
52
119,998
73
jax
29
jax/_src/scipy/sparse/linalg.py
Python
13
{ "docstring": "\n Performs a single (the k'th) step of the Arnoldi process. Thus,\n adds a new orthonormalized Krylov vector A(M(V[:, k])) to V[:, k+1],\n and that vectors overlaps with the existing Krylov vectors to\n H[k, :]. The tolerance 'tol' sets the threshold at which an invariant\n subspace is declared ...
https://github.com/google/jax.git
10
correct_non_span
def _correct_non_span(self, line_str): words = line_str.split("</span>") line_str = "" for i in range(0, words.__len__()): if i != words.__len__() - 1: j = words[i].find("<span") else: j = words[i].__len__() temp = "" ...
902e7eb4f0147b5882a613b67467e38a1d47f01e
18
code_mobject.py
375
Hide more private methods from the docs. (#2468) * hide privs from text_mobject.py * hide privs from tex_mobject.py * hide privs from code_mobject.py * hide privs from svg_mobject.py * remove SVGPath and utils from __init__.py * don't import string_to_numbers * hide privs from geometry.py * hide p...
46,063
0
728
223
46
189,455
118
manim
14
manim/mobject/svg/code_mobject.py
Python
38
{ "docstring": "Function put text color to those strings that don't have one according to background_color of displayed code.\n\n Parameters\n ---------\n line_str : :class:`str`\n Takes a html element's string to put color to it according to background_color of displayed code.\n\n ...
https://github.com/ManimCommunity/manim.git
3
get_named_beta_schedule
def get_named_beta_schedule(schedule_name, num_diffusion_timesteps): if schedule_name == "linear": # Linear schedule from Ho et al, extended to work for any number of # diffusion steps. scale = 1000 / num_diffusion_timesteps beta_start = scale * 0.0001 beta_end = scale *...
f4d6e64cdc132ae868699a0ba442f4ab1d304a14
19
gaussian_diffusion.py
147
add disco_diffusion_cnclip_vitb16 module
9,908
0
166
96
56
49,784
69
PaddleHub
16
modules/image/text_to_image/disco_diffusion_cnclip_vitb16/reverse_diffusion/model/gaussian_diffusion.py
Python
13
{ "docstring": "\n Get a pre-defined beta schedule for the given name.\n\n The beta schedule library consists of beta schedules which remain similar\n in the limit of num_diffusion_timesteps.\n Beta schedules may be added, but should not be removed or changed once\n they are committed to maintain backw...
https://github.com/PaddlePaddle/PaddleHub.git
5
call
def call(self, features, training=None): if not isinstance(features, dict): raise ValueError( "We expected a dictionary here. Instead we got: ", features ) if training is None: training = backend.learning_phase() transformation_cache =...
6fafb567af4e4d9f42974d0b6c55b18bc03e17eb
16
sequence_feature_column.py
264
resolve line-too-long in feature_column
82,375
0
677
167
73
278,117
98
keras
31
keras/feature_column/sequence_feature_column.py
Python
39
{ "docstring": "Returns sequence input corresponding to the `feature_columns`.\n\n Args:\n features: A dict mapping keys to tensors.\n training: Python boolean or None, indicating whether to the layer is\n being run in training mode. This argument is passed to the call\n ...
https://github.com/keras-team/keras.git
9
validate_utf16_characters
def validate_utf16_characters(self, pair): if not self.first_half_surrogate_pair_detected_16be: if 0xD8 <= pair[0] <= 0xDB: self.first_half_surrogate_pair_detected_16be = True elif 0xDC <= pair[0] <= 0xDF: self.invalid_utf16be = True else:...
cd5a9683be69c86c8f3adcd13385a9bc5db198ec
13
utf1632prober.py
199
Rename notpip to pip. Vendor in pip-22.2.1 and latest requirementslib and vistir.
4,096
0
316
128
23
21,965
73
pipenv
7
pipenv/patched/pip/_vendor/chardet/utf1632prober.py
Python
21
{ "docstring": "\n Validate if the pair of bytes is valid UTF-16.\n\n UTF-16 is valid in the range 0x0000 - 0xFFFF excluding 0xD800 - 0xFFFF\n with an exception for surrogate pairs, which must be in the range\n 0xD800-0xDBFF followed by 0xDC00-0xDFFF\n\n https://en.wikipedia.org/wi...
https://github.com/pypa/pipenv.git
7
get_all_items
def get_all_items(date_range, company, field, limit=None): if field in ("available_stock_qty", "available_stock_value"): select_field = "sum(actual_qty)" if field == "available_stock_qty" else "sum(stock_value)" return frappe.db.get_all( "Bin", fields=["item_code as name", "{0} as value".format(select_field)...
494bd9ef78313436f0424b918f200dab8fc7c20b
@frappe.whitelist()
14
leaderboard.py
284
style: format code with black
14,559
1
65
152
56
67,568
96
erpnext
20
erpnext/startup/leaderboard.py
Python
40
{ "docstring": "\n\t\t\tselect order_item.item_code as name, {0} as value\n\t\t\tfrom `tab{1}` sales_order join `tab{1} Item` as order_item\n\t\t\t\ton sales_order.name = order_item.parent\n\t\t\twhere sales_order.docstatus = 1\n\t\t\t\tand sales_order.company = %s {2}\n\t\t\tgroup by order_item.item_code\n\t\t\torde...
https://github.com/frappe/erpnext.git
21
findLibrary
def findLibrary(name): assert compat.is_unix, "Current implementation for Unix only (Linux, Solaris, AIX, FreeBSD)" # Look in the LD_LIBRARY_PATH according to platform. if compat.is_aix: lp = compat.getenv('LIBPATH', '') elif compat.is_darwin: lp = compat.getenv('DYLD_LIBRARY_PATH'...
57c520132b4d0ab7bfd5653383ec2602e40088af
16
bindepend.py
650
Bindepend: Add Termux-specific libraries search path. According to termux/termux-app#1595, this is all we need to change to faclitate using PyInstaller on Termux.
77,342
0
840
360
160
262,743
283
pyinstaller
40
PyInstaller/depend/bindepend.py
Python
54
{ "docstring": "\n Look for a library in the system.\n\n Emulate the algorithm used by dlopen. `name` must include the prefix, e.g., ``libpython2.4.so``.\n ", "language": "en", "n_whitespaces": 30, "n_words": 20, "vocab_size": 18 }
https://github.com/pyinstaller/pyinstaller.git
1
test_return_expanded
def test_return_expanded(self): self.assertEqual(StateFilter.all().return_expanded(), StateFilter.all()) self.assertEqual(StateFilter.none().return_expanded(), StateFilter.none()) # Concrete-only state filters stay the same # (Case: mixed filter) self.assertEqual( ...
eb609c65d0794dd49efcd924bdc8743fd4253a93
15
test_state.py
668
Fix bug in `StateFilter.return_expanded()` and add some tests. (#12016)
71,177
0
1,317
410
63
246,360
203
synapse
12
tests/storage/test_state.py
Python
81
{ "docstring": "\n Tests the behaviour of the return_expanded() function that expands\n StateFilters to include more state types (for the sake of cache hit rate).\n ", "language": "en", "n_whitespaces": 44, "n_words": 22, "vocab_size": 19 }
https://github.com/matrix-org/synapse.git
2
exit_single_process_silo_context
def exit_single_process_silo_context(cls) -> Generator[None, None, None]: old = _single_process_silo_mode_state.mode _single_process_silo_mode_state.mode = None try: yield finally: _single_process_silo_mode_state.mode = old
3bfb9420a7d80e395c250718d17419daaf021aa2
10
base.py
59
chore(hybrid-cloud): several endpoint tests e2e (#41691) This a major break through PR that gets several acceptance and api unit tests passing e2e with hybrid cloud. I want to explain what's going on in greater detail and get this merged next week, unfortunately I'm traveling for now. This only brings up our h...
18,506
0
75
35
13
89,155
18
sentry
6
src/sentry/silo/base.py
Python
13
{ "docstring": "\n Used by silo endpoint decorators and other contexts to signal that a potential inter process interaction\n is being simulated locally for acceptance tests that validate the behavior of multiple endpoints with\n process boundaries in play. Call this inside of any RPC interactio...
https://github.com/getsentry/sentry.git
2
redirect
def redirect(to, *args, permanent=False, **kwargs): redirect_class = ( HttpResponsePermanentRedirect if permanent else HttpResponseRedirect ) return redirect_class(resolve_url(to, *args, **kwargs))
9c19aff7c7561e3a82978a272ecdaad40dda5c00
10
shortcuts.py
60
Refs #33476 -- Reformatted code with Black.
51,392
0
37
39
17
206,167
18
django
9
django/shortcuts.py
Python
5
{ "docstring": "\n Return an HttpResponseRedirect to the appropriate URL for the arguments\n passed.\n\n The arguments could be:\n\n * A model: the model's `get_absolute_url()` function will be called.\n\n * A view name, possibly with arguments: `urls.reverse()` will be used\n to rever...
https://github.com/django/django.git
6
test_ppo_exploration_setup
def test_ppo_exploration_setup(self): config = copy.deepcopy(ppo.DEFAULT_CONFIG) config["num_workers"] = 0 # Run locally. config["env_config"] = {"is_slippery": False, "map_name": "4x4"} obs = np.array(0) # Test against all frameworks. for fw in framework_itera...
7f1bacc7dc9caf6d0ec042e39499bbf1d9a7d065
22
test_ppo.py
446
[CI] Format Python code with Black (#21975) See #21316 and #21311 for the motivation behind these changes.
30,114
0
629
285
87
133,802
126
ray
37
rllib/agents/ppo/tests/test_ppo.py
Python
33
{ "docstring": "Tests, whether PPO runs with different exploration setups.", "language": "en", "n_whitespaces": 7, "n_words": 8, "vocab_size": 8 }
https://github.com/ray-project/ray.git
3
logout
def logout(self, request, extra_context=None): from django.contrib.auth.views import LogoutView defaults = { "extra_context": { **self.each_context(request), # Since the user isn't logged out at this point, the value of # has_permissi...
9c19aff7c7561e3a82978a272ecdaad40dda5c00
13
sites.py
137
Refs #33476 -- Reformatted code with Black.
50,391
0
209
85
46
203,467
52
django
15
django/contrib/admin/sites.py
Python
13
{ "docstring": "\n Log out the user for the given HttpRequest.\n\n This should *not* assume the user is already logged in.\n ", "language": "en", "n_whitespaces": 40, "n_words": 18, "vocab_size": 15 }
https://github.com/django/django.git
7
register
def register(self, addon): api_changes = { # mitmproxy 6 -> mitmproxy 7 "clientconnect": "client_connected", "clientdisconnect": "client_disconnected", "serverconnect": "server_connect and server_connected", "serverdisconnect": "server_disconn...
ee4999e8e4380f7b67faef92f04c361deffba412
16
addonmanager.py
283
Rename new async helper functions. async_trigger -> trigger_event invoke_addon -> invoke_addon_sync (API breakage) async_invoke_addon -> invoke_addon
73,504
0
397
164
68
250,551
91
mitmproxy
27
mitmproxy/addonmanager.py
Python
26
{ "docstring": "\n Register an addon, call its load event, and then register all its\n sub-addons. This should be used by addons that dynamically manage\n addons.\n\n If the calling addon is already running, it should follow with\n running and configure events. M...
https://github.com/mitmproxy/mitmproxy.git
5
test_sql_create_database
def test_sql_create_database(self, db, subtests, request): db_data = request.getfixturevalue(db) db_type = db_data['type'] db_creds = db_data['connection_data'] queries = [ { 'create': 'CREATE DATABASE', 'drop': 'DROP DATABASE' ...
13d267c409bf1cc65fca366d1aa4fc51438cbf71
15
test_http.py
367
It http test refactoring (#3959) * HTTP and company independent tests refactoring
25,949
0
431
200
65
117,299
97
mindsdb
30
tests/integration_tests/flows/test_http.py
Python
34
{ "docstring": " sql-via-http:\n 'create database' for each db\n 'drop database' for each db\n 'create database' for each db\n \n {create_query} {db_name}\n WITH ENGINE = '{db_type}',\n PARAMETERS = {json.dumps(db_creds)}...
https://github.com/mindsdb/mindsdb.git
2
get_log_file_handles
def get_log_file_handles(self, name, unique=False): if not self.should_redirect_logs(): return None, None log_stdout, log_stderr = self._get_log_file_names(name, unique=unique) return open_log(log_stdout), open_log(log_stderr)
1971a08b7dadf98c337ed0067db5b59d805b31ae
9
node.py
77
[RFC] [Core] Support disabling log redirection via `RAY_LOG_TO_STDERR` environment variable. (#21767)
28,982
0
57
48
17
129,592
18
ray
9
python/ray/node.py
Python
5
{ "docstring": "Open log files with partially randomized filenames, returning the\n file handles. If output redirection has been disabled, no files will\n be opened and `(None, None)` will be returned.\n\n Args:\n name (str): descriptive string for this log file.\n unique (b...
https://github.com/ray-project/ray.git
3
get_default_cache_location
def get_default_cache_location() -> str: if "LUDWIG_CACHE" in os.environ and os.environ["LUDWIG_CACHE"]: return os.environ["LUDWIG_CACHE"] else: return str(Path.home().joinpath(".ludwig_cache"))
e4fc06f986e03919d9aef3ab55c05fee5a6b9d3a
14
dataset_loader.py
81
Config-first Datasets API (ludwig.datasets refactor) (#2479) * Adds README and stub for reading dataset configs. * Adds __init__.py for configs, moves circular import into function scope in ludwig/datasets/__init__.py * Print config files in datasets folder. * First pass at automatic archive extraction. * ...
1,336
0
38
44
14
8,086
15
ludwig
7
ludwig/datasets/loaders/dataset_loader.py
Python
6
{ "docstring": "Returns a path to the default LUDWIG_CACHE location, or $HOME/.ludwig_cache.", "language": "en", "n_whitespaces": 9, "n_words": 10, "vocab_size": 10 }
https://github.com/ludwig-ai/ludwig.git
5
response_chunks
def response_chunks(response, chunk_size=CONTENT_CHUNK_SIZE): # type: (Response, int) -> Iterator[bytes] try: # Special case for urllib3. for chunk in response.raw.stream( chunk_size, # We use decode_content=False here because we don't # want urllib3 to m...
f638f5d0e6c8ebed0e69a6584bc7f003ec646580
14
utils.py
114
upd; format
12,341
0
600
54
119
60,915
214
transferlearning
10
.venv/lib/python3.8/site-packages/pip/_internal/network/utils.py
Python
13
{ "docstring": "Given a requests Response, provide the data chunks.\n ", "language": "en", "n_whitespaces": 11, "n_words": 8, "vocab_size": 8 }
https://github.com/jindongwang/transferlearning.git
4
result_list
def result_list(cl): headers = list(result_headers(cl)) num_sorted_fields = 0 for h in headers: if h["sortable"] and h["sorted"]: num_sorted_fields += 1 return { "cl": cl, "result_hidden_fields": list(result_hidden_fields(cl)), "result_headers": headers, ...
9c19aff7c7561e3a82978a272ecdaad40dda5c00
@register.tag(name="result_list")
11
admin_list.py
142
Refs #33476 -- Reformatted code with Black.
50,407
1
103
72
31
203,489
33
django
12
django/contrib/admin/templatetags/admin_list.py
Python
13
{ "docstring": "\n Display the headers and data list together.\n ", "language": "en", "n_whitespaces": 14, "n_words": 7, "vocab_size": 7 }
https://github.com/django/django.git
1
test_single_path
def test_single_path(self): with extend_sys_path(self.base_location): with self.settings(INSTALLED_APPS=["nsapp"]): app_config = apps.get_app_config("nsapp") self.assertEqual(app_config.path, self.app_path)
9c19aff7c7561e3a82978a272ecdaad40dda5c00
14
tests.py
84
Refs #33476 -- Reformatted code with Black.
49,877
0
66
46
10
201,109
11
django
12
tests/apps/tests.py
Python
5
{ "docstring": "\n A Py3.3+ namespace package can be an app if it has only one path.\n ", "language": "en", "n_whitespaces": 29, "n_words": 14, "vocab_size": 14 }
https://github.com/django/django.git
3
origins
def origins(self): if hasattr(self, '_path_objects'): return self.path_objects[0] return [ path_node_to_object(node) for node in self.path[0] ]
6ff2e55ce408f0f7f2fe99129048421c25ecafe6
9
cables.py
60
Add origins, destinations properties on CablePath
77,907
0
65
37
14
264,909
15
netbox
7
netbox/dcim/models/cables.py
Python
6
{ "docstring": "\n Return the list of originating objects (from cache, if available).\n ", "language": "en", "n_whitespaces": 25, "n_words": 10, "vocab_size": 10 }
https://github.com/netbox-community/netbox.git
1
to_state
def to_state(self) -> Tuple[str, Any]: # Must implement by each connector. return NotImplementedError
51aa429f4c2db2f5bb35064cedaf70c8df2828a8
6
connector.py
26
[RLlib] minor cleanup of connector to/from state APIs (#28884) * [RLlib] minor cleanup of connector to/from state APIs. Also better error messages. Signed-off-by: Jun Gong <jungong@anyscale.com> * wip Signed-off-by: Jun Gong <jungong@anyscale.com> * address review comments. Signed-off-by: Jun Gong <jung...
28,611
0
34
15
13
128,083
13
ray
6
rllib/connectors/connector.py
Python
13
{ "docstring": "Serialize a connector into a JSON serializable Tuple.\n\n to_state is required, so that all Connectors are serializable.\n\n Returns:\n A tuple of connector's name and its serialized states.\n String should match the name used to register the connector,\n ...
https://github.com/ray-project/ray.git
1
paired_cosine_distances
def paired_cosine_distances(X, Y): X, Y = check_paired_arrays(X, Y) return 0.5 * row_norms(normalize(X) - normalize(Y), squared=True) PAIRED_DISTANCES = { "cosine": paired_cosine_distances, "euclidean": paired_euclidean_distances, "l2": paired_euclidean_distances, "l1": paired_manhattan_d...
a5b70b3132467b5e3616178d9ecca6cb7316c400
11
pairwise.py
108
DOC Ensures that sklearn.metrics.pairwise.paired_cosine_distances passes numpydoc validation (#22141) Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
75,273
0
56
39
27
258,521
31
scikit-learn
10
sklearn/metrics/pairwise.py
Python
3
{ "docstring": "\n Compute the paired cosine distances between X and Y.\n\n Read more in the :ref:`User Guide <metrics>`.\n\n Parameters\n ----------\n X : array-like of shape (n_samples, n_features)\n An array where each row is a sample and each column is a feature.\n\n Y : array-like of sha...
https://github.com/scikit-learn/scikit-learn.git
1
popular_tags_for_model
def popular_tags_for_model(model, count=10): content_type = ContentType.objects.get_for_model(model) return ( Tag.objects.filter(taggit_taggeditem_items__content_type=content_type) .annotate(item_count=Count("taggit_taggeditem_items")) .order_by("-item_count")[:count] )
d10f15e55806c6944827d801cd9c2d53f5da4186
15
models.py
88
Reformat with black
15,639
0
45
52
12
71,191
12
wagtail
14
wagtail/admin/models.py
Python
7
{ "docstring": "Return a queryset of the most frequently used tags used on this model class", "language": "en", "n_whitespaces": 13, "n_words": 14, "vocab_size": 13 }
https://github.com/wagtail/wagtail.git
1
test_create_remote_before_start
def test_create_remote_before_start(call_ray_start_shared): from ray.util.client import ray
297341e107daee1ea3aff991ae8ea8c90993c683
6
test_client.py
24
[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...
30,157
0
12
77
6
133,938
6
ray
5
python/ray/tests/test_client.py
Python
12
{ "docstring": "Creates remote objects (as though in a library) before\n starting the client.\n ", "language": "en", "n_whitespaces": 18, "n_words": 12, "vocab_size": 12 }
https://github.com/ray-project/ray.git
10
tsqr
def tsqr(a): if len(a.shape) != 2: raise Exception( "tsqr requires len(a.shape) == 2, but a.shape is " "{}".format(a.shape) ) if a.num_blocks[1] != 1: raise Exception( "tsqr requires a.num_blocks[1] == 1, but a.num_blocks " "is {}".format(a.num_bl...
7f1bacc7dc9caf6d0ec042e39499bbf1d9a7d065
@ray.remote(num_returns=3)
18
linalg.py
749
[CI] Format Python code with Black (#21975) See #21316 and #21311 for the motivation behind these changes.
29,340
1
649
473
154
130,746
261
ray
51
python/ray/experimental/array/distributed/linalg.py
Python
52
{ "docstring": "Perform a QR decomposition of a tall-skinny matrix.\n\n Args:\n a: A distributed matrix with shape MxN (suppose K = min(M, N)).\n\n Returns:\n A tuple of q (a DistArray) and r (a numpy array) satisfying the\n following.\n - If q_full = ray.get(DistArray, q).as...
https://github.com/ray-project/ray.git
5
recognize_log_derivative
def recognize_log_derivative(a, d, DE, z=None): z = z or Dummy('z') a, d = a.cancel(d, include=True) _, a = a.div(d) pz = Poly(z, DE.t) Dd = derivation(d, DE) q = a - pz*Dd r, _ = d.resultant(q, includePRS=True) r = Poly(r, z) Np, Sp = splitfactor_sqf(r, DE, coefficientD=True,...
f5e24ed39a88b645ca27d15d60d5098895785773
12
risch.py
226
fix nits
49,138
0
156
146
62
199,088
81
sympy
29
sympy/integrals/risch.py
Python
15
{ "docstring": "\n There exists a v in K(x)* such that f = dv/v\n where f a rational function if and only if f can be written as f = A/D\n where D is squarefree,deg(A) < deg(D), gcd(A, D) = 1,\n and all the roots of the Rothstein-Trager resultant are integers. In that case,\n any of the Rothstein-Trage...
https://github.com/sympy/sympy.git
2
async_step_zeroconf
async def async_step_zeroconf(self, discovery_info): self.url = discovery_info.host self.uuid = await helpers.get_uuid(self.url) if self.uuid is None: return self.async_abort(reason="no_valid_uuid_set") await self.async_set_unique_id(self.uuid) self._abort_i...
3c5a667d9784bb5f2fab426b133b5582706c6e68
11
config_flow.py
111
Add Z-Wave.Me integration (#65473) * Add support of Z-Wave.Me Z-Way and RaZberry server (#61182) Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io> Co-authored-by: Martin Hjelmare <marhje52@gmail.com> Co-authored-by: LawfulChaos <kerbalspacema@gmail.com> * Add switch platform to Z-Wave.Me integration ...
111,351
0
83
65
18
312,712
23
core
13
homeassistant/components/zwave_me/config_flow.py
Python
8
{ "docstring": "\n Handle a discovered Z-Wave accessory - get url to pass into user step.\n\n This flow is triggered by the discovery component.\n ", "language": "en", "n_whitespaces": 43, "n_words": 21, "vocab_size": 21 }
https://github.com/home-assistant/core.git
8
all_simple_paths
def all_simple_paths(G, source, target, cutoff=None): if source not in G: raise nx.NodeNotFound(f"source node {source} not in graph") if target in G: targets = {target} else: try: targets = set(target) except TypeError as err: raise nx.NodeNotFoun...
53f766aa94b5aa5d3f87178418e794c4cc5f77eb
15
simple_paths.py
205
Improved documentation for all_simple_paths (#5944) * Improved documentation for all_simple_paths Improved the documentation for all_simple_paths. * Update simple_paths.py Black code style compliance edits.
42,304
0
188
125
45
177,180
76
networkx
16
networkx/algorithms/simple_paths.py
Python
20
{ "docstring": "Generate all simple paths in the graph G from source to target.\n\n A simple path is a path with no repeated nodes.\n\n Parameters\n ----------\n G : NetworkX graph\n\n source : node\n Starting node for path\n\n target : nodes\n Single node or iterable of nodes at which t...
https://github.com/networkx/networkx.git
2
supports_numpy
def supports_numpy(self): if not self.supports_python(): return False self.interpreter_exec('console', 'python import numpy; print numpy') return "module \'numpy\' from" in self._captured.before.decode()
159f3667f4772680368cb7b0771c6d5e44416e3c
10
gdb_support.py
69
Numba gdb-python extension for printing This adds support for printing Numba types as their python equivalents from gdb by using its python extension.
39,119
0
58
36
18
161,988
19
numba
7
numba/tests/gdb_support.py
Python
5
{ "docstring": "Returns True if the underlying gdb implementation has NumPy support\n (and by extension Python support) False otherwise", "language": "en", "n_whitespaces": 26, "n_words": 17, "vocab_size": 17 }
https://github.com/numba/numba.git
3
_get_tcl_tk_info
def _get_tcl_tk_info(): try: import tkinter from _tkinter import TCL_VERSION, TK_VERSION except ImportError: # tkinter unavailable return None, None, None, False tcl = tkinter.Tcl() # Query the location of Tcl library/data directory. tcl_dir = tcl.eval("info li...
2b2559af1c7790596e7b2040f48e56baef608f9d
10
tcl_tk.py
141
hookutils: tcl/tk: port to PyInstaller.isolated framework
77,583
0
196
68
76
264,062
104
pyinstaller
15
PyInstaller/utils/hooks/tcl_tk.py
Python
14
{ "docstring": "\n Isolated-subprocess helper to retrieve the basic Tcl/Tk information:\n - tcl_dir = path to the Tcl library/data directory.\n - tcl_version = Tcl version\n - tk_version = Tk version\n - tcl_theaded = boolean indicating whether Tcl/Tk is built with multi-threading support.\n ", ...
https://github.com/pyinstaller/pyinstaller.git
1
lead_query
def lead_query(doctype, txt, searchfield, start, page_len, filters): fields = get_fields("Lead", ["name", "lead_name", "company_name"]) return frappe.db.sql( .format( **{"fields": ", ".join(fields), "key": searchfield, "mcond": get_match_cond(doctype)} ), {"txt": "%%%s%%" % txt, "_txt": txt.replace("%", "")...
494bd9ef78313436f0424b918f200dab8fc7c20b
@frappe.whitelist() @frappe.validate_and_sanitize_search_inputs
15
queries.py
178
style: format code with black
13,968
1
31
92
39
65,646
42
erpnext
18
erpnext/controllers/queries.py
Python
21
{ "docstring": "select {fields} from `tabLead`\n\t\twhere docstatus < 2\n\t\t\tand ifnull(status, '') != 'Converted'\n\t\t\tand ({key} like %(txt)s\n\t\t\t\tor lead_name like %(txt)s\n\t\t\t\tor company_name like %(txt)s)\n\t\t\t{mcond}\n\t\torder by\n\t\t\tif(locate(%(_txt)s, name), locate(%(_txt)s, name), 99999),\n...
https://github.com/frappe/erpnext.git
3
update_work_queue_id_from_name
async def update_work_queue_id_from_name(self) -> bool: if not self.work_queue_name: raise ValueError("No work queue name provided.") try: work_queue = await self.client.read_work_queue_by_name(self.work_queue_name) self.work_queue_id = work_queue.id ...
ca11b933b9187a0e1bf9008315eeec2155815ab3
13
agent.py
111
Support work_queue_name for agent
11,054
0
116
60
28
54,421
33
prefect
14
src/prefect/agent.py
Python
15
{ "docstring": "\n For agents that were provided a work_queue_name, rather than a work_queue_id,\n this function will retrieve the work queue ID corresponding to that name and assign\n it to `work_queue_id`. If no matching queue is found, a warning is logged\n and `work_queue_id = None`.\n...
https://github.com/PrefectHQ/prefect.git
2
on_chord_header_start
def on_chord_header_start(self, chord, **header) -> dict: if not isinstance(chord.tasks, group): chord.tasks = group(chord.tasks) return self.on_group_start(chord.tasks, **header)
1c4ff33bd22cf94e297bd6449a06b5a30c2c1fbc
11
canvas.py
73
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 ...
52,191
0
48
46
15
208,066
16
celery
9
celery/canvas.py
Python
12
{ "docstring": "Method that is called on сhord header stamping start.\n\n Arguments:\n chord (chord): chord that is stamped.\n headers (Dict): Partial headers that could be merged with existing headers.\n Returns:\n Dict: headers to update.\n ", "language"...
https://github.com/celery/celery.git
1
test_collect_commands
async def test_collect_commands(): with taddons.context() as tctx: c = command.CommandManager(tctx.master) a = TCmds() c.collect_commands(a) assert "empty" in c.commands a = TypeErrAddon() c.collect_commands(a) await tctx.master.await_log("Could not load...
b3587b52b25077f68116b9852b041d33e7fc6601
11
test_command.py
113
make it black!
73,904
0
81
61
22
251,966
26
mitmproxy
14
test/mitmproxy/test_command.py
Python
9
{ "docstring": "\n This tests for errors thrown by getattr() or __getattr__ implementations\n that return an object for .command_name.\n ", "language": "en", "n_whitespaces": 26, "n_words": 16, "vocab_size": 15 }
https://github.com/mitmproxy/mitmproxy.git
7
mask
def mask(self, row_labels, col_labels): logger = get_logger() logger.debug(f"ENTER::Partition.mask::{self._identity}") new_obj = super().mask(row_labels, col_labels) if isinstance(row_labels, slice) and unidist.is_object_ref(self._length_cache): if row_labels == slic...
193505fdf0c984743397ba3df56262f30aee13a8
14
partition.py
238
FEAT-#5053: Add pandas on unidist execution with MPI backend (#5059) Signed-off-by: Igoshev, Iaroslav <iaroslav.igoshev@intel.com>
36,272
0
325
139
39
155,180
67
modin
18
modin/core/execution/unidist/implementations/pandas_on_unidist/partitioning/partition.py
Python
20
{ "docstring": "\n Lazily create a mask that extracts the indices provided.\n\n Parameters\n ----------\n row_labels : list-like, slice or label\n The row labels for the rows to extract.\n col_labels : list-like, slice or label\n The column labels for the colum...
https://github.com/modin-project/modin.git
1
mixin_gateway_parser
def mixin_gateway_parser(parser): gp = add_arg_group(parser, title='Gateway') _add_host(gp) _add_proxy(gp) gp.add_argument( '--uses', type=str, default=None, # TODO: add Jina Hub Gateway help=, ) gp.add_argument( '--uses-with', actio...
cdaf7f87ececf9e13b517379ca183b17f0d7b007
10
remote.py
404
feat: allow passing custom gateway in Flow (#5189)
2,555
0
543
237
108
13,120
160
jina
22
jina/parsers/orchestrate/runtimes/remote.py
Python
87
{ "docstring": "Add the options for remote expose at the Gateway\n :param parser: the parser\n \n The config of the gateway, it could be one of the followings:\n * the string literal of an Gateway class name\n * a Gateway YAML file (.yml, .yaml, .jaml)\n * a docker image (must start ...
https://github.com/jina-ai/jina.git
1
test_update_next_event
async def test_update_next_event(hass, calls, fake_schedule): event_data1 = fake_schedule.create_event( start=datetime.datetime.fromisoformat("2022-04-19 11:00:00+00:00"), end=datetime.datetime.fromisoformat("2022-04-19 11:15:00+00:00"), ) await create_automation(hass, EVENT_START) ...
a2c74b978664b627bafc4a43b26aa2be7b15b229
12
test_trigger.py
259
Add initial implementation of a calendar trigger (#68674) * Add initial implementation of calendar trigger This is an initial implementation of a calendar trigger, that supports triggering on calendar start time. See architecture proposal in: https://github.com/home-assistant/architecture/discussions/700 * ...
95,806
0
269
149
59
296,832
85
core
15
tests/components/calendar/test_trigger.py
Python
29
{ "docstring": "Test detection of a new event after initial trigger is setup.", "language": "en", "n_whitespaces": 10, "n_words": 11, "vocab_size": 11 }
https://github.com/home-assistant/core.git
1
encode
def encode(self, bboxes, gt_bboxes): bboxes = get_box_tensor(bboxes) gt_bboxes = get_box_tensor(gt_bboxes) assert bboxes.size(0) == gt_bboxes.size(0) assert bboxes.size(-1) == gt_bboxes.size(-1) == 4 encoded_bboxes = bbox2delta(bboxes, gt_bboxes, self.means, self.stds) ...
d915740fa8228cf57741b27d9e5d66e358456b8e
9
delta_xywh_bbox_coder.py
112
[Refactor] Refactor anchor head and base head with boxlist (#8625) * Refactor anchor head * Update * Update * Update * Add a series of boxes tools * Fix box type to support n x box_dim boxes * revert box type changes * Add docstring * refactor retina_head * Update * Update * Fix commen...
70,861
0
77
72
22
245,715
28
mmdetection
10
mmdet/models/task_modules/coders/delta_xywh_bbox_coder.py
Python
7
{ "docstring": "Get box regression transformation deltas that can be used to\n transform the ``bboxes`` into the ``gt_bboxes``.\n\n Args:\n bboxes (torch.Tensor or :obj:`BaseBoxes`): Source boxes,\n e.g., object proposals.\n gt_bboxes (torch.Tensor or :obj:`BaseBoxes...
https://github.com/open-mmlab/mmdetection.git
5
create_perspective_transform
def create_perspective_transform(src, dst, round=False, splat_args=False): try: transform_matrix = create_perspective_transform_matrix(src, dst) error = None except np.linalg.LinAlgError as e: transform_matrix = np.identity(3, dtype=np.float) error = "invalid input quads (%s...
7375ee364e0df2a417f92593e09557f1b2a3575a
13
align2stylegan.py
254
initialize ostec
1,631
0
220
144
67
9,551
102
insightface
23
reconstruction/ostec/utils/align2stylegan.py
Python
26
{ "docstring": " Returns a function which will transform points in quadrilateral\n ``src`` to the corresponding points on quadrilateral ``dst``::\n\n >>> transform = create_perspective_transform(\n ... [(0, 0), (10, 0), (10, 10), (0, 10)],\n ... [(50, 50), (100, 50), (1...
https://github.com/deepinsight/insightface.git
1
limit
def limit(self, *args): return self.applyfunc(lambda x: x.limit(*args)) # https://github.com/sympy/sympy/pull/12854
59d22b6bb7287613d598611027f640d068ca5748
11
matrices.py
44
Moved imports to higher level
47,891
0
22
25
9
196,391
9
sympy
5
sympy/matrices/matrices.py
Python
2
{ "docstring": "Calculate the limit of each element in the matrix.\n ``args`` will be passed to the ``limit`` function.\n\n Examples\n ========\n\n >>> from sympy import Matrix\n >>> from sympy.abc import x, y\n >>> M = Matrix([[x, y], [1, 0]])\n >>> M.limit(x, 2)\n ...
https://github.com/sympy/sympy.git
4
difference
def difference(self, other, sort=None): self._validate_sort_keyword(sort) self._assert_can_do_setop(other) other, result_name = self._convert_can_do_setop(other) # Note: we do NOT call _deprecate_dti_setop here, as there # is no requirement that .difference be commutat...
4e034ec0006b6c05160ce67ea1420ce28f295c91
11
base.py
173
DEPR: DatetimeIndex.intersection with mixed timezones cast to UTC, not object (#45357) * DEPR: DatetimeIndex.intersection with mixed timezones cast to UTC instead of object * GH ref * mypy fixup Co-authored-by: Jeff Reback <jeff@reback.net>
39,453
0
239
105
57
163,521
87
pandas
15
pandas/core/indexes/base.py
Python
12
{ "docstring": "\n Return a new Index with elements of index not in `other`.\n\n This is the set difference of two Index objects.\n\n Parameters\n ----------\n other : Index or array-like\n sort : False or None, default None\n Whether to sort the resulting index. B...
https://github.com/pandas-dev/pandas.git
1
_on_frame_load_finished
def _on_frame_load_finished(self): page = self._widget.page() assert isinstance(page, webpage.BrowserPage), page self._on_load_finished(not page.error_occurred)
a20bb67a878b2e68abf8268c1b0a27f018d01352
9
webkittab.py
58
mypy: Upgrade to PyQt5-stubs 5.15.6.0 For some unknown reason, those new stubs cause a *lot* of things now to be checked by mypy which formerly probably got skipped due to Any being implied somewhere. The stubs themselves mainly improved, with a couple of regressions too. In total, there were some 337 (!) new mypy e...
117,330
0
39
35
10
320,759
11
qutebrowser
9
qutebrowser/browser/webkit/webkittab.py
Python
4
{ "docstring": "Make sure we emit an appropriate status when loading finished.\n\n While Qt has a bool \"ok\" attribute for loadFinished, it always is True\n when using error pages... See\n https://github.com/qutebrowser/qutebrowser/issues/84\n ", "language": "en", "n_whitespaces": 57,...
https://github.com/qutebrowser/qutebrowser.git
2
get_package
def get_package(package): # type: (Package) -> types.ModuleType resolved = resolve(package) if wrap_spec(resolved).submodule_search_locations is None: raise TypeError(f'{package!r} is not a package') return resolved
8198943edd73a363c266633e1aa5b2a9e9c9f526
11
_common.py
58
add python 3.10.4 for windows
55,184
0
44
30
20
218,182
22
XX-Net
7
python3.10.4/Lib/importlib/_common.py
Python
5
{ "docstring": "Take a package name or module object and return the module.\n\n Raise an exception if the resolved module is not a package.\n ", "language": "en", "n_whitespaces": 28, "n_words": 22, "vocab_size": 19 }
https://github.com/XX-net/XX-Net.git
6
get_content_charset
def get_content_charset(self, failobj=None): missing = object() charset = self.get_param('charset', missing) if charset is missing: return failobj if isinstance(charset, tuple): # RFC 2231 encoded, so decode it, and it better end up as ascii. ...
8198943edd73a363c266633e1aa5b2a9e9c9f526
13
message.py
175
add python 3.10.4 for windows
57,095
0
345
101
75
223,835
107
XX-Net
16
python3.10.4/Lib/email/message.py
Python
17
{ "docstring": "Return the charset parameter of the Content-Type header.\n\n The returned string is always coerced to lower case. If there is no\n Content-Type header, or if that header has no charset parameter,\n failobj is returned.\n ", "language": "en", "n_whitespaces": 63, "n_w...
https://github.com/XX-net/XX-Net.git
1
get_fws
def get_fws(value): newvalue = value.lstrip() fws = WhiteSpaceTerminal(value[:len(value)-len(newvalue)], 'fws') return fws, newvalue
8198943edd73a363c266633e1aa5b2a9e9c9f526
13
_header_value_parser.py
64
add python 3.10.4 for windows
56,997
0
24
37
10
223,601
12
XX-Net
7
python3.10.4/Lib/email/_header_value_parser.py
Python
4
{ "docstring": "FWS = 1*WSP\n\n This isn't the RFC definition. We're using fws to represent tokens where\n folding can be done, but when we are parsing the *un*folding has already\n been done so we don't need to watch out for CRLF.\n\n ", "language": "en", "n_whitespaces": 52, "n_words": 39, "voc...
https://github.com/XX-net/XX-Net.git
3
_determine_base_url
def _determine_base_url(document, page_url): # type: (HTMLElement, str) -> str for base in document.findall(".//base"): href = base.get("href") if href is not None: return href return page_url
f638f5d0e6c8ebed0e69a6584bc7f003ec646580
11
collector.py
63
upd; format
12,264
0
62
36
22
60,726
25
transferlearning
7
.venv/lib/python3.8/site-packages/pip/_internal/index/collector.py
Python
6
{ "docstring": "Determine the HTML document's base URL.\n\n This looks for a ``<base>`` tag in the HTML document. If present, its href\n attribute denotes the base URL of anchor tags in the document. If there is\n no such tag (or if it does not have a valid href attribute), the HTML\n file's URL is used a...
https://github.com/jindongwang/transferlearning.git
1
binary_accuracy
def binary_accuracy(y_true, y_pred, threshold=0.5): y_pred = tf.convert_to_tensor(y_pred) threshold = tf.cast(threshold, y_pred.dtype) y_pred = tf.cast(y_pred > threshold, y_pred.dtype) return backend.mean(tf.equal(y_true, y_pred), axis=-1) @keras_export('keras.metrics.categorical_accuracy') @tf.__internal...
8bb1b365ca6bb21b32a1ee1654eecb02570970ac
@keras_export('keras.metrics.categorical_accuracy') @tf.__internal__.dispatch.add_dispatch_support
9
metrics.py
123
reverting binary accuracy to original
79,764
1
26
67
19
268,903
23
keras
16
keras/metrics/metrics.py
Python
5
{ "docstring": "Calculates how often predictions match binary labels.\n\n Standalone usage:\n >>> y_true = [[1], [1], [0], [0]]\n >>> y_pred = [[1], [1], [0], [0]]\n >>> m = tf.keras.metrics.binary_accuracy(y_true, y_pred)\n >>> assert m.shape == (4,)\n >>> m.numpy()\n array([1., 1., 1., 1.], dtype=float32)\n\...
https://github.com/keras-team/keras.git
1
activate
def activate(self) -> str: load_kube_config_from_dict( config_dict=self.config, context=self.context, ) return self.current_context()
8f3ffd09dc47bfd2af6a635cc04c640febffd519
9
kubernetes.py
48
add test coerage for get_api_client and activate
11,603
0
60
29
10
56,999
10
prefect
8
src/prefect/blocks/kubernetes.py
Python
11
{ "docstring": "\n Convenience method for activating the k8s config stored in an instance of this block\n\n Returns current_context for sanity check\n ", "language": "en", "n_whitespaces": 41, "n_words": 19, "vocab_size": 18 }
https://github.com/PrefectHQ/prefect.git
17
style_doc_files
def style_doc_files(*files, max_len=119, check_only=False): changed = [] black_errors = [] for file in files: # Treat folders if os.path.isdir(file): files = [os.path.join(file, f) for f in os.listdir(file)] files = [f for f in files if os.path.isdir(f) or f.ends...
fb5ed62c102c0323486b89805e1888495de3db15
18
style_doc.py
474
Convert documentation to the new front (#271) * Main conversion * Doc styling * Style * New front deploy * Fixes * Fixes * Fix new docstrings * Style
121,025
0
733
264
110
337,312
203
accelerate
26
utils/style_doc.py
Python
43
{ "docstring": "\n Applies doc styling or checks everything is correct in a list of files.\n\n Args:\n files (several `str` or `os.PathLike`): The files to treat.\n max_len (`int`): The maximum number of characters per line.\n check_only (`bool`, *optional*, defaults to `False`):\n ...
https://github.com/huggingface/accelerate.git
2
assuming
def assuming(*assumptions): old_global_assumptions = global_assumptions.copy() global_assumptions.update(assumptions) try: yield finally: global_assumptions.clear() global_assumptions.update(old_global_assumptions)
498015021131af4dbb07eb110e5badaba8250c7b
10
assume.py
67
Updated import locations
47,527
0
47
36
11
196,027
11
sympy
7
sympy/assumptions/assume.py
Python
8
{ "docstring": "\n Context manager for assumptions.\n\n Examples\n ========\n\n >>> from sympy import assuming, Q, ask\n >>> from sympy.abc import x, y\n >>> print(ask(Q.integer(x + y)))\n None\n >>> with assuming(Q.integer(x), Q.integer(y)):\n ... print(ask(Q.integer(x + y)))\n True...
https://github.com/sympy/sympy.git
10
update
def update(self, paddle, brickwall): self._xLoc += self.__xVel self._yLoc += self.__yVel # left screen wall bounce if self._xLoc <= self._radius: self.__xVel *= -1 # right screen wall bounce elif self._xLoc >= self.__width - self._radius: ...
f0af0c43340763724f139fa68aa1e5a9ffe458b4
12
brickout-game.py
296
refactor: clean code Signed-off-by: slowy07 <slowy.arfy@gmail.com>
4,365
0
364
186
64
22,585
126
Python
19
brickout-game/brickout-game.py
Python
24
{ "docstring": "\n moves the ball at the screen.\n contains some collision detection.\n \n Simple class for representing a paddle\n", "language": "en", "n_whitespaces": 41, "n_words": 16, "vocab_size": 15 }
https://github.com/geekcomputers/Python.git
1
get_metadata_distribution
def get_metadata_distribution(self) -> BaseDistribution: assert self.req.local_file_path, "Set as part of preparation during download" assert self.req.name, "Wheels are never unnamed" wheel = FilesystemWheel(self.req.local_file_path) return get_wheel_distribution(wheel, canonica...
f3166e673fe8d40277b804d35d77dcdb760fc3b3
11
wheel.py
79
check point progress on only bringing in pip==22.0.4 (#4966) * vendor in pip==22.0.4 * updating vendor packaging version * update pipdeptree to fix pipenv graph with new version of pip. * Vendoring of pip-shims 0.7.0 * Vendoring of requirementslib 1.6.3 * Update pip index safety restrictions patch for p...
3,125
0
60
48
24
19,880
25
pipenv
10
pipenv/patched/notpip/_internal/distributions/wheel.py
Python
9
{ "docstring": "Loads the metadata from the wheel file into memory and returns a\n Distribution that uses it, not relying on the wheel file or\n requirement.\n ", "language": "en", "n_whitespaces": 45, "n_words": 24, "vocab_size": 20 }
https://github.com/pypa/pipenv.git
4
no_batch_dim_reference_rnn_gru
def no_batch_dim_reference_rnn_gru(m, p, *args, **kwargs): if len(args) == 1: inp, = args h = None elif len(args) == 2: inp, h = args h = h.unsqueeze(1) batch_dim = 0 if kwargs['batch_first'] else 1 kwargs.pop('batch_first') inp = inp.unsqueeze(batch_dim) si...
6eba936082a641be8ece156f70c0f5c435f7a7aa
11
common_modules.py
192
[rnn/gru] no batch dim (#70442) Summary: Fixes https://github.com/pytorch/pytorch/issues/60585 TODO: * [x] Doc updates Pull Request resolved: https://github.com/pytorch/pytorch/pull/70442 Reviewed By: zou3519 Differential Revision: D33460427 Pulled By: jbschlosser fbshipit-source-id: c64d9624c305d90570c79d11a285...
21,518
0
116
118
36
102,398
50
pytorch
15
torch/testing/_internal/common_modules.py
Python
14
{ "docstring": "Reference function for RNN and GRU supporting no batch dimensions.\n\n Unbatched inputs are unsqueezed to form a\n single batch input before passing them to the module.\n The output is squeezed to compare with the\n output of unbatched input to the module.\n ", "language": "en", "n_...
https://github.com/pytorch/pytorch.git
3
get_years
def get_years(): year_list = frappe.db.sql_list( ) if not year_list: year_list = [getdate().year] return "\n".join(str(year) for year in year_list)
494bd9ef78313436f0424b918f200dab8fc7c20b
12
provident_fund_deductions.py
72
style: format code with black
14,458
0
12
41
16
67,257
18
erpnext
9
erpnext/regional/report/provident_fund_deductions/provident_fund_deductions.py
Python
7
{ "docstring": "select distinct YEAR(end_date) from `tabSalary Slip` ORDER BY YEAR(end_date) DESC", "language": "en", "n_whitespaces": 9, "n_words": 10, "vocab_size": 9 }
https://github.com/frappe/erpnext.git
2
rmul
def rmul(*args): rv = args[0] for i in range(1, len(args)): rv = args[i]*rv return rv
498015021131af4dbb07eb110e5badaba8250c7b
10
permutations.py
58
Updated import locations
47,659
0
54
36
12
196,159
15
sympy
6
sympy/combinatorics/permutations.py
Python
5
{ "docstring": "\n Return product of Permutations [a, b, c, ...] as the Permutation whose\n ith value is a(b(c(i))).\n\n a, b, c, ... can be Permutation objects or tuples.\n\n Examples\n ========\n\n >>> from sympy.combinatorics import Permutation\n\n >>> a, b = [1, 0,...
https://github.com/sympy/sympy.git
19
generate
def generate(self) -> dict[str, str]: primary = self.primary secondary = self.secondary or primary warning = self.warning or primary error = self.error or secondary success = self.success or secondary accent = self.accent or primary dark = self._dark ...
49764a3ec7e9525530e25465be0e1b0c7bffaf6c
12
design.py
248
improved color harmony
44,480
0
253
387
45
184,099
82
textual
27
src/textual/design.py
Python
72
{ "docstring": "Generate a mapping of color name on to a CSS color.\n\n Args:\n dark (bool, optional): Enable dark mode. Defaults to False.\n luminosity_spread (float, optional): Amount of luminosity to subtract and add to generate\n shades. Defaults to 0.2.\n te...
https://github.com/Textualize/textual.git
3
cls_token
def cls_token(self) -> str: if self._cls_token is None: if self.verbose: logger.error("Using cls_token, but it is not set yet.") return None return str(self._cls_token)
3eed5530ec74bb60ad9f8f612717d0f6ccf820f2
12
tokenization_utils_base.py
61
Fix properties of unset special tokens in non verbose mode (#17797) Co-authored-by: SaulLu <55560583+SaulLu@users.noreply.github.com>
5,765
0
80
35
19
31,490
22
transformers
7
src/transformers/tokenization_utils_base.py
Python
10
{ "docstring": "\n `str`: Classification token, to extract a summary of an input sequence leveraging self-attention along the full\n depth of the model. Log an error if used while not having been set.\n ", "language": "en", "n_whitespaces": 52, "n_words": 30, "vocab_size": 27 }
https://github.com/huggingface/transformers.git
7
eye
def eye(N, chunks="auto", M=None, k=0, dtype=float): eye = {} if M is None: M = N if dtype is None: dtype = float if not isinstance(chunks, (int, str)): raise ValueError("chunks must be an int or string") vchunks, hchunks = normalize_chunks(chunks, shape=(N, M), dtype=...
e25284dced9749f02bd5d8c80b6225153aa282d8
@derived_from(np)
17
creation.py
342
Fix eye inconsistency with NumPy for dtype=None (#8669) (#8685)
36,471
1
343
230
80
155,800
121
dask
27
dask/array/creation.py
Python
25
{ "docstring": "\n Return a 2-D Array with ones on the diagonal and zeros elsewhere.\n\n Parameters\n ----------\n N : int\n Number of rows in the output.\n chunks : int, str\n How to chunk the array. Must be one of the following forms:\n\n - A blocksize like 1000.\n - A s...
https://github.com/dask/dask.git
1
test_null_annotation
def test_null_annotation(self): book = Book.objects.annotate( no_value=Value(None, output_field=IntegerField()) ).first() self.assertIsNone(book.no_value)
9c19aff7c7561e3a82978a272ecdaad40dda5c00
16
tests.py
66
Refs #33476 -- Reformatted code with Black.
49,839
0
48
39
9
200,995
9
django
12
tests/annotations/tests.py
Python
5
{ "docstring": "\n Annotating None onto a model round-trips\n ", "language": "en", "n_whitespaces": 21, "n_words": 6, "vocab_size": 6 }
https://github.com/django/django.git
5
process
def process(self) -> None: logger.info("[CREATE ALIGNMENTS FROM FACES]") # Tidy up cli output skip_count = 0 d_align = {} for filename, meta in tqdm(read_image_meta_batch(self._filelist), desc="Generating Alignments", ...
6437cd7ab0d6f18cdca0172ba281fd71967b86ac
14
jobs.py
306
alignments tool - Add from-faces job - Allows user to regenerate alignments file(s) from a folder of extracted faces
20,138
0
405
184
81
100,680
98
faceswap
29
tools/alignments/jobs.py
Python
23
{ "docstring": " Run the job to read faces from a folder to create alignments file(s). ", "language": "en", "n_whitespaces": 14, "n_words": 13, "vocab_size": 12 }
https://github.com/deepfakes/faceswap.git
1
method
def method(self): # type: () -> str raise NotImplementedError('Ansible has no built-in doas become plugin.')
24d91f552cad2a485f286f3c34cbba2005599ab4
8
become.py
24
ansible-test - Add support for more remotes.
78,936
0
30
11
15
267,516
15
ansible
3
test/lib/ansible_test/_internal/become.py
Python
2
{ "docstring": "The name of the Ansible become plugin that is equivalent to this.", "language": "en", "n_whitespaces": 11, "n_words": 12, "vocab_size": 12 }
https://github.com/ansible/ansible.git
1
test_disposition_none
def test_disposition_none(self) -> None: channel = self._req(None) headers = channel.headers self.assertEqual( headers.getRawHeaders(b"Content-Type"), [self.test_image.content_type] ) self.assertEqual(headers.getRawHeaders(b"Content-Disposition"), None)
32c828d0f760492711a98b11376e229d795fd1b3
10
test_media_storage.py
90
Add type hints to `tests/rest`. (#12208) Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
71,709
0
69
55
15
247,516
16
synapse
9
tests/rest/media/v1/test_media_storage.py
Python
11
{ "docstring": "\n If there is no filename, one isn't passed on in the Content-Disposition\n of the request.\n ", "language": "en", "n_whitespaces": 37, "n_words": 15, "vocab_size": 14 }
https://github.com/matrix-org/synapse.git
2
is_on
def is_on(self) -> bool: # Note: wemo.get_standby_state is a @property. return super().is_on and self.wemo.get_standby_state == StandbyState.ON
cf5e21a996818d4273cb107f1de5c91ac69ab4e9
9
binary_sensor.py
42
Use properties of wemo Insight device (#72316)
100,041
0
37
24
16
301,193
16
core
8
homeassistant/components/wemo/binary_sensor.py
Python
3
{ "docstring": "Return true device connected to the Insight Switch is on.", "language": "en", "n_whitespaces": 9, "n_words": 10, "vocab_size": 10 }
https://github.com/home-assistant/core.git
1
CircularUnitaryEnsemble
def CircularUnitaryEnsemble(sym, dim): sym, dim = _symbol_converter(sym), _sympify(dim) model = CircularUnitaryEnsembleModel(sym, dim) rmp = RandomMatrixPSpace(sym, model=model) return RandomMatrixSymbol(sym, dim, dim, pspace=rmp)
24f1e7730119fe958cc8e28411f790c9a5ec04eb
9
random_matrix_models.py
80
Fix various typos Found via `codespell -q 3 -L aboves,aline,ans,aother,arithmetics,assum,atleast,braket,clen,declar,declars,dorder,dum,enew,fo,fro,inout,iself,ist,ket,lamda,lightyear,lightyears,nd,numer,numers,orderd,ot,pring,rcall,rever,ro,ser,siz,splitted,sring,supercedes,te,tht,unequality,upto,vas,versin,whet`
49,657
0
36
52
18
200,451
21
sympy
11
sympy/stats/random_matrix_models.py
Python
5
{ "docstring": "\n Represents Circular Unitary Ensembles.\n\n Examples\n ========\n\n >>> from sympy.stats import CircularUnitaryEnsemble as CUE\n >>> from sympy.stats import joint_eigen_distribution\n >>> C = CUE('U', 1)\n >>> joint_eigen_distribution(C)\n Lambda(t[1], Product(Abs(exp(I*t[_j]...
https://github.com/sympy/sympy.git
4
generate_invalid_param_val
def generate_invalid_param_val(constraint, constraints=None): if isinstance(constraint, StrOptions): return f"not {' or '.join(constraint.options)}" if not isinstance(constraint, Interval): raise NotImplementedError # constraint is an interval constraints = [constraint] if constra...
02cbe01e67165d7d38e5e441cfccd6b57b2207b6
12
_param_validation.py
96
FIX Param validation: fix generating invalid param when 2 interval constraints (#23513) Co-authored-by: Julien Jerphanion <git@jjerphan.xyz> Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com>
76,092
0
66
50
27
260,151
34
scikit-learn
10
sklearn/utils/_param_validation.py
Python
7
{ "docstring": "Return a value that does not satisfy the constraint.\n\n Raises a NotImplementedError if there exists no invalid value for this constraint.\n\n This is only useful for testing purpose.\n\n Parameters\n ----------\n constraint : _Constraint instance\n The constraint to generate a ...
https://github.com/scikit-learn/scikit-learn.git
1
test_invalidate_cache_by_room_id
def test_invalidate_cache_by_room_id(self): with LoggingContext(name="test") as ctx: # Prime the cache with some values res = self.get_success( self.store.have_seen_events(self.room_id, self.event_ids) ) self.assertEqual(res, set(self.even...
29269d9d3f3419a3d92cdd80dae4a37e2d99a395
13
test_events_worker.py
230
Fix `have_seen_event` cache not being invalidated (#13863) Fix https://github.com/matrix-org/synapse/issues/13856 Fix https://github.com/matrix-org/synapse/issues/13865 > Discovered while trying to make Synapse fast enough for [this MSC2716 test for importing many batches](https://github.com/matrix-org/complement/...
72,989
0
261
137
44
249,552
75
synapse
17
tests/storage/databases/main/test_events_worker.py
Python
14
{ "docstring": "\n Test to make sure that all events associated with the given `(room_id,)`\n are invalidated in the `have_seen_event` cache.\n ", "language": "en", "n_whitespaces": 40, "n_words": 18, "vocab_size": 17 }
https://github.com/matrix-org/synapse.git
12
_find_alignments
def _find_alignments(self) -> str: fname = self._args.alignments_file frames = self._args.frames_dir if fname and os.path.isfile(fname) and os.path.splitext(fname)[-1].lower() == ".fsa": return fname if fname: logger.error("Not a valid alignments file: '%...
2d312a9db228c025d0bd2ea7a4f747a2c644b5d8
13
alignments.py
360
Minor updates and fixups - Mask Tool - Typing + BiSeNet mask update fix - Alignments Tool - Auto search for alignments file
21,043
0
289
204
50
101,635
95
faceswap
21
tools/alignments/alignments.py
Python
32
{ "docstring": " If an alignments folder is required and hasn't been provided, scan for a file based on\n the video folder.\n\n Exits if an alignments file cannot be located\n\n Returns\n -------\n str\n The full path to an alignments file\n ", "language": "en", ...
https://github.com/deepfakes/faceswap.git
3
_has_arrow_table
def _has_arrow_table(self): if not isinstance(self._op, FrameNode): return False return all(p.arrow_table is not None for p in self._partitions.flatten())
027f92a7655ae5b473839b7956ff52bf7879f3cc
11
dataframe.py
63
FIX-#4022: Fixed empty data frame with index (#4910) Signed-off-by: Andrey Pavlenko <andrey.a.pavlenko@gmail.com>
36,150
0
49
39
15
154,793
17
modin
10
modin/experimental/core/execution/native/implementations/hdk_on_native/dataframe/dataframe.py
Python
4
{ "docstring": "\n Return True for materialized frame with Arrow table.\n\n Returns\n -------\n bool\n ", "language": "en", "n_whitespaces": 47, "n_words": 11, "vocab_size": 11 }
https://github.com/modin-project/modin.git
1
message_level_tag
def message_level_tag(message): return MESSAGE_TAGS.get(message.level) @register.simple_tag
1838fbfb1a720e0a286c989dbdea03dfde6af4a5
@register.simple_tag
8
wagtailadmin_tags.py
34
Prevent custom MESSAGE_TAGS settings from leaking into admin styles Fixes a test failure against Django main. In #2552, a fix was applied to ensure that the project-level MESSAGE_TAGS setting was ignored, allowing end-users to customise that setting for their own projects without it leaking into Wagtail admin styles....
16,502
1
10
15
5
76,338
5
wagtail
7
wagtail/admin/templatetags/wagtailadmin_tags.py
Python
2
{ "docstring": "\n Return the tag for this message's level as defined in\n django.contrib.messages.constants.DEFAULT_TAGS, ignoring the project-level\n MESSAGE_TAGS setting (which end-users might customise).\n ", "language": "en", "n_whitespaces": 33, "n_words": 20, "vocab_size": 19 }
https://github.com/wagtail/wagtail.git
2
_has_nchw_support
def _has_nchw_support(): explicitly_on_cpu = _is_current_explicit_device("CPU") gpus_available = bool(_get_available_gpus()) return not explicitly_on_cpu and gpus_available # VARIABLE MANIPULATION
84afc5193d38057e2e2badf9c889ea87d80d8fbf
10
backend.py
47
Reformatting the codebase with black. PiperOrigin-RevId: 450093126
80,226
0
27
24
13
269,606
16
keras
6
keras/backend.py
Python
4
{ "docstring": "Check whether the current scope supports NCHW ops.\n\n TensorFlow does not support NCHW on CPU. Therefore we check if we are not\n explicitly put on\n CPU, and have GPUs available. In this case there will be soft-placing on the\n GPU device.\n\n Returns:\n bool: if the current sc...
https://github.com/keras-team/keras.git
4
write
def write(self, fp, space_around_delimiters=True): if space_around_delimiters: d = " {} ".format(self._delimiters[0]) else: d = self._delimiters[0] if self._defaults: self._write_section(fp, self.default_section, se...
8198943edd73a363c266633e1aa5b2a9e9c9f526
13
configparser.py
140
add python 3.10.4 for windows
56,462
0
174
91
24
221,659
29
XX-Net
13
python3.10.4/Lib/configparser.py
Python
11
{ "docstring": "Write an .ini-format representation of the configuration state.\n\n If `space_around_delimiters' is True (the default), delimiters\n between keys and values are surrounded by spaces.\n\n Please note that comments in the original configuration file are not\n preserved when w...
https://github.com/XX-net/XX-Net.git
1
test_get_name_mixed_case
def test_get_name_mixed_case(): result = salt.utils.win_dacl.get_name("adMiniStrAtorS") expected = "Administrators" assert result == expected
3bb43882e727b1d36abe2e501759c9c5e9048ecf
10
test_get_name.py
46
Add tests, migrate some tests to pytest
54,127
0
24
24
9
215,733
12
salt
7
tests/pytests/unit/utils/win_dacl/test_get_name.py
Python
4
{ "docstring": "\n Test get_name when passing an account name with mixed case characters\n ", "language": "en", "n_whitespaces": 18, "n_words": 11, "vocab_size": 11 }
https://github.com/saltstack/salt.git
1
test_non_categorical_value_label_convert_categoricals_error
def test_non_categorical_value_label_convert_categoricals_error(): # Mapping more than one value to the same label is valid for Stata # labels, but can't be read with convert_categoricals=True value_labels = { "repeated_labels": {10: "Ten", 20: "More than ten", 40: "More than ten"} } data =...
b48a73ff53a2c3414e38f5adf11f661dd7883cd1
@pytest.mark.parametrize("version", [114, 117, 118, 119, None]) @pytest.mark.parametrize( "dtype", [ pd.BooleanDtype, pd.Int8Dtype, pd.Int16Dtype, pd.Int32Dtype, pd.Int64Dtype, pd.UInt8Dtype, pd.UInt16Dtype, pd.UInt32Dtype, pd.UInt64Dtype, ...
13
test_stata.py
334
TST: use `with` where possible instead of manual `close` (#48931) Coincidentally fixes some StataReaders being left open in tests.
40,445
1
304
131
90
169,679
112
pandas
33
pandas/tests/io/test_stata.py
Python
29
{ "docstring": "\nValue labels for column {col} are not unique. These cannot be converted to\npandas categoricals.\n\nEither read the file with `convert_categoricals` set to False or use the\nlow level interface in `StataReader` to separately read the values and the\nvalue_labels.\n\nThe repeated labels are:\n{repeat...
https://github.com/pandas-dev/pandas.git
4
memoize
def memoize(ttl=60, cache_key=None, track_function=False, cache=None): if cache_key and track_function: raise IllegalArgumentError("Can not specify cache_key when track_function is True") cache = cache or get_memoize_cache()
cfce31419d6fa5155e87f0d3faddd713e12210a2
10
common.py
61
Move the IS_TESTING method out of settings
17,296
0
39
41
21
82,019
23
awx
7
awx/main/utils/common.py
Python
6
{ "docstring": "\n Decorator to wrap a function and cache its result.\n ", "language": "en", "n_whitespaces": 16, "n_words": 9, "vocab_size": 9 }
https://github.com/ansible/awx.git
5
mixin_base_ppr_parser
def mixin_base_ppr_parser(parser): gp = add_arg_group(parser, title='Essential') gp.add_argument( '--name', type=str, help=, ) gp.add_argument( '--workspace', type=str, help='The working directory for any IO operations in this object. ' 'If ...
13edc16d806fb5d77a6849551178ccc75937f25f
13
base.py
461
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...
1,996
0
700
278
147
10,921
247
jina
27
jina/parsers/orchestrate/base.py
Python
99
{ "docstring": "Mixing in arguments required by pod/deployment/runtime module into the given parser.\n :param parser: the parser instance to which we add arguments\n \nThe name of this object.\n\nThis will be used in the following places:\n- how you refer to this object in Python/YAML/CLI\n- visualization\n- lo...
https://github.com/jina-ai/jina.git
3
transform
def transform(self, X, copy=True): check_is_fitted(self) X = self._validate_data( X, copy=(copy and self._whiten), dtype=[np.float64, np.float32], reset=False ) if self._whiten: X -= self.mean_ return np.dot(X, self.components_.T)
d14fd82cf423c21ab6d01f7d0430083f9d7026be
12
_fastica.py
110
ENH Preserving dtypes for ICA (#22806) Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org> Co-authored-by: Jérémie du Boisberranger <34657725+jeremiedbb@users.noreply.github.com> Co-authored-by: Julien Jerphanion <git@jjerphan.xyz>
75,763
0
88
73
22
259,424
24
scikit-learn
16
sklearn/decomposition/_fastica.py
Python
8
{ "docstring": "Recover the sources from X (apply the unmixing matrix).\n\n Parameters\n ----------\n X : array-like of shape (n_samples, n_features)\n Data to transform, where `n_samples` is the number of samples\n and `n_features` is the number of features.\n\n copy...
https://github.com/scikit-learn/scikit-learn.git
12
get_freq
def get_freq(self) -> str | None: if not self.is_monotonic or not self.index._is_unique: return None delta = self.deltas[0] ppd = periods_per_day(self._reso) if delta and _is_multiple(delta, ppd): return self._infer_daily_rule() # Business hourl...
e9350a4affbb424aaecad279f638a0dd1584df68
13
frequencies.py
367
infer_freq handle non-nano (#47126) * infer_freq handle non-nano * remove unused import
39,834
0
487
210
94
166,591
162
pandas
20
pandas/tseries/frequencies.py
Python
35
{ "docstring": "\n Find the appropriate frequency string to describe the inferred\n frequency of self.i8values\n\n Returns\n -------\n str or None\n ", "language": "en", "n_whitespaces": 60, "n_words": 17, "vocab_size": 15 }
https://github.com/pandas-dev/pandas.git
2
guarded_deprecation_warning
def guarded_deprecation_warning(*args, **kwargs): if os.environ.get("SERVE_WARN_V1_DEPRECATIONS", "0") == "1": from ray._private.utils import deprecated return deprecated(*args, **kwargs) else:
f6d19ac7c03b12bbf839824381376e228d0fffad
10
utils.py
75
[Serve] Gate the deprecation warnings behind envvar (#27479)
28,208
0
39
47
16
126,641
16
ray
10
python/ray/serve/_private/utils.py
Python
7
{ "docstring": "Wrapper for deprecation warnings, guarded by a flag.", "language": "en", "n_whitespaces": 7, "n_words": 8, "vocab_size": 8 }
https://github.com/ray-project/ray.git
2
current_headings
def current_headings(self): return {v['name']:('#' + v['label']) for v in self.custcols.values()}
9a95d8b0c26bdaea17ea9264ab45e8a81b6422f0
11
create_custom_column.py
57
More CreateNewCustomColumn stuff. - Improved documentation - Check column headings for duplicates - Method to return the current column headings as a dict - Improved exception handling
45,934
0
24
32
10
188,798
10
calibre
5
src/calibre/gui2/preferences/create_custom_column.py
Python
2
{ "docstring": "\n Return the currently defined column headings\n\n Return the column headings including the ones that haven't yet been\n created. It is a dict. The key is the heading, the value is the lookup\n name having that heading.\n ", "language": "en", "n_whitespaces": 72...
https://github.com/kovidgoyal/calibre.git
8
_generate
def _generate(self, pset, min_, max_, condition, type_=None): if type_ is None: type_ = pset.ret expr = [] height = np.random.randint(min_, max_) stack = [(0, type_)] while len(stack) != 0: depth, type_ = stack.pop() # We've added a t...
388616b6247ca4ea8de4e2f340d6206aee523541
19
base.py
357
Revert "Deployed 7ccda9a with MkDocs version: 1.3.0" This reverts commit bd9629c40e01241766197119b581a99409b07068.
43,607
0
683
221
83
181,829
131
tpot
34
tpot/base.py
Python
35
{ "docstring": "Generate a Tree as a list of lists.\n\n The tree is build from the root to the leaves, and it stop growing when\n the condition is fulfilled.\n\n Parameters\n ----------\n pset: PrimitiveSetTyped\n Primitive set from which primitives are selected.\n ...
https://github.com/EpistasisLab/tpot.git
2
installed_by_distutils
def installed_by_distutils(self) -> bool: info_location = self.info_location if not info_location: return False return pathlib.Path(info_location).is_file()
f3166e673fe8d40277b804d35d77dcdb760fc3b3
9
base.py
52
check point progress on only bringing in pip==22.0.4 (#4966) * vendor in pip==22.0.4 * updating vendor packaging version * update pipdeptree to fix pipenv graph with new version of pip. * Vendoring of pip-shims 0.7.0 * Vendoring of requirementslib 1.6.3 * Update pip index safety restrictions patch for p...
3,148
0
53
30
13
19,917
14
pipenv
7
pipenv/patched/notpip/_internal/metadata/base.py
Python
11
{ "docstring": "Whether this distribution is installed with legacy distutils format.\n\n A distribution installed with \"raw\" distutils not patched by setuptools\n uses one single file at ``info_location`` to store metadata. We need to\n treat this specially on uninstallation.\n ", "lan...
https://github.com/pypa/pipenv.git
13
_view
def _view(arr, dtype=None, type=None): lax_internal._check_user_dtype_supported(dtype, "view") if type is not None: raise NotImplementedError("`type` argument of array.view()") if dtype is None: return arr arr_dtype = _dtype(arr) if arr_dtype == dtype: return arr # bool is implemented as lax:PRE...
e262c72b195d4f6b31d9b45c18a23a53d22be85c
16
lax_numpy.py
632
remove `_check_user_dtype_supported` from public `jax.lax` module
26,669
0
317
391
135
119,709
224
jax
39
jax/_src/numpy/lax_numpy.py
Python
39
{ "docstring": "\n*** This function is not yet implemented by jax.numpy, and will raise NotImplementedError ***\n", "language": "en", "n_whitespaces": 13, "n_words": 14, "vocab_size": 13 }
https://github.com/google/jax.git
2
_get_offset
def _get_offset(self) -> Dict[CenteringType, np.ndarray]: offset: Dict[CenteringType, np.ndarray] = dict(legacy=np.array([0.0, 0.0])) points: Dict[Literal["face", "head"], Tuple[float, ...]] = dict(head=(0.0, 0.0, -2.3), fa...
a2de4a97985dc62db3b140a924aeac2be733abf8
18
aligned_face.py
258
lib.align.aligned_face updates - Typing - Legacy support for pre-aligned faces - Coverage support for pre-aligned faces - Standardized retrieval of sub-crops
20,610
0
357
190
47
101,189
57
faceswap
30
lib/align/aligned_face.py
Python
22
{ "docstring": " Obtain the offset between the original center of the extracted face to the new center\n of the head in 2D space.\n\n Returns\n -------\n :class:`numpy.ndarray`\n The x, y offset of the new center from the old center.\n ", "language": "en", "n_whitespa...
https://github.com/deepfakes/faceswap.git
9
list_fonts
def list_fonts(directory, extensions): extensions = ["." + ext for ext in extensions] if sys.platform == 'win32' and directory == win32FontDirectory(): return [os.path.join(directory, filename) for filename in os.listdir(directory) if os.path.isfile(filename)] el...
e8006163923564ea04f745a289e079b80afc6db8
16
font_manager.py
170
skip sub directories when finding fonts on windows Closes #22859 Co-authored-by: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com>
23,132
0
170
108
38
108,279
54
matplotlib
20
lib/matplotlib/font_manager.py
Python
11
{ "docstring": "\n Return a list of all fonts matching any of the extensions, found\n recursively under the directory.\n ", "language": "en", "n_whitespaces": 26, "n_words": 16, "vocab_size": 14 }
https://github.com/matplotlib/matplotlib.git