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
1
alembic_stamp
def alembic_stamp(revision): # lazy import for performance import alembic.command alembic.command.stamp(alembic_config(), revision=revision)
36e7e0838aeaffc9492b330297e4905f3ab4b11f
9
alembic_commands.py
42
code review revisions pt3
10,767
0
23
24
10
53,272
11
prefect
6
src/prefect/orion/database/alembic_commands.py
Python
3
{ "docstring": "\n Stamp the revision table with the given revision; don’t run any migrations\n\n Args:\n revision: The revision passed to `alembic stamp`.\n ", "language": "en", "n_whitespaces": 37, "n_words": 20, "vocab_size": 18 }
https://github.com/PrefectHQ/prefect.git
2
compat_system
def compat_system(source_dir): try: system = load_system(source_dir) except (FileNotFoundError, KeyError): system = {} system.setdefault( 'build-backend', 'setuptools.build_meta:__legacy__', ) system.setdefault('requires', ['setuptools', 'wheel']) return syst...
f638f5d0e6c8ebed0e69a6584bc7f003ec646580
10
build.py
87
upd; format
13,077
0
70
48
18
62,961
21
transferlearning
7
.venv/lib/python3.8/site-packages/pip/_vendor/pep517/build.py
Python
11
{ "docstring": "\n Given a source dir, attempt to get a build system backend\n and requirements from pyproject.toml. Fallback to\n setuptools but only if the file was not found or a build\n system was not indicated.\n ", "language": "en", "n_whitespaces": 49, "n_words": 33, "vocab_size": 26 }
https://github.com/jindongwang/transferlearning.git
2
get_static_upper_page
def get_static_upper_page(with_shutdown): template = if with_shutdown: shutdown_link = '<a href="SHUTDOWN THE SERVER">Shutdown</a>' else: shutdown_link = "" return template % shutdown_link
b0e85694107992e00a2f9fb48e6410c50fe1f1f6
10
wordnet_app.py
49
Updated Copyright year to 2022 (#2928)
7,529
0
50
24
15
42,431
20
nltk
4
nltk/app/wordnet_app.py
Python
30
{ "docstring": "\n Return the upper frame page,\n\n If with_shutdown is True then a 'shutdown' button is also provided\n to shutdown the server.\n \n<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">\n<html>\n <!-- Natural Language Toolkit: Wordnet Interface:...
https://github.com/nltk/nltk.git
1
test_add_battery_later
async def test_add_battery_later(hass, aioclient_mock, mock_deconz_websocket): data = { "sensors": { "1": { "name": "Switch 1", "type": "ZHASwitch", "state": {"buttonevent": 1000}, "config": {}, "uniqueid": "00:...
61ff52c93acd2f274d24469494b51356c88bb66f
@pytest.mark.parametrize("model_id", ["0x8030", "0x8031", "0x8034", "0x8035"])
15
test_sensor.py
466
Normalize deCONZ sensor unique IDs (#76357) * Normalize deCONZ sensor unique IDs * Handle battery sensors properly * Fix daylight sensor unique ID
104,097
1
439
229
59
305,307
107
core
19
tests/components/deconz/test_sensor.py
Python
43
{ "docstring": "Test that a battery sensor can be created later on.\n\n Without an initial battery state a battery sensor\n can be created once a value is reported.\n ", "language": "en", "n_whitespaces": 35, "n_words": 26, "vocab_size": 18 }
https://github.com/home-assistant/core.git
6
_get_text_value
def _get_text_value(self, row) -> Tuple[str, Dict[str, str]]: # construct text query from the hf_text_fields specified text_dict = {} for col in self.hf_text_fields: text_part = row.get(col) if text_part is None: raise KeyError(f'Feature "{col}" n...
4f7e4b60975ff73be4227d7c8c428319366e1fe9
15
agents.py
189
[tasks/huggingface] Way to add to message but not "text" (#4516) I want to be able to add my own mutators to grab information from other fields out of a huggingface dataset. Since I don't want it to show up in the text itself, I do it in a new attribute. I also delete some code that was written at some point but is...
47,158
0
241
112
40
195,032
69
ParlAI
17
parlai/tasks/huggingface/agents.py
Python
18
{ "docstring": "\n return the constructed text query and dict mapping text field names to values.\n ", "language": "en", "n_whitespaces": 28, "n_words": 13, "vocab_size": 12 }
https://github.com/facebookresearch/ParlAI.git
2
_postprocess
def _postprocess(self, inputs): final_results = [] for text, similarity in zip(inputs['text'], inputs['result']): result = {} result['text1'] = text[0] result['text2'] = text[1] result['similarity'] = similarity final_results.append(re...
621357338437ee420eabbbf5ab19065bc85e73a5
10
text_similarity.py
112
Update neural search readme and Add Paddle Serving Support (#1558) * add recall inference similarity * update examples * updatea readme * update dir name * update neural search readme * update milvus readme * update domain adaptive pretraining readme * fix the mistakes * update readme * add ...
118,095
0
110
66
21
322,212
27
PaddleNLP
9
paddlenlp/taskflow/text_similarity.py
Python
9
{ "docstring": "\n The model output is tag ids, this function will convert the model output to raw text.\n ", "language": "en", "n_whitespaces": 31, "n_words": 16, "vocab_size": 14 }
https://github.com/PaddlePaddle/PaddleNLP.git
10
_most_frequent
def _most_frequent(array, extra_value, n_repeat): # Compute the most frequent value in array only if array.size > 0: if array.dtype == object: # scipy.stats.mode is slow with object dtype array. # Python Counter is more efficient counter = Counter(array) ...
02a4b342181e5ff0226081691308414e53c3107b
15
_base.py
221
MAINT fix the way to call stats.mode (#23633) Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org> Co-authored-by: Meekail Zain <34613774+Micky774@users.noreply.github.com> Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
76,401
0
366
137
67
260,662
121
scikit-learn
20
sklearn/impute/_base.py
Python
25
{ "docstring": "Compute the most frequent value in a 1d array extended with\n [extra_value] * n_repeat, where extra_value is assumed to be not part\n of the array.", "language": "en", "n_whitespaces": 30, "n_words": 25, "vocab_size": 24 }
https://github.com/scikit-learn/scikit-learn.git
2
order
def order(self): return reduce(lcm, [len(cycle) for cycle in self.cyclic_form], 1)
498015021131af4dbb07eb110e5badaba8250c7b
10
permutations.py
41
Updated import locations
47,658
0
24
26
10
196,158
10
sympy
7
sympy/combinatorics/permutations.py
Python
2
{ "docstring": "\n Computes the order of a permutation.\n\n When the permutation is raised to the power of its\n order it equals the identity permutation.\n\n Examples\n ========\n\n >>> from sympy.combinatorics import Permutation\n >>> from sympy import init_printing\...
https://github.com/sympy/sympy.git
1
test_filename_date_parse_valid_ymd
def test_filename_date_parse_valid_ymd(self, *args): self.assertEqual( parse_date("/tmp/Scan-2022-04-01.pdf", "No date in here"), datetime.datetime(2022, 4, 1, 0, 0, tzinfo=tz.gettz(settings.TIME_ZONE)), )
8a6aaf4e2d05021a14adc681c66dff6a815aa2a0
13
test_date_parsing.py
73
Adds additional testing for both date parsing and consumed document created date
116,952
0
59
47
15
319,512
16
paperless-ngx
11
src/documents/tests/test_date_parsing.py
Python
5
{ "docstring": "\n GIVEN:\n - Date parsing from the filename is enabled\n - Filename date format is with Year Month Day (YMD)\n - Filename contains date matching the format\n\n THEN:\n - Should parse the date from the filename\n ", "language": "en", ...
https://github.com/paperless-ngx/paperless-ngx.git
8
install_artifact
def install_artifact(b_coll_targz_path, b_collection_path, b_temp_path, signatures, keyring): try: with tarfile.open(b_coll_targz_path, mode='r') as collection_tar: # Verify the signature on the MANIFEST.json before extracting anything else _extract_tar_file(collection_tar, MANI...
43e55db20821a1341d21ffa1e4e7e6185b244105
18
__init__.py
353
ansible-galaxy - add signature verification of the MANIFEST.json (#76681) * ansible-galaxy collection install|verify: - Support verifying the origin of the MANIFEST.json when the Galaxy server has provided signatures. - Allow supplemental signatures to use during verification on the CLI/requirements file. *...
78,488
0
446
216
83
266,590
108
ansible
39
lib/ansible/galaxy/collection/__init__.py
Python
26
{ "docstring": "Install a collection from tarball under a given path.\n\n :param b_coll_targz_path: Collection tarball to be installed.\n :param b_collection_path: Collection dirs layout path.\n :param b_temp_path: Temporary dir path.\n :param signatures: frozenset of signatures to verify the MANIFEST.jso...
https://github.com/ansible/ansible.git
1
test_create_version
def test_create_version(self) -> None: version = self.get_success( self.handler.create_version( self.local_user, { "algorithm": "m.megolm_backup.v1", "auth_data": "first_version_auth_data", }, ...
652d1669c5a103b1c20478770c4aaf18849c09a3
13
test_e2e_room_keys.py
448
Add missing type hints to tests.handlers. (#14680) And do not allow untyped defs in tests.handlers.
73,370
0
802
253
52
250,292
131
synapse
14
tests/handlers/test_e2e_room_keys.py
Python
58
{ "docstring": "Check that we can create and then retrieve versions.", "language": "en", "n_whitespaces": 8, "n_words": 9, "vocab_size": 9 }
https://github.com/matrix-org/synapse.git
4
is_parametric_dtype
def is_parametric_dtype(dtype): if dtype.itemsize == 0: return True if issubclass(dtype.type, (np.datetime64, np.timedelta64)): if dtype.name.endswith("64"): # Generic time units return True return False
7332a698c8194c6e680510da086678fe07d9cf9d
10
test_array_coercion.py
78
Fix some typos.
38,598
0
70
47
17
160,332
22
numpy
10
numpy/core/tests/test_array_coercion.py
Python
7
{ "docstring": "Returns True if the dtype is a parametric legacy dtype (itemsize\n is 0, or a datetime without units)\n ", "language": "en", "n_whitespaces": 24, "n_words": 18, "vocab_size": 15 }
https://github.com/numpy/numpy.git
1
_handle_default_message
def _handle_default_message(self, type, data): logger.debug(f"Received message from Leader of type {type}: {data}")
2b5f0678772bea0abaf4abe93efc55de43ea3e0e
9
rpc.py
37
Refactoring, minor improvements, data provider improvements
34,858
0
26
17
12
150,868
12
freqtrade
6
freqtrade/rpc/rpc.py
Python
2
{ "docstring": "\n Default leader message handler, just logs it. We should never have to\n run this unless the leader sends us some weird message.\n ", "language": "en", "n_whitespaces": 44, "n_words": 22, "vocab_size": 21 }
https://github.com/freqtrade/freqtrade.git
3
borrowed
def borrowed(self) -> float: if self.has_no_leverage: return 0.0 elif not self.is_short: return (self.amount * self.open_rate) * ((self.leverage - 1) / self.leverage) else: return self.amount
baefda80d19e3eaf14e2ec6a600dcb8c456a3ccf
14
models.py
83
Enable flake8 E226 rule
34,448
0
85
53
21
149,544
24
freqtrade
8
freqtrade/persistence/models.py
Python
12
{ "docstring": "\n The amount of currency borrowed from the exchange for leverage trades\n If a long trade, the amount is in base currency\n If a short trade, the amount is in the other currency being traded\n ", "language": "en", "n_whitespaces": 75, "n_words": 34, "vo...
https://github.com/freqtrade/freqtrade.git
5
fit_transform
def fit_transform(self, y): if self.classes is not None: return self.fit(y).transform(y) self._validate_params() self._cached_dict = None # Automatically increment on new class class_mapping = defaultdict(int) class_mapping.default_factory = class_m...
fd60379f95f5c0d3791b2f54c4d070c0aa2ac576
11
_label.py
269
MAINT parameter validation for Multilabel Binarizer (#23802) Co-authored-by: Jérémie du Boisberranger <34657725+jeremiedbb@users.noreply.github.com>
76,245
0
244
171
65
260,432
89
scikit-learn
36
sklearn/preprocessing/_label.py
Python
17
{ "docstring": "Fit the label sets binarizer and transform the given label sets.\n\n Parameters\n ----------\n y : iterable of iterables\n A set of labels (any orderable and hashable object) for each\n sample. If the `classes` parameter is set, `y` will not be\n i...
https://github.com/scikit-learn/scikit-learn.git
1
select_query
def select_query(self, query): renderer = SqlalchemyRender('mysql') query_str = renderer.get_string(query, with_failback=True) return self.native_query(query_str)
e00014335bbda3623ee1ccac02c9427ae324141d
9
mysql_handler.py
56
Update mysql handler
25,255
0
42
33
11
114,701
12
mindsdb
9
mindsdb/integrations/mysql_handler/mysql_handler.py
Python
4
{ "docstring": "\n Retrieve the data from the SQL statement.\n ", "language": "en", "n_whitespaces": 22, "n_words": 7, "vocab_size": 6 }
https://github.com/mindsdb/mindsdb.git
1
test_multigraph_add_edges_from_four_tuple_misordered
def test_multigraph_add_edges_from_four_tuple_misordered(self): G = nx.MultiGraph() with pytest.raises(TypeError): # key/data values flipped in 4-tuple G.add_edges_from([(0, 1, {"color": "red"}, 0)])
15614a4e2736752b0200d3a770d83f2be2d130b9
14
test_multigraph.py
73
Update tests in base class and simple rename in convert.py (#5848)
42,237
0
61
41
18
177,027
18
networkx
9
networkx/classes/tests/test_multigraph.py
Python
4
{ "docstring": "add_edges_from expects 4-tuples of the format (u, v, key, data_dict).\n\n Ensure 4-tuples of form (u, v, data_dict, key) raise exception.\n ", "language": "en", "n_whitespaces": 34, "n_words": 20, "vocab_size": 16 }
https://github.com/networkx/networkx.git
1
test_get_previous_start_date_none
def test_get_previous_start_date_none(self, dag_maker): with dag_maker("test_get_previous_start_date_none", schedule_interval=None) as dag: task = EmptyOperator(task_id="op") day_1 = DEFAULT_DATE day_2 = DEFAULT_DATE + datetime.timedelta(days=1) # Create a DagRun f...
49e336ae0302b386a2f47269a6d13988382d975f
12
test_taskinstance.py
219
Replace usage of `DummyOperator` with `EmptyOperator` (#22974) * Replace usage of `DummyOperator` with `EmptyOperator`
9,179
0
281
135
59
47,625
85
airflow
29
tests/models/test_taskinstance.py
Python
21
{ "docstring": "\n Test that get_previous_start_date() can handle TaskInstance with no start_date.\n ", "language": "en", "n_whitespaces": 24, "n_words": 9, "vocab_size": 9 }
https://github.com/apache/airflow.git
2
print_mathml
def print_mathml(expr, printer='content', **settings): if printer == 'presentation': s = MathMLPresentationPrinter(settings) else: s = MathMLContentPrinter(settings) xml = s._print(sympify(expr)) s.apply_patch() pretty_xml = xml.toprettyxml() s.restore_patch() print(pre...
59d22b6bb7287613d598611027f640d068ca5748
11
mathml.py
119
Moved imports to higher level
47,914
0
67
64
26
196,414
31
sympy
16
sympy/printing/mathml.py
Python
10
{ "docstring": "\n Prints a pretty representation of the MathML code for expr. If printer is\n presentation then prints Presentation MathML else prints content MathML.\n\n Examples\n ========\n\n >>> ##\n >>> from sympy import print_mathml\n >>> from sympy.abc import x\n >>> print_mathml(x+1) ...
https://github.com/sympy/sympy.git
2
sync_to_numpy_or_python_type
def sync_to_numpy_or_python_type(tensors): if isinstance(tensors, tf.distribute.experimental.coordinator.RemoteValue): tensors = tensors.fetch()
84afc5193d38057e2e2badf9c889ea87d80d8fbf
11
tf_utils.py
49
Reformatting the codebase with black. PiperOrigin-RevId: 450093126
81,872
0
21
42
8
277,101
8
keras
9
keras/utils/tf_utils.py
Python
5
{ "docstring": "Syncs and converts a structure of `Tensor`s to `NumPy` arrays or Python scalar types.\n\n For each tensor, it calls `tensor.numpy()`. If the result is a scalar value,\n it converts it to a Python type, such as a float or int, by calling\n `result.item()`.\n\n Numpy scalars are converted, a...
https://github.com/keras-team/keras.git
2
test_setup_permanent_error
async def test_setup_permanent_error(hass, aioclient_mock): fake_async_add_entities = MagicMock() errors = [HTTPStatus.BAD_REQUEST, HTTPStatus.UNAUTHORIZED, HTTPStatus.FORBIDDEN] for error in errors: aioclient_mock.get(re.compile("api.foobot.io/v2/owner/.*"), status=error) result = awa...
8896229ea641a558161d8caed796895e9a78f457
12
test_sensor.py
103
Improve type hint in foobot sensor entity (#77164)
103,613
0
81
65
26
304,818
30
core
19
tests/components/foobot/test_sensor.py
Python
9
{ "docstring": "Expected failures caused by permanent errors in API response.", "language": "en", "n_whitespaces": 8, "n_words": 9, "vocab_size": 9 }
https://github.com/home-assistant/core.git
9
integrate
def integrate(self, comet_ml=None, wandb=None, mlflow=None) -> None: analytics_integration = "" if comet_ml is not None: analytics_integration = "CometML" comet_ml.log_other("Created from", "Gradio") if self.share_url is not None: comet_ml.log...
cc0cff893f9d7d472788adc2510c123967b384fe
22
interface.py
356
Format The Codebase - black formatting - isort formatting
42,929
0
755
202
66
179,258
120
gradio
22
gradio/interface.py
Python
52
{ "docstring": "\n A catch-all method for integrating with other libraries.\n Should be run after launch()\n Parameters:\n comet_ml (Experiment): If a comet_ml Experiment object is provided,\n will integrate with the experiment and appear on Comet dashboard\n wand...
https://github.com/gradio-app/gradio.git
2
require_huggingface_suite
def require_huggingface_suite(test_case): return unittest.skipUnless( is_transformers_available() and is_datasets_available(), "test requires the Hugging Face suite" )(test_case)
8944975a3c8db55f57774e9e566e7a791be766cb
11
testing.py
44
Reenable Gather for Metrics (#590) * Clean and finish Co-authored-by: Sylvain Gugger <Sylvain.gugger@gmail.com>
121,157
0
30
24
14
338,046
14
accelerate
6
src/accelerate/test_utils/testing.py
Python
4
{ "docstring": "\n Decorator marking a test that requires transformers and datasets. These tests are skipped when they are not.\n ", "language": "en", "n_whitespaces": 24, "n_words": 17, "vocab_size": 16 }
https://github.com/huggingface/accelerate.git
14
_type
def _type(string, has_invisible=True, numparse=True): if has_invisible and ( isinstance(string, _text_type) or isinstance(string, _binary_type) ): string = _strip_invisible(string) if string is None: return _none_type elif hasattr(string, "isoformat"): # datetime.datetime...
adf24bfa9723b0621183bb27f0c889b813c06e8a
10
tabulate.py
179
[State Observability] Use a table format by default (#26159) NOTE: tabulate is copied/pasted to the codebase for table formatting. This PR changes the default layout to be the table format for both summary and list APIs.
27,792
0
168
110
40
125,175
64
ray
17
python/ray/_private/thirdparty/tabulate/tabulate.py
Python
21
{ "docstring": "The least generic type (type(None), int, float, str, unicode).\n\n >>> _type(None) is type(None)\n True\n >>> _type(\"foo\") is type(\"\")\n True\n >>> _type(\"1\") is type(1)\n True\n >>> _type('\\x1b[31m42\\x1b[0m') is type(42)\n True\n >>> _type('\\x1b[31m42\\x1b[0m') is ...
https://github.com/ray-project/ray.git
9
multi_gpu_train_one_step
def multi_gpu_train_one_step(algorithm, train_batch) -> Dict: config = algorithm.config workers = algorithm.workers local_worker = workers.local_worker() num_sgd_iter = config.get("num_sgd_iter", 1) sgd_minibatch_size = config.get("sgd_minibatch_size", config["train_batch_size"]) # Determi...
38c9e1d52aeada536a0460fba01b2633973bc989
18
train_ops.py
616
[RLlib]: Fix OPE trainables (#26279) Co-authored-by: Kourosh Hakhamaneshi <kourosh@anyscale.com>
27,750
0
892
362
216
125,012
330
ray
63
rllib/execution/train_ops.py
Python
66
{ "docstring": "Multi-GPU version of train_one_step.\n\n Uses the policies' `load_batch_into_buffer` and `learn_on_loaded_batch` methods\n to be more efficient wrt CPU/GPU data transfers. For example, when doing multiple\n passes through a train batch (e.g. for PPO) using `config.num_sgd_iter`, the\n actu...
https://github.com/ray-project/ray.git
11
get_keys
def get_keys(self, subpath, method, view): if hasattr(view, 'action'): # Viewsets have explicitly named actions. action = view.action else: # Views have no associated action, so we determine one from the method. if is_list_view(subpath, method, vi...
df584350b4f77143d84615f05000f71408aec9c0
15
coreapi.py
287
Prevent head method mapping to coerce action name (#7729)
9,553
0
484
174
73
48,644
128
django-rest-framework
19
rest_framework/schemas/coreapi.py
Python
27
{ "docstring": "\n Return a list of keys that should be used to layout a link within\n the schema document.\n\n /users/ (\"users\", \"list\"), (\"users\", \"create\")\n /users/{pk}/ (\"users\", \"read\"), (\"users\", \"update\"), (\"users\", \"delete\")\n ...
https://github.com/encode/django-rest-framework.git
3
set_pickradius
def set_pickradius(self, pickradius): if not isinstance(pickradius, Number) or pickradius < 0: raise ValueError("pick radius should be a distance") self._pickradius = pickradius pickradius = property(get_pickradius, set_pickradius)
91f47d6eff63187f582c395c007d0152980be6b3
10
lines.py
65
Unify set_pickradius argument
23,452
0
60
31
22
109,136
25
matplotlib
9
lib/matplotlib/lines.py
Python
4
{ "docstring": "\n Set the pick radius used for containment tests.\n\n See `.contains` for more details.\n\n Parameters\n ----------\n pickradius : float\n Pick radius, in points.\n ", "language": "en", "n_whitespaces": 76, "n_words": 22, "vocab_size": 21 }
https://github.com/matplotlib/matplotlib.git
1
test_missing_config
def test_missing_config(self): with patch("streamlit.config.os.path.exists") as path_exists: path_exists.return_value = False config.get_config_options() self.assertEqual(True, config.get_option("client.caching")) self.assertIsNone(config.get_option("the...
dd9084523e365e637443ea351eaaaa25f52d8412
12
config_test.py
90
Report sharing removal (#4260) The report sharing feature is a substantial but completely unused portion of the code in Streamlit's underlying machinery. The feature was created early on, used by just a few groups, and has not been used by anyone for a while, as indicated by no activity in the associated S3 buckets. T...
26,360
0
71
48
13
118,685
13
streamlit
10
lib/tests/streamlit/config_test.py
Python
6
{ "docstring": "Test that we can initialize our config even if the file is missing.", "language": "en", "n_whitespaces": 12, "n_words": 13, "vocab_size": 13 }
https://github.com/streamlit/streamlit.git
3
get_last_runtime
def get_last_runtime(self, file_path): stat = self._file_stats.get(file_path) return stat.last_duration.total_seconds() if stat and stat.last_duration else None
1507ca48d7c211799129ce7956c11f4c45fee5bc
9
manager.py
55
Fix StatD timing metric units (#21106) Co-authored-by: Tzu-ping Chung <uranusjr@gmail.com> Co-authored-by: Tzu-ping Chung <tp@astronomer.io>
7,740
0
35
34
13
42,816
14
airflow
8
airflow/dag_processing/manager.py
Python
3
{ "docstring": "\n :param file_path: the path to the file that was processed\n :return: the runtime (in seconds) of the process of the last run, or\n None if the file was never processed.\n :rtype: float\n ", "language": "en", "n_whitespaces": 72, "n_words": 32, "vocab_s...
https://github.com/apache/airflow.git
4
turn_on
def turn_on(self) -> None: if DPCode.SWITCH in self.device.function: self._send_command([{"code": DPCode.SWITCH, "value": True}]) return # Fake turn on for mode in (HVACMode.HEAT_COOL, HVACMode.HEAT, HVACMode.COOL): if mode not in self.hvac_modes: ...
e688f6b315a2edcab6c7e6bd1dfe8a77bf715fed
13
climate.py
116
Use climate enums in tuya (#70747)
97,746
0
129
71
27
298,805
31
core
14
homeassistant/components/tuya/climate.py
Python
10
{ "docstring": "Turn the device on, retaining current HVAC (if supported).", "language": "en", "n_whitespaces": 8, "n_words": 9, "vocab_size": 9 }
https://github.com/home-assistant/core.git
13
train
def train(self): if self._warmup_time is None: self._warmup_time = time.time() - self._start_time start = time.time() try: result = self.step() except Exception as e: raise skip_exceptions(e) from None assert isinstance(result, dict),...
d0678b80edf7ab50ffde93c13f4a8cdbd7dbba99
12
trainable.py
536
[rfc] [air/tune/train] Improve trial/training failure error printing (#27946) When training fails, the console output is currently cluttered with tracebacks which are hard to digest. This problem is exacerbated when running multiple trials in a tuning run. The main problems here are: 1. Tracebacks are printed mu...
28,398
0
623
328
104
127,235
183
ray
47
python/ray/tune/trainable/trainable.py
Python
47
{ "docstring": "Runs one logical iteration of training.\n\n Calls ``step()`` internally. Subclasses should override ``step()``\n instead to return results.\n This method automatically fills the following fields in the result:\n\n `done` (bool): training is terminated. Filled only if no...
https://github.com/ray-project/ray.git
3
legacy_plugin_dir_to_plugin_type
def legacy_plugin_dir_to_plugin_type(legacy_plugin_dir_name): legacy_plugin_dir_name = to_text(legacy_plugin_dir_name) plugin_type = legacy_plugin_dir_name.removesuffix(u'_plugins') if plugin_type == u'library': plugin_type = u'modules' if plugin_type not in Ansib...
884244f1b2da3c3f367e064ef4ac0123fcb12675
13
_collection_finder.py
93
Python 3.9 min for controller (#77566)
79,008
0
97
54
26
267,700
33
ansible
10
lib/ansible/utils/collection_loader/_collection_finder.py
Python
8
{ "docstring": "\n Utility method to convert from a PluginLoader dir name to a plugin ref_type\n :param legacy_plugin_dir_name: PluginLoader dir name (eg, 'action_plugins', 'library')\n :return: the corresponding plugin ref_type (eg, 'action', 'role')\n ", "language": "en", "n_whitespa...
https://github.com/ansible/ansible.git
1
test_fs_checkpoint_dict
def test_fs_checkpoint_dict(self): checkpoint = self._prepare_fs_checkpoint() # Convert into dict checkpoint data_dict = checkpoint.to_dict() self.assertIsInstance(data_dict, dict) # Create from dict checkpoint = Checkpoint.from_dict(data_dict) self.ass...
b267be475863a66e9feedb2be5f0a30a2ed8c493
8
test_checkpoints.py
87
[ml] Add Ray ML / AIR checkpoint implementation (#22691) This PR splits up the changes in #22393 and introduces an implementation of the ML Checkpoint interface used by Ray Tune. This means, the TuneCheckpoint class implements the to/from_[bytes|dict|directory|object_ref|uri] conversion functions, as well as more h...
33,588
0
87
50
18
146,015
24
ray
13
python/ray/ml/tests/test_checkpoints.py
Python
7
{ "docstring": "Test conversion from fs to dict checkpoint and back.", "language": "en", "n_whitespaces": 8, "n_words": 9, "vocab_size": 9 }
https://github.com/ray-project/ray.git
6
_validate_index_level
def _validate_index_level(self, level) -> None: if isinstance(level, int): if level < 0 and level != -1: raise IndexError( "Too many levels: Index has only 1 level, " f"{level} is not a valid level number" ) ...
d13c9e034ce8a1d738766c4b1cec80c76f5523be
14
base.py
121
STYLE: fix pylint: no-else-raise (#49520) * fix pylint: no-else-raise * fix possible imbalanced tuple unpacking warning Co-authored-by: carlotta <c.fabian@turbit.de>
40,622
0
267
59
48
170,932
70
pandas
8
pandas/core/indexes/base.py
Python
22
{ "docstring": "\n Validate index level.\n\n For single-level Index getting level number is a no-op, but some\n verification must be done like in MultiIndex.\n\n ", "language": "en", "n_whitespaces": 50, "n_words": 21, "vocab_size": 21 }
https://github.com/pandas-dev/pandas.git
15
make_sl_entries
def make_sl_entries(sl_entries, allow_negative_stock=False, via_landed_cost_voucher=False): from erpnext.controllers.stock_controller import future_sle_exists if sl_entries: cancel = sl_entries[0].get("is_cancelled") if cancel: validate_cancellation(sl_entries) set_as_cancel(sl_entries[0].get("voucher_ty...
494bd9ef78313436f0424b918f200dab8fc7c20b
19
stock_ledger.py
563
style: format code with black
14,689
0
93
336
85
67,967
132
erpnext
37
erpnext/stock/stock_ledger.py
Python
38
{ "docstring": "Create SL entries from SL entry dicts\n\n\targs:\n\t - allow_negative_stock: disable negative stock valiations if true\n\t - via_landed_cost_voucher: landed cost voucher cancels and reposts\n\t entries of purchase document. This flag is used to identify if\n\t cancellation ...
https://github.com/frappe/erpnext.git
1
get_feature_names_out
def get_feature_names_out(self, input_features=None): class_name = self.__class__.__name__.lower() return np.asarray([f"{class_name}0"], dtype=object)
8991c3d7870df692fe01510e0fe6de62ea550cad
10
isotonic.py
61
ENH Adds get_feature_names to isotonic module (#22249)
75,349
0
30
35
9
258,647
9
scikit-learn
11
sklearn/isotonic.py
Python
3
{ "docstring": "Get output feature names for transformation.\n\n Parameters\n ----------\n input_features : array-like of str or None, default=None\n Ignored.\n\n Returns\n -------\n feature_names_out : ndarray of str objects\n An ndarray with one string...
https://github.com/scikit-learn/scikit-learn.git
2
config_test
def config_test(self) -> None: try: util.run_script([self.conf('ctl'), "-c", self.nginx_conf, "-t"]) except errors.SubprocessError as err: raise errors.MisconfigurationError(str(err))
16aad35d31a887dab157f9d4f5e0fe9218d06064
13
configurator.py
84
Fully type certbot-nginx module (#9124) * Work in progress * Fix type * Work in progress * Work in progress * Work in progress * Work in progress * Work in progress * Oups. * Fix typing in UnspacedList * Fix logic * Finish typing * List certbot-nginx as fully typed in tox * Fix lint...
45,498
0
58
48
15
186,582
15
certbot
11
certbot-nginx/certbot_nginx/_internal/configurator.py
Python
10
{ "docstring": "Check the configuration of Nginx for errors.\n\n :raises .errors.MisconfigurationError: If config_test fails\n\n ", "language": "en", "n_whitespaces": 26, "n_words": 12, "vocab_size": 12 }
https://github.com/certbot/certbot.git
2
_is_arraylike_not_scalar
def _is_arraylike_not_scalar(array): return _is_arraylike(array) and not np.isscalar(array)
5d1571db5c1f5b65b1dfc47c21d08050238a60f7
9
validation.py
34
FIX Supports numpy strings and array-like in KMean.init (#22154) Co-authored-by: Jérémie du Boisberranger <34657725+jeremiedbb@users.noreply.github.com>
75,501
0
13
19
7
258,972
7
scikit-learn
5
sklearn/utils/validation.py
Python
2
{ "docstring": "Return True if array is array-like and not a scalar", "language": "en", "n_whitespaces": 9, "n_words": 10, "vocab_size": 10 }
https://github.com/scikit-learn/scikit-learn.git
2
get_result_type
def get_result_type(self) -> str: if "result_type_string" in self._bound_other_args_to_resolve: return self._bound_other_args_to_resolve["result_type_string"] @DeveloperAPI
203253321d34543aa25483803ebc21e3903679b6
@DeveloperAPI
9
input_node.py
45
[serve] Add additional features to DAG visualization with Gradio (#28246)
28,431
1
35
22
11
127,398
11
ray
5
python/ray/dag/input_node.py
Python
7
{ "docstring": "Get type of the output of this DAGNode.\n\n Generated by ray.experimental.gradio_utils.type_to_string().\n ", "language": "en", "n_whitespaces": 25, "n_words": 11, "vocab_size": 10 }
https://github.com/ray-project/ray.git
1
test_album_from_url
def test_album_from_url(): album = Album.from_url("https://open.spotify.com/album/4MQnUDGXmHOvnsWCpzeqWT") assert album.name == "NCS: The Best of 2017" assert album.url == "https://open.spotify.com/album/4MQnUDGXmHOvnsWCpzeqWT" assert album.artist["name"] == "Various Artists" assert len(album...
fa2ad657482aca9dc628e6d7062b8badf2706bb6
@pytest.mark.vcr()
9
test_album.py
94
v4 init
5,332
1
44
43
21
30,131
27
spotify-downloader
12
tests/types/test_album.py
Python
6
{ "docstring": "\n Test if Album class can be initialized from url.\n ", "language": "en", "n_whitespaces": 16, "n_words": 9, "vocab_size": 9 }
https://github.com/spotDL/spotify-downloader.git
7
link_pyqt
def link_pyqt(executable, venv_path, *, version='5'): if version not in ["5", "6"]: raise ValueError(f"Invalid version {version}") try: get_lib_path(executable, f'PyQt{version}.sip') except Error: # There is no PyQt5.sip, so we need to copy the toplevel sip. sip_file = ...
9212ba94d651e4bed5724dea28e90ca2e190b007
13
link_pyqt.py
262
scripts: Allow linking/installing pyqt-5 or pyqt-6
117,879
0
254
153
68
321,744
90
qutebrowser
22
scripts/link_pyqt.py
Python
22
{ "docstring": "Symlink the systemwide PyQt/sip into the venv.\n\n Args:\n executable: The python executable where the source files are present.\n venv_path: The path to the virtualenv site-packages.\n version: The PyQt version to use.\n ", "language": "en", "n_whitespaces": 58, "n_wo...
https://github.com/qutebrowser/qutebrowser.git
3
get_next_unordered
def get_next_unordered(self, timeout=None): if not self.has_next(): raise StopIteration("No more results to get") # TODO(ekl) bulk wait for performance res, _ = ray.wait(list(self._future_to_actor), num_returns=1, timeout=timeout) if res: [future] = res ...
7f1bacc7dc9caf6d0ec042e39499bbf1d9a7d065
11
actor_pool.py
175
[CI] Format Python code with Black (#21975) See #21316 and #21311 for the motivation behind these changes.
29,857
0
161
107
45
132,898
51
ray
22
python/ray/util/actor_pool.py
Python
13
{ "docstring": "Returns any of the next pending results.\n\n This returns some result produced by submit(), blocking for up to\n the specified timeout until it is available. Unlike get_next(), the\n results are not always returned in same order as submitted, which can\n improve performance...
https://github.com/ray-project/ray.git
3
normalize_eols
def normalize_eols(raw_contents): lines_list = raw_contents.splitlines() # Ensure last line has its EOL if lines_list and lines_list[-1]: lines_list.append("") return "\n".join(lines_list)
9c19aff7c7561e3a82978a272ecdaad40dda5c00
10
makemessages.py
67
Refs #33476 -- Reformatted code with Black.
50,833
0
41
35
18
204,660
19
django
6
django/core/management/commands/makemessages.py
Python
5
{ "docstring": "\n Take a block of raw text that will be passed through str.splitlines() to\n get universal newlines treatment.\n\n Return the resulting block of text with normalized `\\n` EOL sequences ready\n to be written to disk using current platform's native EOLs.\n ", "language": "en", "n_wh...
https://github.com/django/django.git
5
tree_data
def tree_data(G, root, ident="id", children="children"): if G.number_of_nodes() != G.number_of_edges() + 1: raise TypeError("G is not a tree.") if not G.is_directed(): raise TypeError("G is not directed.") if not nx.is_weakly_connected(G): raise TypeError("G is not weakly connec...
5b7d549bf1369440151708fa6b988eb36e1a1bde
10
tree.py
134
remove old attr keyword from json_graph/tree (#5785)
42,160
0
91
116
34
176,891
48
networkx
12
networkx/readwrite/json_graph/tree.py
Python
13
{ "docstring": "Returns data in tree format that is suitable for JSON serialization\n and use in Javascript documents.\n\n Parameters\n ----------\n G : NetworkX graph\n G must be an oriented tree\n\n root : node\n The root of the tree\n\n ident : string\n Attribute name for stori...
https://github.com/networkx/networkx.git
15
_check_cg_simp
def _check_cg_simp(expr, simp, sign, lt, term_list, variables, dep_variables, build_index_expr, index_expr): other_part = 0 i = 0 while i < len(term_list): sub_1 = _check_cg(term_list[i], expr, len(variables)) if sub_1 is None: i += 1 continue if not buil...
2a1afca9477eb781f16d5d6b63fa37abed7740a3
20
cg.py
557
Use sympify less
48,858
0
450
366
82
198,289
139
sympy
33
sympy/physics/quantum/cg.py
Python
33
{ "docstring": " Checks for simplifications that can be made, returning a tuple of the\n simplified list of terms and any terms generated by simplification.\n\n Parameters\n ==========\n\n expr: expression\n The expression with Wild terms that will be matched to the terms in\n the sum\n\n ...
https://github.com/sympy/sympy.git
1
test_filtering
def test_filtering(self): self.assertQuerysetEqual( Book.published_objects.all(), [ "How to program", ], lambda b: b.title, )
9c19aff7c7561e3a82978a272ecdaad40dda5c00
10
tests.py
52
Refs #33476 -- Reformatted code with Black.
50,134
0
93
31
13
202,491
13
django
8
tests/custom_managers/tests.py
Python
8
{ "docstring": "\n Custom managers respond to usual filtering methods\n ", "language": "en", "n_whitespaces": 22, "n_words": 7, "vocab_size": 7 }
https://github.com/django/django.git
1
test_process_datetime_to_timestamp_freeze_time
def test_process_datetime_to_timestamp_freeze_time(time_zone, hass): hass.config.set_time_zone(time_zone) utc_now = dt_util.utcnow() with freeze_time(utc_now): epoch = utc_now.timestamp() assert process_datetime_to_timestamp(dt_util.utcnow()) == epoch now = dt_util.now() ...
1d9fb4bca871f97109684419f0f9526a0c151f2d
@pytest.mark.parametrize( "time_zone", ["Europe/Berlin", "America/Chicago", "US/Hawaii", "UTC"] )
12
test_models.py
141
Fix process_datetime_to_timestamp and add test coverage (#71755)
99,327
1
71
61
24
300,467
30
core
16
tests/components/recorder/test_models.py
Python
8
{ "docstring": "Test we can handle processing database datatimes to timestamps.\n\n This test freezes time to make sure everything matches.\n ", "language": "en", "n_whitespaces": 24, "n_words": 18, "vocab_size": 17 }
https://github.com/home-assistant/core.git
1
test_null_localpart
def test_null_localpart(self) -> None: userinfo = { "sub": "tester", "username": None, } self.get_success(_make_callback_with_userinfo(self.hs, userinfo)) self.assertRenderedError("mapping_error", "localpart is invalid: ")
5dd949bee6158a8b651db9f2ae417a62c8184bfd
10
test_oidc.py
75
Add type hints to some tests/handlers files. (#12224)
71,794
0
76
41
19
247,630
19
synapse
7
tests/handlers/test_oidc.py
Python
8
{ "docstring": "Mapping onto a null localpart via an empty OIDC attribute should be rejected", "language": "en", "n_whitespaces": 12, "n_words": 13, "vocab_size": 13 }
https://github.com/matrix-org/synapse.git
3
points2polygon
def points2polygon(points): if isinstance(points, list): points = np.array(points) assert isinstance(points, np.ndarray) assert (points.size % 2 == 0) and (points.size >= 8) point_mat = points.reshape([-1, 2]) return plg.Polygon(point_mat)
9f62b610dea6161627200ed85d92e19b1923279a
10
fce_postprocess.py
109
add fcenet
4,551
0
52
69
23
23,234
27
PaddleOCR
12
ppocr/postprocess/fce_postprocess.py
Python
7
{ "docstring": "Convert k points to 1 polygon.\n\n Args:\n points (ndarray or list): A ndarray or a list of shape (2k)\n that indicates k points.\n\n Returns:\n polygon (Polygon): A polygon object.\n ", "language": "en", "n_whitespaces": 63, "n_words": 29, "vocab_size": 24 }
https://github.com/PaddlePaddle/PaddleOCR.git
1
import_pandas_dataframe
def import_pandas_dataframe(cls, df, name=None): return cls.import_arrow_table(pa.Table.from_pandas(df))
1c0935c1bc0856d43f69c1e32498636ee24ebc85
10
base_worker.py
42
FEAT-#4913: Enabling pyhdk (#4900) Co-authored-by: ienkovich <ilya.enkovich@intel.com> Signed-off-by: izamyati <igor.zamyatin@intel.com>
35,959
0
20
26
6
154,398
6
modin
8
modin/experimental/core/execution/native/implementations/omnisci_on_native/base_worker.py
Python
2
{ "docstring": "\n Import ``pandas.DataFrame`` to the worker.\n\n Parameters\n ----------\n df : pandas.DataFrame\n A frame to import.\n name : str, optional\n A table name to use. None to generate a unique name.\n\n Returns\n -------\n str...
https://github.com/modin-project/modin.git
9
get_operation_id_base
def get_operation_id_base(self, path, method, action): model = getattr(getattr(self.view, 'queryset', None), 'model', None) if self.operation_id_base is not None: name = self.operation_id_base # Try to deduce the ID from the view's model elif model is not None: ...
9e328a9549b8cc5fbeff7b70cf2523fa3d97518f
16
openapi.py
295
Fix OpenAPI operation name plural appropriately (#8017)
9,574
0
385
177
72
48,712
126
django-rest-framework
17
rest_framework/schemas/openapi.py
Python
21
{ "docstring": "\n Compute the base part for operation ID from the model, serializer or view name.\n ", "language": "en", "n_whitespaces": 29, "n_words": 14, "vocab_size": 13 }
https://github.com/encode/django-rest-framework.git
2
workflow_logging_context
def workflow_logging_context(job_id) -> None: node = ray.worker._global_node original_out_file, original_err_file = node.get_log_file_handles( get_worker_log_file_name("WORKER") ) out_file, err_file = node.get_log_file_handles( get_worker_log_file_name("WORKER", job_id) ) tr...
e8fc66af348f2afd2b578fe1c6776cc88ea82499
11
workflow_context.py
104
[Workflow]Make workflow logs publish to the correct driver. (#24089) All workflow tasks are executed as remote functions that submitted from WorkflowManagmentActor. WorkflowManagmentActor is a detached long-running actor whose owner is the first driver in the cluster that runs the very first workflow execution. Theref...
31,619
0
86
60
23
139,165
27
ray
13
python/ray/workflow/workflow_context.py
Python
27
{ "docstring": "Initialize the workflow logging context.\n\n Workflow executions are running as remote functions from\n WorkflowManagementActor. Without logging redirection, workflow\n inner execution logs will be pushed to the driver that initially\n created WorkflowManagementActor rather than the driver...
https://github.com/ray-project/ray.git
4
load_model_from_db
def load_model_from_db(cls, instance_or_id, allow_cache=True): if isinstance(instance_or_id, int): if hasattr(cls.objects, "get_from_cache") and allow_cache: return cls.objects.get_from_cache(pk=instance_or_id) return cls.objects.get(pk=instance_or_id) return instance_or_id
8c83731694d352c5832ef6dd26ec57333bc8d5b5
12
base.py
89
feat(celery): Disallow complex pickle for new tasks (#35811)
18,819
0
52
56
15
91,851
18
sentry
11
src/sentry/tasks/base.py
Python
6
{ "docstring": "Utility function to allow a task to transition to passing ids rather than model instances.", "language": "en", "n_whitespaces": 14, "n_words": 15, "vocab_size": 13 }
https://github.com/getsentry/sentry.git
2
ndcg_score
def ndcg_score(y_true, y_score, *, k=None, sample_weight=None, ignore_ties=False): y_true = check_array(y_true, ensure_2d=False) y_score = check_array(y_score, ensure_2d=False) check_consistent_length(y_true, y_score, sample_weight) if y_true.min() < 0: # TODO(1.4): Replace warning w/ Valu...
9bb209817a978d6da0fec392ed212685efe08694
11
_ranking.py
154
ENH Added warning for `ndcg_score` when used w/ negative `y_true` values (#23461) Co-authored-by: trinhcon <conroy.trinh@mail.utoronto.ca> Co-authored-by: Victor Ko <vk07275@gmail.com> Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com> Co-authored-by: Jérémie du Boisberranger <34657725+jeremiedbb@users.noreply.g...
76,130
0
142
100
54
260,239
64
scikit-learn
19
sklearn/metrics/_ranking.py
Python
13
{ "docstring": "Compute Normalized Discounted Cumulative Gain.\n\n Sum the true scores ranked in the order induced by the predicted scores,\n after applying a logarithmic discount. Then divide by the best possible\n score (Ideal DCG, obtained for a perfect ranking) to obtain a score between\n 0 and 1.\n\n...
https://github.com/scikit-learn/scikit-learn.git
1
get_supplier_block_status
def get_supplier_block_status(party_name): supplier = frappe.get_doc("Supplier", party_name) info = { "on_hold": supplier.on_hold, "release_date": supplier.release_date, "hold_type": supplier.hold_type, } return info
494bd9ef78313436f0424b918f200dab8fc7c20b
9
accounts_controller.py
70
style: format code with black
13,959
0
10
40
16
65,623
18
erpnext
9
erpnext/controllers/accounts_controller.py
Python
8
{ "docstring": "\n\tReturns a dict containing the values of `on_hold`, `release_date` and `hold_type` of\n\ta `Supplier`\n\t", "language": "en", "n_whitespaces": 12, "n_words": 14, "vocab_size": 12 }
https://github.com/frappe/erpnext.git
1
compare_total
def compare_total(self, a, b): a = _convert_other(a, raiseit=True) return a.compare_total(b)
8198943edd73a363c266633e1aa5b2a9e9c9f526
9
_pydecimal.py
43
add python 3.10.4 for windows
55,795
0
31
27
10
219,780
10
XX-Net
6
python3.10.4/Lib/_pydecimal.py
Python
3
{ "docstring": "Compares two operands using their abstract representation.\n\n This is not like the standard compare, which use their numerical\n value. Note that a total ordering is defined for all possible abstract\n representations.\n\n >>> ExtendedContext.compare_total(Decimal('12.73')...
https://github.com/XX-net/XX-Net.git
1
step_pred
def step_pred(self, score, x, t): # TODO(Patrick) better comments + non-PyTorch t = self.repeat_scalar(t, x.shape[0]) timesteps = self.long((t * (len(self.timesteps) - 1))) sigma = self.discrete_sigmas[timesteps] adjacent_sigma = self.get_adjacent_sigma(timesteps, t) ...
63c68d979a8e4a9c9fea306bdf63e73812843453
15
scheduling_sde_ve.py
215
VE/VP SDE updates (#90) * improve comments for sde_ve scheduler, init tests * more comments, tweaking pipelines * timesteps --> num_training_timesteps, some comments * merge cpu test, add m1 data * fix scheduler tests with num_train_timesteps * make np compatible, add tests for sde ve * minor default...
120,850
0
263
140
87
336,027
141
diffusers
20
src/diffusers/schedulers/scheduling_sde_ve.py
Python
12
{ "docstring": "\n Predict the sample at the previous timestep by reversing the SDE.\n ", "language": "en", "n_whitespaces": 26, "n_words": 11, "vocab_size": 9 }
https://github.com/huggingface/diffusers.git
1
test_get_bad_image
def test_get_bad_image(self): # Get response = self.client.get( reverse( "wagtailimages:generate_url", args=(self.image.id + 1, "fill-800x600") ) ) # Check response self.assertEqual(response.status_code, 404) self.assertEq...
d10f15e55806c6944827d801cd9c2d53f5da4186
15
test_admin_views.py
137
Reformat with black
16,373
0
225
79
30
75,173
36
wagtail
16
wagtail/images/tests/test_admin_views.py
Python
16
{ "docstring": "\n This tests that the view gives a 404 response if a user attempts to use it with an image which doesn't exist\n ", "language": "en", "n_whitespaces": 37, "n_words": 22, "vocab_size": 21 }
https://github.com/wagtail/wagtail.git
3
get
def get(self, url, cache=True, **kwargs): if not url.isValid(): urlutils.invalid_url_error(url, "start download") return None req = QNetworkRequest(url) user_agent = websettings.user_agent(url) req.setHeader(QNetworkRequest.KnownHeaders.UserAgentHeader, ...
0877fb0d78635692e481c8bde224fac5ad0dd430
11
qtnetworkdownloads.py
136
Run scripts/dev/rewrite_enums.py
117,539
0
111
85
25
321,111
29
qutebrowser
19
qutebrowser/browser/qtnetworkdownloads.py
Python
10
{ "docstring": "Start a download with a link URL.\n\n Args:\n url: The URL to get, as QUrl\n cache: If set to False, don't cache the response.\n **kwargs: passed to get_request().\n\n Return:\n The created DownloadItem.\n ", "language": "en", "n_whi...
https://github.com/qutebrowser/qutebrowser.git
23
getcomments
def getcomments(object): try: lines, lnum = findsource(object) except (OSError, TypeError): return None if ismodule(object): # Look for a comment block at the top of the file. start = 0 if lines and lines[0][:2] == '#!': start = 1 while start < len(lines...
8198943edd73a363c266633e1aa5b2a9e9c9f526
20
inspect.py
571
add python 3.10.4 for windows
55,330
0
568
345
74
218,471
178
XX-Net
20
python3.10.4/Lib/inspect.py
Python
36
{ "docstring": "Get lines of comments immediately preceding an object's source code.\n\n Returns None when source can't be found.\n ", "language": "en", "n_whitespaces": 23, "n_words": 17, "vocab_size": 16 }
https://github.com/XX-net/XX-Net.git
7
convert_to_strings
def convert_to_strings(cls, obj): if isinstance(obj, dict): return { cls.convert_to_strings(key): cls.convert_to_strings(value) for key, value in obj.items() } elif isinstance(obj, list) or isinstance(obj, tuple): return [cls.c...
8c2428c9d355ca5fbc3dd90e9820ceb1cc795837
11
jsondump.py
140
[autofix.ci] apply automated fixes
74,068
0
144
91
26
253,331
35
mitmproxy
13
examples/contrib/jsondump.py
Python
11
{ "docstring": "\n Recursively convert all list/dict elements of type `bytes` into strings.\n ", "language": "en", "n_whitespaces": 25, "n_words": 10, "vocab_size": 10 }
https://github.com/mitmproxy/mitmproxy.git
1
test_makemigrations_interactive_reject
def test_makemigrations_interactive_reject(self): # Monkeypatch interactive questioner to auto reject with mock.patch('builtins.input', mock.Mock(return_value='N')): with self.temporary_migration_module(module="migrations.test_migrations_conflict") as migration_dir: ...
0ab58c120939093fea90822f376e1866fc714d1f
15
test_commands.py
158
Refs #29026 -- Allowed customizing InteractiveMigrationQuestioner's prompt destination. Previously, the questioner did not obey the value of stdout provided to the command.
50,165
0
284
88
29
202,906
31
django
21
tests/migrations/test_commands.py
Python
14
{ "docstring": "\n makemigrations enters and exits interactive mode properly.\n ", "language": "en", "n_whitespaces": 22, "n_words": 7, "vocab_size": 7 }
https://github.com/django/django.git
16
customize_compiler
def customize_compiler(compiler): if compiler.compiler_type == "unix": if sys.platform == "darwin": # Perform first-time customization of compiler-related # config vars on OS X now that we know we need a compiler. # This is primarily to support Pythons from binary ...
8198943edd73a363c266633e1aa5b2a9e9c9f526
17
sysconfig.py
658
add python 3.10.4 for windows
56,846
0
957
369
147
223,004
303
XX-Net
32
python3.10.4/Lib/distutils/sysconfig.py
Python
50
{ "docstring": "Do any platform-specific customization of a CCompiler instance.\n\n Mainly needed on Unix, so we can plug in the information that\n varies across Unices and is stored in Python's Makefile.\n ", "language": "en", "n_whitespaces": 38, "n_words": 29, "vocab_size": 28 }
https://github.com/XX-net/XX-Net.git
8
_check_list_filter_item
def _check_list_filter_item(self, obj, item, label): from django.contrib.admin import FieldListFilter, ListFilter if callable(item) and not isinstance(item, models.Field): # If item is option 3, it should be a ListFilter... if not _issubclass(item, ListFilter): ...
9c19aff7c7561e3a82978a272ecdaad40dda5c00
16
checks.py
331
Refs #33476 -- Reformatted code with Black.
50,332
0
880
207
89
203,361
144
django
31
django/contrib/admin/checks.py
Python
44
{ "docstring": "\n Check one item of `list_filter`, i.e. check if it is one of three options:\n 1. 'field' -- a basic field filter, possibly w/ relationships (e.g.\n 'field__rel')\n 2. ('field', SomeFieldListFilter) - a field-based list filter class\n 3. SomeListFilter - a non-fi...
https://github.com/django/django.git
1
get_redemption_details
def get_redemption_details(customer, loyalty_program, company): return frappe._dict( frappe.db.sql( , (customer, loyalty_program, company), ) )
494bd9ef78313436f0424b918f200dab8fc7c20b
10
loyalty_point_entry.py
47
style: format code with black
13,746
0
6
32
11
64,880
13
erpnext
8
erpnext/accounts/doctype/loyalty_point_entry/loyalty_point_entry.py
Python
12
{ "docstring": "\n\t\tselect redeem_against, sum(loyalty_points)\n\t\tfrom `tabLoyalty Point Entry`\n\t\twhere customer=%s and loyalty_program=%s and loyalty_points<0 and company=%s\n\t\tgroup by redeem_against\n\t", "language": "en", "n_whitespaces": 14, "n_words": 18, "vocab_size": 16 }
https://github.com/frappe/erpnext.git
4
get_all_tests
def get_all_tests(): test_root_dir = os.path.join(PATH_TO_TRANFORMERS, "tests") # test folders/files directly under `tests` folder tests = os.listdir(test_root_dir) tests = sorted( list(filter(lambda x: os.path.isdir(x) or x.startswith("tests/test_"), [f"tests/{x}" for x in tests])) ) ...
38043d8453b82a9c712f8d5c98323150fbee7503
17
tests_fetcher.py
205
Update self-push workflow (#17177) * update push ci * install git-python * update comment * update deepspeed jobs * fix report * skip 2 more tests that require fairscale * Fix changes in test_fetcher.py (to deal with `setup.py` is changed) * set RUN_PT_TF_CROSS_TESTS=1 and final clean-up * remo...
6,971
0
98
118
40
38,418
55
transformers
17
utils/tests_fetcher.py
Python
11
{ "docstring": "\n Return a list of paths to all test folders and files under `tests`. All paths are rooted at `tests`.\n\n - folders under `tests`: `tokenization`, `pipelines`, etc. The folder `models` is excluded.\n - folders under `tests/models`: `bert`, `gpt2`, etc.\n - test files under `tests`: `test...
https://github.com/huggingface/transformers.git
4
promote_snaps
def promote_snaps(version): assert_logged_into_snapcraft() for snap in SNAPS: revisions = get_snap_revisions(snap, version) # The loop below is kind of slow, so let's print some output about what # it is doing. print('Releasing', snap, 'snaps to the stable channel') ...
39e8d14e1b221bf37526cc05ecc83beee30a3c57
19
finish_release.py
180
Set up 2.0 pre-releases (#9400) * update credential info * update release tooling to use candidate channel * split deploy jobs * pass parameter through * add 2.0 pipeline prerelease * add comments * quote file path
45,647
0
222
97
61
186,894
70
certbot
19
tools/finish_release.py
Python
14
{ "docstring": "Promotes all Certbot snaps from the candidate to stable channel.\n\n If the snaps have already been released to the stable channel, this\n function will try to release them again which has no effect.\n\n :param str version: the version number that should be found in the\n candidate cha...
https://github.com/certbot/certbot.git
5
get_ss_earning_map
def get_ss_earning_map(salary_slips, currency, company_currency): ss_earnings = frappe.db.sql( % (", ".join(["%s"] * len(salary_slips))), tuple([d.name for d in salary_slips]), as_dict=1, ) ss_earning_map = {} for d in ss_earnings: ss_earning_map.setdefault(d.parent, frappe._dict()).setdefault(d.salary_...
494bd9ef78313436f0424b918f200dab8fc7c20b
15
salary_register.py
221
style: format code with black
14,391
0
34
145
38
66,963
50
erpnext
22
erpnext/payroll/report/salary_register/salary_register.py
Python
18
{ "docstring": "select sd.parent, sd.salary_component, sd.amount, ss.exchange_rate, ss.name\n\t\tfrom `tabSalary Detail` sd, `tabSalary Slip` ss where sd.parent=ss.name and sd.parent in (%s)", "language": "en", "n_whitespaces": 17, "n_words": 19, "vocab_size": 18 }
https://github.com/frappe/erpnext.git
5
_get_save_kwargs
def _get_save_kwargs(self) -> Dict[str, Union[bool, int, str]]: filetype = self.config["format"] kwargs = {} if filetype in ("gif", "jpg", "png"): kwargs["optimize"] = self.config["optimize"] if filetype == "gif": kwargs["interlace"] = self.config["gif_in...
049314429f71a21e6595e9d27e9e36f6a3479c42
10
pillow.py
195
Convert: Add option to output mask separately for draw-transparent
20,507
0
153
110
31
101,070
46
faceswap
12
plugins/convert/writer/pillow.py
Python
20
{ "docstring": " Return the save parameters for the file format\n\n Returns\n -------\n dict\n The specific keyword arguments for the selected file format\n ", "language": "en", "n_whitespaces": 60, "n_words": 20, "vocab_size": 15 }
https://github.com/deepfakes/faceswap.git
1
test_multi_conv
def test_multi_conv(self): n = coord_net_spec() # multi bottom/top n.conv_data, n.conv_aux = L.Convolution( n.data, n.aux, ntop=2, num_output=10, kernel_size=5, stride=2, pad=0) ax1, a1, b1 = coord_map_from_to(n.conv_data, n.data) ax2, a2, b2 = co...
cc4d0564756ca067516f71718a3d135996525909
9
test_coord_map.py
160
Balanced joint maximum mean discrepancy for deep transfer learning
12,080
0
122
107
34
60,302
37
transferlearning
23
code/deep/BJMMD/caffe/python/caffe/test/test_coord_map.py
Python
10
{ "docstring": "\n Multiple bottoms/tops of a layer are identically mapped.\n ", "language": "en", "n_whitespaces": 23, "n_words": 8, "vocab_size": 8 }
https://github.com/jindongwang/transferlearning.git
7
get_submatrix
def get_submatrix(self, matrix): r reduced, non_reduced = self.get_reduced_nonreduced() # if reduced == [], then det(matrix) should be 1 if reduced == []: return diag([1]) # reduced != [] reduction_set = [v ** self.degrees[i] for i, v ...
9d58006fc0a23afcba38f641c9472917c436428a
12
multivariate_resultants.py
212
Code cleanup
48,966
0
237
138
54
198,503
75
sympy
25
sympy/polys/multivariate_resultants.py
Python
24
{ "docstring": "\n Returns\n =======\n\n macaulay_submatrix: Matrix\n The Macaulay denominator matrix. Columns that are non reduced are kept.\n The row which contains one of the a_{i}s is dropped. a_{i}s\n are the coefficients of x_i ^ {d_i}.\n ", "langua...
https://github.com/sympy/sympy.git
3
check_components_alive
def check_components_alive(cluster, component_type, check_component_alive): worker_nodes = get_other_nodes(cluster) assert len(worker_nodes) > 0 for node in worker_nodes: process = node.all_processes[component_type][0].process if check_component_alive: assert process.poll() ...
7f1bacc7dc9caf6d0ec042e39499bbf1d9a7d065
@pytest.mark.parametrize( "ray_start_cluster", [ { "num_cpus": 8, "num_nodes": 4, "_system_config": {"num_heartbeats_timeout": 10}, } ], indirect=True, )
17
test_component_failures_2.py
235
[CI] Format Python code with Black (#21975) See #21316 and #21311 for the motivation behind these changes.
29,534
1
398
102
52
131,456
81
ray
19
python/ray/tests/test_component_failures_2.py
Python
24
{ "docstring": "Check that a given component type is alive on all worker nodes.", "language": "en", "n_whitespaces": 11, "n_words": 12, "vocab_size": 12 }
https://github.com/ray-project/ray.git
3
compute_current_divisions
def compute_current_divisions(self, col=None): if col is None and self.known_divisions: return self.divisions from dask.dataframe.shuffle import compute_divisions return compute_divisions(self, col=col)
cccb9d8d8e33a891396b1275c2448c352ef40c27
8
core.py
62
absolufy-imports - No relative - PEP8 (#8796) Conversation in https://github.com/dask/distributed/issues/5889
36,561
0
57
40
17
156,105
18
dask
9
dask/dataframe/core.py
Python
5
{ "docstring": "Compute the current divisions of the DataFrame.\n\n This method triggers immediate computation. If you find yourself running this command\n repeatedly for the same dataframe, we recommend storing the result\n so you don't have to rerun it.\n\n If the column or index values ...
https://github.com/dask/dask.git
2
parse_wheel
def parse_wheel(wheel_zip, name): # type: (ZipFile, str) -> Tuple[str, Message] try: info_dir = wheel_dist_info_dir(wheel_zip, name) metadata = wheel_metadata(wheel_zip, info_dir) version = wheel_version(metadata) except UnsupportedWheel as e: raise UnsupportedWheel("{} ...
f638f5d0e6c8ebed0e69a6584bc7f003ec646580
14
wheel.py
103
upd; format
12,522
0
85
62
35
61,340
39
transferlearning
14
.venv/lib/python3.8/site-packages/pip/_internal/utils/wheel.py
Python
9
{ "docstring": "Extract information from the provided wheel, ensuring it meets basic\n standards.\n\n Returns the name of the .dist-info directory and the parsed WHEEL metadata.\n ", "language": "en", "n_whitespaces": 32, "n_words": 23, "vocab_size": 20 }
https://github.com/jindongwang/transferlearning.git
1
require_torch_bf16_cpu
def require_torch_bf16_cpu(test_case): return unittest.skipUnless( is_torch_bf16_cpu_available(), "test requires torch>=1.10, using CPU", )(test_case)
a2d34b7c040723b92823310e3b8fd66874c9d667
10
testing_utils.py
38
deprecate is_torch_bf16_available (#17738) * deprecate is_torch_bf16_available * address suggestions
5,726
0
34
21
11
31,378
11
transformers
5
src/transformers/testing_utils.py
Python
5
{ "docstring": "Decorator marking a test that requires torch>=1.10, using CPU.", "language": "en", "n_whitespaces": 8, "n_words": 9, "vocab_size": 9 }
https://github.com/huggingface/transformers.git
3
is_show
def is_show(self, value, header=""): # @TODO: possible optimisation: create a re.compile list return any(j for j in [re.match(i, value) for i in self.get_conf_value('show', header=header)])
4d50e8cb5756755cf019cef1f45cd569bef708fc
13
glances_plugin.py
69
Create a Show option in the configuration file to only show some stats #2052
15,210
0
45
43
22
69,969
24
glances
10
glances/plugins/glances_plugin.py
Python
2
{ "docstring": "Return True if the value is in the show configuration list.\n\n If the show value is empty, return True (show by default)\n\n The show configuration list is defined in the glances.conf file.\n It is a comma separated list of regexp.\n Example for diskio:\n show=sda.*...
https://github.com/nicolargo/glances.git
2
test_estimator_does_not_support_feature_names
def test_estimator_does_not_support_feature_names(): pytest.importorskip("pandas") X, y = datasets.load_iris(as_frame=True, return_X_y=True) all_feature_names = set(X.columns)
9f85c9d44965b764f40169ef2917e5f7a798684f
9
test_from_model.py
61
TST Better info when checking for no warnings in tests (#22362)
75,364
0
23
114
10
258,673
11
scikit-learn
12
sklearn/feature_selection/tests/test_from_model.py
Python
14
{ "docstring": "SelectFromModel works with estimators that do not support feature_names_in_.\n\n Non-regression test for #21949.\n ", "language": "en", "n_whitespaces": 19, "n_words": 13, "vocab_size": 13 }
https://github.com/scikit-learn/scikit-learn.git
1
test_get_member_list_no_permission_former_member
def test_get_member_list_no_permission_former_member(self): # create a room, invite the user and the user joins room_id = self.helper.create_room_as("@alice:red") self.helper.invite(room_id, "@alice:red", self.user_id) self.helper.join(room_id, self.user_id) # check tha...
02d708568b476f2f7716000b35c0adfa4cbd31b3
10
test_rooms.py
203
Replace assertEquals and friends with non-deprecated versions. (#12092)
71,395
0
162
120
42
246,901
71
synapse
15
tests/rest/client/test_rooms.py
Python
9
{ "docstring": "\n Tests that a former member of the room can not get the member list.\n ", "language": "en", "n_whitespaces": 29, "n_words": 14, "vocab_size": 12 }
https://github.com/matrix-org/synapse.git
6
get_dated_queryset
def get_dated_queryset(self, **lookup): qs = self.get_queryset().filter(**lookup) date_field = self.get_date_field() allow_future = self.get_allow_future() allow_empty = self.get_allow_empty() paginate_by = self.get_paginate_by(qs) if not allow_future: ...
9c19aff7c7561e3a82978a272ecdaad40dda5c00
17
dates.py
222
Refs #33476 -- Reformatted code with Black.
51,756
0
323
130
61
206,855
84
django
25
django/views/generic/dates.py
Python
19
{ "docstring": "\n Get a queryset properly filtered according to `allow_future` and any\n extra lookup kwargs.\n ", "language": "en", "n_whitespaces": 35, "n_words": 13, "vocab_size": 13 }
https://github.com/django/django.git
1
default_params
def default_params(self) -> dict: return {"order": "asc", "sort": self.sort_key, "limit": self.limit}
63af98e3b999d4b223237b51472a819915c5a558
8
streams.py
49
🎉 Recurly Schema Revamp (#9866) * Cleanup Recurly connector schemas * Add more Recurly schemas to the connector - `billing_infos` - `shipping_addresses` - `shipping_methods` - `subscription_changes` * Add Recurly `add-on` resouce * Add Recurly's account notes resource schema * Add unique coupons to ...
628
0
25
26
11
4,171
11
airbyte
5
airbyte-integrations/connectors/source-recurly/source_recurly/streams.py
Python
5
{ "docstring": "\n Returns the parameters to be sent together with the API call to Recurly\n ", "language": "en", "n_whitespaces": 28, "n_words": 13, "vocab_size": 11 }
https://github.com/airbytehq/airbyte.git
3
filter_on_submodules
def filter_on_submodules(all_modules, submodule): filtered_modules = [ mod for mod in all_modules if PACKAGE + submodule in mod.__name__ ] return filtered_modules
a449efe29b092e658a29cd847e0494979a47d252
10
keras_doctest.py
43
Add a keras doctest modeled on tensorflow doctest PiperOrigin-RevId: 424672415
79,737
0
29
27
17
268,868
20
keras
7
keras/tests/keras_doctest.py
Python
5
{ "docstring": "Filters all the modules based on the module flag.\n\n The module flag has to be relative to the core package imported.\n For example, if `submodule=keras.layers` then, this function will return\n all the modules in the submodule.\n\n Args:\n all_modules: All the modules in the core package.\n ...
https://github.com/keras-team/keras.git
1
is_stale
def is_stale(self, resource, path): # Cache invalidation is a hard problem :-) return True
f638f5d0e6c8ebed0e69a6584bc7f003ec646580
6
resources.py
21
upd; format
12,869
0
35
12
14
62,100
14
transferlearning
4
.venv/lib/python3.8/site-packages/pip/_vendor/distlib/resources.py
Python
2
{ "docstring": "\n Is the cache stale for the given resource?\n\n :param resource: The :class:`Resource` being cached.\n :param path: The path of the resource in the cache.\n :return: True if the cache is stale.\n ", "language": "en", "n_whitespaces": 67, "n_words": 31, "voc...
https://github.com/jindongwang/transferlearning.git
3
set_result
def set_result(self, result): with self._condition: if self._state in {CANCELLED, CANCELLED_AND_NOTIFIED, FINISHED}: raise InvalidStateError('{}: {!r}'.format(self._state, self)) self._result = result self._state = FINISHED for waiter in s...
8198943edd73a363c266633e1aa5b2a9e9c9f526
14
_base.py
123
add python 3.10.4 for windows
56,431
0
134
75
25
221,566
28
XX-Net
16
python3.10.4/Lib/concurrent/futures/_base.py
Python
10
{ "docstring": "Sets the return value of work associated with the future.\n\n Should only be used by Executor implementations and unit tests.\n ", "language": "en", "n_whitespaces": 34, "n_words": 20, "vocab_size": 19 }
https://github.com/XX-net/XX-Net.git
9
get_data
def get_data(self, session_id, metric): if session_id is None: raw = self._data else: data = self._data.get(session_id) if not data: return None raw = {session_id: data} dtype = "float32" if metric == "loss" else "float64"...
c1512fd41d86ef47a5d1ce618d6d755ef7cbacdf
17
event_reader.py
284
Update code to support Tensorflow versions up to 2.8 (#1213) * Update maximum tf version in setup + requirements * - bump max version of tf version in launcher - standardise tf version check * update keras get_custom_objects for tf>2.6 * bugfix: force black text in GUI file dialogs (linux) * dssim loss -...
19,804
0
358
173
52
100,307
80
faceswap
25
lib/gui/analysis/event_reader.py
Python
21
{ "docstring": " Retrieve the decompressed cached data from the cache for the given session id.\n\n Parameters\n ----------\n session_id: int or ``None``\n If session_id is provided, then the cached data for that session is returned. If\n session_id is ``None`` then the cach...
https://github.com/deepfakes/faceswap.git
2
find_all_matches
def find_all_matches(self, sources=None, finder=None): # type: (Optional[List[Dict[S, Union[S, bool]]]], Optional[PackageFinder]) -> List[InstallationCandidate] from .dependencies import find_all_matches, get_finder if not finder: _, finder = get_finder(sources=sources) ...
cd5a9683be69c86c8f3adcd13385a9bc5db198ec
11
requirements.py
77
Rename notpip to pip. Vendor in pip-22.2.1 and latest requirementslib and vistir.
4,277
0
73
46
27
22,233
27
pipenv
8
pipenv/vendor/requirementslib/models/requirements.py
Python
5
{ "docstring": "Find all matching candidates for the current requirement.\n\n Consults a finder to find all matching candidates.\n\n :param sources: Pipfile-formatted sources, defaults to None\n :param sources: list[dict], optional\n :param PackageFinder finder: A **PackageFinder** instanc...
https://github.com/pypa/pipenv.git
4
test_ddpg_compilation
def test_ddpg_compilation(self): config = ( ddpg.DDPGConfig() .training(num_steps_sampled_before_learning_starts=0) .rollouts(num_rollout_workers=0, num_envs_per_worker=2) ) explore = config.exploration_config.update({"random_timesteps": 100}) ...
0dceddb912ed92286032b5563dd2e541a8a7031f
14
test_ddpg.py
257
[RLlib] Move learning_starts logic from buffers into `training_step()`. (#26032)
28,309
0
330
153
56
126,954
67
ray
37
rllib/algorithms/ddpg/tests/test_ddpg.py
Python
23
{ "docstring": "Test whether DDPG can be built with both frameworks.", "language": "en", "n_whitespaces": 8, "n_words": 9, "vocab_size": 9 }
https://github.com/ray-project/ray.git
1
increment_iterations
def increment_iterations(self) -> None: self._iterations += 1 self._sessions[self._session_id]["iterations"] += 1
ff6b0209dd5ad57b81b0aca570df7f39a7119bfb
9
model.py
45
Refactoring and TravisCI to Github Actions (#1239) * refactor training * travis to actions
20,292
0
31
26
8
100,841
10
faceswap
5
plugins/train/model/_base/model.py
Python
4
{ "docstring": " Increment :attr:`iterations` and session iterations by 1. ", "language": "en", "n_whitespaces": 8, "n_words": 7, "vocab_size": 7 }
https://github.com/deepfakes/faceswap.git
1
export_docker_compose
def export_docker_compose(args): Flow.load_config(args.flowpath).to_docker_compose_yaml( output_path=args.outpath, network_name=args.network_name )
16b16b07a66cd5a8fc7cca1d3f1c378a9c63d38c
10
exporter.py
48
refactor: rename cli to jina_cli (#4890) * chore: fix readme * chore: fix readme * chore: fix dockerignore * fix: #4845 * style: fix overload and cli autocomplete * fix: cicd export cli Co-authored-by: Jina Dev Bot <dev-bot@jina.ai>
2,301
0
22
29
6
12,474
6
jina
9
jina/exporter.py
Python
4
{ "docstring": "Export to Docker compose yaml files\n\n :param args: args from CLI\n ", "language": "en", "n_whitespaces": 17, "n_words": 11, "vocab_size": 11 }
https://github.com/jina-ai/jina.git
7
test_search_based_stream_should_not_attempt_to_get_more_than_10k_records
def test_search_based_stream_should_not_attempt_to_get_more_than_10k_records(requests_mock, common_params, fake_properties_list): responses = [ { "json": { "results": [{"id": f"{y}", "updatedAt": "2022-02-25T16:43:11Z"} for y in range(100)], "paging": {"next...
710543a9abacc7578238cb5edaa47f43ed7c0431
19
test_source.py
514
🐛 Source Hubspot: Handled 10K+ search-endpoint queries (#10700) * Handled search queries that would output more than 10K records * Getting CRM search objects in ascending chronological ortder * Fixed stream * Fixed rebase * Fixed condition * Added unit test * Removed unused import * Started a new...
652
0
524
277
107
4,306
178
airbyte
24
airbyte-integrations/connectors/source-hubspot/unit_tests/test_source.py
Python
42
{ "docstring": "\n If there are more than 10,000 records that would be returned by the Hubspot search endpoint,\n the CRMSearchStream instance should stop at the 10Kth record\n ", "language": "en", "n_whitespaces": 35, "n_words": 25, "vocab_size": 23 }
https://github.com/airbytehq/airbyte.git
4
get_mode_of_payments
def get_mode_of_payments(filters): mode_of_payments = {} invoice_list = get_invoices(filters) invoice_list_names = ",".join("'" + invoice["name"] + "'" for invoice in invoice_list) if invoice_list: inv_mop = frappe.db.sql( .format( invoice_list_names=invoice_list_names ), as_dict=1, ) for d in in...
74a782d81d8f8c4a4d9214a9c06377e5e6e464dd
18
sales_payment_summary.py
157
refactor: DB independent quoting and truthy/falsy values (#31358) * refactor: DB independent quoting and truthy/falsy values * style: reformat to black spec * fix: ifnull -> coalesce * fix: coalesce -> Coalesce * fix: revert pypika comparison * refactor: convert queries to QB * fix: incorrect value t...
14,908
0
25
93
31
68,837
39
erpnext
19
erpnext/accounts/report/sales_payment_summary/sales_payment_summary.py
Python
34
{ "docstring": "select a.owner,a.posting_date, ifnull(b.mode_of_payment, '') as mode_of_payment\n\t\t\tfrom `tabSales Invoice` a, `tabSales Invoice Payment` b\n\t\t\twhere a.name = b.parent\n\t\t\tand a.docstatus = 1\n\t\t\tand a.name in ({invoice_list_names})\n\t\t\tunion\n\t\t\tselect a.owner,a.posting_date, ifnull...
https://github.com/frappe/erpnext.git
1
test_alter_value
def test_alter_value(self): altered_raw_data = apply_changes_to_raw_data( raw_data=self.raw_data, block_path_str="char1", operation=AlterBlockValueOperation(new_value="foo"), streamfield=models.SampleModel.content, ) self.assertEqual(alt...
ad65741b94f36fbe793cf15f0ab002482070cdb6
13
test_simple_structures.py
181
Add tests for streamfield migration helpers Currently failing due to wagtail-factories being broken on Wagtail 4.1: https://github.com/wagtail/wagtail-factories/issues/65
17,024
0
111
110
17
80,146
18
wagtail
14
wagtail/tests/streamfield_migrations/test_simple_structures.py
Python
11
{ "docstring": "Change the value of each `char1` block to `foo`\n\n Check whether the value of each `char1` block has changed to `foo`.\n Check whether the values of other blocks are intact.\n ", "language": "en", "n_whitespaces": 51, "n_words": 30, "vocab_size": 19 }
https://github.com/wagtail/wagtail.git
2
get_popularity_based_topk
def get_popularity_based_topk(self, top_k=10, items=True): # TODO: get most frequent users if not items: raise ValueError("Not implemented") return self.item_frequencies.orderBy("frequency", ascending=False).limit(top_k)
99b46f65e08a67f3b11cbaf80edeffe6dd5d6b2e
10
SARPlus.py
70
Implemented get_popularity_based_topk
7,242
0
58
41
19
39,476
19
recommenders
9
contrib/sarplus/python/pysarplus/SARPlus.py
Python
4
{ "docstring": "Get top K most frequently occurring items across all users.\n\n Args:\n top_k (int): number of top items to recommend.\n items (bool): if false, return most frequent users instead.\n\n Returns:\n pyspark.sql.DataFrame: Spark dataframe with top k most popu...
https://github.com/microsoft/recommenders.git
2
format_string_to_json
def format_string_to_json(balance_info): Working Account|KES|481000.00|481000.00|0.00|0.00 balance_dict = frappe._dict() for account_info in balance_info.split("&"): account_info = account_info.split("|") balance_dict[account_info[0]] = dict( current_balance=fmt_money(account_info[2], currency="KES"), avai...
494bd9ef78313436f0424b918f200dab8fc7c20b
15
mpesa_settings.py
166
style: format code with black
14,080
0
16
103
22
65,988
28
erpnext
15
erpnext/erpnext_integrations/doctype/mpesa_settings/mpesa_settings.py
Python
11
{ "docstring": "\n\tFormat string to json.\n\n\te.g: \n\t=> {'Working Account': {'current_balance': '481000.00',\n\t 'available_balance': '481000.00',\n\t 'reserved_balance': '0.00',\n\t 'uncleared_balance': '0.00'}}\n\t", "language": "en", "n_whitespaces": 35, "n_words": 16, "vocab_size"...
https://github.com/frappe/erpnext.git
8
setimage
def setimage(self, im, extents=None): # following c code self.im = im if extents: (x0, y0, x1, y1) = extents else: (x0, y0, x1, y1) = (0, 0, 0, 0) if x0 == 0 and x1 == 0: self.state.xsize, self.state.ysize = self.im.size els...
a0e1fde1eddf45f26653e2ff6080d31e177adbec
11
ImageFile.py
282
Added PyEncoder
69,856
0
282
184
54
242,434
91
Pillow
15
src/PIL/ImageFile.py
Python
20
{ "docstring": "\n Called from ImageFile to set the core output image for the codec\n\n :param im: A core image object\n :param extents: a 4 tuple of (x0, y0, x1, y1) defining the rectangle\n for this tile\n :returns: None\n ", "language": "en", "n_whitespaces": 83, ...
https://github.com/python-pillow/Pillow.git
1
get_cache_attr_name
def get_cache_attr_name(cls): return "_{}.{}".format(cls._meta.app_label, cls._meta.model_name).lower()
d10f15e55806c6944827d801cd9c2d53f5da4186
11
models.py
47
Reformat with black
16,023
0
19
27
5
73,478
5
wagtail
7
wagtail/contrib/settings/models.py
Python
2
{ "docstring": "\n Returns the name of the attribute that should be used to store\n a reference to the fetched/created object on a request.\n ", "language": "en", "n_whitespaces": 43, "n_words": 21, "vocab_size": 17 }
https://github.com/wagtail/wagtail.git
5
serialize
def serialize(self): data = dict() for attr in self.fattributes: if attr not in ('block', 'rescue', 'always'): data[attr] = getattr(self, attr) data['dep_chain'] = self.get_dep_chain() if self._role is not None: data['role'] = self._rol...
43153c58310d02223f2cb0964f4255ba1ac4ed53
13
block.py
188
`FieldAttribute`s as descriptors (#73908)
78,962
0
152
112
30
267,581
44
ansible
14
lib/ansible/playbook/block.py
Python
12
{ "docstring": "\n Override of the default serialize method, since when we're serializing\n a task we don't want to include the attribute list of tasks.\n ", "language": "en", "n_whitespaces": 44, "n_words": 22, "vocab_size": 20 }
https://github.com/ansible/ansible.git
4
_apply_scores
def _apply_scores(self, scores, value, scores_mask=None, training=None): if scores_mask is not None: padding_mask = tf.logical_not(scores_mask) # Bias so padding positions do not contribute to attention # distribution. Note 65504. is the max float16 value. ...
8401e08334d4b1f102a6ee9479738bacfee0600c
16
base_dense_attention.py
153
reduce layers line-too-long
82,075
0
185
133
44
277,507
60
keras
17
keras/layers/attention/base_dense_attention.py
Python
15
{ "docstring": "Applies attention scores to the given value tensor.\n\n To use this method in your attention layer, follow the steps:\n\n * Use `query` tensor of shape `[batch_size, Tq]` and `key` tensor of\n shape `[batch_size, Tv]` to calculate the attention `scores`.\n * Pass `scores`...
https://github.com/keras-team/keras.git
3
_build_sub_tabs
def _build_sub_tabs(self) -> None: for section, plugins in self.config_tools.plugins_dict.items(): for plugin in plugins: config_key = ".".join((section, plugin)) config_dict = self.config_tools.config_dicts[config_key] tab = ConfigFrame(self,...
1022651eb8a7741014f5d2ec7cbfe882120dfa5f
16
preview.py
175
Bugfix: convert - Gif Writer - Fix non-launch error on Gif Writer - convert plugins - linting - convert/fs_media/preview/queue_manager - typing - Change convert items from dict to Dataclass
20,846
0
151
110
29
101,433
36
faceswap
22
tools/preview/preview.py
Python
10
{ "docstring": " Build the notebook sub tabs for each convert section's plugin. ", "language": "en", "n_whitespaces": 11, "n_words": 10, "vocab_size": 10 }
https://github.com/deepfakes/faceswap.git
1
test_realm_quota
def test_realm_quota(self) -> None: self.login("hamlet") d1 = StringIO("zulip!") d1.name = "dummy_1.txt" result = self.client_post("/json/user_uploads", {"file": d1}) response_dict = self.assert_json_success(result) d1_path_id = re.sub("/user_uploads/", "", resp...
a142fbff85302c5e3acb2e204eca2e9c75dbc74b
11
test_upload.py
402
tests: Refactor away result.json() calls with helpers. Signed-off-by: Zixuan James Li <p359101898@gmail.com>
17,789
0
327
223
69
84,150
117
zulip
29
zerver/tests/test_upload.py
Python
30
{ "docstring": "\n Realm quota for uploading should not be exceeded.\n ", "language": "en", "n_whitespaces": 23, "n_words": 8, "vocab_size": 8 }
https://github.com/zulip/zulip.git
1
forward_dummy
def forward_dummy(self, img, img_metas): super(SingleStageDetector, self).forward_train(img, img_metas) x = self.extract_feat(img) outs = self.panoptic_head(x, img_metas) return outs
cac356380d505bf15587f07c0529218cc36b9652
9
maskformer.py
67
[Feature] Add Maskformer to mmdet (#7212) * first commit * add README * move model description from config to readme add description for binary_input add description for dice loss add a independent panoptic gt processing function add a independent panoptic gt processing function remove compatibili...
70,214
0
51
43
13
244,047
16
mmdetection
11
mmdet/models/detectors/maskformer.py
Python
5
{ "docstring": "Used for computing network flops. See\n `mmdetection/tools/analysis_tools/get_flops.py`\n\n Args:\n img (Tensor): of shape (N, C, H, W) encoding input images.\n Typically these should be mean centered and std scaled.\n img_metas (list[Dict]): list of ...
https://github.com/open-mmlab/mmdetection.git