n_ast_errors int64 0 28 | n_whitespaces int64 3 14k | commit_id stringlengths 40 40 | url stringlengths 31 59 | random_cut stringlengths 16 15.8k | token_counts int64 6 2.13k | vocab_size int64 4 1.11k | repo stringlengths 3 28 | file_name stringlengths 5 79 | path stringlengths 8 134 | ast_levels int64 6 31 | ast_errors stringlengths 0 3.2k | d_id int64 44 121k | code stringlengths 101 62.2k | nloc int64 1 548 | fun_name stringlengths 1 84 | id int64 70 338k | n_identifiers int64 1 131 | n_ast_nodes int64 15 19.2k | commit_message stringlengths 2 15.3k | documentation dict | complexity int64 1 66 | language stringclasses 1
value | n_words int64 4 4.82k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 101 | f65417656ba8c59438d832b6e2a431f78d40c21c | https://github.com/pandas-dev/pandas.git | def rolling(self, *args, **kwargs) -> RollingGroupby:
from pandas.core.window import RollingGroupby
| 48 | 17 | pandas | groupby.py | pandas/core/groupby/groupby.py | 9 | 40,113 | def rolling(self, *args, **kwargs) -> RollingGroupby:
from pandas.core.window import RollingGroupby
return RollingGroupby(
self._selected_obj,
*args,
_grouper=self.grouper,
_as_index=self.as_index,
**kwargs,
)
| 12 | rolling | 167,770 | 13 | 71 | TYP: more return annotations in core/ (#47618)
* TYP: more return annotations in core/
* from __future__ import annotations
* more __future__ | {
"docstring": "\n Return a rolling grouper, providing rolling functionality per group.\n ",
"language": "en",
"n_whitespaces": 24,
"n_words": 9,
"vocab_size": 8
} | 1 | Python | 18 | |
0 | 417 | 2a05ccdb07cff88e56661dee8a9271859354027f | https://github.com/networkx/networkx.git | def expected_degree_graph(w, seed=None, selfloops=True):
r
n = len(w)
G = nx.empty_graph(n)
# If there are no nodes are no edges in the graph, return the empty graph.
if n == 0 or max(w) == 0:
return G
rho = 1 / sum(w)
# Sort the weights in decreasing order. The original order of t... | 240 | 97 | networkx | degree_seq.py | networkx/generators/degree_seq.py | 17 | 42,064 | def expected_degree_graph(w, seed=None, selfloops=True):
r
n = len(w)
G = nx.empty_graph(n)
# If there are no nodes are no edges in the graph, return the empty graph.
if n == 0 or max(w) == 0:
return G
rho = 1 / sum(w)
# Sort the weights in decreasing order. The original order of t... | 100 | expected_degree_graph | 176,730 | 35 | 375 | Remove redundant py2 numeric conversions (#5661)
* Remove redundant float conversion
* Remove redundant int conversion
* Use integer division
Co-authored-by: Miroslav Šedivý <6774676+eumiro@users.noreply.github.com> | {
"docstring": "Returns a random graph with given expected degrees.\n\n Given a sequence of expected degrees $W=(w_0,w_1,\\ldots,w_{n-1})$\n of length $n$ this algorithm assigns an edge between node $u$ and\n node $v$ with probability\n\n .. math::\n\n p_{uv} = \\frac{w_u w_v}{\\sum_k w_k} .\n\n ... | 13 | Python | 179 | |
0 | 208 | 4c58179509e6f6047789efb0a95c2b0e20cb6c8f | https://github.com/mlflow/mlflow.git | def save(self, path):
os.makedirs(path, | 153 | 36 | mlflow | base.py | mlflow/models/evaluation/base.py | 13 | 2,897 | def save(self, path):
os.makedirs(path, exist_ok=True)
with open(os.path.join(path, "metrics.json"), "w") as fp:
json.dump(self.metrics, fp)
artifacts_metadata = {
artifact_name: {
"uri": artifact.uri,
"class_name": _get_fully_qua... | 17 | save | 19,151 | 22 | 253 | Improve evaluation api (#5256)
* init
Signed-off-by: Weichen Xu <weichen.xu@databricks.com>
* update
Signed-off-by: Weichen Xu <weichen.xu@databricks.com>
* update
Signed-off-by: Weichen Xu <weichen.xu@databricks.com>
* update doc
Signed-off-by: Weichen Xu <weichen.xu@databricks.com>
* update d... | {
"docstring": "Write the evaluation results to the specified local filesystem path",
"language": "en",
"n_whitespaces": 9,
"n_words": 10,
"vocab_size": 9
} | 3 | Python | 49 | |
0 | 154 | 3255fa4ebb9fbc1df6bb063c0eb77a0298ca8f72 | https://github.com/getsentry/sentry.git | def test_build_group_generic_issue_attachment(self):
event = self.store_event(
data={"message": "Hello world", "level": "error"}, project_id=self.project.id
)
event = event.for_group(event.groups[0])
occurrence = self.build_occurrence(level="info")
occurrence... | 137 | 38 | sentry | test_message_builder.py | tests/sentry/integrations/slack/test_message_builder.py | 12 | 18,592 | def test_build_group_generic_issue_attachment(self):
event = self.store_event(
data={"message": "Hello world", "level": "error"}, project_id=self.project.id
)
event = event.for_group(event.groups[0])
occurrence = self.build_occurrence(level="info")
occurrence... | 14 | test_build_group_generic_issue_attachment | 89,933 | 25 | 249 | feat(integrations): Support generic issue type alerts (#42110)
Add support for issue alerting integrations that use the message builder
(Slack and MSTeams) for generic issue types.
Preview text for Slack alert:
<img width="350" alt="Screen Shot 2022-12-08 at 4 07 16 PM"
src="https://user-images.githubuserconte... | {
"docstring": "Test that a generic issue type's Slack alert contains the expected values",
"language": "en",
"n_whitespaces": 11,
"n_words": 12,
"vocab_size": 12
} | 1 | Python | 51 | |
0 | 127 | b3bc4e734528d3b186c3a38a6e73e106c3555cc7 | https://github.com/iperov/DeepFaceLive.git | def apply(self, func, mask=None) -> 'ImageProcessor':
img = orig_img = self._img
img = func(img).astype(orig_img.dtype)
if img.ndim != 4:
raise Exception('func used in ImageProcessor.apply changed format of image')
if mask is not None:
| 82 | 34 | DeepFaceLive | ImageProcessor.py | xlib/image/ImageProcessor.py | 13 | 42,906 | def apply(self, func, mask=None) -> 'ImageProcessor':
img = orig_img = self._img
img = func(img).astype(orig_img.dtype)
if img.ndim != 4:
raise Exception('func used in ImageProcessor.apply changed format of image')
if mask is not None:
mask = self._check... | 21 | apply | 179,114 | 14 | 137 | ImageProcessor.py refactoring | {
"docstring": "\n apply your own function on internal image\n\n image has NHWC format. Do not change format, but dims can be changed.\n\n func callable (img) -> img\n\n example:\n\n .apply( lambda img: img-[102,127,63] )\n ",
"language": "en",
"n_whitespaces": 79,
... | 3 | Python | 45 | |
0 | 110 | 843dba903757d592f7703a83ebd75eb3ffb46f6f | https://github.com/microsoft/recommenders.git | def predict(self, x):
# start the timer
self.timer.start()
v_, _ = self | 65 | 30 | recommenders | rbm.py | recommenders/models/rbm/rbm.py | 12 | 7,073 | def predict(self, x):
# start the timer
self.timer.start()
v_, _ = self.eval_out() # evaluate the ratings and the associated probabilities
vp = self.sess.run(v_, feed_dict={self.vu: x})
# stop the timer
self.timer.stop()
log.info("Done infere... | 7 | predict | 39,007 | 17 | 111 | removed time from returning args | {
"docstring": "Returns the inferred ratings. This method is similar to recommend_k_items() with the\n exceptions that it returns all the inferred ratings\n\n Basic mechanics:\n\n The method samples new ratings from the learned joint distribution, together with\n their probabilities. The i... | 1 | Python | 38 | |
0 | 74 | 8198943edd73a363c266633e1aa5b2a9e9c9f526 | https://github.com/XX-net/XX-Net.git | def raw_decode(self, s, idx=0):
try:
obj, end = self.scan_once(s, idx)
except StopIteration as err:
raise JSONDecodeError("Expecting value", s, err.val | 48 | 21 | XX-Net | decoder.py | python3.10.4/Lib/json/decoder.py | 11 | 55,394 | def raw_decode(self, s, idx=0):
try:
obj, end = self.scan_once(s, idx)
except StopIteration as err:
raise JSONDecodeError("Expecting value", s, err.value) from None
return obj, end
| 6 | raw_decode | 218,569 | 11 | 76 | add python 3.10.4 for windows | {
"docstring": "Decode a JSON document from ``s`` (a ``str`` beginning with\n a JSON document) and return a 2-tuple of the Python\n representation and the index in ``s`` where the document ended.\n\n This can be used to decode a JSON document from a string that may\n have extraneous data a... | 2 | Python | 24 | |
1 | 45 | aa1f40a93a882db304e9a06c2a11d93b2532d80a | https://github.com/networkx/networkx.git | def has_bridges(G, root=None):
try:
next(bridges | 28 | 13 | networkx | bridges.py | networkx/algorithms/bridges.py | 11 | @not_implemented_for("multigraph")
@not_implemented_for("directed") | 41,965 | def has_bridges(G, root=None):
try:
next(bridges(G))
except StopIteration:
return False
else:
return True
@not_implemented_for("multigraph")
@not_implemented_for("directed") | 7 | has_bridges | 176,561 | 7 | 70 | Improve bridges documentation (#5519)
* Fix bridges documentation
* Revert source code modification
* Revert raise errors for multigraphs | {
"docstring": "Decide whether a graph has any bridges.\n\n A *bridge* in a graph is an edge whose removal causes the number of\n connected components of the graph to increase.\n\n Parameters\n ----------\n G : undirected graph\n\n root : node (optional)\n A node in the graph `G`. If specified... | 2 | Python | 14 |
0 | 112 | f638f5d0e6c8ebed0e69a6584bc7f003ec646580 | https://github.com/jindongwang/transferlearning.git | def wheel_metadata(source, dist_info_dir):
# type: (ZipFile, str) -> Message
path = f"{dist_info_dir}/WHEEL"
# Zip file path separators must be /
wheel_contents = read_wheel_metadata_file(source, path)
try:
wheel_text = wheel_contents.decode()
except UnicodeDecodeError as e:
... | 49 | 57 | transferlearning | wheel.py | .venv/lib/python3.8/site-packages/pip/_internal/utils/wheel.py | 12 | 12,520 | def wheel_metadata(source, dist_info_dir):
# type: (ZipFile, str) -> Message
path = f"{dist_info_dir}/WHEEL"
# Zip file path separators must be /
wheel_contents = read_wheel_metadata_file(source, path)
try:
wheel_text = wheel_contents.decode()
except UnicodeDecodeError as e:
... | 8 | wheel_metadata | 61,338 | 13 | 103 | upd; format | {
"docstring": "Return the WHEEL metadata of an extracted wheel, if possible.\n Otherwise, raise UnsupportedWheel.\n ",
"language": "en",
"n_whitespaces": 19,
"n_words": 13,
"vocab_size": 13
} | 2 | Python | 65 | |
0 | 172 | e35be138148333078284b942ccc9ed7b1d826f97 | https://github.com/huggingface/datasets.git | def remove_column(self, i, *args, **kwargs):
table = self.table.remove_column(i, *args, **kwargs)
name = self.table.column_names[i]
blocks = []
for tables in self.blocks:
blocks.append(
[
t.remove_colu | 96 | 29 | datasets | table.py | src/datasets/table.py | 16 | 21,852 | def remove_column(self, i, *args, **kwargs):
table = self.table.remove_column(i, *args, **kwargs)
name = self.table.column_names[i]
blocks = []
for tables in self.blocks:
blocks.append(
[
t.remove_column(t.column_names.index(name),... | 12 | remove_column | 104,416 | 14 | 145 | Update docs to new frontend/UI (#3690)
* WIP: update docs to new UI
* make style
* Rm unused
* inject_arrow_table_documentation __annotations__
* hasattr(arrow_table_method, "__annotations__")
* Update task_template.rst
* Codeblock PT-TF-SPLIT
* Convert loading scripts
* Convert docs to mdx
... | {
"docstring": "\n Create new Table with the indicated column removed.\n\n Args:\n i (:obj:`int`):\n Index of column to remove.\n\n Returns:\n :class:`datasets.table.Table`:\n New table without the column.\n ",
"language": "en",
"n_wh... | 4 | Python | 40 | |
0 | 53 | 3a461d02793e6f9d41c2b1a92647e691de1abaac | https://github.com/netbox-community/netbox.git | def test_cable_cannot_terminate_to_a_wireless_interface(self):
wireless_interface = Interface(device=self.device1, name="W1", type=InterfaceTypeChoices.TYPE_80211A)
cable = Cable(a_terminations=[self.interface2], b_terminations=[wireless_interface])
with self.assertRaises(ValidationErro... | 57 | 13 | netbox | test_models.py | netbox/dcim/tests/test_models.py | 11 | 77,897 | def test_cable_cannot_terminate_to_a_wireless_interface(self):
wireless_interface = Interface(device=self.device1, name="W1", type=InterfaceTypeChoices.TYPE_80211A)
cable = Cable(a_terminations=[self.interface2], b_terminations=[wireless_interface])
with self.assertRaises(ValidationErro... | 5 | test_cable_cannot_terminate_to_a_wireless_interface | 264,886 | 18 | 95 | Update Cable instantiations to match new signature | {
"docstring": "\n A cable cannot terminate to a wireless interface\n ",
"language": "en",
"n_whitespaces": 23,
"n_words": 8,
"vocab_size": 8
} | 1 | Python | 14 | |
0 | 114 | 9c19aff7c7561e3a82978a272ecdaad40dda5c00 | https://github.com/django/django.git | def get_test_db_clone_settings(self, suffix):
# When this function is called, the test database has been created
# already and its name has been copied to | 35 | 38 | django | creation.py | django/db/backends/base/creation.py | 11 | 50,917 | def get_test_db_clone_settings(self, suffix):
# When this function is called, the test database has been created
# already and its name has been copied to settings_dict['NAME'] so
# we don't need to call _get_test_db_name.
orig_settings_dict = self.connection.settings_dict
... | 6 | get_test_db_clone_settings | 204,838 | 7 | 63 | Refs #33476 -- Reformatted code with Black. | {
"docstring": "\n Return a modified connection settings dict for the n-th clone of a DB.\n ",
"language": "en",
"n_whitespaces": 28,
"n_words": 13,
"vocab_size": 12
} | 1 | Python | 43 | |
0 | 52 | 8198943edd73a363c266633e1aa5b2a9e9c9f526 | https://github.com/XX-net/XX-Net.git | def open(self, host='', port=IMAP4_PORT, timeout=None):
self.host = host
self.port = port
self.sock = self._create_socket(timeout)
self.file = self.sock.makefile('rb')
| 50 | 14 | XX-Net | imaplib.py | python3.10.4/Lib/imaplib.py | 9 | 55,005 | def open(self, host='', port=IMAP4_PORT, timeout=None):
self.host = host
self.port = port
self.sock = self._create_socket(timeout)
self.file = self.sock.makefile('rb')
| 5 | open | 217,907 | 10 | 83 | add python 3.10.4 for windows | {
"docstring": "Setup connection to remote server on \"host:port\"\n (default: localhost:standard IMAP4 port).\n This connection will be used by the routines:\n read, readline, send, shutdown.\n ",
"language": "en",
"n_whitespaces": 59,
"n_words": 23,
"vocab_size": 22
} | 1 | Python | 17 | |
0 | 42 | 7f27e70440c177b2a047b7f74a78ed5cd5b4b596 | https://github.com/Textualize/textual.git | def synchronized_output_end_sequence(self) -> str:
if self.synchronised_output:
return | 25 | 9 | textual | _terminal_features.py | src/textual/_terminal_features.py | 10 | 44,257 | def synchronized_output_end_sequence(self) -> str:
if self.synchronised_output:
return TERMINAL_MODES_ANSI_SEQUENCES[Mode.SynchronizedOutput]["end_sync"]
return ""
| 13 | synchronized_output_end_sequence | 183,574 | 7 | 45 | [terminal buffering] Address PR feedback | {
"docstring": "\n Returns the ANSI sequence that we should send to the terminal to tell it that\n it should stop buffering the content we're about to send.\n If the terminal doesn't seem to support synchronised updates the string will be empty.\n\n Returns:\n str: the \"synchro... | 2 | Python | 10 | |
0 | 98 | f6021faf2a8e62f88a8d6979ce812dcb71133a8f | https://github.com/jaakkopasanen/AutoEq.git | def _band_penalty_coefficients(self, fc, q, gain, filter_frs):
ref_frs = biquad.digital_coeffs(self.frequenc | 121 | 34 | AutoEq | frequency_response.py | frequency_response.py | 12 | 39,253 | def _band_penalty_coefficients(self, fc, q, gain, filter_frs):
ref_frs = biquad.digital_coeffs(self.frequency, 192e3, *biquad.peaking(fc, q, gain, fs=192e3))
est_sums = np.sum(filter_frs, axis=1)
ref_sums = np.sum(ref_frs, axis=1)
penalties = np.zeros((len(fc),))
mask = ... | 8 | _band_penalty_coefficients | 162,681 | 23 | 176 | Improved quality regularization to a point where it works well. 10 kHz to 20 kHz is RMSE is calculated from the average levels. Split neo PEQ notebook by band and Q. | {
"docstring": "Calculates penalty coefficients for filters if their transition bands extend beyond Nyquist frequency\n\n The calculation is based on ratio of frequency response integrals between 44.1 kHz and 192 kHz\n\n Args:\n fc: Filter center frequencies, 1-D array\n q: Filter ... | 1 | Python | 42 | |
0 | 201 | 02b04cb3ecfc5fce1f627281c312753f3b4b8494 | https://github.com/scikit-learn/scikit-learn.git | def test_predict_on_toy_problem(global_random_seed):
clf1 = LogisticRegression(random_state=global_random_seed)
clf2 = RandomForestClassifier(n_estimators=10, random_state=global_random_seed)
clf3 = GaussianNB()
X = np.array(
[[-1.1, -1.5], [-1.2, -1.4], [-3.4, -2.2], [1.1, 1.2], [2.1, 1.4... | 357 | 48 | scikit-learn | test_voting.py | sklearn/ensemble/tests/test_voting.py | 12 | 76,664 | def test_predict_on_toy_problem(global_random_seed):
clf1 = LogisticRegression(random_state=global_random_seed)
clf2 = RandomForestClassifier(n_estimators=10, random_state=global_random_seed)
clf3 = GaussianNB()
X = np.array(
[[-1.1, -1.5], [-1.2, -1.4], [-3.4, -2.2], [1.1, 1.2], [2.1, 1.4... | 23 | test_predict_on_toy_problem | 261,153 | 22 | 469 | TST use global_random_seed in sklearn/ensemble/tests/test_voting.py (#24282)
Co-authored-by: Jérémie du Boisberranger <34657725+jeremiedbb@users.noreply.github.com> | {
"docstring": "Manually check predicted class labels for toy dataset.",
"language": "en",
"n_whitespaces": 7,
"n_words": 8,
"vocab_size": 8
} | 1 | Python | 104 | |
0 | 29 | 5a850eb044ca07f1f3bcb1b284116d6f2d37df1b | https://github.com/scikit-learn/scikit-learn.git | def fit_transform(self, X, y=None):
self._validate_params()
return self._tran | 28 | 8 | scikit-learn | _dict_vectorizer.py | sklearn/feature_extraction/_dict_vectorizer.py | 8 | 76,257 | def fit_transform(self, X, y=None):
self._validate_params()
return self._transform(X, fitting=True)
| 3 | fit_transform | 260,448 | 7 | 45 | MAINT Param validation for Dictvectorizer (#23820) | {
"docstring": "Learn a list of feature name -> indices mappings and transform X.\n\n Like fit(X) followed by transform(X), but does not require\n materializing X in memory.\n\n Parameters\n ----------\n X : Mapping or iterable over Mappings\n Dict(s) or Mapping(s) from f... | 1 | Python | 8 | |
0 | 761 | 0877fb0d78635692e481c8bde224fac5ad0dd430 | https://github.com/qutebrowser/qutebrowser.git | def _on_feature_permission_requested(self, url, feature):
page = self._widget.page()
grant_permission = functools.partial(
page.setFeaturePermission, url, feature,
QWebEnginePage.PermissionPolicy.PermissionGrantedByUser)
deny_permission = functools.partial(
... | 301 | 84 | qutebrowser | webenginetab.py | qutebrowser/browser/webengine/webenginetab.py | 14 | 117,565 | def _on_feature_permission_requested(self, url, feature):
page = self._widget.page()
grant_permission = functools.partial(
page.setFeaturePermission, url, feature,
QWebEnginePage.PermissionPolicy.PermissionGrantedByUser)
deny_permission = functools.partial(
... | 44 | _on_feature_permission_requested | 321,150 | 54 | 470 | Run scripts/dev/rewrite_enums.py | {
"docstring": "Ask the user for approval for geolocation/media/etc..",
"language": "en",
"n_whitespaces": 6,
"n_words": 7,
"vocab_size": 6
} | 10 | Python | 125 | |
0 | 784 | 8198943edd73a363c266633e1aa5b2a9e9c9f526 | https://github.com/XX-net/XX-Net.git | def add_find_python(self):
start = 402
for ver in self.versions:
install_path = r"SOFTWARE\Python\PythonCore\%s\InstallPath" % ver
machine_reg = "python.machine." + ver
user_reg = "python.user." + ver
machine_prop = "PYTHON.MACHINE." + ver
... | 304 | 86 | XX-Net | bdist_msi.py | python3.10.4/Lib/distutils/command/bdist_msi.py | 14 | 56,684 | def add_find_python(self):
start = 402
for ver in self.versions:
install_path = r"SOFTWARE\Python\PythonCore\%s\InstallPath" % ver
machine_reg = "python.machine." + ver
user_reg = "python.user." + ver
machine_prop = "PYTHON.MACHINE." + ver
... | 42 | add_find_python | 222,643 | 20 | 469 | add python 3.10.4 for windows | {
"docstring": "Adds code to the installer to compute the location of Python.\n\n Properties PYTHON.MACHINE.X.Y and PYTHON.USER.X.Y will be set from the\n registry for each version of Python.\n\n Properties TARGETDIRX.Y will be set from PYTHON.USER.X.Y if defined,\n else from PYTHON.MACHIN... | 3 | Python | 167 | |
0 | 45 | f638f5d0e6c8ebed0e69a6584bc7f003ec646580 | https://github.com/jindongwang/transferlearning.git | def write_exports(self, exports):
rf = self | 32 | 13 | transferlearning | database.py | .venv/lib/python3.8/site-packages/pip/_vendor/distlib/database.py | 11 | 12,781 | def write_exports(self, exports):
rf = self.get_distinfo_file(EXPORTS_FILENAME)
with open(rf, 'w') as f:
write_exports(exports, f)
| 4 | write_exports | 61,961 | 8 | 57 | upd; format | {
"docstring": "\n Write a dictionary of exports to a file in .ini format.\n :param exports: A dictionary of exports, mapping an export category to\n a list of :class:`ExportEntry` instances describing the\n individual export entries.\n ",
"language... | 1 | Python | 13 | |
0 | 685 | 621e782ed0c119d2c84124d006fdf253c082449a | https://github.com/ansible/ansible.git | def _get_action_handler_with_module_context(self, connection, templar):
module_collection, separator, module_name = self._task.action.rpartition(".")
module_prefix = module_name.split('_')[0]
if module_collection:
# For network modules, which look for one action plugin per p... | 264 | 117 | ansible | task_executor.py | lib/ansible/executor/task_executor.py | 15 | 78,856 | def _get_action_handler_with_module_context(self, connection, templar):
module_collection, separator, module_name = self._task.action.rpartition(".")
module_prefix = module_name.split('_')[0]
if module_collection:
# For network modules, which look for one action plugin per p... | 38 | _get_action_handler_with_module_context | 267,337 | 41 | 420 | Add toggle to fix module_defaults with module-as-redirected-action on a per-module basis (#77265)
* If there is a platform specific handler, prefer the resolved module over the resolved action when loading module_defaults
Add a toggle for action plugins to prefer the resolved module when loading module_defaults
... | {
"docstring": "\n Returns the correct action plugin to handle the requestion task action and the module context\n ",
"language": "en",
"n_whitespaces": 30,
"n_words": 15,
"vocab_size": 12
} | 8 | Python | 191 | |
0 | 161 | c17ff17a18f21be60c6916714ac8afd87d4441df | https://github.com/coqui-ai/TTS.git | def forward(self, y_hat, y, length):
mask = sequence_mask(sequence_length=length, max_len=y.size(1)).unsqueeze(2)
y_norm = sample_wise_min_max(y, mask)
y_hat_norm = sample_wise_min_max(y_hat, mask)
ssim_loss = self.loss_func((y_norm * mask).unsqueeze(1), (y_hat_norm * mask).unsq... | 122 | 40 | TTS | losses.py | TTS/tts/layers/losses.py | 13 | 77,241 | def forward(self, y_hat, y, length):
mask = sequence_mask(sequence_length=length, max_len=y.size(1)).unsqueeze(2)
y_norm = sample_wise_min_max(y, mask)
y_hat_norm = sample_wise_min_max(y_hat, mask)
ssim_loss = self.loss_func((y_norm * mask).unsqueeze(1), (y_hat_norm * mask).unsq... | 12 | forward | 262,500 | 18 | 203 | Fix SSIM loss | {
"docstring": "\n Args:\n y_hat (tensor): model prediction values.\n y (tensor): target values.\n length (tensor): length of each sample in a batch for masking.\n\n Shapes:\n y_hat: B x T X D\n y: B x T x D\n length: B\n\n Return... | 3 | Python | 61 | |
0 | 67 | 7346c288e307e1821e3ceb757d686c9bd879389c | https://github.com/django/django.git | def get_commands():
commands = {name: 'django.core' for name in find_commands(__path__[0])}
if not settings.configured:
return commands
for app_config in reversed(apps.get_app_configs()):
path = os.path.join(app_config.path, 'management')
commands.update({n | 77 | 22 | django | __init__.py | django/core/management/__init__.py | 13 | 50,200 | def get_commands():
commands = {name: 'django.core' for name in find_commands(__path__[0])}
if not settings.configured:
return commands
for app_config in reversed(apps.get_app_configs()):
path = os.path.join(app_config.path, 'management')
commands.update({name: app_config.name... | 8 | get_commands | 202,989 | 15 | 126 | Refs #32355 -- Removed unnecessary list() calls before reversed() on dictviews.
Dict and dictviews are iterable in reversed insertion order using
reversed() in Python 3.8+. | {
"docstring": "\n Return a dictionary mapping command names to their callback applications.\n\n Look for a management.commands package in django.core, and in each\n installed application -- if a commands package exists, register all\n commands in that package.\n\n Core commands are always included. If... | 5 | Python | 31 | |
0 | 193 | 8198943edd73a363c266633e1aa5b2a9e9c9f526 | https://github.com/XX-net/XX-Net.git | def getphraselist(self):
plist = []
while self.pos < len(self.field):
if self.field[self.pos] in self.FWS:
self.pos += 1
elif self.field[self.pos] == '"':
plist.append(self.getquote())
elif self.field[self.pos] == '(':
... | 119 | 26 | XX-Net | _parseaddr.py | python3.10.4/Lib/email/_parseaddr.py | 15 | 57,004 | def getphraselist(self):
plist = []
while self.pos < len(self.field):
if self.field[self.pos] in self.FWS:
self.pos += 1
elif self.field[self.pos] == '"':
plist.append(self.getquote())
elif self.field[self.pos] == '(':
... | 14 | getphraselist | 223,611 | 13 | 196 | add python 3.10.4 for windows | {
"docstring": "Parse a sequence of RFC 2822 phrases.\n\n A phrase is a sequence of words, which are in turn either RFC 2822\n atoms or quoted-strings. Phrases are canonicalized by squeezing all\n runs of continuous whitespace into one space.\n ",
"language": "en",
"n_whitespaces": 66... | 6 | Python | 35 | |
0 | 363 | 8387676bc049d7b3e071846730c632e6ced137ed | https://github.com/matplotlib/matplotlib.git | def set_location(self, location):
# This puts the rectangle | 130 | 97 | matplotlib | _secondary_axes.py | lib/matplotlib/axes/_secondary_axes.py | 15 | 23,720 | def set_location(self, location):
# This puts the rectangle into figure-relative coordinates.
if isinstance(location, str):
_api.check_in_list(self._locstrings, location=location)
self._pos = 1. if location in ('top', 'right') else 0.
elif isinstance(location, n... | 17 | set_location | 109,724 | 19 | 230 | Clean up code in SecondaryAxis | {
"docstring": "\n Set the vertical or horizontal location of the axes in\n parent-normalized coordinates.\n\n Parameters\n ----------\n location : {'top', 'bottom', 'left', 'right'} or float\n The position to put the secondary axis. Strings can be 'top' or\n ... | 5 | Python | 142 | |
0 | 149 | e7cb2e82f8b9c7a68f82abdd3b6011d661230b7e | https://github.com/modin-project/modin.git | def length(self):
if self._length_cache is None:
if len(self.call_queue):
self.drain_call_queue()
else:
self._length_cache, self._width_cache = _get_index_and_columns.remote(
self.oid
| 70 | 19 | modin | partition.py | modin/core/execution/ray/implementations/pandas_on_ray/partitioning/partition.py | 14 | 35,383 | def length(self):
if self._length_cache is None:
if len(self.call_queue):
self.drain_call_queue()
else:
self._length_cache, self._width_cache = _get_index_and_columns.remote(
self.oid
)
if isinstance(sel... | 11 | length | 153,347 | 14 | 115 | REFACTOR-#4251: define public interfaces in `modin.core.execution.ray` module (#3868)
Signed-off-by: Anatoly Myachev <anatoly.myachev@intel.com> | {
"docstring": "\n Get the length of the object wrapped by this partition.\n\n Returns\n -------\n int\n The length of the object.\n ",
"language": "en",
"n_whitespaces": 65,
"n_words": 18,
"vocab_size": 14
} | 4 | Python | 24 | |
0 | 44 | 0f6dde45a1c75b02c208323574bdb09b8536e3e4 | https://github.com/sympy/sympy.git | def dmp_l2_norm_squared(f, u, K):
if not u:
return dup_l2_norm_squared(f, K)
v = u - 1
return s | 44 | 23 | sympy | densearith.py | sympy/polys/densearith.py | 10 | 47,480 | def dmp_l2_norm_squared(f, u, K):
if not u:
return dup_l2_norm_squared(f, K)
v = u - 1
return sum([ dmp_l2_norm_squared(c, v, K) for c in f ])
| 5 | dmp_l2_norm_squared | 195,939 | 8 | 67 | Add `l2_norm_squared` methods. | {
"docstring": "\n Returns squared l2 norm of a polynomial in ``K[X]``.\n\n Examples\n ========\n\n >>> from sympy.polys import ring, ZZ\n >>> R, x,y = ring(\"x,y\", ZZ)\n\n >>> R.dmp_l2_norm_squared(2*x*y - x - 3)\n 14\n\n ",
"language": "en",
"n_whitespaces": 55,
"n_words": 30,
"voca... | 3 | Python | 25 | |
0 | 72 | a06fa496d3f837cca3c437ab6e9858525633d147 | https://github.com/ansible/ansible.git | def cloud_filter(args, targets): # type: (IntegrationConfig, t.Tuple[IntegrationTarget, ...]) -> t.List[str]
if args.metadata.cloud_config is not None:
return [] # cloud filter already performed prior to delegation
exclude = [] # type: t.List[str]
for provider in get_cloud_providers( | 45 | 32 | ansible | __init__.py | test/lib/ansible_test/_internal/commands/integration/cloud/__init__.py | 9 | 78,551 | def cloud_filter(args, targets): # type: (IntegrationConfig, t.Tuple[IntegrationTarget, ...]) -> t.List[str]
if args.metadata.cloud_config is not None:
return [] # cloud filter already performed prior to delegation
exclude = [] # type: t.List[str]
for provider in get_cloud_providers(args, ... | 7 | cloud_filter | 266,740 | 9 | 74 | ansible-test - Code cleanup and refactoring. (#77169)
* Remove unnecessary PyCharm ignores.
* Ignore intentional undefined attribute usage.
* Add missing type hints. Fix existing type hints.
* Fix docstrings and comments.
* Use function to register completion handler.
* Pass strings to display functions.
* Fix C... | {
"docstring": "Return a list of target names to exclude based on the given targets.",
"language": "en",
"n_whitespaces": 12,
"n_words": 13,
"vocab_size": 13
} | 3 | Python | 40 | |
0 | 252 | f1c37893caf90738288e789c3233ab934630254f | https://github.com/saltstack/salt.git | def test_upgrade_available_none():
chk_upgrade_out = (
"Last metadata ex | 124 | 56 | salt | test_aixpkg.py | tests/pytests/unit/modules/test_aixpkg.py | 16 | 53,805 | def test_upgrade_available_none():
chk_upgrade_out = (
"Last metadata expiration check: 22:5:48 ago on Mon Dec 6 19:26:36 EST 2021."
)
dnf_call = MagicMock(return_value={"retcode": 100, "stdout": chk_upgrade_out})
version_mock = MagicMock(return_value="6.6-2")
with patch("pathlib.Pat... | 21 | test_upgrade_available_none | 215,087 | 19 | 217 | Working tests for install | {
"docstring": "\n test upgrade available where a valid upgrade is not available\n ",
"language": "en",
"n_whitespaces": 17,
"n_words": 10,
"vocab_size": 8
} | 1 | Python | 64 | |
0 | 373 | 361b7f444a53cc34cad8ddc378d125b7027d96df | https://github.com/getsentry/sentry.git | def test_too_many_boosted_releases_do_not_boost_anymore(self):
release_2 = Release.get_or_create( | 185 | 46 | sentry | test_event_manager.py | tests/sentry/event_manager/test_event_manager.py | 14 | 18,273 | def test_too_many_boosted_releases_do_not_boost_anymore(self):
release_2 = Release.get_or_create(self.project, "2.0")
release_3 = Release.get_or_create(self.project, "3.0")
for release_id in (self.release.id, release_2.id):
self.redis_client.set(f"ds::p:{self.project.id}:r:... | 27 | test_too_many_boosted_releases_do_not_boost_anymore | 87,293 | 27 | 342 | feat(ds): Limit the amount of boosted releases to 10 (#40501)
Limits amount of boosted releases to 10 releases
otherwise do not add any more releases to hash set of listed releases | {
"docstring": "\n This test tests the case when we have already too many boosted releases, in this case we want to skip the\n boosting of anymore releases\n ",
"language": "en",
"n_whitespaces": 47,
"n_words": 25,
"vocab_size": 22
} | 2 | Python | 56 | |
0 | 175 | 5dfd57af2a141a013ae3753e160180b82bec9469 | https://github.com/networkx/networkx.git | def hits(G, max_iter=100, tol=1.0e-8, nstart=None, normalized=True):
import numpy as np
import scipy as sp
imp | 226 | 56 | networkx | hits_alg.py | networkx/algorithms/link_analysis/hits_alg.py | 15 | 41,745 | def hits(G, max_iter=100, tol=1.0e-8, nstart=None, normalized=True):
import numpy as np
import scipy as sp
import scipy.sparse.linalg # call as sp.sparse.linalg
if len(G) == 0:
return {}, {}
A = nx.adjacency_matrix(G, nodelist=list(G), dtype=float)
if nstart is None:
u, s... | 20 | hits | 176,175 | 39 | 339 | Use scipy.sparse array datastructure (#5139)
* Step 1: use sparse arrays in nx.to_scipy_sparse_matrix.
Seems like a reasonable place to start.
nx.to_scipy_sparse_matrix is one of the primary interfaces to
scipy.sparse from within NetworkX.
* 1: Use np.outer instead of mult col/row vectors
Fix two instances ... | {
"docstring": "Returns HITS hubs and authorities values for nodes.\n\n The HITS algorithm computes two numbers for a node.\n Authorities estimates the node value based on the incoming links.\n Hubs estimates the node value based on outgoing links.\n\n Parameters\n ----------\n G : graph\n A Ne... | 4 | Python | 90 | |
0 | 87 | 26e8d6d7664bbaae717438bdb41766550ff57e4f | https://github.com/apache/airflow.git | def test_connection(self) -> Tuple[bool, str]:
try:
conn = se | 41 | 21 | airflow | ftp.py | airflow/providers/ftp/hooks/ftp.py | 11 | 8,731 | def test_connection(self) -> Tuple[bool, str]:
try:
conn = self.get_conn()
conn.pwd
return True, "Connection successfully tested"
except Exception as e:
return False, str(e)
| 8 | test_connection | 45,823 | 10 | 71 | Updates FTPHook provider to have test_connection (#21997)
* Updates FTP provider to have test_connection
Co-authored-by: eladkal <45845474+eladkal@users.noreply.github.com> | {
"docstring": "Test the FTP connection by calling path with directory",
"language": "en",
"n_whitespaces": 8,
"n_words": 9,
"vocab_size": 9
} | 2 | Python | 22 | |
0 | 352 | 1661ddd44044c637526e9a1e812e7c1863be35fc | https://github.com/OpenBB-finance/OpenBBTerminal.git | def call_price(self, other_args):
parser = argparse.ArgumentParser(
add_help=False,
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
prog="price",
description=,
)
parser.add_argument(
"-s",
"--symbol",
... | 131 | 64 | OpenBBTerminal | crypto_controller.py | openbb_terminal/cryptocurrency/crypto_controller.py | 13 | 85,397 | def call_price(self, other_args):
parser = argparse.ArgumentParser(
add_help=False,
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
prog="price",
description=,
)
parser.add_argument(
"-s",
"--symbol",
... | 26 | call_price | 285,727 | 28 | 221 | Integrate live feeds from Pyth (#2178)
* added dependency
* added pyth models
* dependencies
* docs
* some improvements to this pyth command (#2433)
* some improvements to this pyth command
* minor improv
* dependencies
* tests
Co-authored-by: DidierRLopes <dro.lopes@campus.fct.unl.pt>; COli... | {
"docstring": "Process price commandDisplay price and interval of confidence in real-time. [Source: Pyth]",
"language": "en",
"n_whitespaces": 11,
"n_words": 12,
"vocab_size": 11
} | 5 | Python | 74 | |
0 | 316 | 6ed6ac9448311930557810383d2cfd4fe6aae269 | https://github.com/huggingface/datasets.git | def _single_map_nested(args):
function, data_struct, types, rank, disable_tqdm, desc = args
# Singleton first to spare some computation
if not isinstance(data_struct, dict) and not isinstance(data_struct, types):
return function(data_struct)
# Reduce logging to keep things readable in mul... | 259 | 107 | datasets | py_utils.py | src/datasets/utils/py_utils.py | 13 | 21,793 | def _single_map_nested(args):
function, data_struct, types, rank, disable_tqdm, desc = args
# Singleton first to spare some computation
if not isinstance(data_struct, dict) and not isinstance(data_struct, types):
return function(data_struct)
# Reduce logging to keep things readable in mul... | 21 | _single_map_nested | 104,238 | 38 | 398 | Better TQDM output (#3654)
* Show progress bar when generating examples
* Consistent utils.is_progress_bar_enabled calls
* Fix tqdm in notebook
* Add missing params to DatasetDict.map
* Specify total in tqdm progress bar in map
* Fix total computation
* Small fix
* Add desc to map_nested
* Add ... | {
"docstring": "Apply a function recursively to each element of a nested data struct.",
"language": "en",
"n_whitespaces": 11,
"n_words": 12,
"vocab_size": 11
} | 17 | Python | 182 | |
0 | 99 | 9c19aff7c7561e3a82978a272ecdaad40dda5c00 | https://github.com/django/django.git | def test_unified(self):
| 77 | 26 | django | tests.py | tests/admin_scripts/tests.py | 11 | 51,930 | def test_unified(self):
self.write_settings("settings_to_diff.py", sdict={"FOO": '"bar"'})
args = ["diffsettings", "--settings=settings_to_diff", "--output=unified"]
out, err = self.run_manage(args)
self.assertNoOutput(err)
self.assertOutput(out, "+ FOO = 'bar'")
... | 9 | test_unified | 207,334 | 11 | 140 | Refs #33476 -- Reformatted code with Black. | {
"docstring": "--output=unified emits settings diff in unified mode.",
"language": "en",
"n_whitespaces": 6,
"n_words": 7,
"vocab_size": 7
} | 1 | Python | 35 | |
0 | 18 | eb2692cb32bb1747e312d5b20e976d7a879c9588 | https://github.com/ray-project/ray.git | def runtime_env(self):
| 17 | 4 | ray | runtime_context.py | python/ray/runtime_context.py | 9 | 31,793 | def runtime_env(self):
return RuntimeEnv.deserialize(self._get_runtime_env_string())
| 2 | runtime_env | 139,848 | 5 | 31 | [runtime env] runtime env inheritance refactor (#24538)
* [runtime env] runtime env inheritance refactor (#22244)
Runtime Environments is already GA in Ray 1.6.0. The latest doc is [here](https://docs.ray.io/en/master/ray-core/handling-dependencies.html#runtime-environments). And now, we already supported a [inheri... | {
"docstring": "Get the runtime env of the current job/worker.\n\n If this API is called in driver or ray client, returns the job level runtime\n env.\n If this API is called in workers/actors, returns the worker level runtime env.\n\n Returns:\n A new ray.runtime_env.RuntimeEnv... | 1 | Python | 4 | |
0 | 65 | d1a8d1597d4fe9f129a72fe94c1508304b7eae0f | https://github.com/streamlink/streamlink.git | def sleeper(self, duration):
s = time()
yield
time_to_sleep = duration - (time() - s)
if time_to_sleep > 0:
s | 36 | 16 | streamlink | dash.py | src/streamlink/stream/dash.py | 11 | 45,770 | def sleeper(self, duration):
s = time()
yield
time_to_sleep = duration - (time() - s)
if time_to_sleep > 0:
self.wait(time_to_sleep)
| 6 | sleeper | 187,407 | 7 | 63 | stream.dash: update DASHStreamWorker.iter_segments
- Refactor DASHStreamWorker.iter_segments()
- Replace dash_manifest.sleeper() with SegmentedStreamWorker.wait(),
and make the worker thread shut down immediately on close().
- Prevent unnecessary wait times for static manifest types by calling
close() after all se... | {
"docstring": "\n Do something and then wait for a given duration minus the time it took doing something\n ",
"language": "en",
"n_whitespaces": 31,
"n_words": 16,
"vocab_size": 15
} | 2 | Python | 19 | |
0 | 1,100 | a17f4f3bd63e3ca3754f96d7db4ce5197720589b | https://github.com/matplotlib/matplotlib.git | def test_BoundaryNorm():
boundaries = [0, 1.1, 2.2]
vals = [-1, 0, 1, 2, 2.2, 4]
# Without interpolation
expected = [-1, 0, 0, 1, 2, 2]
ncolors = len(boundaries) - 1
bn = mcolors.BoundaryNorm(boundaries, ncolors)
assert_array_equal(bn(vals), expected)
# ncolors != len(boundaries)... | 1,470 | 192 | matplotlib | test_colors.py | lib/matplotlib/tests/test_colors.py | 12 | 23,566 | def test_BoundaryNorm():
boundaries = [0, 1.1, 2.2]
vals = [-1, 0, 1, 2, 2.2, 4]
# Without interpolation
expected = [-1, 0, 0, 1, 2, 2]
ncolors = len(boundaries) - 1
bn = mcolors.BoundaryNorm(boundaries, ncolors)
assert_array_equal(bn(vals), expected)
# ncolors != len(boundaries)... | 119 | test_BoundaryNorm | 109,399 | 52 | 2,192 | MNT: convert tests and internal usage way from using mpl.cm.get_cmap | {
"docstring": "\n GitHub issue #1258: interpolation was failing with numpy\n 1.7 pre-release.\n ",
"language": "en",
"n_whitespaces": 20,
"n_words": 10,
"vocab_size": 10
} | 4 | Python | 623 | |
0 | 912 | e5b1888cd932909e49194d58035da34b210b91c4 | https://github.com/modin-project/modin.git | def _join_by_index(self, other_modin_frames, how, sort, ignore_index):
if how == "outer":
raise NotImplementedError("outer join is not supported in HDK engine")
lhs = self._maybe_materialize_rowid()
reset_index_names = False
for rhs in other_modin_frames:
... | 315 | 113 | modin | dataframe.py | modin/experimental/core/execution/native/implementations/hdk_on_native/dataframe/dataframe.py | 16 | 36,066 | def _join_by_index(self, other_modin_frames, how, sort, ignore_index):
if how == "outer":
raise NotImplementedError("outer join is not supported in HDK engine")
lhs = self._maybe_materialize_rowid()
reset_index_names = False
for rhs in other_modin_frames:
... | 57 | _join_by_index | 154,556 | 44 | 498 | FEAT-#4946: Replace OmniSci with HDK (#4947)
Co-authored-by: Iaroslav Igoshev <Poolliver868@mail.ru>
Signed-off-by: Andrey Pavlenko <andrey.a.pavlenko@gmail.com> | {
"docstring": "\n Perform equi-join operation for multiple frames by index columns.\n\n Parameters\n ----------\n other_modin_frames : list of HdkOnNativeDataframe\n Frames to join with.\n how : str\n A type of join.\n sort : bool\n Sort the ... | 11 | Python | 171 | |
0 | 112 | e272ed2fa4c58e0a89e273a3e85da7d13a85e04c | https://github.com/OpenMined/PySyft.git | def _object2proto(self) -> RunFunctionOrConstructorAction_PB:
return RunFunctionOrConstructorAction_PB(
path=self.path,
args=[serialize(x, to_bytes=True) for x in self.args],
kwargs={k: serialize(v, to_bytes=True) for k, v in self.kwargs.items()},
id_at_l... | 91 | 22 | PySyft | function_or_constructor_action.py | packages/syft/src/syft/core/node/common/action/function_or_constructor_action.py | 13 | 342 | def _object2proto(self) -> RunFunctionOrConstructorAction_PB:
return RunFunctionOrConstructorAction_PB(
path=self.path,
args=[serialize(x, to_bytes=True) for x in self.args],
kwargs={k: serialize(v, to_bytes=True) for k, v in self.kwargs.items()},
id_at_l... | 23 | _object2proto | 2,710 | 16 | 135 | [syft.core.node.common.action] Change syft import absolute -> relative | {
"docstring": "Returns a protobuf serialization of self.\n\n As a requirement of all objects which inherit from Serializable,\n this method transforms the current object into the corresponding\n Protobuf object so that it can be further serialized.\n\n :return: returns a protobuf object\n... | 3 | Python | 25 | |
0 | 370 | dec723f072eb997a497a159dbe8674cd39999ee9 | https://github.com/networkx/networkx.git | def truncated_cube_graph(create_using=None):
description = [
"adjacencylist",
"Truncated Cube Graph",
24,
[
[2, 3, 5],
[12, 15],
[4, 5],
[7, 9],
[6],
[17, 19],
[8, 9],
[11, 13],
... | 152 | 46 | networkx | small.py | networkx/generators/small.py | 9 | 41,741 | def truncated_cube_graph(create_using=None):
description = [
"adjacencylist",
"Truncated Cube Graph",
24,
[
[2, 3, 5],
[12, 15],
[4, 5],
[7, 9],
[6],
[17, 19],
[8, 9],
[11, 13],
... | 34 | truncated_cube_graph | 176,171 | 5 | 197 | Docstrings for the small.py module (#5240)
* added description for the first 5 small graphs
* modified descriptions based on comment and added description for two more functions
* added doctrings to all the functions
* Minor touchups.
Co-authored-by: Ross Barnowski <rossbar@berkeley.edu> | {
"docstring": "\n Returns the skeleton of the truncated cube.\n\n The truncated cube is an Archimedean solid with 14 regular\n faces (6 octagonal and 8 triangular), 36 edges and 24 nodes [1]_.\n The truncated cube is created by truncating (cutting off) the tips\n of the cube one third of the way into ... | 1 | Python | 56 | |
0 | 53 | de3fcba9e95818e9634ab7de6bfcb1f4221f2775 | https://github.com/wagtail/wagtail.git | def get_admin_urls_for_registration(self):
urls = ()
for instance in self.modeladmin_instances:
urls += instance.get_admin_urls_for_registration()
return urls
| 26 | 12 | wagtail | options.py | wagtail/contrib/modeladmin/options.py | 10 | 15,593 | def get_admin_urls_for_registration(self):
urls = ()
for instance in self.modeladmin_instances:
urls += instance.get_admin_urls_for_registration()
return urls
| 5 | get_admin_urls_for_registration | 70,994 | 5 | 45 | Fix warnings from flake8-comprehensions. | {
"docstring": "\n Utilised by Wagtail's 'register_admin_urls' hook to register urls for\n used by any associated ModelAdmin instances\n ",
"language": "en",
"n_whitespaces": 37,
"n_words": 15,
"vocab_size": 14
} | 2 | Python | 14 | |
0 | 63 | f638f5d0e6c8ebed0e69a6584bc7f003ec646580 | https://github.com/jindongwang/transferlearning.git | def setName(self, name):
self.name = name
self.errmsg = "Expected " + self.name
if __diag__.enable_debug_on_named_expressions:
self.setDebug()
return self
| 34 | 15 | transferlearning | pyparsing.py | .venv/lib/python3.8/site-packages/pip/_vendor/pyparsing.py | 9 | 13,241 | def setName(self, name):
self.name = name
self.errmsg = "Expected " + self.name
if __diag__.enable_debug_on_named_expressions:
self.setDebug()
return self
| 6 | setName | 63,304 | 7 | 59 | upd; format | {
"docstring": "\n Define name for this expression, makes debugging and exception messages clearer.\n\n Example::\n\n Word(nums).parseString(\"ABC\") # -> Exception: Expected W:(0123...) (at char 0), (line:1, col:1)\n Word(nums).setName(\"integer\").parseString(\"ABC\") # -> Exce... | 2 | Python | 17 | |
0 | 82 | 1e65a4afd191cf61ba05b80545d23f9b88962f41 | https://github.com/modin-project/modin.git | def get_func(cls, key, **kwargs):
if "agg_func" in kwargs:
return cls.inplace_applyier_builder(key, kwargs["agg_func"])
elif "func_dict" in kwargs:
return cls.inplace_applyier_builder(key, kwargs["func_dict"])
else:
return cls.inplace_applyier_builder... | 54 | 16 | modin | groupby.py | modin/core/dataframe/algebra/default2pandas/groupby.py | 12 | 35,257 | def get_func(cls, key, **kwargs):
if "agg_func" in kwargs:
return cls.inplace_applyier_builder(key, kwargs["agg_func"])
elif "func_dict" in kwargs:
return cls.inplace_applyier_builder(key, kwargs["func_dict"])
else:
return cls.inplace_applyier_builder... | 7 | get_func | 153,097 | 5 | 92 | FIX-#3197: do not pass lambdas to the backend in GroupBy (#3373)
Signed-off-by: Dmitry Chigarev <dmitry.chigarev@intel.com> | {
"docstring": "\n Extract aggregation function from groupby arguments.\n\n Parameters\n ----------\n key : callable or str\n Default aggregation function. If aggregation function is not specified\n via groupby arguments, then `key` function is used.\n **kwargs... | 3 | Python | 21 | |
0 | 44 | 7f1bacc7dc9caf6d0ec042e39499bbf1d9a7d065 | https://github.com/ray-project/ray.git | def update_scheduler(self, metric):
self.worker_group.apply_all_operators(
lambda op: [sched.step(m | 32 | 12 | ray | torch_trainer.py | python/ray/util/sgd/torch/torch_trainer.py | 11 | 29,983 | def update_scheduler(self, metric):
self.worker_group.apply_all_operators(
lambda op: [sched.step(metric) for sched in op._schedulers]
)
| 4 | update_scheduler | 133,351 | 9 | 52 | [CI] Format Python code with Black (#21975)
See #21316 and #21311 for the motivation behind these changes. | {
"docstring": "Calls ``scheduler.step(metric)`` on all registered schedulers.\n\n This is useful for lr_schedulers such as ``ReduceLROnPlateau``.\n ",
"language": "en",
"n_whitespaces": 28,
"n_words": 14,
"vocab_size": 14
} | 2 | Python | 12 | |
0 | 56 | a5b70b3132467b5e3616178d9ecca6cb7316c400 | https://github.com/scikit-learn/scikit-learn.git | def paired_cosine_distances(X, Y):
X, Y = c | 39 | 27 | scikit-learn | pairwise.py | sklearn/metrics/pairwise.py | 11 | 75,273 | 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... | 3 | paired_cosine_distances | 258,521 | 10 | 108 | DOC Ensures that sklearn.metrics.pairwise.paired_cosine_distances passes numpydoc validation (#22141)
Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com> | {
"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... | 1 | Python | 31 | |
0 | 131 | 897a8dd89f40817201bc4aebe532a096405bdeb1 | https://github.com/huggingface/transformers.git | def torchdynamo_smart_context_manager(self):
ctx_manager = contextlib.nullcontext()
if is_torchdynamo_available():
import torchdynamo
from torchdy | 64 | 20 | transformers | trainer.py | src/transformers/trainer.py | 13 | 5,648 | def torchdynamo_smart_context_manager(self):
ctx_manager = contextlib.nullcontext()
if is_torchdynamo_available():
import torchdynamo
from torchdynamo.optimizations.training import aot_autograd_speedup_strategy
if self.args.torchdynamo == "eager":
... | 10 | torchdynamo_smart_context_manager | 30,695 | 12 | 112 | Support compilation via Torchdynamo, AOT Autograd, NVFuser (#17308)
* Support compilation via Torchdynamo, AOT Autograd, NVFuser
* Address comments
* Lint
* Stas comments - missing quality test
* Lintere
* Quality test
* Doc lint
* Reset CUDA peak mem
* Add CustomTrainer
* require a single g... | {
"docstring": "\n A helper wrapper that creates an appropriate context manager for `torchdynamo`.\n ",
"language": "en",
"n_whitespaces": 26,
"n_words": 11,
"vocab_size": 11
} | 4 | Python | 29 | |
0 | 110 | 7d9e9a49005de7961e84d2a7c608db57dbab3046 | https://github.com/certbot/certbot.git | def check_aug_version(self) -> bool:
self.aug.set("/test/path/testing/arg", "aRgUMeNT")
try:
matches = self.aug.match(
"/test//*[self::arg=~regexp('argument', 'i')]")
except RuntimeError:
self.aug.remove("/test/path")
return False
... | 53 | 17 | certbot | parser.py | certbot-apache/certbot_apache/_internal/parser.py | 11 | 45,584 | def check_aug_version(self) -> bool:
self.aug.set("/test/path/testing/arg", "aRgUMeNT")
try:
matches = self.aug.match(
"/test//*[self::arg=~regexp('argument', 'i')]")
except RuntimeError:
self.aug.remove("/test/path")
return False
... | 13 | check_aug_version | 186,677 | 9 | 98 | Add typing to certbot.apache (#9071)
* Add typing to certbot.apache
Co-authored-by: Adrien Ferrand <ferrand.ad@gmail.com> | {
"docstring": " Checks that we have recent enough version of libaugeas.\n If augeas version is recent enough, it will support case insensitive\n regexp matching",
"language": "en",
"n_whitespaces": 36,
"n_words": 22,
"vocab_size": 20
} | 2 | Python | 20 | |
0 | 42 | ca86da3a30c4e080d4db8c25fca73de843663cb4 | https://github.com/Stability-AI/stablediffusion.git | def resize_depth(depth, width, height):
depth = torch.squeeze(depth[0, :, :, :]).to("cpu")
depth_resized = cv2.resize(
depth.numpy(), (width, height), interpolation=cv2.INTER_CUBIC
)
return depth_resized
| 58 | 17 | stablediffusion | utils.py | ldm/modules/midas/utils.py | 12 | 37,003 | def resize_depth(depth, width, height):
depth = torch.squeeze(depth[0, :, :, :]).to("cpu")
depth_resized = cv2.resize(
depth.numpy(), (width, height), interpolation=cv2.INTER_CUBIC
)
return depth_resized
| 6 | resize_depth | 157,635 | 13 | 91 | release more models | {
"docstring": "Resize depth map and bring to CPU (numpy).\n\n Args:\n depth (tensor): depth\n width (int): image width\n height (int): image height\n\n Returns:\n array: processed depth\n ",
"language": "en",
"n_whitespaces": 61,
"n_words": 24,
"vocab_size": 17
} | 1 | Python | 20 | |
0 | 729 | cda8dfe6f45dc5ed394c2f5cda706cd6c729f713 | https://github.com/sympy/sympy.git | def comp(z1, z2, tol=None):
r
if type(z2) is str:
if not | 381 | 107 | sympy | numbers.py | sympy/core/numbers.py | 24 | 47,440 | def comp(z1, z2, tol=None):
r
if type(z2) is str:
if not pure_complex(z1, or_real=True):
raise ValueError('when z2 is a str z1 must be a Number')
return str(z1) == z2
if not z1:
z1, z2 = z2, z1
if not z1:
return True
if not tol:
a, b = z1, z2
... | 105 | comp | 195,853 | 34 | 605 | Improved documentation formatting | {
"docstring": "Return a bool indicating whether the error between z1 and z2\n is $\\le$ ``tol``.\n\n Examples\n ========\n\n If ``tol`` is ``None`` then ``True`` will be returned if\n :math:`|z1 - z2|\\times 10^p \\le 5` where $p$ is minimum value of the\n decimal precision of each value.\n\n >>... | 26 | Python | 213 | |
0 | 491 | 36c1f477b273cb2fb0dea3c921ec267db877c039 | https://github.com/open-mmlab/mmdetection.git | def _parse_img_level_ann(self, image_level_ann_file):
item_lists = defaultdict(list)
with self.file_client.get_local_path(
image_level_ann_file) as local_path:
with open(local_path, 'r') as f:
reader = csv.reader(f)
i = -1
... | 122 | 45 | mmdetection | openimages.py | mmdet/datasets/openimages.py | 19 | 70,677 | def _parse_img_level_ann(self, image_level_ann_file):
item_lists = defaultdict(list)
with self.file_client.get_local_path(
image_level_ann_file) as local_path:
with open(local_path, 'r') as f:
reader = csv.reader(f)
i = -1
... | 23 | _parse_img_level_ann | 245,152 | 24 | 201 | Refactor OpenImages. | {
"docstring": "Parse image level annotations from csv style ann_file.\n\n Args:\n image_level_ann_file (str): CSV style image level annotation\n file path.\n\n Returns:\n defaultdict[list[dict]]: Annotations where item of the defaultdict\n indicates an im... | 3 | Python | 58 | |
0 | 32 | 8198943edd73a363c266633e1aa5b2a9e9c9f526 | https://github.com/XX-net/XX-Net.git | def logical_and(self, a, b):
a = _convert | 31 | 11 | XX-Net | _pydecimal.py | python3.10.4/Lib/_pydecimal.py | 9 | 55,789 | def logical_and(self, a, b):
a = _convert_other(a, raiseit=True)
return a.logical_and(b, context=self)
| 3 | logical_and | 219,771 | 7 | 48 | add python 3.10.4 for windows | {
"docstring": "Applies the logical operation 'and' between each operand's digits.\n\n The operands must be both logical numbers.\n\n >>> ExtendedContext.logical_and(Decimal('0'), Decimal('0'))\n Decimal('0')\n >>> ExtendedContext.logical_and(Decimal('0'), Decimal('1'))\n Decimal('0... | 1 | Python | 11 | |
0 | 587 | 65be461082dda54c8748922f9c29a19af1279fe1 | https://github.com/sympy/sympy.git | def decrement_part_small(self, part, ub):
if self.lpart >= ub - 1:
self.p1 += 1 # increment to keep track of usefulness of tests
return False
plen = len(part)
for j in range(plen - 1, -1, -1):
# Knuth's mod, (answer to problem 7.2.1.5.69)
... | 214 | 114 | sympy | enumerative.py | sympy/utilities/enumerative.py | 18 | 48,514 | def decrement_part_small(self, part, ub):
if self.lpart >= ub - 1:
self.p1 += 1 # increment to keep track of usefulness of tests
return False
plen = len(part)
for j in range(plen - 1, -1, -1):
# Knuth's mod, (answer to problem 7.2.1.5.69)
... | 21 | decrement_part_small | 197,371 | 16 | 333 | Remove abbreviations in documentation | {
"docstring": "Decrements part (a subrange of pstack), if possible, returning\n True iff the part was successfully decremented.\n\n Parameters\n ==========\n\n part\n part to be decremented (topmost part on the stack)\n\n ub\n the maximum number of parts allow... | 13 | Python | 182 | |
0 | 40 | 90cea203befa8f2e86e9c1c18bb3972296358e7b | https://github.com/ray-project/ray.git | def get_node_id(self) -> str:
node_id = self.worker.current_node_id
assert not node_id.is_nil()
return node_i | 28 | 12 | ray | runtime_context.py | python/ray/runtime_context.py | 8 | 27,935 | def get_node_id(self) -> str:
node_id = self.worker.current_node_id
assert not node_id.is_nil()
return node_id.hex()
| 12 | get_node_id | 125,638 | 8 | 49 | Ray 2.0 API deprecation (#26116)
Ray 2.0 API deprecation for:
ray.remote(): placement_group
ray.remote(): placement_group_bundle_index
ray.remote(): placement_group_capture_child_tasks
ray.get_dashboard_url()
ray.get_resource_ids()
ray.disconnect()
ray.connect()
ray.util.ActorGroup
ray.util.ActorPo... | {
"docstring": "Get current node ID for this worker or driver.\n\n Node ID is the id of a node that your driver, task, or actor runs.\n The ID will be in hex format.\n\n Returns:\n A node id in hex format for this worker or driver.\n ",
"language": "en",
"n_whitespaces": 82,... | 1 | Python | 12 | |
0 | 57 | 6c4e2810285af0698538aed9d46a99de085eb310 | https://github.com/qutebrowser/qutebrowser.git | def list_option(*, info):
return _option(
info,
"List options",
lambda opt: (isinstance(info.config.get_obj(op | 41 | 16 | qutebrowser | configmodel.py | qutebrowser/completion/models/configmodel.py | 15 | 117,392 | def list_option(*, info):
return _option(
info,
"List options",
lambda opt: (isinstance(info.config.get_obj(opt.name), list) and
not opt.no_autoconfig)
)
| 7 | list_option | 320,849 | 10 | 67 | pylint: Fix new unnecessary-lambda-assignment | {
"docstring": "A CompletionModel filled with settings whose values are lists.",
"language": "en",
"n_whitespaces": 8,
"n_words": 9,
"vocab_size": 9
} | 2 | Python | 16 | |
1 | 201 | 2e7ee756eb1d55080d707cef63454788a7abb6be | https://github.com/airbytehq/airbyte.git | def get_instance_from_config_with_end_date(config, query):
start_date = "2021-03-04"
end_date = "2021-04-04"
conversion_window_days = 14
google_api = GoogleAds(credentials=config["credentials"], customer_id=config["customer_id"])
instance = CustomQuery(
api=google_api,
conversion_wi... | 73 | 44 | airbyte | test_source.py | airbyte-integrations/connectors/source-google-ads/unit_tests/test_source.py | 12 | @pytest.mark.parametrize(
"query, fields",
[
(
"""
SELecT
campaign.id,
campaign.name,
campaign.status,
metrics.impressions FROM campaign
wheRe campaign.status = 'PAUSED'
AND metrics.impressions > 100
order by campaign.status
""",
["campaign.id", "campaign.name", "... | 480 | def get_instance_from_config_with_end_date(config, query):
start_date = "2021-03-04"
end_date = "2021-04-04"
conversion_window_days = 14
google_api = GoogleAds(credentials=config["credentials"], customer_id=config["customer_id"])
instance = CustomQuery(
api=google_api,
conversion_wi... | 14 | get_instance_from_config_with_end_date | 3,546 | 18 | 208 | Source GoogleAds: add end_date to config (#8669)
* GoogleAds add end_date to config
* Update script following review comments
* Add unit test
* Solve conflicts
* Solve conflicts in MR
* Update test_google_ads.py
Instanciate IncrementalGoogleAdsStream in tests + add missing line between functions
*... | {
"docstring": "\n SELecT\n campaign.id,\n campaign.name,\n campaign.status,\n metrics.impressions FROM campaign\nwheRe campaign.status = 'PAUSED'\nAND metrics.impressions > 100\norder by campaign.status\n \n SELECT\n campaign.accessible_bidding_strategy,\n segments.ad_destinati... | 1 | Python | 53 |
0 | 144 | 34d9d630bb02426d297d3e20fedb7da8c3ced03a | https://github.com/networkx/networkx.git | def node_degree_xy(G, x="out", y="in", weight=None, nodes=None):
nodes = set(G) if nodes is None else set(nodes)
if G.is_directed():
direction = {"out": G.out_degree, "in": G.in_degree}
xdeg = direction[x]
ydeg = direction[y]
else:
xdeg = ydeg = G.degree
for u, degu... | 132 | 49 | networkx | pairs.py | networkx/algorithms/assortativity/pairs.py | 12 | 41,838 | def node_degree_xy(G, x="out", y="in", weight=None, nodes=None):
nodes = set(G) if nodes is None else set(nodes)
if G.is_directed():
direction = {"out": G.out_degree, "in": G.in_degree}
xdeg = direction[x]
ydeg = direction[y]
else:
xdeg = ydeg = G.degree
for u, degu... | 12 | node_degree_xy | 176,324 | 21 | 209 | MAINT: Cleanup assortativity module, remove unused variables (#5301)
Remove unused variables, sort imports,
raise errors instead of accepting invalid arguments silently
Co-authored-by: Dan Schult <dschult@colgate.edu> | {
"docstring": "Generate node degree-degree pairs for edges in G.\n\n Parameters\n ----------\n G: NetworkX graph\n\n x: string ('in','out')\n The degree type for source node (directed graphs only).\n\n y: string ('in','out')\n The degree type for target node (directed graphs only).\n\n ... | 7 | Python | 69 | |
0 | 88 | 7f1bacc7dc9caf6d0ec042e39499bbf1d9a7d065 | https://github.com/ray-project/ray.git | def validate(self, num_steps=None, profile=False, reduce_results=True, info=None):
worker_stats = self.worker_group.validate(
| 56 | 18 | ray | torch_trainer.py | python/ray/util/sgd/torch/torch_trainer.py | 9 | 29,985 | def validate(self, num_steps=None, profile=False, reduce_results=True, info=None):
worker_stats = self.worker_group.validate(
num_steps=num_steps, profile=profile, info=info
)
if reduce_results:
return self._process_stats(worker_stats)
else:
... | 8 | validate | 133,353 | 9 | 85 | [CI] Format Python code with Black (#21975)
See #21316 and #21311 for the motivation behind these changes. | {
"docstring": "Evaluates the model on the validation data set.\n\n Args:\n num_steps (int): Number of batches to compute update steps on\n per worker. This corresponds also to the number of times\n ``TrainingOperator.validate_batch`` is called per worker.\n ... | 2 | Python | 20 | |
0 | 29 | cc4d0564756ca067516f71718a3d135996525909 | https://github.com/jindongwang/transferlearning.git | def set_raw_scale(self, in_, scale):
self.__check_input(in_)
self.raw_scale[in_] = scale
| 24 | 8 | transferlearning | io.py | code/deep/BJMMD/caffe/python/caffe/io.py | 8 | 12,047 | def set_raw_scale(self, in_, scale):
self.__check_input(in_)
self.raw_scale[in_] = scale
| 3 | set_raw_scale | 60,255 | 6 | 39 | Balanced joint maximum mean discrepancy for deep transfer learning | {
"docstring": "\n Set the scale of raw features s.t. the input blob = input * scale.\n While Python represents images in [0, 1], certain Caffe models\n like CaffeNet and AlexNet represent images in [0, 255] so the raw_scale\n of these models must be 255.\n\n Parameters\n ---... | 1 | Python | 8 | |
0 | 238 | d1aa5608979891e3dd859c07fa919fa01cfead5f | https://github.com/ray-project/ray.git | def test_add_rule_to_best_shard():
# If we start with an empty list, then add to first shard
shards: List[List[bazel_sharding.BazelRule]] = [list() for _ in range(4)]
optimum = 600
rule = bazel_sharding.BazelRule("mock", "medium")
bazel_sharding.add_rule_to_best_shard(rule, shards, optimum)
... | 291 | 61 | ray | test_bazel_sharding.py | ci/run/bazel_sharding/tests/test_bazel_sharding.py | 10 | 30,178 | def test_add_rule_to_best_shard():
# If we start with an empty list, then add to first shard
shards: List[List[bazel_sharding.BazelRule]] = [list() for _ in range(4)]
optimum = 600
rule = bazel_sharding.BazelRule("mock", "medium")
bazel_sharding.add_rule_to_best_shard(rule, shards, optimum)
... | 25 | test_add_rule_to_best_shard | 134,046 | 16 | 460 | [CI] Make bazel sharding for parallel buildkite more intelligent (#29221)
This PR implements two changes to our `bazel-sharding.py` script, used for determining which bazel tests to run on each instance when buildkite parallelism is used:
* An ability to filter tests before they are sharded, using the same logic as `... | {
"docstring": "Test that the best shard in optimal strategy is chosen correctly.",
"language": "en",
"n_whitespaces": 10,
"n_words": 11,
"vocab_size": 11
} | 7 | Python | 151 | |
0 | 37 | 6c38a6b5697bcf4587e00101771001bf596974f9 | https://github.com/home-assistant/core.git | def async_heartbeat(self) -> None:
self._computed_state = False
self._restart_timer()
self.async_write_ha_stat | 23 | 9 | core | binary_sensor.py | homeassistant/components/isy994/binary_sensor.py | 7 | 110,798 | def async_heartbeat(self) -> None:
self._computed_state = False
self._restart_timer()
self.async_write_ha_state()
| 11 | async_heartbeat | 312,146 | 5 | 42 | Enable strict typing for isy994 (#65439)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com> | {
"docstring": "Mark the device as online, and restart the 25 hour timer.\n\n This gets called when the heartbeat node beats, but also when the\n parent sensor sends any events, as we can trust that to mean the device\n is online. This mitigates the risk of false positives due to a single\n ... | 1 | Python | 9 | |
0 | 49 | 7e23a37e1c5bda81234801a6584563e2880769eb | https://github.com/pandas-dev/pandas.git | def test_assert_series_equal_interval_dtype_mismatch():
# https://github.com/pandas-dev/pandas/issues/32747
left = Series([pd.Interval(0, 1, "right")], dtype="interval")
right = left.astype(object)
msg =
tm.assert_series_equal(left, right, check_dtype=False)
with pytest.raises(AssertionError... | 72 | 20 | pandas | test_assert_series_equal.py | pandas/tests/util/test_assert_series_equal.py | 12 | 39,861 | def test_assert_series_equal_interval_dtype_mismatch():
# https://github.com/pandas-dev/pandas/issues/32747
left = Series([pd.Interval(0, 1, "right")], dtype="interval")
right = left.astype(object)
msg =
tm.assert_series_equal(left, right, check_dtype=False)
with pytest.raises(AssertionError... | 11 | test_assert_series_equal_interval_dtype_mismatch | 166,848 | 17 | 123 | ENH: consistency of input args for boundaries - Interval (#46522) | {
"docstring": "Attributes of Series are different\n\nAttribute \"dtype\" are different\n\\\\[left\\\\]: interval\\\\[int64, right\\\\]\n\\\\[right\\\\]: object",
"language": "en",
"n_whitespaces": 11,
"n_words": 14,
"vocab_size": 12
} | 1 | Python | 24 | |
0 | 85 | 7c6c5f6215b40a27cfefb7bf21246299fd9b3a1e | https://github.com/matplotlib/matplotlib.git | def rc_file_defaults():
# | 41 | 32 | matplotlib | __init__.py | lib/matplotlib/__init__.py | 12 | 23,106 | def rc_file_defaults():
# Deprecation warnings were already handled when creating rcParamsOrig, no
# need to reemit them here.
with _api.suppress_matplotlib_deprecation_warning():
from .style.core import STYLE_BLACKLIST
rcParams.update({k: rcParamsOrig[k] for k in rcParamsOrig
... | 5 | rc_file_defaults | 108,225 | 10 | 72 | Fix removed cross-references | {
"docstring": "\n Restore the `.rcParams` from the original rc file loaded by Matplotlib.\n\n Style-blacklisted `.rcParams` (defined in\n ``matplotlib.style.core.STYLE_BLACKLIST``) are not updated.\n ",
"language": "en",
"n_whitespaces": 32,
"n_words": 19,
"vocab_size": 17
} | 3 | Python | 35 | |
0 | 153 | f3166e673fe8d40277b804d35d77dcdb760fc3b3 | https://github.com/pypa/pipenv.git | def lexer(self) -> Optional[Lexer]:
if isinstance(self._lexer, Lexer):
return self._lexer
try:
return get_lexer_by_name(
self._lexer,
stripnl=False,
ensurenl=True,
tabsize=self.tab_size,
)
... | 54 | 19 | pipenv | syntax.py | pipenv/patched/notpip/_vendor/rich/syntax.py | 11 | 3,587 | def lexer(self) -> Optional[Lexer]:
if isinstance(self._lexer, Lexer):
return self._lexer
try:
return get_lexer_by_name(
self._lexer,
stripnl=False,
ensurenl=True,
tabsize=self.tab_size,
)
... | 16 | lexer | 20,845 | 12 | 83 | 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... | {
"docstring": "The lexer for this syntax, or None if no lexer was found.\n\n Tries to find the lexer by name if a string was passed to the constructor.\n ",
"language": "en",
"n_whitespaces": 41,
"n_words": 27,
"vocab_size": 21
} | 3 | Python | 21 | |
0 | 19 | a35b29b2651bf33c5d5b45e64bc7765ffde4aff4 | https://github.com/saltstack/salt.git | def test_numeric_repl(file, multiline_file):
file.replace(multiline_fi | 27 | 10 | salt | test_replace.py | tests/pytests/functional/modules/file/test_replace.py | 8 | 54,182 | def test_numeric_repl(file, multiline_file):
file.replace(multiline_file, r"Etiam", 123)
assert "123" in multiline_file.read_text()
| 3 | test_numeric_repl | 215,808 | 5 | 46 | Add some funtional tests
Add functional tests for the following:
- file.readlink
- file.replace
- file.symlink
Remove unit tests for file.replace as they are duplicated in the added
functional test | {
"docstring": "\n This test covers cases where the replacement string is numeric. The CLI\n parser yaml-fies it into a numeric type. If not converted back to a string\n type in file.replace, a TypeError occurs when the replace is attempted. See\n https://github.com/saltstack/salt/issues/9097 for more inf... | 1 | Python | 10 | |
0 | 29 | 7fa8e45b6782d545fa0ead112d92d13bdad7417c | https://github.com/gradio-app/gradio.git | def set_interpret_parameters(self, segments=16):
self.interpretation_segments = segments
retu | 17 | 8 | gradio | components.py | gradio/components.py | 7 | 43,005 | def set_interpret_parameters(self, segments=16):
self.interpretation_segments = segments
return self
| 3 | set_interpret_parameters | 179,715 | 4 | 29 | Blocks-Components
- fixes
- format | {
"docstring": "\n Calculates interpretation score of image subsections by splitting the image into subsections, then using a \"leave one out\" method to calculate the score of each subsection by whiting out the subsection and measuring the delta of the output value.\n Parameters:\n segments (int... | 1 | Python | 8 | |
0 | 24 | 1fe202a1a3343fad77da270ffe0923a46f1944dd | https://github.com/matrix-org/synapse.git | def can_native_upsert(self) -> bool:
return sqlite3.sqlite_version_info >= (3, 2 | 20 | 10 | synapse | sqlite.py | synapse/storage/engines/sqlite.py | 7 | 72,207 | def can_native_upsert(self) -> bool:
return sqlite3.sqlite_version_info >= (3, 24, 0)
| 6 | can_native_upsert | 248,309 | 5 | 32 | Tidy up and type-hint the database engine modules (#12734)
Co-authored-by: Sean Quah <8349537+squahtx@users.noreply.github.com> | {
"docstring": "\n Do we support native UPSERTs? This requires SQLite3 3.24+, plus some\n more work we haven't done yet to tell what was inserted vs updated.\n ",
"language": "en",
"n_whitespaces": 46,
"n_words": 24,
"vocab_size": 23
} | 1 | Python | 10 | |
0 | 97 | 30ab5458a7e4ba2351d5e1beef8c8797b5946493 | https://github.com/ray-project/ray.git | async def get_actors(self) -> dict:
reply = await self._client.get_all_actor_info(timeout=DEFAULT_RPC_TIMEOUT)
result = {}
for message in rep | 67 | 22 | ray | state_aggregator.py | dashboard/state_aggregator.py | 13 | 31,405 | async def get_actors(self) -> dict:
reply = await self._client.get_all_actor_info(timeout=DEFAULT_RPC_TIMEOUT)
result = {}
for message in reply.actor_table_data:
data = self._message_to_dict(message=message, fields_to_decode=["actor_id"])
data = filter_fields(dat... | 14 | get_actors | 138,397 | 16 | 111 | [State Observability] Tasks and Objects API (#23912)
This PR implements ray list tasks and ray list objects APIs.
NOTE: You can ignore the merge conflict for now. It is because the first PR was reverted. There's a fix PR open now. | {
"docstring": "List all actor information from the cluster.\n\n Returns:\n {actor_id -> actor_data_in_dict}\n actor_data_in_dict's schema is in ActorState\n ",
"language": "en",
"n_whitespaces": 52,
"n_words": 16,
"vocab_size": 16
} | 2 | Python | 29 | |
0 | 833 | 551205a18ac2ac19626f4e4ffb2ed88fcad705b9 | https://github.com/mindsdb/mindsdb.git | def insert_predictor_answer(self, insert):
model_interface = self.session.model_interface
data_store = self.session.data_store
select_data_query = insert.get('select_data_query')
if isinstance(select_data_query, str) is False or len(select_data_query) == 0:
self.pac... | 445 | 109 | mindsdb | mysql_proxy.py | mindsdb/api/mysql/mysql_proxy/mysql_proxy.py | 16 | 25,051 | def insert_predictor_answer(self, insert):
model_interface = self.session.model_interface
data_store = self.session.data_store
select_data_query = insert.get('select_data_query')
if isinstance(select_data_query, str) is False or len(select_data_query) == 0:
self.pac... | 63 | insert_predictor_answer | 113,876 | 42 | 713 | fix | {
"docstring": " Start learn new predictor.\n Parameters:\n - insert - dict with keys as columns of mindsb.predictors table.\n ",
"language": "en",
"n_whitespaces": 47,
"n_words": 16,
"vocab_size": 15
} | 18 | Python | 181 | |
0 | 469 | 2c3e10a128fa0ce4e937d8d50dc0cd6d7cd11485 | https://github.com/OpenBB-finance/OpenBBTerminal.git | def populate_historical_trade_data(self):
trade_data = self.__orderbook.pivot(
index="Date",
columns="Ticker",
values=[
"Type",
"Sector",
"Industry",
"Country",
"Price",
"... | 164 | 65 | OpenBBTerminal | portfolio_model.py | openbb_terminal/portfolio/portfolio_model.py | 12 | 85,115 | def populate_historical_trade_data(self):
trade_data = self.__orderbook.pivot(
index="Date",
columns="Ticker",
values=[
"Type",
"Sector",
"Industry",
"Country",
"Price",
"... | 34 | populate_historical_trade_data | 285,032 | 23 | 282 | Overhaul Portfolio class (#2021)
* adds pythonic portfolio class
* start calculate trades refactoring
* adds comments to portfolio model - delete afterwards
* finish calculate trades refactoring
* restore original portfolio_model.py
* implement calculate_allocations
* adapt and test controller load, ... | {
"docstring": "Create a new dataframe to store historical prices by ticker",
"language": "en",
"n_whitespaces": 9,
"n_words": 10,
"vocab_size": 10
} | 1 | Python | 78 | |
1 | 129 | a47d569e670fd4102af37c3165c9b1ddf6fd3005 | https://github.com/scikit-learn/scikit-learn.git | def test_fetch_openml_equivalence_array_dataframe(monkeypatch, parser):
pytest.importorskip("pandas")
data_id = 61
_monkey_patch_webbased_functions(monkeypatch, data_id, gzip_response=True)
bunch_as_frame_true = fetch_openml(
data_id=data_id,
as_frame=True,
cache=False,
... | 89 | 39 | scikit-learn | test_openml.py | sklearn/datasets/tests/test_openml.py | 9 | @fails_if_pypy
@pytest.mark.parametrize("parser", ["liac-arff", "pandas"]) | 75,979 | def test_fetch_openml_equivalence_array_dataframe(monkeypatch, parser):
pytest.importorskip("pandas")
data_id = 61
_monkey_patch_webbased_functions(monkeypatch, data_id, gzip_response=True)
bunch_as_frame_true = fetch_openml(
data_id=data_id,
as_frame=True,
cache=False,
... | 18 | test_fetch_openml_equivalence_array_dataframe | 259,898 | 20 | 167 | ENH improve ARFF parser using pandas (#21938)
Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
Co-authored-by: Olivier Grisel <olivier.grisel@gmail.com>
Co-authored-by: Adrin Jalali <adrin.jalali@gmail.com> | {
"docstring": "Check the equivalence of the dataset when using `as_frame=False` and\n `as_frame=True`.\n ",
"language": "en",
"n_whitespaces": 17,
"n_words": 11,
"vocab_size": 10
} | 1 | Python | 47 |
0 | 76 | 002f919dda5f01d067c2e786426c68751551d15c | https://github.com/mitmproxy/mitmproxy.git | def wire_type(self):
if hasattr(self, '_m_wire_type'):
return self._m_wire_type
self._m_wire_type = Kaita | 51 | 15 | mitmproxy | google_protobuf.py | mitmproxy/contrib/kaitaistruct/google_protobuf.py | 12 | 73,944 | def wire_type(self):
if hasattr(self, '_m_wire_type'):
return self._m_wire_type
self._m_wire_type = KaitaiStream.resolve_enum(GoogleProtobuf.Pair.WireTypes, (self.key.value & 7))
return getattr(self, '_m_wire_type', None)
| 5 | wire_type | 252,396 | 12 | 83 | update kaitai definitions | {
"docstring": "\"Wire type\" is a part of the \"key\" that carries enough\n information to parse value from the wire, i.e. read correct\n amount of bytes, but there's not enough informaton to\n interprete in unambiguously. For example, one can't clearly\n distinguish 64-bi... | 2 | Python | 17 | |
0 | 80 | b3587b52b25077f68116b9852b041d33e7fc6601 | https://github.com/mitmproxy/mitmproxy.git | def address(self): # pragma: no cover
warnings.warn(
"Client.address is deprecated, use Client.peername instead.",
D | 23 | 18 | mitmproxy | connection.py | mitmproxy/connection.py | 8 | 73,687 | def address(self): # pragma: no cover
warnings.warn(
"Client.address is deprecated, use Client.peername instead.",
DeprecationWarning,
stacklevel=2,
)
return self.peername
| 7 | address | 251,333 | 7 | 40 | make it black! | {
"docstring": "*Deprecated:* An outdated alias for Client.peername.",
"language": "en",
"n_whitespaces": 5,
"n_words": 6,
"vocab_size": 6
} | 1 | Python | 18 | |
3 | 80 | a4fdabab38def4bf6b4007f8cd67d6944740b303 | https://github.com/sympy/sympy.git | def jordan_block(kls, size=None, eigenvalue=None, *, band='upper', **kwargs):
if 'r | 239 | 19 | sympy | common.py | sympy/matrices/common.py | 12 | f"""\
To get asquare Jordan block matrix use a morebanded matrix | 48,242 | def jordan_block(kls, size=None, eigenvalue=None, *, band='upper', **kwargs):
if 'rows' in kwargs or 'cols' in kwargs:
msg =
if 'rows' in kwargs and 'cols' in kwargs:
msg += f | 45 | jordan_block | 196,907 | 21 | 109 | Update the Matrix.jordan_block() rows and cols kwargs deprecation | {
"docstring": "Returns a Jordan block\n\n Parameters\n ==========\n\n size : Integer, optional\n Specifies the shape of the Jordan block matrix.\n\n eigenvalue : Number or Symbol\n Specifies the value for the main diagonal of the matrix.\n\n .. note::\n ... | 16 | Python | 28 |
End of preview. Expand in Data Studio
No dataset card yet
- Downloads last month
- 4