id
int64
20
338k
vocab_size
int64
2
671
ast_levels
int64
4
32
nloc
int64
1
451
n_ast_nodes
int64
12
5.6k
n_identifiers
int64
1
186
n_ast_errors
int64
0
10
n_words
int64
2
2.17k
n_whitespaces
int64
2
13.8k
fun_name
stringlengths
2
73
commit_message
stringlengths
51
15.3k
url
stringlengths
31
59
code
stringlengths
51
31k
ast_errors
stringlengths
0
1.46k
token_counts
int64
6
3.32k
file_name
stringlengths
5
56
language
stringclasses
1 value
path
stringlengths
7
134
commit_id
stringlengths
40
40
repo
stringlengths
3
28
complexity
int64
1
153
125,184
47
15
22
251
18
0
65
224
_format
[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.
https://github.com/ray-project/ray.git
def _format(val, valtype, floatfmt, missingval="", has_invisible=True): # noqa if val is None: return missingval if valtype in [int, _text_type]: return "{0}".format(val) elif valtype is _binary_type: try: return _text_type(val, "ascii") except TypeError: ...
132
tabulate.py
Python
python/ray/_private/thirdparty/tabulate/tabulate.py
adf24bfa9723b0621183bb27f0c889b813c06e8a
ray
8
42,070
10
8
3
53
9
0
10
19
set_context
Convert docs to pydata-sphinx-theme and add new material (#2842) * Do basic conversion of site to pydata_sphinx_theme * Remove some pae structure customizations we no longer need * Add some custom CSS * Tweak a few more colors * Remove vestigial div closing tag * Reorganize release notes into hierarchic...
https://github.com/mwaskom/seaborn.git
def set_context(context=None, font_scale=1, rc=None): context_object = plotting_context(context, font_scale, rc) mpl.rcParams.update(context_object)
34
rcmod.py
Python
seaborn/rcmod.py
34662f4be5c364e7518f9c1118c9b362038ee5dd
seaborn
1
311,030
7
10
3
35
5
0
7
21
async_unload
Replace Synology DSM services with buttons (#57352)
https://github.com/home-assistant/core.git
async def async_unload(self) -> None: await self._syno_api_executer(self.dsm.logout)
19
common.py
Python
homeassistant/components/synology_dsm/common.py
5d7d652237b2368320a68c772ce3d837e4c1d04b
core
1
278,720
35
16
14
160
16
0
46
191
clone_keras_tensors
Remove pylint comments. PiperOrigin-RevId: 452353044
https://github.com/keras-team/keras.git
def clone_keras_tensors(args, keras_tensor_mapping): result = [] for obj in tf.nest.flatten(args): if node_module.is_keras_tensor(obj): if id(obj) in keras_tensor_mapping: cpy = keras_tensor_mapping[id(obj)] else: # Create copy of keras_tensor...
98
functional_utils.py
Python
keras/engine/functional_utils.py
3613c3defc39c236fb1592c4f7ba1a9cc887343a
keras
4
22,168
7
7
9
31
4
0
7
21
get_plain_headed_box
Rename notpip to pip. Vendor in pip-22.2.1 and latest requirementslib and vistir.
https://github.com/pypa/pipenv.git
def get_plain_headed_box(self) -> "Box": return PLAIN_HEADED_SUBSTITUTIONS.get(self, self)
17
box.py
Python
pipenv/patched/pip/_vendor/rich/box.py
cd5a9683be69c86c8f3adcd13385a9bc5db198ec
pipenv
1
156,567
36
12
11
129
10
0
44
106
apply_and_enforce
Add kwarg ``enforce_ndim`` to ``dask.array.map_blocks()`` (#8865)
https://github.com/dask/dask.git
def apply_and_enforce(*args, **kwargs): func = kwargs.pop("_func") expected_ndim = kwargs.pop("expected_ndim") out = func(*args, **kwargs) if getattr(out, "ndim", 0) != expected_ndim: out_ndim = getattr(out, "ndim", 0) raise ValueError( f"Dimension mismatch: expected out...
68
core.py
Python
dask/array/core.py
2b90415b02d3ad1b08362889e0818590ca3133f4
dask
2
178,165
33
11
6
83
10
0
42
90
get_jobs_by_meta
feat: DEV-2075: Add mixin to Project to support mechanism to cancel old jobs (#2547) * feat: DEV-2075: Add mixin to Project to support mechanism to cancel old jobs
https://github.com/heartexlabs/label-studio.git
def get_jobs_by_meta(queue, func_name, meta): # get all jobs from Queue jobs = (job for job in queue.get_jobs() if job.func.__name__ == func_name ) # return only with same meta data return [job for job in jobs if hasattr(job, 'meta') and job.meta == meta]
52
redis.py
Python
label_studio/core/redis.py
283628097a10e8abafc94c683bc8be2d79a5998f
label-studio
6
269,601
8
8
3
38
4
1
9
17
enable_tf_random_generator
Reformatting the codebase with black. PiperOrigin-RevId: 450093126
https://github.com/keras-team/keras.git
def enable_tf_random_generator(): global _USE_GENERATOR_FOR_RNG _USE_GENERATOR_FOR_RNG = True @keras_export("keras.backend.experimental.disable_tf_random_generator", v1=[])
@keras_export("keras.backend.experimental.disable_tf_random_generator", v1=[])
10
backend.py
Python
keras/backend.py
84afc5193d38057e2e2badf9c889ea87d80d8fbf
keras
1
42,548
48
14
18
205
27
0
61
258
collocation_list
Docstring tests (#3050) * fixed pytests * fixed more pytests * fixed more pytest and changed multiline pytest issues fixes for snowball.py and causal.py * fixed pytests (mainly multiline or rounding issues) * fixed treebank pytests, removed test for return_string=True (deprecated) * fixed destructive.py...
https://github.com/nltk/nltk.git
def collocation_list(self, num=20, window_size=2): if not ( "_collocations" in self.__dict__ and self._num == num and self._window_size == window_size ): self._num = num self._window_size = window_size # print("Building co...
126
text.py
Python
nltk/text.py
8a4cf5d94eb94b6427c5d1d7907ba07b119932c5
nltk
5
294,024
33
13
15
126
21
0
34
116
library_section_payload
Support multiple Plex servers in media browser (#68321)
https://github.com/home-assistant/core.git
def library_section_payload(section): try: children_media_class = ITEM_TYPE_MEDIA_CLASS[section.TYPE] except KeyError as err: raise UnknownMediaType(f"Unknown type received: {section.TYPE}") from err server_id = section._server.machineIdentifier # pylint: disable=protected-access r...
77
media_browser.py
Python
homeassistant/components/plex/media_browser.py
653305b998dd033365576db303b32dd5df3a6c54
core
2
213,030
27
9
8
111
4
0
36
99
gen_skeleton
fix: Py27hash fix (#2182) * Add third party py27hash code * Add Py27UniStr and unit tests * Add py27hash_fix utils and tests * Add to_py27_compatible_template and tests * Apply py27hash fix to wherever it is needed * Apply py27hash fix, all tests pass except api_with_any_method_in_swagger * apply py2...
https://github.com/aws/serverless-application-model.git
def gen_skeleton(): # create as Py27Dict and insert key one by one to preserve input order skeleton = Py27Dict() skeleton["openapi"] = "3.0.1" skeleton["info"] = Py27Dict() skeleton["info"]["version"] = "1.0" skeleton["info"]["title"] = ref("AWS::StackName") ...
55
open_api.py
Python
samtranslator/open_api/open_api.py
a5db070f446b7cfebdaa6ad2e3dcf78f6105a272
serverless-application-model
1
260,625
48
12
13
175
24
0
57
171
fit
MAINT validate parameter in KernelPCA (#24020) Co-authored-by: Julien Jerphanion <git@jjerphan.xyz> Co-authored-by: jeremiedbb <jeremiedbb@yahoo.fr>
https://github.com/scikit-learn/scikit-learn.git
def fit(self, X, y=None): self._validate_params() if self.fit_inverse_transform and self.kernel == "precomputed": raise ValueError("Cannot fit_inverse_transform with a precomputed kernel.") X = self._validate_data(X, accept_sparse="csr", copy=self.copy_X) self._cent...
106
_kernel_pca.py
Python
sklearn/decomposition/_kernel_pca.py
3312bc2ea6aad559643a1d920e3380fa123f627c
scikit-learn
4
42,787
146
13
71
759
49
0
267
1,032
get_conn
Use KubernetesHook to create api client in KubernetesPodOperator (#20578) Add support for k8s hook in KPO; use it always (even when no conn id); continue to consider the core k8s settings that KPO already takes into account but emit deprecation warning about them. KPO historically takes into account a few settings ...
https://github.com/apache/airflow.git
def get_conn(self) -> Any: in_cluster = self._coalesce_param( self.in_cluster, self.conn_extras.get("extra__kubernetes__in_cluster") or None ) cluster_context = self._coalesce_param( self.cluster_context, self.conn_extras.get("extra__kubernetes__cluster_context"...
460
kubernetes.py
Python
airflow/providers/cncf/kubernetes/hooks/kubernetes.py
60eb9e106f5915398eafd6aa339ec710c102dc09
airflow
24
149,758
29
15
18
272
19
0
37
180
load_data
add freqao backend machinery, user interface, documentation
https://github.com/freqtrade/freqtrade.git
def load_data(self) -> Any: model = load(self.model_path+self.model_filename+"_model.joblib") with open(self.model_path+self.model_filename+"_metadata.json", 'r') as fp: self.data = json.load(fp) if self.data.get('training_features_list'): self.training_...
155
data_handler.py
Python
freqtrade/freqai/data_handler.py
fc837c4daa27a18ff0e86128f4d52089b88fa5fb
freqtrade
3
144,300
13
9
3
56
11
0
13
34
_bind
[Ray DAG] Implement experimental Ray DAG API for task/class (#22058)
https://github.com/ray-project/ray.git
def _bind(self, *args, **kwargs): from ray.experimental.dag.class_node import ClassNode return ClassNode(self.__ray_metadata__.modified_class, args, kwargs, {})
38
actor.py
Python
python/ray/actor.py
c065e3f69ec248383d98b45a8d1c00832ccfdd57
ray
1
337,524
22
13
13
128
11
0
42
149
find_device
Big model inference (#345) * Big model inference * Reorganize port cleanup * Last cleanup * Test fix * Quality * Update src/accelerate/big_modeling.py Co-authored-by: Patrick von Platen <patrick.v.platen@gmail.com> * Fix bug in default mem * Check device map is complete * More tests * Mak...
https://github.com/huggingface/accelerate.git
def find_device(data): if isinstance(data, Mapping): for obj in data.values(): device = find_device(obj) if device is not None: return device elif isinstance(data, (tuple, list)): for obj in data: device = find_device(obj) if d...
82
operations.py
Python
src/accelerate/utils/operations.py
f56f4441b3d448f4a81d5131c03e7dd73eac3ba0
accelerate
8
60,126
17
10
12
78
8
0
19
80
wait
Add thread-safe async primitives `Event` and `Future` (#7865) Co-authored-by: Serina Grill <42048900+serinamarie@users.noreply.github.com>
https://github.com/PrefectHQ/prefect.git
async def wait(self) -> None: if self._is_set: return if not self._loop: self._loop = get_running_loop() self._event = asyncio.Event() await self._event.wait()
44
primitives.py
Python
src/prefect/_internal/concurrency/primitives.py
a368874d1b145c1ec5201e5efd3c26ce7c1e8611
prefect
3
78,295
18
10
8
67
10
0
21
89
test_get_settings_no_request
Add generic settings to compliment site-specific settings (#8327)
https://github.com/wagtail/wagtail.git
def test_get_settings_no_request(self): context = Context() template = Template( "{% load wagtailsettings_tags %}" "{% get_settings %}" "{{ settings.tests.testgenericsetting.title }}" ) self.assertEqual(template.render(context), self.default...
36
test_templates.py
Python
wagtail/contrib/settings/tests/generic/test_templates.py
d967eccef28ce47f60d26be1c28f2d83a25f40b0
wagtail
1
208,719
44
12
25
198
13
0
73
344
get_tail
This fixed the mixing of multiple history seen in #13631 It forces get_tail to put the current session last in the returned results.
https://github.com/ipython/ipython.git
def get_tail(self, n=10, raw=True, output=False, include_latest=False): self.writeout_cache() if not include_latest: n += 1 # cursor/line/entry this_cur = list( self._run_sql( "WHERE session == ? ORDER BY line DESC LIMIT ? ", ...
128
history.py
Python
IPython/core/history.py
dc5bcc1c50892a5128fcf128af28887226144927
ipython
3
268,911
12
10
6
70
13
1
16
29
opt_combinations_only
- Consolidate disparate test-related files into a single testing_infra folder. - Cleanup TODO related to removing testing infra as a dependency of the Keras target. - Standardize import naming: there is now only "test_combinations" for test combinations, and "test_utils" for utilities. The TF utilities module "test_uti...
https://github.com/keras-team/keras.git
def opt_combinations_only(): experimental_opt_combinations = test_combinations.combine( mode='eager', opt_cls=optimizer_experimental.Optimizer) orig_opt_combination = test_combinations.combine( opt_cls=optimizer_v2.OptimizerV2) return experimental_opt_combinations + orig_opt_combination @tf_test_...
@tf_test_utils.with_control_flow_v2
37
loss_scale_optimizer_test.py
Python
keras/mixed_precision/loss_scale_optimizer_test.py
b96518a22bfd92a29811e507dec0b34248a8a3f5
keras
1
148,285
13
12
5
57
7
0
16
11
_normalize_entries
[Bugfix] fix invalid excluding of Black (#24042) - We should use `--force-exclude` when we pass code path explicitly https://black.readthedocs.io/en/stable/usage_and_configuration/the_basics.html?highlight=--force-exclude#command-line-options - Recover the files in `python/ray/_private/thirdparty` which has been form...
https://github.com/ray-project/ray.git
def _normalize_entries(entries, separators=None): norm_files = {} for entry in entries: norm_files[normalize_file(entry.path, separators=separators)] = entry return norm_files
36
util.py
Python
python/ray/_private/thirdparty/pathspec/util.py
0e6c042e29cbbe429d81c9c1af3c75c261f00980
ray
2
209,543
26
10
9
117
13
0
30
61
overlap_frag
E275 - Missing whitespace after keyword (#3711) Co-authored-by: Alexander Aring <alex.aring@gmail.com> Co-authored-by: Anmol Sarma <me@anmolsarma.in> Co-authored-by: antoine.torre <torreantoine1@gmail.com> Co-authored-by: Antoine Vacher <devel@tigre-bleu.net> Co-authored-by: Arnaud Ebalard <arno@natisbad.org> Co-...
https://github.com/secdev/scapy.git
def overlap_frag(p, overlap, fragsize=8, overlap_fragsize=None): if overlap_fragsize is None: overlap_fragsize = fragsize q = p.copy() del q[IP].payload q[IP].add_payload(overlap) qfrag = fragment(q, overlap_fragsize) qfrag[-1][IP].flags |= 1 return qfrag + fragment(p, fragsiz...
76
inet.py
Python
scapy/layers/inet.py
08b1f9d67c8e716fd44036a027bdc90dcb9fcfdf
scapy
2
144,233
8
9
2
34
6
0
8
22
__len__
[RLlib] AlphaStar: Parallelized, multi-agent/multi-GPU learning via league-based self-play. (#21356)
https://github.com/ray-project/ray.git
def __len__(self): return sum(len(s) for s in self.shards)
20
distributed_learners.py
Python
rllib/agents/alpha_star/distributed_learners.py
3f03ef8ba8016b095c611c4d2e118771e4a750ca
ray
2
263,805
68
11
11
135
17
0
88
163
update_exe_pe_checksum
winutils: optimize PE headers fixup Attempt to optimize PE headers fix-up from both time- and memory- intensity perspective. First, avoid specifying `fast_load=False` in `pefile.PE` constructor, because that triggers the bytes statistics collection https://github.com/erocarrera/pefile/blob/v2022.5.30/pefile.py#L2862-...
https://github.com/pyinstaller/pyinstaller.git
def update_exe_pe_checksum(exe_path): import pefile # Compute checksum using our equivalent of the MapFileAndCheckSumW - for large files, it is significantly faster # than pure-pyton pefile.PE.generate_checksum(). However, it requires the file to be on disk (i.e., cannot operate # on a memory buff...
72
winutils.py
Python
PyInstaller/utils/win32/winutils.py
41483cb9e6d5086416c8fea6ad6781782c091c60
pyinstaller
2
78,323
74
16
20
201
17
0
102
506
test_get_page_url_when_for_settings_fetched_via_for_site
Add generic settings to compliment site-specific settings (#8327)
https://github.com/wagtail/wagtail.git
def test_get_page_url_when_for_settings_fetched_via_for_site(self): self._create_importantpagessitesetting_object() settings = ImportantPagesSiteSetting.for_site(self.default_site) # Force site root paths query beforehand self.default_site.root_page._get_site_root_paths() ...
115
test_model.py
Python
wagtail/contrib/settings/tests/site_specific/test_model.py
d967eccef28ce47f60d26be1c28f2d83a25f40b0
wagtail
2
269,136
48
15
18
142
12
0
58
140
recursively_deserialize_keras_object
Support Keras saving/loading for ShardedVariables with arbitrary partitions. PiperOrigin-RevId: 439837516
https://github.com/keras-team/keras.git
def recursively_deserialize_keras_object(config, module_objects=None): if isinstance(config, dict): if 'class_name' in config: return generic_utils.deserialize_keras_object( config, module_objects=module_objects) else: return { key: recursively_deserialize_keras_object(confi...
89
load.py
Python
keras/saving/saved_model/load.py
e61cbc52fd3b0170769c120e9b8dabc8c4205322
keras
6
309,801
28
14
15
106
9
0
42
227
get_latest_device_activity
spelling: components/august (#64232) Co-authored-by: Josh Soref <jsoref@users.noreply.github.com>
https://github.com/home-assistant/core.git
def get_latest_device_activity(self, device_id, activity_types): if device_id not in self._latest_activities: return None latest_device_activities = self._latest_activities[device_id] latest_activity = None for activity_type in activity_types: if activi...
69
activity.py
Python
homeassistant/components/august/activity.py
dadcc5ebcbcf951ff677568b281c5897d990c8ae
core
6
159,623
6
12
3
40
7
0
6
12
project_root
[ATO-114]Add nightly workflows and creation scripts
https://github.com/RasaHQ/rasa.git
def project_root() -> Path: return Path(os.path.dirname(__file__)).parent.parent
23
prepare_nightly_release.py
Python
scripts/prepare_nightly_release.py
9f634d248769198881bbb78ccd8d333982462ef5
rasa
1
248,026
24
14
17
121
14
0
28
279
add_device_change
Process device list updates asynchronously (#12365)
https://github.com/matrix-org/synapse.git
def add_device_change(self, user_id, device_ids, host): for device_id in device_ids: stream_id = self.get_success( self.store.add_device_change_to_streams( "user_id", [device_id], ["!some:room"] ) ) self.get_succe...
79
test_devices.py
Python
tests/storage/test_devices.py
aa2811026402394b4013033f075d8f509cdc1257
synapse
2
267,050
35
13
7
71
7
0
54
93
self_check
ansible-test - Support multiple coverage versions. ci_complete ci_coverage
https://github.com/ansible/ansible.git
def self_check() -> None: # Verify all supported Python versions have a coverage version. for version in SUPPORTED_PYTHON_VERSIONS: get_coverage_version(version) # Verify all controller Python versions are mapped to the latest coverage version. for version in CONTROLLER_PYTHON_VERSIONS: ...
35
coverage_util.py
Python
test/lib/ansible_test/_internal/coverage_util.py
b9606417598217106e394c12c776d8c5ede9cd98
ansible
4
258,546
65
15
21
310
26
0
99
320
predict
MAINT Do not compute distances for uniform weighting (#22280)
https://github.com/scikit-learn/scikit-learn.git
def predict(self, X): if self.weights == "uniform": # In that case, we do not need the distances to perform # the weighting so we do not compute them. neigh_ind = self.kneighbors(X, return_distance=False) neigh_dist = None else: neigh_...
199
_regression.py
Python
sklearn/neighbors/_regression.py
fb082b223dc9f1dd327f48dc9b830ee382d6f661
scikit-learn
6
190,825
61
10
10
130
7
0
90
217
getImageDescriptor
Reformat of files using black These files were not properly formatted.
https://github.com/thumbor/thumbor.git
def getImageDescriptor(self, im, xy=None): # Defaule use full image and place at upper left if xy is None: xy = (0, 0) # Image separator, bb = b"\x2C" # Image position and size bb += int2long(xy[0]) # Left position bb += int2long(xy[1]) #...
74
pil.py
Python
thumbor/engines/extensions/pil.py
3c745ef193e9af9244cc406734e67815377472ed
thumbor
2
272,348
36
12
9
203
22
0
62
153
test_calculate_scores_one_dim_with_scale
Reformatting the codebase with black. PiperOrigin-RevId: 450093126
https://github.com/keras-team/keras.git
def test_calculate_scores_one_dim_with_scale(self): # Query tensor of shape [1, 1, 1] q = np.array([[[1.1]]], dtype=np.float32) # Key tensor of shape [1, 1, 1] k = np.array([[[1.6]]], dtype=np.float32) attention_layer = keras.layers.Attention(use_scale=True) atte...
139
attention_test.py
Python
keras/layers/attention/attention_test.py
84afc5193d38057e2e2badf9c889ea87d80d8fbf
keras
1
281,114
65
12
48
339
22
0
84
266
prepare_all_coins_df
Crypto menu refactor (#1119) * enabled some crypto commands in dd to be called independent of source loaded * support for coin_map_df in all dd functions + load ta and plot chart refactor * updated tests and removed coingecko scrapping where possible * removed ref of command from hugo * updated pycoingecko...
https://github.com/OpenBB-finance/OpenBBTerminal.git
def prepare_all_coins_df() -> pd.DataFrame: gecko_coins_df = load_coins_list("coingecko_coins.json") paprika_coins_df = load_coins_list("coinpaprika_coins.json") paprika_coins_df = paprika_coins_df[paprika_coins_df["is_active"]] paprika_coins_df = paprika_coins_df[["rank", "id", "name", "symbol",...
191
cryptocurrency_helpers.py
Python
gamestonk_terminal/cryptocurrency/cryptocurrency_helpers.py
ea964109d654394cc0a5237e6ec5510ba6404097
OpenBBTerminal
1
34,009
30
9
3
64
10
1
33
52
_set_gradient_checkpointing
Add Nystromformer (#14659) * Initial commit * Config and modelling changes Added Nystromformer-specific attributes to config and removed all decoder functionality from modelling. * Modelling and test changes Added Nystrom approximation and removed decoder tests. * Code quality fixes * Modeling change...
https://github.com/huggingface/transformers.git
def _set_gradient_checkpointing(self, module, value=False): if isinstance(module, NystromformerEncoder): module.gradient_checkpointing = value NYSTROMFORMER_START_DOCSTRING = r NYSTROMFORMER_INPUTS_DOCSTRING = r @add_start_docstrings( "The bare Nyströmformer Model transformer outputting raw...
@add_start_docstrings( "The bare Nyströmformer Model transformer outputting raw hidden-states without any specific head on top.", NYSTROMFORMER_START_DOCSTRING, )
24
modeling_nystromformer.py
Python
src/transformers/models/nystromformer/modeling_nystromformer.py
28e091430eea9e0d40839e56fd0d57aec262f5f9
transformers
2
119,984
23
9
8
124
16
1
27
91
bcoo_dot_general_sampled
[sparse] Update docstrings for bcoo primitives. PiperOrigin-RevId: 438685829
https://github.com/google/jax.git
def bcoo_dot_general_sampled(A, B, indices, *, dimension_numbers): (lhs_contract, rhs_contract), (lhs_batch, rhs_batch) = dimension_numbers cdims = (api_util._ensure_index_tuple(lhs_contract), api_util._ensure_index_tuple(rhs_contract)) bdims = (api_util._ensure_index_tuple(lhs_batch), ap...
@bcoo_dot_general_sampled_p.def_impl
80
bcoo.py
Python
jax/experimental/sparse/bcoo.py
3184dd65a222354bffa2466d9a375162f5649132
jax
1
80,736
21
11
9
95
10
0
28
83
_get_instance_id
Fix up new Django 3.0 deprecations Mostly text based: force/smart_text, ugettext_*
https://github.com/ansible/awx.git
def _get_instance_id(from_dict, new_id, default=''): instance_id = default for key in new_id.split('.'): if not hasattr(from_dict, 'get'): instance_id = default break instance_id = from_dict.get(key, default) from_dict = instance_id return smart_str(insta...
56
_inventory_source.py
Python
awx/main/migrations/_inventory_source.py
a3a216f91f1158fd54c001c34cbdf2f68ccbc272
awx
3
100,396
48
11
13
225
20
0
74
225
compile_sample
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 -...
https://github.com/deepfakes/faceswap.git
def compile_sample(self, batch_size, samples=None, images=None, masks=None): num_images = self._config.get("preview_images", 14) num_images = min(batch_size, num_images) if batch_size is not None else num_images retval = {} for side in ("a", "b"): logger.debug("Compi...
153
_base.py
Python
plugins/train/trainer/_base.py
c1512fd41d86ef47a5d1ce618d6d755ef7cbacdf
faceswap
6
314,211
8
6
6
25
4
0
8
22
temperature
Weather unit conversion (#73441) Co-authored-by: Erik <erik@montnemery.com>
https://github.com/home-assistant/core.git
def temperature(self) -> float | None: return self._attr_temperature
14
__init__.py
Python
homeassistant/components/weather/__init__.py
90e1fb6ce2faadb9a35fdbe1774fce7b4456364f
core
1
20,801
6
7
3
26
4
0
6
20
get_time
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...
https://github.com/pypa/pipenv.git
def get_time(self) -> float: return self._get_time()
14
progress.py
Python
pipenv/patched/notpip/_vendor/rich/progress.py
f3166e673fe8d40277b804d35d77dcdb760fc3b3
pipenv
1
118,718
28
12
13
173
19
0
35
142
test_add_unstyled_rows_to_styled_rows
Pandas 1.4 styler fix (#4316) Change the way we detect custom styling in a DataFrame, to account for changes in Pandas 1.4. Our DataFrame styling support is based on internal Pandas APIs, so they're always subject to change out from underneath us. In general, we'd prefer to only pass `display_value` data to the fro...
https://github.com/streamlit/streamlit.git
def test_add_unstyled_rows_to_styled_rows(self, st_element, get_proto): df1 = pd.DataFrame([5, 6]) df2 = pd.DataFrame([7, 8]) css_values = [ {css_s("color", "black")}, {css_s("color", "black")}, set(), set(), ] x = st_ele...
106
legacy_dataframe_styling_test.py
Python
lib/tests/streamlit/legacy_dataframe_styling_test.py
2c153aa179a27539f856e389870161d5a58da213
streamlit
1
282,770
13
11
4
53
9
0
13
37
handle_error_code
Output Missing API Key Message to Console (#1357) * Decorator to output error msg to console of missing API Key * Refactor FMP & alpha advantage * Refactor FRED & QUANDL * Refactor Polygon * Refactor FRED * Refactor FRED * Refactor Finnhub & coinmarketcap & Newsapi * Allow disabling of check api ...
https://github.com/OpenBB-finance/OpenBBTerminal.git
def handle_error_code(requests_obj, error_code_map): for error_code, error_msg in error_code_map.items(): if requests_obj.status_code == error_code: console.print(error_msg)
32
helper_funcs.py
Python
gamestonk_terminal/helper_funcs.py
401e4c739a6f9d18944e0ab49c782e97b56fda94
OpenBBTerminal
3
21,882
27
15
10
99
11
0
31
97
detect
Rename notpip to pip. Vendor in pip-22.2.1 and latest requirementslib and vistir.
https://github.com/pypa/pipenv.git
def detect(byte_str): if not isinstance(byte_str, bytearray): if not isinstance(byte_str, bytes): raise TypeError( f"Expected object of type bytes or bytearray, got: {type(byte_str)}" ) byte_str = bytearray(byte_str) detector = UniversalDetector() ...
53
__init__.py
Python
pipenv/patched/pip/_vendor/chardet/__init__.py
cd5a9683be69c86c8f3adcd13385a9bc5db198ec
pipenv
3
212,923
37
13
9
133
13
0
46
129
delete_file
Added report_error setting for user_settings_delete_file. Global Settings window complete rework to use Tabs. Hoping nothing broke, but just remember things are in flux for a little bit while the ttk scrollbars are finishing up
https://github.com/PySimpleGUI/PySimpleGUI.git
def delete_file(self, filename=None, path=None, report_error=False): if filename is not None or path is not None or (filename is None and path is None): self.set_location(filename=filename, path=path) try: os.remove(self.full_filename) except Exception as e: ...
83
PySimpleGUI.py
Python
PySimpleGUI.py
f776589349476a41b98aa1f467aff2f30e2a8fc2
PySimpleGUI
7
60,235
31
9
10
91
11
0
44
86
compose
Balanced joint maximum mean discrepancy for deep transfer learning
https://github.com/jindongwang/transferlearning.git
def compose(base_map, next_map): ax1, a1, b1 = base_map ax2, a2, b2 = next_map if ax1 is None: ax = ax2 elif ax2 is None or ax1 == ax2: ax = ax1 else: raise AxisMismatchException return ax, a1 * a2, a1 * b2 + b1
58
coord_map.py
Python
code/deep/BJMMD/caffe/python/caffe/coord_map.py
cc4d0564756ca067516f71718a3d135996525909
transferlearning
4
225,809
9
7
3
29
5
1
9
22
is_doc_id_none
Add index composability! (#86) Summary of changes - Bumped version to 0.1.0 - Abstracted out a BaseDocument class that both Document (from data loaders) and IndexStruct (our data struct classes) inherit from. - Add a DocumentStore that contains the id's of all BaseDocuments. Both Document objects and IndexStruct ...
https://github.com/jerryjliu/llama_index.git
def is_doc_id_none(self) -> bool: return self.doc_id is None @dataclass
@dataclass
14
schema.py
Python
gpt_index/schema.py
c22d865acb3899a181921d94b6e94e665a12b432
llama_index
1
301,395
17
10
6
91
17
0
19
37
test_setup_not_ready
Create iAlarmXR integration (#67817) * Creating iAlarmXR integration * fixing after review code * fixing remaining review hints * fixing remaining review hints * updating underlying pyialarm library * Creating iAlarmXR integration * fixing after review code * fixing remaining review hints * fix...
https://github.com/home-assistant/core.git
async def test_setup_not_ready(hass, ialarmxr_api, mock_config_entry): ialarmxr_api.return_value.get_mac = Mock(side_effect=ConnectionError) mock_config_entry.add_to_hass(hass) assert not await hass.config_entries.async_setup(mock_config_entry.entry_id) await hass.async_block_till_done() asser...
55
test_init.py
Python
tests/components/ialarm_xr/test_init.py
42c80dda85f567192c182da2b4c603408a890381
core
1
264,031
99
15
19
243
20
0
146
397
collect_qtqml_files
hookutils: reorganize the Qt hook utilities Reorganize the Qt module information to provide information necessary to deal with variations between different python Qt bindings (PySide2, PyQt5, PySide6, and PyQt6). Replace the existing table-like dictionary with list of entries, which is easier to format and document. F...
https://github.com/pyinstaller/pyinstaller.git
def collect_qtqml_files(self): # No-op if requested Qt-based package is not available. if self.version is None: return [], [] # Not all PyQt5/PySide2 installs have QML files. In this case, location['Qml2ImportsPath'] is empty. # Furthermore, even if location path i...
144
__init__.py
Python
PyInstaller/utils/hooks/qt/__init__.py
d789a7daa7712716c89259b987349917a89aece7
pyinstaller
6
82,418
50
11
26
356
15
0
72
314
test_patricks_move
ci: Added codespell (#7355) Co-authored-by: Christian Clauss <cclauss@me.com> * ci: codespell config taken from #7292
https://github.com/django-cms/django-cms.git
def test_patricks_move(self): self.assertEqual(self.pg.node.parent, self.pe.node) # perform moves under slave... self.move_page(self.pg, self.pc) self.reload_pages() # page is now under PC self.assertEqual(self.pg.node.parent, self.pc.node) self.assertEqu...
215
test_permmod.py
Python
cms/tests/test_permmod.py
c1290c9ff89cb00caa5469129fd527e9d82cd820
django-cms
1
291,315
23
10
9
85
15
0
24
67
test_text_new_min_max_pattern
Add `text` platform (#79454) Co-authored-by: Franck Nijhof <frenck@frenck.nl> Co-authored-by: Franck Nijhof <git@frenck.dev>
https://github.com/home-assistant/core.git
async def test_text_new_min_max_pattern(hass): text = MockTextEntity(native_min=-1, native_max=500, pattern=r"[a-z]") text.hass = hass assert text.capability_attributes == { ATTR_MIN: 0, ATTR_MAX: MAX_LENGTH_STATE_STATE, ATTR_MODE: TextMode.TEXT, ATTR_PATTERN: r"[a-z]",...
55
test_init.py
Python
tests/components/text/test_init.py
003e4224c89a6da381960dc5347750d1521d85c9
core
1
260,017
266
15
48
713
67
0
475
735
load_dataset
DOC rework plot_document_classification_20newsgroups.py example (#22928) Co-authored-by: Jérémie du Boisberranger <34657725+jeremiedbb@users.noreply.github.com> Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org> Co-authored-by: Julien Jerphanion <git@jjerphan.xyz>
https://github.com/scikit-learn/scikit-learn.git
def load_dataset(verbose=False, remove=()): data_train = fetch_20newsgroups( subset="train", categories=categories, shuffle=True, random_state=42, remove=remove, ) data_test = fetch_20newsgroups( subset="test", categories=categories, shu...
224
plot_document_classification_20newsgroups.py
Python
examples/text/plot_document_classification_20newsgroups.py
71028322e8964cf1f341a7b293abaefeb5275e12
scikit-learn
2
155,176
51
13
13
222
21
0
64
193
apply
FEAT-#5053: Add pandas on unidist execution with MPI backend (#5059) Signed-off-by: Igoshev, Iaroslav <iaroslav.igoshev@intel.com>
https://github.com/modin-project/modin.git
def apply(self, func, *args, **kwargs): logger = get_logger() logger.debug(f"ENTER::Partition.apply::{self._identity}") data = self._data call_queue = self.call_queue + [[func, args, kwargs]] if len(call_queue) > 1: logger.debug(f"SUBMIT::_apply_list_of_funcs...
126
partition.py
Python
modin/core/execution/unidist/implementations/pandas_on_unidist/partitioning/partition.py
193505fdf0c984743397ba3df56262f30aee13a8
modin
2
157,201
55
14
15
278
22
1
60
148
test_roundtrip_nullable_dtypes
Add support for `use_nullable_dtypes` to `dd.read_parquet` (#9617)
https://github.com/dask/dask.git
def test_roundtrip_nullable_dtypes(tmp_path, write_engine, read_engine): if read_engine == "fastparquet" or write_engine == "fastparquet": pytest.xfail("https://github.com/dask/fastparquet/issues/465") df = pd.DataFrame( { "a": pd.Series([1, 2, pd.NA, 3, 4], dtype="Int64"), ...
@PYARROW_MARK
182
test_parquet.py
Python
dask/dataframe/io/tests/test_parquet.py
b1e468e8645baee30992fbfa84250d816ac1098a
dask
3
290,831
90
16
47
410
41
0
167
606
async_update_group_state
Cleanup supported_features in group (#82242) * Cleanup supported_features in group * Remove defaults (already set to 0 in fan and media_player)
https://github.com/home-assistant/core.git
def async_update_group_state(self) -> None: self._attr_assumed_state = False states = [ state for entity_id in self._entities if (state := self.hass.states.get(entity_id)) is not None ] self._attr_assumed_state |= not states_equal(states) ...
265
fan.py
Python
homeassistant/components/group/fan.py
38a8e86ddeb65ee8c731b90a7063a3b3702dc1ef
core
14
261,351
15
10
6
75
11
0
15
61
predict
OPTIM use pairwise_distances_argmin in NearestCentroid.predict (#24645) Co-authored-by: Julien Jerphanion <git@jjerphan.xyz>
https://github.com/scikit-learn/scikit-learn.git
def predict(self, X): check_is_fitted(self) X = self._validate_data(X, accept_sparse="csr", reset=False) return self.classes_[ pairwise_distances_argmin(X, self.centroids_, metric=self.metric) ]
48
_nearest_centroid.py
Python
sklearn/neighbors/_nearest_centroid.py
e01035d3b2dc147cbbe9f6dbd7210a76119991e8
scikit-learn
1
109,149
69
13
35
487
22
0
146
463
_suplabels
Add rcparam for figure label size and weight (#22566) * Add rcparam for figure label size and weight
https://github.com/matplotlib/matplotlib.git
def _suplabels(self, t, info, **kwargs): suplab = getattr(self, info['name']) x = kwargs.pop('x', None) y = kwargs.pop('y', None) if info['name'] in ['_supxlabel', '_suptitle']: autopos = y is None elif info['name'] == '_supylabel': autopos = x ...
283
figure.py
Python
lib/matplotlib/figure.py
eeac402ec56d7e69234e0cd7b15f59d53852e457
matplotlib
16
47,465
65
15
34
372
49
0
84
398
test_backfill_execute_subdag_with_removed_task
Replace usage of `DummyOperator` with `EmptyOperator` (#22974) * Replace usage of `DummyOperator` with `EmptyOperator`
https://github.com/apache/airflow.git
def test_backfill_execute_subdag_with_removed_task(self): dag = self.dagbag.get_dag('example_subdag_operator') subdag = dag.get_task('section-1').subdag session = settings.Session() executor = MockExecutor() job = BackfillJob( dag=subdag, start_date=DEFAULT_...
232
test_backfill_job.py
Python
tests/jobs/test_backfill_job.py
49e336ae0302b386a2f47269a6d13988382d975f
airflow
2
210,267
46
11
11
197
19
1
59
174
__call__
Remove conditional block in RCNN export onnx (#5371) * support rcnn onnx * clean code * update cascade rcnn * add todo for rpn proposals
https://github.com/PaddlePaddle/PaddleDetection.git
def __call__(self, mask_out, bboxes, bbox_num, origin_shape): num_mask = mask_out.shape[0] origin_shape = paddle.cast(origin_shape, 'int32') # TODO: support bs > 1 and mask output dtype is bool pred_result = paddle.zeros( [num_mask, origin_shape[0][0], origin_shape[0...
@register
129
post_process.py
Python
ppdet/modeling/post_process.py
afb3b7a1c7842921b8eacae9d2ac4f2e660ea7e1
PaddleDetection
1
81,344
146
19
96
894
7
0
244
1,599
context_stub
Adding fields to job_metadata for workflows and approval nodes (#12255)
https://github.com/ansible/awx.git
def context_stub(cls): context = { 'job': { 'allow_simultaneous': False, 'artifacts': {}, 'controller_node': 'foo_controller', 'created': datetime.datetime(2018, 11, 13, 6, 4, 0, 0, tzinfo=datetime.timezone.utc), ...
480
notifications.py
Python
awx/main/models/notifications.py
389c4a318035cdb02a972ba8200391765f522169
awx
1
274,647
5
10
11
32
8
0
5
19
test_build_in_tf_function
Reformatting the codebase with black. PiperOrigin-RevId: 450093126
https://github.com/keras-team/keras.git
def test_build_in_tf_function(self): m = metrics.MeanTensor(dtype=tf.float64)
117
base_metric_test.py
Python
keras/metrics/base_metric_test.py
84afc5193d38057e2e2badf9c889ea87d80d8fbf
keras
1
276,840
28
14
13
185
20
0
42
105
func_dump
Reformatting the codebase with black. PiperOrigin-RevId: 450093126
https://github.com/keras-team/keras.git
def func_dump(func): if os.name == "nt": raw_code = marshal.dumps(func.__code__).replace(b"\\", b"/") code = codecs.encode(raw_code, "base64").decode("ascii") else: raw_code = marshal.dumps(func.__code__) code = codecs.encode(raw_code, "base64").decode("ascii") defaults ...
109
generic_utils.py
Python
keras/utils/generic_utils.py
84afc5193d38057e2e2badf9c889ea87d80d8fbf
keras
4
257,048
6
8
8
33
5
0
6
20
get_evaluation_sets
EvaluationSetClient for deepset cloud to fetch evaluation sets and la… (#2345) * EvaluationSetClient for deepset cloud to fetch evaluation sets and labels for one specific evaluation set * make DeepsetCloudDocumentStore able to fetch uploaded evaluation set names * fix missing renaming of get_evaluation_set_name...
https://github.com/deepset-ai/haystack.git
def get_evaluation_sets(self) -> List[dict]: return self.evaluation_set_client.get_evaluation_sets()
19
deepsetcloud.py
Python
haystack/document_stores/deepsetcloud.py
a273c3a51dd432bd125e5b35df4be94260a2cdb7
haystack
1
95,412
36
13
17
274
26
0
52
215
test_simple
feat(codeowners): Add endpoint to view code owner associations per organization (#31030) See API-2186 So the earlier version of this PR just had the endpoint return the entire serialized ProjectCodeOwners for an organization. While that works, the intention behind this feature is to read and use the associations, s...
https://github.com/getsentry/sentry.git
def test_simple(self): code_owner_1 = self.create_codeowners( self.project_1, self.code_mapping_1, raw=self.data_1["raw"] ) code_owner_2 = self.create_codeowners( self.project_2, self.code_mapping_2, raw=self.data_2["raw"] ) response = self.get_su...
175
test_organization_codeowners_associations.py
Python
tests/sentry/api/endpoints/test_organization_codeowners_associations.py
5efa5eeb57ae6ddf740256e08ce3b9ff4ec98eaa
sentry
2
189,402
14
9
54
53
7
0
15
47
set
Clarify the docs for MObject.animate, MObject.set and Variable. (#2407) * Clarify the docs for MObject.animate, MObject.set and Variable. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Slight reword * Apply suggestions from code review Co-authore...
https://github.com/ManimCommunity/manim.git
def set(self, **kwargs) -> "Mobject": for attr, value in kwargs.items(): setattr(self, attr, value) return self
32
mobject.py
Python
manim/mobject/mobject.py
6d15ca5e745ecdd5d0673adbd55fc7a589abdae3
manim
2
181,598
53
17
23
231
15
0
64
265
test_driver_3
Revert "Deployed 7ccda9a with MkDocs version: 1.3.0" This reverts commit bd9629c40e01241766197119b581a99409b07068.
https://github.com/EpistasisLab/tpot.git
def test_driver_3(): args_list = [ 'tests/tests.csv', '-is', ',', '-target', 'class', '-g', '1', '-p', '2', '-cv', '3', '-s',' 45', '-config', 'TPOT light', '-v', '2' ...
125
driver_tests.py
Python
tests/driver_tests.py
388616b6247ca4ea8de4e2f340d6206aee523541
tpot
2
263,901
58
12
15
105
13
0
81
111
_find_all_or_none
hookutils: qt: ensure ANGLE DLLs are collected from Anaconda Qt5 Anaconda's Qt5 ships ANGLE DLLs (`libEGL.dll` and `libGLESv2.dll`) but does not seem to provide the `d3dcompiler_XY.dll`. Therefore, we need to adjust the extra Qt DLL collection to consider the latter an optional dependency whose absence does not preclu...
https://github.com/pyinstaller/pyinstaller.git
def _find_all_or_none(qt_library_info, mandatory_dll_patterns, optional_dll_patterns=None): optional_dll_patterns = optional_dll_patterns or [] # Resolve path to the the corresponding python package (actually, its parent directory). Used to preserve directory # structure when DLLs are collected from t...
100
qt.py
Python
PyInstaller/utils/hooks/qt.py
49abfa5498b1db83b8f1b2e859e461b1e8540c6f
pyinstaller
6
261,040
20
11
9
104
13
0
25
60
test_asarray_with_order
ENH Adds Array API support to LinearDiscriminantAnalysis (#22554) Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org> Co-authored-by: Julien Jerphanion <git@jjerphan.xyz>
https://github.com/scikit-learn/scikit-learn.git
def test_asarray_with_order(is_array_api): if is_array_api: xp = pytest.importorskip("numpy.array_api") else: xp = numpy X = xp.asarray([1.2, 3.4, 5.1]) X_new = _asarray_with_order(X, order="F") X_new_np = numpy.asarray(X_new) assert X_new_np.flags["F_CONTIGUOUS"]
67
test_array_api.py
Python
sklearn/utils/tests/test_array_api.py
2710a9e7eefd2088ce35fd2fb6651d5f97e5ef8b
scikit-learn
2
277,191
7
8
4
43
6
0
7
35
set_params
Reformatting the codebase with black. PiperOrigin-RevId: 450093126
https://github.com/keras-team/keras.git
def set_params(self, **params): self.check_params(params) self.sk_params.update(params) return self
25
scikit_learn.py
Python
keras/wrappers/scikit_learn.py
84afc5193d38057e2e2badf9c889ea87d80d8fbf
keras
1
44,722
33
14
20
143
21
0
36
152
_validate_argument_count
Straighten up MappedOperator hierarchy and typing (#21505)
https://github.com/apache/airflow.git
def _validate_argument_count(self) -> None: if isinstance(self.operator_class, str): return # No need to validate deserialized operator. operator = self._create_unmapped_operator( mapped_kwargs={k: unittest.mock.MagicMock(name=k) for k in self.mapped_kwargs}, ...
90
mappedoperator.py
Python
airflow/models/mappedoperator.py
0cd3b11f3a5c406fbbd4433d8e44d326086db634
airflow
5
299,547
88
13
41
477
42
0
158
656
turn_on
Use LightEntityFeature enum in limitlessled (#71061)
https://github.com/home-assistant/core.git
def turn_on(self, transition_time, pipeline, **kwargs): # The night effect does not need a turned on light if kwargs.get(ATTR_EFFECT) == EFFECT_NIGHT: if EFFECT_NIGHT in self._effect_list: pipeline.night_light() self._effect = EFFECT_NIGHT ...
291
light.py
Python
homeassistant/components/limitlessled/light.py
6635fc4e3111f72bfa6095c97b3f522429fa1a8b
core
21
302,108
32
8
15
137
8
0
51
108
test_duplicate_removal
Update MQTT tests to use the config entry setup (#72373) * New testframework and tests for fan platform * Merge test_common_new to test_common * Add alarm_control_panel * Add binary_sensor * Add button * Add camera * Add climate * Add config_flow * Add cover * Add device_tracker_disovery ...
https://github.com/home-assistant/core.git
async def test_duplicate_removal(hass, mqtt_mock_entry_no_yaml_config, caplog): await mqtt_mock_entry_no_yaml_config() async_fire_mqtt_message( hass, "homeassistant/binary_sensor/bla/config", '{ "name": "Beer", "state_topic": "test-topic" }', ) await hass.async_block_till_do...
75
test_discovery.py
Python
tests/components/mqtt/test_discovery.py
52561ce0769ddcf1e8688c8909692b66495e524b
core
1
276,769
53
21
29
297
29
1
79
397
_extract_archive
Reformatting the codebase with black. PiperOrigin-RevId: 450093126
https://github.com/keras-team/keras.git
def _extract_archive(file_path, path=".", archive_format="auto"): if archive_format is None: return False if archive_format == "auto": archive_format = ["tar", "zip"] if isinstance(archive_format, str): archive_format = [archive_format] file_path = io_utils.path_to_string(f...
@keras_export("keras.utils.get_file")
169
data_utils.py
Python
keras/utils/data_utils.py
84afc5193d38057e2e2badf9c889ea87d80d8fbf
keras
11
31,499
29
12
23
195
23
0
33
106
test_run_image_classification_no_trainer
Change no trainer image_classification test (#17635) * Adjust test arguments and use a new example test
https://github.com/huggingface/transformers.git
def test_run_image_classification_no_trainer(self): tmp_dir = self.get_auto_remove_tmp_dir() testargs = f.split() if is_cuda_and_apex_available(): testargs.append("--fp16") _ = subprocess.run(self._launch_args + testargs, stdout=subprocess.PIPE) result = get_results...
112
test_accelerate_examples.py
Python
examples/pytorch/test_accelerate_examples.py
acb709d55150501698b5b500ca49683b913d4b3d
transformers
2
224,518
19
12
10
90
12
0
29
91
nest_paths
Refactor URI handling to not have to deal with backslashes
https://github.com/mkdocs/mkdocs.git
def nest_paths(paths): nested = [] for path in paths: parts = PurePath(path).parent.parts branch = nested for part in parts: part = dirname_to_title(part) branch = find_or_create_node(branch, part) branch.append(path) return nested
55
__init__.py
Python
mkdocs/utils/__init__.py
1c50987f9c17b228fdf22456aa369b83bd6b11b9
mkdocs
3
77,226
4
6
2
16
2
0
4
18
run_before_hook
Extract mixins from Snippet views and use it in generic create/edit/delete views (#8361)
https://github.com/wagtail/wagtail.git
def run_before_hook(self): return None
8
mixins.py
Python
wagtail/admin/views/generic/mixins.py
bc1a2ab1148b0f27cfd1435f8cb0e44c2721102d
wagtail
1
181,586
39
19
8
123
12
0
44
76
test_driver
Revert "Deployed 7ccda9a with MkDocs version: 1.3.0" This reverts commit bd9629c40e01241766197119b581a99409b07068.
https://github.com/EpistasisLab/tpot.git
def test_driver(): batcmd = "python -m tpot.driver tests/tests.csv -is , -target class -g 1 -p 2 -os 4 -cv 5 -s 45 -v 1" ret_stdout = subprocess.check_output(batcmd, shell=True) try: ret_val = float(ret_stdout.decode('UTF-8').split('\n')[-2].split(': ')[-1]) except Exception as e: ...
69
driver_tests.py
Python
tests/driver_tests.py
388616b6247ca4ea8de4e2f340d6206aee523541
tpot
2
164,682
28
10
4
147
13
1
34
66
close
DEP: Protect some ExcelWriter attributes (#45795) * DEP: Deprecate ExcelWriter attributes * DEP: Deprecate ExcelWriter attributes * Fixup for test * Move tests and restore check_extension y * Deprecate xlwt fm_date and fm_datetime; doc improvements
https://github.com/pandas-dev/pandas.git
def close(self) -> None: self._save() self._handles.close() XLS_SIGNATURES = ( b"\x09\x00\x04\x00\x07\x00\x10\x00", # BIFF2 b"\x09\x02\x06\x00\x00\x00\x10\x00", # BIFF3 b"\x09\x04\x06\x00\x00\x00\x10\x00", # BIFF4 b"\xD0\xCF\x11\xE0\xA1\xB1\x1A\xE1", # Compound File Binary...
@doc(storage_options=_shared_docs["storage_options"])
20
_base.py
Python
pandas/io/excel/_base.py
047137ce2619cfe2027e3999dfb92eb614d9a485
pandas
1
124,708
78
15
15
270
21
1
120
225
test_max_concurrent_in_progress_functions
[Core | State Observability] Implement API Server (Dashboard) HTTP Requests Throttling (#26257) This is to limit the max number of HTTP requests the dashboard (API server) will accept before rejecting more requests. This will make sure the observability requests do not overload the downstream systems (raylet/gcs) whe...
https://github.com/ray-project/ray.git
async def test_max_concurrent_in_progress_functions(extra_req_num): max_req = 10 a = A(max_num_call=max_req) # Run more than allowed concurrent async functions should trigger rate limiting res_arr = await asyncio.gather( *[a.fn1() if i % 2 == 0 else a.fn2() for i in range(max_req + extra_r...
@pytest.mark.asyncio @pytest.mark.parametrize( "failures", [ [True, True, True, True, True], [False, False, False, False, False], [False, True, False, True, False], [False, False, False, True, True], [True, True, False, False, False], ], )
96
test_state_head.py
Python
dashboard/tests/test_state_head.py
365ffe21e592589880e3116302705b5e08a5b81f
ray
5
176,904
34
10
41
80
9
0
45
75
astar_path
Updated astar docstring (#5797) The docstring now reflects on heuristic admissibility and heuristic value caching
https://github.com/networkx/networkx.git
def astar_path(G, source, target, heuristic=None, weight="weight"): if source not in G or target not in G: msg = f"Either source {source} or target {target} is not in G" raise nx.NodeNotFound(msg) if heuristic is None: # The default heuristic is h=0 - same as Dijkstra's algorithm
273
astar.py
Python
networkx/algorithms/shortest_paths/astar.py
b28d30bd552a784d60692fd2d2016f8bcd1cfa17
networkx
13
89,927
48
14
24
269
30
0
62
294
test_note_generic_issue
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...
https://github.com/getsentry/sentry.git
def test_note_generic_issue(self, mock_func, occurrence): event = self.store_event( data={"message": "Hellboy's world", "level": "error"}, project_id=self.project.id ) event = event.for_group(event.groups[0]) notification = NoteActivityNotification( Activ...
151
test_note.py
Python
tests/sentry/integrations/slack/notifications/test_note.py
3255fa4ebb9fbc1df6bb063c0eb77a0298ca8f72
sentry
1
299,399
4
6
3
16
3
0
4
7
async_add_devices
Insteon Device Control Panel (#70834) Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
https://github.com/home-assistant/core.git
async def async_add_devices(address, multiple):
26
device.py
Python
homeassistant/components/insteon/api/device.py
a9ca774e7ed1d8fe502a53d5b765c1d9b393a524
core
2
270,861
10
11
5
58
4
0
12
35
is_subclassed
Reformatting the codebase with black. PiperOrigin-RevId: 450093126
https://github.com/keras-team/keras.git
def is_subclassed(layer): return ( layer.__module__.find("keras.engine") == -1 and layer.__module__.find("keras.layers") == -1 )
32
base_layer_utils.py
Python
keras/engine/base_layer_utils.py
84afc5193d38057e2e2badf9c889ea87d80d8fbf
keras
2
297,866
37
13
13
90
10
0
39
194
_async_device_changed
String formatting and max line length - Part 2 (#84393)
https://github.com/home-assistant/core.git
def _async_device_changed(self, *args, **kwargs) -> None: # Don't update disabled entities if self.enabled: _LOGGER.debug("Event %s (%s)", self.name, CONST_ALARM_CONTROL_PANEL_NAME) self.async_write_ha_state() else: _LOGGER.debug( ( ...
52
alarm_control_panel.py
Python
homeassistant/components/homematicip_cloud/alarm_control_panel.py
cb13418babd21a1e9584978b0c523f1b1e4e1cb0
core
2
183,841
24
10
6
82
12
0
27
45
test_stylesheet_many_classes_dont_overrule_id
Add various additional tests around CSS specificity
https://github.com/Textualize/textual.git
def test_stylesheet_many_classes_dont_overrule_id(): css = "#id {color: red;} .a.b.c.d {color: blue;}" stylesheet = _make_stylesheet(css) node = DOMNode(classes="a b c d", id="id") stylesheet.apply(node) assert node.styles.color == Color(255, 0, 0)
47
test_stylesheet.py
Python
tests/css/test_stylesheet.py
4dd0d9fae43583638f34257f97d5749ca4f2c00c
textual
1
297,532
4
6
18
16
3
0
4
7
test_check_requesterror
Improve HomeWizard request issue reporting (#82366) * Trigger reauth flow when HomeWizard API was disabled * Add tests for reauth flow * Fix typo in test * Add parallel updates constant * Improve error message when device in unreachable during config * Set quality scale * Remove quality scale * Th...
https://github.com/home-assistant/core.git
async def test_check_requesterror(hass, aioclient_mock):
112
test_config_flow.py
Python
tests/components/homewizard/test_config_flow.py
b41d0be9522fabda0ac8affd2add6876a66205ea
core
1
265,772
53
14
18
194
14
0
87
177
to_grams
9654 device weight (#10448) * 9654 add weight fields to devices * 9654 changes from code review * 9654 change _abs_weight to grams * Resolve migrations conflict * 9654 code-review changes * 9654 total weight on devices * Misc cleanup Co-authored-by: Jeremy Stretch <jstretch@ns1.com>
https://github.com/netbox-community/netbox.git
def to_grams(weight, unit): try: if weight < 0: raise ValueError("Weight must be a positive number") except TypeError: raise TypeError(f"Invalid value '{weight}' for weight (must be a number)") valid_units = WeightUnitChoices.values() if unit not in valid_units: ...
106
utils.py
Python
netbox/utilities/utils.py
204c10c053fddc26ad23ec15a3c60eee38bfc081
netbox
8
153,944
6
6
27
26
6
0
6
13
_setitem
PERF-#4325: Improve perf of multi-column assignment in `__setitem__` when no new column names are assigning (#4455) Co-authored-by: Yaroslav Igoshev <Poolliver868@mail.ru> Signed-off-by: Myachev <anatoly.myachev@intel.com>
https://github.com/modin-project/modin.git
def _setitem(self, axis, key, value, how="inner"):
168
query_compiler.py
Python
modin/core/storage_formats/pandas/query_compiler.py
eddfda4b521366c628596dcb5c21775c7f50eec1
modin
4
92,181
107
14
68
1,025
52
0
225
858
test_update_organization_config
ref(integrations): Update Vercel endpoints (#36150) This PR updates the endpoints we reach to in the Vercel integration. It seems to work just fine without changes as the payloads returned from vercel haven't updated, but we'll need to specify API Scopes so they don't receive 403s. This also refactored the paginat...
https://github.com/getsentry/sentry.git
def test_update_organization_config(self): with self.tasks(): self.assert_setup_flow() org = self.organization project_id = self.project.id enabled_dsn = ProjectKey.get_default(project=Project.objects.get(id=project_id)).get_dsn( public=True ) ...
566
test_integration.py
Python
tests/sentry/integrations/vercel/test_integration.py
8201e74ec3d81e89354905c946e62436f0247602
sentry
2
293,197
80
16
28
242
32
0
104
536
async_step_manual_connection
Ensure elkm1 can be manually configured when discovered instance is not used (#67712)
https://github.com/home-assistant/core.git
async def async_step_manual_connection(self, user_input=None): errors = {} if user_input is not None: # We might be able to discover the device via directed UDP # in case its on another subnet if device := await async_discover_device( self.has...
153
config_flow.py
Python
homeassistant/components/elkm1/config_flow.py
26c5dca45d9b3dee002dfe1549780747e5007e06
core
4
224,049
6
9
2
35
4
0
6
20
on_page_read_source
Remove spaces at the ends of docstrings, normalize quotes
https://github.com/mkdocs/mkdocs.git
def on_page_read_source(self, **kwargs): return f'{self.config["foo"]} source'
12
plugin_tests.py
Python
mkdocs/tests/plugin_tests.py
e7f07cc82ab2be920ab426ba07456d8b2592714d
mkdocs
1
259,640
115
16
84
352
32
0
173
322
trustworthiness
FIX Raise error when n_neighbors >= n_samples / 2 in manifold.trustworthiness (#23033) Co-authored-by: Shao Yang Hong <hongsy2006@gmail.com> Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com> Co-authored-by: Jérémie du Boisberranger <34657725+jeremiedbb@users.noreply.github.com>
https://github.com/scikit-learn/scikit-learn.git
def trustworthiness(X, X_embedded, *, n_neighbors=5, metric="euclidean"): r n_samples = X.shape[0] if n_neighbors >= n_samples / 2: raise ValueError( f"n_neighbors ({n_neighbors}) should be less than n_samples / 2" f" ({n_samples / 2})" ) dist_X = pairwise_distanc...
228
_t_sne.py
Python
sklearn/manifold/_t_sne.py
ade90145c9c660a1a7baf2315185995899b0f356
scikit-learn
3
132,895
34
12
10
108
9
0
38
140
start
[CI] Format Python code with Black (#21975) See #21316 and #21311 for the motivation behind these changes.
https://github.com/ray-project/ray.git
def start(self): if self.actors and len(self.actors) > 0: raise RuntimeError( "The actors have already been started. " "Please call `shutdown` first if you want to " "restart them." ) logger.debug(f"Starting {self.num_acto...
49
actor_group.py
Python
python/ray/util/actor_group.py
7f1bacc7dc9caf6d0ec042e39499bbf1d9a7d065
ray
3
126,264
59
14
20
179
21
0
72
215
_detect_checkpoint_function
[air] Add annotation for Tune module. (#27060) Co-authored-by: Kai Fricke <kai@anyscale.com>
https://github.com/ray-project/ray.git
def _detect_checkpoint_function(train_func, abort=False, partial=False): func_sig = inspect.signature(train_func) validated = True try: # check if signature is func(config, checkpoint_dir=None) if partial: func_sig.bind_partial({}, checkpoint_dir="tmp/path") else: ...
102
util.py
Python
python/ray/tune/utils/util.py
eb69c1ca286a2eec594f02ddaf546657a8127afd
ray
5
323,123
10
10
5
43
5
0
13
56
should_log
[Trainer] Add init version of paddlenlp trainer and apply finetune for ernie-1.0 pretraining. (#1761) * add some datasets for finetune. * support fine tune for all tastks. * add trainer prototype. * init verison for paddlenlp trainer. * refine trainer. * update for some details. * support multi-card...
https://github.com/PaddlePaddle/PaddleNLP.git
def should_log(self): if self.log_on_each_node: return self.local_process_index == 0 else: return self.process_index == 0
25
trainer_args.py
Python
paddlenlp/trainer/trainer_args.py
44a290e94d1becd1f09fddc3d873f9e19c9d6919
PaddleNLP
2
300,405
37
19
21
169
8
0
50
309
test_all_optional_config
Remove unused calls fixture from template tests (#71735)
https://github.com/home-assistant/core.git
async def test_all_optional_config(hass): with assert_setup_component(1, "template"): assert await setup.async_setup_component( hass, "template", { "template": { "number": { "state": "{{ 4 }}", ...
90
test_number.py
Python
tests/components/template/test_number.py
b70e97e949ca73fe57849625c0b0c51f0b8796f7
core
1
167,393
21
9
79
88
10
0
21
75
radviz
TYP: Missing return annotations in util/tseries/plotting (#47510) * TYP: Missing return annotations in util/tseries/plotting * the more tricky parts
https://github.com/pandas-dev/pandas.git
def radviz(frame, class_column, ax=None, color=None, colormap=None, **kwds) -> Axes: plot_backend = _get_plot_backend("matplotlib") return plot_backend.radviz( frame=frame, class_column=class_column, ax=ax, color=color, colormap=colormap, **kwds, )
60
_misc.py
Python
pandas/plotting/_misc.py
4bb1fd50a63badd38b5d96d9c4323dae7bc36d8d
pandas
1
266,663
19
12
4
63
10
0
19
40
download_file
ansible-test - Fix consistency of managed venvs. (#77028)
https://github.com/ansible/ansible.git
def download_file(url, path): # type: (str, str) -> None with open(to_bytes(path), 'wb') as saved_file: download = urlopen(url) shutil.copyfileobj(download, saved_file)
35
requirements.py
Python
test/lib/ansible_test/_util/target/setup/requirements.py
68fb3bf90efa3a722ba5ab7d66b1b22adc73198c
ansible
1
46,474
4
11
2
44
3
0
4
18
extract_bucket_name
Create Endpoint and Model Service, Batch Prediction and Hyperparameter Tuning Jobs operators for Vertex AI service (#22088)
https://github.com/apache/airflow.git
def extract_bucket_name(config): return config["artifact_destination"]["output_uri_prefix"].rpartition("gs://")[-1]
23
vertex_ai.py
Python
airflow/providers/google/cloud/links/vertex_ai.py
ca4b8d1744cd1de9b6af97dacb0e03de0f014006
airflow
1
12,472
6
10
4
48
9
0
6
22
export_kubernetes
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>
https://github.com/jina-ai/jina.git
def export_kubernetes(args): Flow.load_config(args.flowpath).to_kubernetes_yaml( output_base_path=args.outpath, k8s_namespace=args.k8s_namespace )
29
exporter.py
Python
jina/exporter.py
16b16b07a66cd5a8fc7cca1d3f1c378a9c63d38c
jina
1
86,267
50
14
18
272
17
0
87
257
expand_frame
ref(processor): Use symbolic-sourcemapcache for JavaScript Sourcemap processing (#38551) This PR attempts to replace the currently used `rust-sourcemap` crate and it's symbolic python bindings, with `symbolic-sourcemapcache` crate. It makes the whole processing pipeline easier to maintain, as it pushes some work ...
https://github.com/getsentry/sentry.git
def expand_frame(self, frame, source_context=None, source=None): if frame.get("lineno") is None: return False if source_context is None: source = source or self.get_sourceview(frame["abs_path"]) if source is None: logger.debug("No source fou...
169
processor.py
Python
src/sentry/lang/javascript/processor.py
ae9c0d8a33d509d9719a5a03e06c9797741877e9
sentry
14