complexity int64 1 56 | n_identifiers int64 1 114 | code stringlengths 19 12.7k | path stringlengths 8 134 | n_ast_nodes int64 12 2.35k | ast_errors stringlengths 0 4.01k | repo stringlengths 3 28 | documentation dict | n_words int64 2 866 | language stringclasses 1
value | vocab_size int64 2 323 | commit_id stringlengths 40 40 | file_name stringlengths 5 79 | id int64 243 338k | nloc int64 1 228 | token_counts int64 5 1.4k | fun_name stringlengths 1 77 | url stringlengths 31 60 | commit_message stringlengths 3 15.3k | n_whitespaces int64 1 3.23k | n_ast_errors int64 0 20 | d_id int64 74 121k | ast_levels int64 4 29 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
3 | 7 | def get_patches(self):
r
return silent_list('Patch',
[h for h in self.legend_handles
if isinstance(h, Patch)])
| lib/matplotlib/legend.py | 46 | matplotlib | {
"docstring": "Return the list of `~.patches.Patch`\\s in the legend.",
"language": "en",
"n_whitespaces": 7,
"n_words": 8,
"vocab_size": 7
} | 13 | Python | 13 | 2a1a1a6e47e41b8992d462c48491d2ce347694cd | legend.py | 110,667 | 5 | 29 | get_patches | https://github.com/matplotlib/matplotlib.git | API/DOC: Document legend_handles and legend_handlers
- deprecate legendHandles | 79 | 0 | 24,247 | 11 | |
2 | 14 | def pop():
conn = sqlite3.connect(DB_FILE)
c = conn.cursor()
c.execute("BEGIN EXCLUSIVE")
c.execute(
)
result = c.fetchone()
if result is None:
conn.commit()
return None
queue_index = result[0]
c.execute(
,
(queue_index,),
)
conn.commi... | gradio/queueing.py | 160 | gradio | {
"docstring": "\n SELECT queue_index, hash, input_data, action FROM queue\n WHERE popped = 0 ORDER BY queue_index ASC LIMIT 1;\n \n UPDATE queue SET popped = 1, input_data = '' WHERE queue_index = ?;\n ",
"language": "en",
"n_whitespaces": 59,
"n_words": 30,
"vocab_size": 23
} | 35 | Python | 27 | cc0cff893f9d7d472788adc2510c123967b384fe | queueing.py | 179,286 | 23 | 98 | pop | https://github.com/gradio-app/gradio.git | Format The Codebase
- black formatting
- isort formatting | 106 | 0 | 42,936 | 9 | |
1 | 4 | def __call__(self, name, value):
return self[name](name, value)
| python3.10.4/Lib/email/headerregistry.py | 31 | XX-Net | {
"docstring": "Create a header instance for header 'name' from 'value'.\n\n Creates a header instance by creating a specialized class for parsing\n and representing the specified header by combining the factory\n base_class with a specialized class from the registry or the\n default_class... | 7 | Python | 7 | 8198943edd73a363c266633e1aa5b2a9e9c9f526 | headerregistry.py | 223,754 | 2 | 20 | __call__ | https://github.com/XX-net/XX-Net.git | add python 3.10.4 for windows | 21 | 0 | 57,050 | 7 | |
2 | 5 | def disconnect(self):
if self.is_connected is False:
return
self.connection.close()
self.is_connected = False
return self.is_connected
| mindsdb/integrations/handlers/sqlite_handler/sqlite_handler.py | 52 | mindsdb | {
"docstring": "\r\n Close any existing connections.\r\n ",
"language": "en",
"n_whitespaces": 19,
"n_words": 4,
"vocab_size": 4
} | 13 | Python | 10 | fc9776d9b342f873cbb3f36fd39955b9e1ea6f76 | sqlite_handler.py | 115,431 | 6 | 30 | disconnect | https://github.com/mindsdb/mindsdb.git | added connection_args and connection_args_example dicts | 59 | 0 | 25,459 | 8 | |
3 | 38 | def call_mkt(self, other_args):
parser = argparse.ArgumentParser(
prog="mkt",
add_help=False,
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
description=,
)
parser.add_argument(
"--vs",
help="Quoted currenc... | openbb_terminal/cryptocurrency/due_diligence/dd_controller.py | 384 | OpenBBTerminal | {
"docstring": "Process mkt commandGet all markets found for given coin.\n You can display only N number of markets with --limt parameter.\n You can sort data by pct_volume_share, exchange, pair, trust_score, volume, price --sort parameter\n and also with --reverse flag to... | 109 | Python | 89 | 0ae89d6cc20be84bf49c31e437fda38a845ebc68 | dd_controller.py | 286,516 | 73 | 239 | call_mkt | https://github.com/OpenBB-finance/OpenBBTerminal.git | Style fixing: removing --ascend/--descend (#3395)
* stocks candle to use reverse
* qa raw to use reverse
* etf candle to use reverse
* oss rossix to use reverse
* crypto/defi to use reverse
* crypto/disc to use reverse
* added test
* crypto/dd to use reverse
* crypto/onchain to use reverse
*... | 847 | 0 | 85,839 | 13 | |
6 | 11 | def nseries(self, x=None, x0=0, n=6, dir='+', logx=None, cdir=0):
if x and x not in self.free_symbols:
return self
if x is None or x0 or dir != '+': # {see XPOS above} or (x.is_positive == x.is_negative == None):
return self.series(x, x0, n, dir, cdir=cdir)
else... | sympy/core/expr.py | 135 | sympy | {
"docstring": "\n Wrapper to _eval_nseries if assumptions allow, else to series.\n\n If x is given, x0 is 0, dir='+', and self has x, then _eval_nseries is\n called. This calculates \"n\" terms in the innermost expressions and\n then builds up the final series just by \"cross-multiplying\... | 49 | Python | 40 | 46ba104ee0f9cb35b54c2f5f5591cfabb26d0301 | expr.py | 195,878 | 7 | 91 | nseries | https://github.com/sympy/sympy.git | Fixed failing doctest | 111 | 0 | 47,462 | 11 | |
4 | 13 | def _process_triggers(self) -> None:
if self._triggers is None: # Don't need triggers for GUI
return
logger.debug("Processing triggers")
root = self._canvas.winfo_toplevel()
for key in self._keymaps:
bindkey = "Return" if key == "enter" else key
... | lib/training/preview_tk.py | 131 | faceswap | {
"docstring": " Process the standard faceswap key press triggers:\n\n m = toggle_mask\n r = refresh\n s = save\n enter = quit\n ",
"language": "en",
"n_whitespaces": 55,
"n_words": 19,
"vocab_size": 16
} | 43 | Python | 35 | 7da2cc3dd266aabebf41a31384cc2e0e7e5af6e5 | preview_tk.py | 101,555 | 17 | 72 | _process_triggers | https://github.com/deepfakes/faceswap.git | Training - Use custom preview pop-out | 130 | 0 | 20,965 | 11 | |
3 | 15 | def to_arrow_refs(self) -> List[ObjectRef["pyarrow.Table"]]:
blocks: List[ObjectRef[Block]] = self.get_internal_block_refs()
if self.dataset_format() == BlockFormat.ARROW:
# Zero-copy path.
return blocks
block_to_arrow = cached_remote_fn(_block_to_arrow)
... | python/ray/data/dataset.py | 100 | ray | {
"docstring": "Convert this dataset into a distributed set of Arrow tables.\n\n This is only supported for datasets convertible to Arrow records.\n This function is zero-copy if the existing data is already in Arrow\n format. Otherwise, the data will be converted to Arrow format.\n\n Time... | 26 | Python | 24 | 326d84f1149319809191e7887155df7f04f6f46a | dataset.py | 136,382 | 17 | 61 | to_arrow_refs | https://github.com/ray-project/ray.git | [AIR][Predictor] Enable numpy based predictor (#28917)
Co-authored-by: Clark Zinzow <clarkzinzow@gmail.com>
Co-authored-by: Amog Kamsetty <amogkam@users.noreply.github.com> | 83 | 0 | 30,902 | 9 | |
1 | 16 | def _get_kernel(self) -> tf.Tensor:
coords = np.arange(self._filter_size, dtype="float32")
coords -= (self._filter_size - 1) / 2.
kernel = np.square(coords)
kernel *= -0.5 / np.square(self._filter_sigma)
kernel = np.reshape(kernel, (1, -1)) + np.reshape(kernel, (-1, 1))... | lib/model/losses_tf.py | 211 | faceswap | {
"docstring": " Obtain the base kernel for performing depthwise convolution.\n\n Returns\n -------\n :class:`tf.Tensor`\n The gaussian kernel based on selected size and sigma\n ",
"language": "en",
"n_whitespaces": 60,
"n_words": 20,
"vocab_size": 19
} | 49 | Python | 33 | 04337e0c5efd442c1ce3e2da193dd8749f1e30d8 | losses_tf.py | 100,878 | 17 | 141 | _get_kernel | https://github.com/deepfakes/faceswap.git | SSIM Updates
- Standardize DSSIM Function
- Implement MSSIM function for AMD | 119 | 0 | 20,328 | 12 | |
1 | 4 | def test_validate_subscription_query_invalid():
result = validate_subscription_query("invalid_query")
assert result is False
TEST_VALID_SUBSCRIPTION_QUERY_WITH_FRAGMENT =
| saleor/plugins/webhook/tests/subscription_webhooks/test_create_deliveries_for_subscription.py | 33 | saleor | {
"docstring": "\nfragment productFragment on Product{\n name\n}\nsubscription{\n event{\n ...on ProductUpdated{\n product{\n id\n ...productFragment\n }\n }\n }\n}\n",
"language": "en",
"n_whitespaces": 46,
"n_words": 17,
"vocab_size": 13
} | 11 | Python | 9 | aca6418d6c36956bc1ab530e6ef7e146ec9df90c | test_create_deliveries_for_subscription.py | 26,493 | 3 | 14 | test_validate_subscription_query_invalid | https://github.com/saleor/saleor.git | Add Webhook payload via graphql subscriptions (#9394)
* Add PoC of webhook subscriptions
* add async webhooks subscription payloads feature
* remove unneeded file
* add translations subscription handling, fixes after review
* remove todo
* add descriptions
* add descriptions, move subsrciption_payloa... | 16 | 0 | 5,022 | 9 | |
7 | 18 | def find_module(module, path=None, imp=None):
if imp is None:
imp = import_module
with cwd_in_path():
try:
return imp(module)
except ImportError:
# Raise a more specific error if the problem is that one of the
# dot-separated segments of the modul... | celery/utils/imports.py | 185 | celery | {
"docstring": "Version of :func:`imp.find_module` supporting dots.",
"language": "en",
"n_whitespaces": 4,
"n_words": 5,
"vocab_size": 5
} | 84 | Python | 61 | 59263b0409e3f02dc16ca8a3bd1e42b5a3eba36d | imports.py | 208,027 | 20 | 105 | find_module | https://github.com/celery/celery.git | Minor refactors, found by static analysis (#7587)
* Remove deprecated methods in `celery.local.Proxy`
* Collapse conditionals for readability
* Remove unused parameter `uuid`
* Remove unused import `ClusterOptions`
* Remove dangerous mutable default argument
Continues work from #5478
* Remove always ... | 432 | 0 | 52,179 | 20 | |
1 | 13 | def test_from_is_negative(self) -> None:
channel = self.make_request(
"GET",
self.url + "?from=-5",
access_token=self.admin_user_tok,
)
self.assertEqual(400, channel.code, msg=channel.json_body)
self.assertEqual(Codes.INVALID_PARAM, channel.... | tests/rest/admin/test_event_reports.py | 97 | synapse | {
"docstring": "\n Testing that a negative from parameter returns a 400\n ",
"language": "en",
"n_whitespaces": 24,
"n_words": 9,
"vocab_size": 8
} | 18 | Python | 18 | 2281427175e4c93a30c39607fb4ac23c2a1f399f | test_event_reports.py | 249,309 | 11 | 60 | test_from_is_negative | https://github.com/matrix-org/synapse.git | Use literals in place of `HTTPStatus` constants in tests (#13488)
* Use literals in place of `HTTPStatus` constants in tests
* newsfile
* code style
* code style | 86 | 0 | 72,812 | 10 | |
1 | 5 | def test__compress_ids_not_dict():
data = ["malformed"]
actual_output = highstate._compress_ids(data)
assert actual_output == data
| tests/pytests/unit/output/test_highstate.py | 41 | salt | {
"docstring": "\n Simple test for returning original malformed data\n to let the outputter figure it out.\n ",
"language": "en",
"n_whitespaces": 24,
"n_words": 14,
"vocab_size": 14
} | 12 | Python | 9 | 7e1c2baa659ee2a975cbe4ed0f6d85e34ec91e50 | test_highstate.py | 216,122 | 4 | 22 | test__compress_ids_not_dict | https://github.com/saltstack/salt.git | fixes saltstack/salt#61549 allow roll-up of duplicate IDs with different names | 24 | 0 | 54,413 | 8 | |
9 | 31 | def _populate_directed_relation_graph(self):
related_objects_graph = defaultdict(list)
all_models = self.apps.get_models(include_auto_created=True)
for model in all_models:
opts = model._meta
# Abstract model's fields are copied to child models, hence we will
... | django/db/models/options.py | 248 | django | {
"docstring": "\n This method is used by each model to find its reverse objects. As this\n method is very expensive and is accessed frequently (it looks up every\n field in a model, in every app), it is computed on first access and then\n is set as a property on every model.\n ",
... | 151 | Python | 100 | 9c19aff7c7561e3a82978a272ecdaad40dda5c00 | options.py | 205,736 | 22 | 153 | _populate_directed_relation_graph | https://github.com/django/django.git | Refs #33476 -- Reformatted code with Black. | 500 | 0 | 51,182 | 18 | |
2 | 15 | def downgrade():
conn = op.get_bind()
if conn.dialect.name == "mysql":
op.alter_column(
table_name=TABLE_NAME, column_name=COLUMN_NAME, type_=mysql.TIMESTAMP(), nullable=False
)
| airflow/migrations/versions/a66efa278eea_add_precision_to_execution_date_in_mysql.py | 75 | airflow | {
"docstring": "Unapply Add Precision to ``execution_date`` in ``RenderedTaskInstanceFields`` table",
"language": "en",
"n_whitespaces": 7,
"n_words": 8,
"vocab_size": 8
} | 15 | Python | 15 | 69f6f9e01b6df76c3c8fa266d460324163957887 | a66efa278eea_add_precision_to_execution_date_in_mysql.py | 45,487 | 6 | 45 | downgrade | https://github.com/apache/airflow.git | Autogenerate migration reference doc (#21601)
* document airflow version in each alembic migration module and use this to autogen the doc
* update each migration module to have the same description used in migration ref (so it can be used in autogen) | 49 | 0 | 8,614 | 12 | |
1 | 2 | def colors(self):
return self["colors"]
| packages/python/plotly/plotly/graph_objs/funnelarea/_marker.py | 22 | plotly.py | {
"docstring": "\n Sets the color of each sector. If not specified, the default\n trace color set is used to pick the sector colors.\n\n The 'colors' property is an array that may be specified as a tuple,\n list, numpy array, or pandas Series\n\n Returns\n -------\n nu... | 4 | Python | 4 | 43e3a4011080911901176aab919c0ecf5046ddd3 | _marker.py | 229,885 | 2 | 11 | colors | https://github.com/plotly/plotly.py.git | switch to black .22 | 18 | 0 | 61,558 | 7 | |
2 | 11 | def post_fork(self, payload_handler, io_loop):
if not io_loop:
raise ValueError("io_loop must be set")
self.payload_handler = payload_handler
self.io_loop = io_loop
self._rmq_nonblocking_connection_wrapper = RMQNonBlockingConnectionWrapper(
self.opts, io... | salt/transport/rabbitmq.py | 99 | salt | {
"docstring": "\n After forking we need to set up handlers to listen to the\n router\n\n :param func payload_handler: A function to called to handle incoming payloads as\n they are picked up off the wire\n :param IOLoop io_loop: An instance of a Tornado... | 28 | Python | 25 | ab4803984bce4a4de7cc10910e7310c4babf557e | rabbitmq.py | 215,409 | 12 | 60 | post_fork | https://github.com/saltstack/salt.git | Start to add base class defs | 124 | 0 | 53,954 | 10 | |
3 | 7 | def to(self, device=None, dtype=None) -> None:
r
# .to() on the tensors handles None correctly
self.shadow_params = [
p.to(device=device, dtype=dtype) if p.is_floating_point() else p.to(device=device)
for p in self.shadow_params
]
| examples/text_to_image/train_text_to_image.py | 85 | diffusers | {
"docstring": "Move internal buffers of the ExponentialMovingAverage to `device`.\n\n Args:\n device: like `device` argument to `torch.Tensor.to`\n ",
"language": "en",
"n_whitespaces": 40,
"n_words": 15,
"vocab_size": 14
} | 29 | Python | 28 | 008b608f1551dbcf521284ed0e7a6722cd02ef07 | train_text_to_image.py | 337,105 | 10 | 56 | to | https://github.com/huggingface/diffusers.git | [train_text2image] Fix EMA and make it compatible with deepspeed. (#813)
* fix ema
* style
* add comment about copy
* style
* quality | 78 | 0 | 120,959 | 11 | |
5 | 15 | def _try_state_query_expect_rate_limit(api_func, res_q, start_q=None):
try:
# Indicate start of the process
if start_q is not None:
start_q.put(1)
api_func()
except RayStateApiException as e:
# Other exceptions will be thrown
if "Max number of in-progress... | python/ray/tests/test_state_api.py | 163 | @pytest.mark.skipif(
sys.platform == "win32",
reason="Lambda test functions could not be pickled on Windows",
) | ray | {
"docstring": "Utility functions for rate limit related e2e tests below",
"language": "en",
"n_whitespaces": 8,
"n_words": 9,
"vocab_size": 9
} | 60 | Python | 50 | 365ffe21e592589880e3116302705b5e08a5b81f | test_state_api.py | 124,713 | 14 | 75 | _try_state_query_expect_rate_limit | https://github.com/ray-project/ray.git | [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... | 168 | 1 | 27,666 | 13 |
1 | 13 | async def handle_webhook(hass, webhook_id, request):
data = dict(await request.post())
data["webhook_id"] = webhook_id
hass.bus.async_fire(RECEIVED_DATA, dict(data))
return web.Response(text="")
| homeassistant/components/twilio/__init__.py | 84 | core | {
"docstring": "Handle incoming webhook from Twilio for inbound messages and calls.",
"language": "en",
"n_whitespaces": 9,
"n_words": 10,
"vocab_size": 10
} | 16 | Python | 15 | 44befe5f11390365e2ff0a7ce03133c1edd838a9 | __init__.py | 292,141 | 5 | 49 | handle_webhook | https://github.com/home-assistant/core.git | Fix Twilio webhook content type (#66561) | 31 | 0 | 91,243 | 11 | |
6 | 26 | def manhattan_distances(X, Y=None, *, sum_over_features="deprecated"):
# TODO(1.4): remove sum_over_features
if sum_over_features != "deprecated":
warnings.warn(
"`sum_over_features` is deprecated in version 1.2 and will be"
" removed in version 1.4.",
FutureWarn... | sklearn/metrics/pairwise.py | 339 | scikit-learn | {
"docstring": "Compute the L1 distances between the vectors in X and Y.\n\n With sum_over_features equal to False it returns the componentwise\n distances.\n\n Read more in the :ref:`User Guide <metrics>`.\n\n Parameters\n ----------\n X : array-like of shape (n_samples_X, n_features)\n An a... | 108 | Python | 81 | 7cf938c78ff0e38a231a7cb3a2a7fa412bb47966 | pairwise.py | 261,366 | 28 | 214 | manhattan_distances | https://github.com/scikit-learn/scikit-learn.git | API Remove `sklearn.metrics.manhattan_distances` option `sum_over_features` (#24630) | 308 | 0 | 76,778 | 13 | |
1 | 6 | def set_axis_direction(self, label_direction):
self.set_default_alignment(label_direction)
self.set_default_angle(label_direction)
self._axis_direction = label_direction
| lib/mpl_toolkits/axisartist/axis_artist.py | 43 | matplotlib | {
"docstring": "\n Adjust the text angle and text alignment of ticklabels\n according to the Matplotlib convention.\n\n The *label_direction* must be one of [left, right, bottom, top].\n\n ===================== ========== ========= ========== ==========\n Property ... | 8 | Python | 8 | df6f95703b60348e01603f98a439b133da2938a0 | axis_artist.py | 109,904 | 4 | 25 | set_axis_direction | https://github.com/matplotlib/matplotlib.git | Improve mpl_toolkit documentation | 36 | 0 | 23,812 | 7 | |
1 | 4 | def prep_related_object_data(self, parent, data):
return data
| netbox/netbox/views/generic/bulk_views.py | 20 | netbox | {
"docstring": "\n Hook to modify the data for related objects before it's passed to the related object form (for example, to\n assign a parent object).\n ",
"language": "en",
"n_whitespaces": 45,
"n_words": 23,
"vocab_size": 19
} | 6 | Python | 6 | 93e7457e0d84ad24cba22cc5c0811777ddebf94e | bulk_views.py | 266,053 | 2 | 12 | prep_related_object_data | https://github.com/netbox-community/netbox.git | 4347 Add JSON/YAML import support for all objects (#10367)
* 4347 initial code for json import
* 4347 initial code for json import
* Clean up form processing logic
* Consolidate import forms
* Consolidate object import/update logic
* Clean up bulk import view
Co-authored-by: jeremystretch <jstretch@n... | 20 | 0 | 78,283 | 6 | |
4 | 15 | def euler_poly(n, x=None, polys=False):
if n < 0:
raise ValueError("Cannot generate Euler polynomial of degree %s" % n)
poly = DMP(dup_euler(int(n), QQ), QQ)
if x is not None:
poly = Poly.new(poly, x)
else:
poly = PurePoly.new(poly, Dummy('x'))
return poly if polys else ... | sympy/polys/appellseqs.py | 133 | sympy | {
"docstring": "Generates the Euler polynomial `\\operatorname{E}_n(x)`.\n\n Parameters\n ==========\n\n n : int\n Degree of the polynomial.\n x : optional\n polys : bool, optional\n If True, return a Poly, otherwise (default) return an expression.\n ",
"language": "en",
"n_whitesp... | 43 | Python | 36 | 93e4d381d35cd4c21a3a8d713c157f8fb21f725b | appellseqs.py | 199,650 | 9 | 83 | euler_poly | https://github.com/sympy/sympy.git | Custom Appell sequence functions and a doctest | 82 | 0 | 49,316 | 14 | |
6 | 10 | def iterencode(self, o, _one_shot=False):
if self.check_circular:
markers = {}
else:
markers = None
if self.ensure_ascii:
_encoder = encode_basestring_ascii
else:
_encoder = encode_basestring
| python3.10.4/Lib/json/encoder.py | 66 | XX-Net | {
"docstring": "Encode the given object and yield each string\n representation as available.\n\n For example::\n\n for chunk in JSONEncoder().iterencode(bigobject):\n mysocket.write(chunk)\n\n ",
"language": "en",
"n_whitespaces": 65,
"n_words": 18,
"vocab_size":... | 22 | Python | 15 | 8198943edd73a363c266633e1aa5b2a9e9c9f526 | encoder.py | 218,574 | 22 | 138 | iterencode | https://github.com/XX-net/XX-Net.git | add python 3.10.4 for windows | 101 | 0 | 55,396 | 9 | |
1 | 10 | def clear(self) -> None:
self.row_count = 0
self._clear_caches()
self._y_offsets.clear()
self.data.clear()
self.rows.clear()
self._line_no = 0
self._require_update_dimensions = True
self.refresh()
| src/textual/widgets/_data_table.py | 94 | textual | {
"docstring": "Clear the table.\n\n Args:\n columns (bool, optional): Also clear the columns. Defaults to False.\n ",
"language": "en",
"n_whitespaces": 39,
"n_words": 14,
"vocab_size": 13
} | 18 | Python | 15 | b524fa08eecadc83b0b694278db1c79d90feb9d8 | _data_table.py | 185,757 | 14 | 54 | clear | https://github.com/Textualize/textual.git | ffixed table refresh on add row | 81 | 0 | 45,161 | 8 | |
1 | 16 | def test_string_target(pyplot):
iris = load_iris()
X = iris.data[:, [0, 1]]
# Use strings as target
y = iris.target_names[iris.target]
log_reg = LogisticRegression().fit(X, y)
# Does not raise
DecisionBoundaryDisplay.from_estimator(
log_reg,
X,
grid_resolution=... | sklearn/inspection/_plot/tests/test_boundary_decision_display.py | 103 | scikit-learn | {
"docstring": "Check that decision boundary works with classifiers trained on string labels.",
"language": "en",
"n_whitespaces": 10,
"n_words": 11,
"vocab_size": 11
} | 32 | Python | 28 | d400723a2112f15c5d5b4d40dfac2ed8a19cca5c | test_boundary_decision_display.py | 259,484 | 11 | 64 | test_string_target | https://github.com/scikit-learn/scikit-learn.git | FEA Add DecisionBoundaryDisplay (#16061)
Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com>
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
Co-authored-by: Loïc Estève <loic.esteve@ymail.com> | 87 | 0 | 75,797 | 10 | |
3 | 13 | def setdefault(cls, key, default, description=None, deserialize_json=False):
obj = Variable.get(key, default_var=None, deserialize_json=deserialize_json)
if obj is None:
if default is not None:
Variable.set(key, default, description=description, serialize_json=deseri... | airflow/models/variable.py | 113 | airflow | {
"docstring": "\n Like a Python builtin dict object, setdefault returns the current value\n for a key, and if it isn't there, stores the default value and returns it.\n\n :param key: Dict key for this Variable\n :param default: Default value to set and return if the variable\n ... | 36 | Python | 27 | 602abe8394fafe7de54df7e73af56de848cdf617 | variable.py | 44,105 | 10 | 74 | setdefault | https://github.com/apache/airflow.git | Remove `:type` lines now sphinx-autoapi supports typehints (#20951)
* Remove `:type` lines now sphinx-autoapi supports typehints
Since we have no updated sphinx-autoapi to a more recent version it
supports showing type hints in the documentation, so we don't need to
have the type hints _and_ the `:type` lines -- ... | 142 | 0 | 8,155 | 13 | |
3 | 10 | def _update_trackables(self):
for trackable_obj in self._self_tracked_trackables:
if isinstance(
trackable_obj, tf.__internal__.tracking.TrackableDataStructure
):
self._track_variables(trackable_obj)
| keras/engine/base_layer.py | 54 | keras | {
"docstring": "Track variables added to lists/dicts after creation",
"language": "en",
"n_whitespaces": 6,
"n_words": 7,
"vocab_size": 7
} | 12 | Python | 12 | 00524152437b957ca4e850a5db014e223d3c6826 | base_layer.py | 279,734 | 6 | 33 | _update_trackables | https://github.com/keras-team/keras.git | isort, black and flake8 checked | 78 | 0 | 83,115 | 12 | |
2 | 14 | def assertCountSeleniumElements(self, selector, count, root_element=None):
from selenium.webdriver.common.by import By
root_element = root_element or self.selenium
self.assertEqual(
len(root_element.find_elements(By.CSS_SELECTOR, selector)), count
)
| django/contrib/admin/tests.py | 76 | django | {
"docstring": "\n Assert number of matches for a CSS selector.\n\n `root_element` allow restriction to a pre-selected node.\n ",
"language": "en",
"n_whitespaces": 37,
"n_words": 15,
"vocab_size": 14
} | 19 | Python | 18 | 9c19aff7c7561e3a82978a272ecdaad40dda5c00 | tests.py | 203,511 | 6 | 51 | assertCountSeleniumElements | https://github.com/django/django.git | Refs #33476 -- Reformatted code with Black. | 65 | 0 | 50,416 | 12 | |
1 | 3 | async def action_pop_screen(self) -> None:
self.pop_screen()
| src/textual/app.py | 26 | textual | {
"docstring": "Removes the topmost screen and makes the new topmost screen active.",
"language": "en",
"n_whitespaces": 10,
"n_words": 11,
"vocab_size": 8
} | 6 | Python | 6 | cf14b812ed47982463062e5b51bce506ad6ede1f | app.py | 185,316 | 3 | 13 | action_pop_screen | https://github.com/Textualize/textual.git | words | 20 | 0 | 44,967 | 7 | |
1 | 6 | def test_empty_string_topic(self) -> None:
self.login("hamlet")
result = self.client_post(
"/json/messages",
{
"type": "stream",
"to": "Verona",
"client": "test suite",
"content": "Test message",
... | zerver/tests/test_message_send.py | 107 | zulip | {
"docstring": "\n Sending a message that has empty string topic should fail\n ",
"language": "en",
"n_whitespaces": 25,
"n_words": 10,
"vocab_size": 10
} | 29 | Python | 29 | 4f482c234c3ab72d264e7bff7835dad5207b9d07 | test_message_send.py | 83,031 | 16 | 54 | test_empty_string_topic | https://github.com/zulip/zulip.git | string_validation: Standardize missing topic with missing stream name.
Co-authored-by: Shlok Patel <shlokcpatel2001@gmail.com> | 172 | 0 | 17,583 | 11 | |
1 | 5 | def generate_metric_ids(self) -> Set[Any]:
raise NotImplementedError
| src/sentry/snuba/metrics/fields/base.py | 23 | sentry | {
"docstring": "\n Method that generates all the metric ids required to query an instance of\n MetricsFieldBase\n ",
"language": "en",
"n_whitespaces": 36,
"n_words": 14,
"vocab_size": 14
} | 6 | Python | 6 | 3e8115c4a681e9c4adeafb1f15eb669a9342b93c | base.py | 96,875 | 6 | 13 | generate_metric_ids | https://github.com/getsentry/sentry.git | feat(metrics): Add initial framework for derived metrics [INGEST-924] (#32451)
* feat(metrics): Add initial framework for derived metrics
Adds support for derived metrics composed of
constituent metrics that span one entity
* Adds logic/test for when metric does not exist
* Fix failing test + incorporate PR ... | 20 | 0 | 19,347 | 6 | |
1 | 2 | def angleref(self):
return self["angleref"]
| packages/python/plotly/plotly/graph_objs/scatter/_marker.py | 22 | plotly.py | {
"docstring": "\n Sets the reference for marker angle. With \"previous\", angle 0\n points along the line from the previous point to this one. With\n \"up\", angle 0 points toward the top of the screen.\n\n The 'angleref' property is an enumeration that may be specified as:\n - O... | 4 | Python | 4 | d5a345d01507f8b6792c51507d1d8f35d7386d29 | _marker.py | 231,197 | 2 | 11 | angleref | https://github.com/plotly/plotly.py.git | update to plotly.js 2.16.1 | 18 | 0 | 62,773 | 7 | |
9 | 36 | def ask_question(self, question, blocking):
log.prompt.debug("Asking question {}, blocking {}, loops {}, queue "
"{}".format(question, blocking, self._loops,
self._queue))
if self._shutting_down:
# If we're currently shu... | qutebrowser/mainwindow/prompt.py | 497 | qutebrowser | {
"docstring": "Display a prompt for a given question.\n\n Args:\n question: The Question object to ask.\n blocking: If True, this function blocks and returns the result.\n\n Return:\n The answer of the user when blocking=True.\n None if blocking=False.\n ... | 193 | Python | 117 | 0877fb0d78635692e481c8bde224fac5ad0dd430 | prompt.py | 321,259 | 41 | 295 | ask_question | https://github.com/qutebrowser/qutebrowser.git | Run scripts/dev/rewrite_enums.py | 786 | 0 | 117,614 | 13 | |
10 | 19 | def prettify_exc(error):
errors = []
for exc in KNOWN_EXCEPTIONS:
search_string = exc.match_string if exc.match_string else exc.exception_name
split_string = (
exc.show_from_string if exc.show_from_string else exc.exception_name
)
if search_string in error:
... | pipenv/exceptions.py | 231 | pipenv | {
"docstring": "Catch known errors and prettify them instead of showing the\n entire traceback, for better UX",
"language": "en",
"n_whitespaces": 17,
"n_words": 15,
"vocab_size": 15
} | 80 | Python | 51 | 9a3b3ce70621af6f9adaa9eeac9cf83fa149319c | exceptions.py | 19,700 | 19 | 126 | prettify_exc | https://github.com/pypa/pipenv.git | Issue 4993 Add standard pre commit hooks and apply linting. (#4994)
* Add .pre-commit-config.yaml to the project and exclude tests (for now). This does not include the MyPy linting that pip does but does include everything else. | 267 | 0 | 3,069 | 16 | |
1 | 5 | def get_filename(self):
return getattr(self.model_admin, "export_filename", super().get_filename())
| wagtail/contrib/modeladmin/views.py | 41 | wagtail | {
"docstring": "Get filename for exported spreadsheet, without extension",
"language": "en",
"n_whitespaces": 6,
"n_words": 7,
"vocab_size": 7
} | 6 | Python | 6 | d10f15e55806c6944827d801cd9c2d53f5da4186 | views.py | 73,308 | 2 | 23 | get_filename | https://github.com/wagtail/wagtail.git | Reformat with black | 20 | 0 | 16,012 | 11 | |
1 | 4 | def ensure_future(coro_or_future, *, loop=None):
return _ensure_future(coro_or_future, loop=loop)
| python3.10.4/Lib/asyncio/tasks.py | 34 | XX-Net | {
"docstring": "Wrap a coroutine or an awaitable in a future.\n\n If the argument is a Future, it is returned directly.\n ",
"language": "en",
"n_whitespaces": 25,
"n_words": 19,
"vocab_size": 16
} | 7 | Python | 7 | 8198943edd73a363c266633e1aa5b2a9e9c9f526 | tasks.py | 220,829 | 2 | 21 | ensure_future | https://github.com/XX-net/XX-Net.git | add python 3.10.4 for windows | 13 | 0 | 56,137 | 8 | |
7 | 21 | def _get_permissions(self, user_obj, obj, from_name):
if not user_obj.is_active or user_obj.is_anonymous or obj is not None:
return set()
perm_cache_name = "_%s_perm_cache" % from_name
if not hasattr(user_obj, perm_cache_name):
if user_obj.is_superuser:
... | django/contrib/auth/backends.py | 190 | django | {
"docstring": "\n Return the permissions of `user_obj` from `from_name`. `from_name` can\n be either \"group\" or \"user\" to return permissions from\n `_get_group_permissions` or `_get_user_permissions` respectively.\n ",
"language": "en",
"n_whitespaces": 51,
"n_words": 22,
"voc... | 58 | Python | 44 | 9c19aff7c7561e3a82978a272ecdaad40dda5c00 | backends.py | 203,604 | 14 | 117 | _get_permissions | https://github.com/django/django.git | Refs #33476 -- Reformatted code with Black. | 204 | 0 | 50,471 | 16 | |
1 | 2 | def __hash__(self):
# type: () -> int
| .venv/lib/python3.8/site-packages/pip/_vendor/packaging/specifiers.py | 14 | transferlearning | {
"docstring": "\n Returns a hash value for this Specifier like object.\n ",
"language": "en",
"n_whitespaces": 24,
"n_words": 9,
"vocab_size": 9
} | 7 | Python | 7 | f638f5d0e6c8ebed0e69a6584bc7f003ec646580 | specifiers.py | 62,876 | 1 | 6 | __hash__ | https://github.com/jindongwang/transferlearning.git | upd; format | 21 | 0 | 13,057 | 6 | |
1 | 4 | def get_cost_of_delayed_shipments(scorecard):
return get_total_cost_of_shipments(scorecard) - get_cost_of_on_time_shipments(scorecard)
| erpnext/buying/doctype/supplier_scorecard_variable/supplier_scorecard_variable.py | 29 | erpnext | {
"docstring": "Gets the total cost of all delayed shipments in the period (based on Purchase Receipts - POs)",
"language": "en",
"n_whitespaces": 16,
"n_words": 17,
"vocab_size": 16
} | 6 | Python | 6 | 494bd9ef78313436f0424b918f200dab8fc7c20b | supplier_scorecard_variable.py | 65,547 | 2 | 16 | get_cost_of_delayed_shipments | https://github.com/frappe/erpnext.git | style: format code with black | 4 | 0 | 13,924 | 8 | |
3 | 12 | def check(self, pattern):
if self.eos:
raise EndOfText()
if pattern not in self._re_cache:
self._re_cache[pattern] = re.compile(pattern, self.flags)
return self._re_cache[pattern].match(self.data, self.pos)
| pipenv/patched/notpip/_vendor/pygments/scanner.py | 93 | pipenv | {
"docstring": "\n Apply `pattern` on the current position and return\n the match object. (Doesn't touch pos). Use this for\n lookahead.\n ",
"language": "en",
"n_whitespaces": 47,
"n_words": 18,
"vocab_size": 17
} | 19 | Python | 18 | f3166e673fe8d40277b804d35d77dcdb760fc3b3 | scanner.py | 20,474 | 6 | 60 | check | https://github.com/pypa/pipenv.git | check point progress on only bringing in pip==22.0.4 (#4966)
* vendor in pip==22.0.4
* updating vendor packaging version
* update pipdeptree to fix pipenv graph with new version of pip.
* Vendoring of pip-shims 0.7.0
* Vendoring of requirementslib 1.6.3
* Update pip index safety restrictions patch for p... | 69 | 0 | 3,391 | 11 | |
1 | 4 | def test_clear_not_launched_queued_tasks_mapped_task(self, dag_maker, session):
| tests/executors/test_kubernetes_executor.py | 17 | airflow | {
"docstring": "One mapped task has a launched pod - other does not.",
"language": "en",
"n_whitespaces": 10,
"n_words": 11,
"vocab_size": 11
} | 4 | Python | 4 | 98d52af7074e9a82457515588bdf9cdd6de70f35 | test_kubernetes_executor.py | 47,898 | 41 | 238 | test_clear_not_launched_queued_tasks_mapped_task | https://github.com/apache/airflow.git | Use map_index when clearing not launched tasks in k8s (#23224) | 11 | 0 | 9,291 | 6 | |
1 | 2 | def vertexcolorsrc(self):
return self["vertexcolorsrc"]
| packages/python/plotly/plotly/graph_objs/_mesh3d.py | 22 | plotly.py | {
"docstring": "\n Sets the source reference on Chart Studio Cloud for\n `vertexcolor`.\n\n The 'vertexcolorsrc' property must be specified as a string or\n as a plotly.grid_objs.Column object\n\n Returns\n -------\n str\n ",
"language": "en",
"n_whitespaces... | 4 | Python | 4 | 43e3a4011080911901176aab919c0ecf5046ddd3 | _mesh3d.py | 227,437 | 2 | 11 | vertexcolorsrc | https://github.com/plotly/plotly.py.git | switch to black .22 | 18 | 0 | 59,110 | 7 | |
1 | 2 | def widthsrc(self):
return self["widthsrc"]
| packages/python/plotly/plotly/graph_objs/_bar.py | 22 | plotly.py | {
"docstring": "\n Sets the source reference on Chart Studio Cloud for `width`.\n\n The 'widthsrc' property must be specified as a string or\n as a plotly.grid_objs.Column object\n\n Returns\n -------\n str\n ",
"language": "en",
"n_whitespaces": 77,
"n_words": 2... | 4 | Python | 4 | 43e3a4011080911901176aab919c0ecf5046ddd3 | _bar.py | 226,181 | 2 | 11 | widthsrc | https://github.com/plotly/plotly.py.git | switch to black .22 | 18 | 0 | 57,854 | 7 | |
1 | 7 | def _dotprodsimp(expr, withsimp=False):
from sympy.simplify.simplify import dotprodsimp as dps
return dps(expr, withsimp=withsimp)
| sympy/matrices/utilities.py | 45 | sympy | {
"docstring": "Wrapper for simplify.dotprodsimp to avoid circular imports.",
"language": "en",
"n_whitespaces": 6,
"n_words": 7,
"vocab_size": 7
} | 12 | Python | 12 | f757f3daae6e11ea0cfb7dadc133274d8d74315f | utilities.py | 196,808 | 3 | 29 | _dotprodsimp | https://github.com/sympy/sympy.git | Reordered imports 2 | 21 | 0 | 48,190 | 8 | |
2 | 5 | def libc_ver() -> Tuple[str, str]:
glibc_version = glibc_version_string()
if glibc_version is None:
return ("", "")
else:
return ("glibc", glibc_version)
| pipenv/patched/notpip/_internal/utils/glibc.py | 64 | pipenv | {
"docstring": "Try to determine the glibc version\n\n Returns a tuple of strings (lib, version) which default to empty strings\n in case the lookup fails.\n ",
"language": "en",
"n_whitespaces": 32,
"n_words": 23,
"vocab_size": 20
} | 19 | Python | 17 | f3166e673fe8d40277b804d35d77dcdb760fc3b3 | glibc.py | 19,980 | 11 | 36 | libc_ver | https://github.com/pypa/pipenv.git | check point progress on only bringing in pip==22.0.4 (#4966)
* vendor in pip==22.0.4
* updating vendor packaging version
* update pipdeptree to fix pipenv graph with new version of pip.
* Vendoring of pip-shims 0.7.0
* Vendoring of requirementslib 1.6.3
* Update pip index safety restrictions patch for p... | 45 | 0 | 3,162 | 10 | |
1 | 8 | def select_query(self, targets, from_stmt, where_stmt) -> pd.DataFrame:
# noqa
raise NotImplementedError()
| mindsdb/integrations/libs/base_handler.py | 33 | mindsdb | {
"docstring": "\n Select data from some entity in the handler and return in dataframe format.\n \n This method assumes a raw query has been parsed beforehand with mindsdb_sql using some dialect compatible with the handler, and only targets, from, and where clauses are fed into it.\n ",
... | 11 | Python | 11 | 0fd3b436c38f38bcae6fed9e14dc4d2a12e90793 | base_handler.py | 114,370 | 7 | 20 | select_query | https://github.com/mindsdb/mindsdb.git | fix tests and reformat | 26 | 0 | 25,169 | 7 | |
1 | 2 | def test_bad_return_in_train_loop(ray_start_4_cpus):
# Simulates what happens with eg. torch models | python/ray/train/tests/test_data_parallel_trainer.py | 14 | ray | {
"docstring": "Test to check if returns from train loop are discarded.",
"language": "en",
"n_whitespaces": 9,
"n_words": 10,
"vocab_size": 10
} | 10 | Python | 10 | 8bb67427c18887f43721cf9726d6836c3b40cafb | test_data_parallel_trainer.py | 124,658 | 8 | 30 | test_bad_return_in_train_loop | https://github.com/ray-project/ray.git | [AIR] Discard returns of train loops in Trainers (#26448)
Discards returns of user defined train loop functions to prevent deser issues with eg. torch models. Those returns are not used anywhere in AIR, so there is no loss of functionality. | 16 | 0 | 27,647 | 6 | |
1 | 2 | def cone(self):
return self["cone"]
| packages/python/plotly/plotly/graph_objs/layout/template/_data.py | 22 | plotly.py | {
"docstring": "\n The 'cone' property is a tuple of instances of\n Cone that may be specified as:\n - A list or tuple of instances of plotly.graph_objs.layout.template.data.Cone\n - A list or tuple of dicts of string/value properties that\n will be passed to the Cone constr... | 4 | Python | 4 | 43e3a4011080911901176aab919c0ecf5046ddd3 | _data.py | 232,549 | 2 | 11 | cone | https://github.com/plotly/plotly.py.git | switch to black .22 | 18 | 0 | 63,993 | 7 | |
2 | 11 | def get_purchased_items_cost():
pr_items = frappe.db.sql(
,
as_dict=1,
)
pr_item_map = {}
for item in pr_items:
pr_item_map.setdefault(item.project, item.amount)
return pr_item_map
| erpnext/projects/report/project_wise_stock_tracking/project_wise_stock_tracking.py | 67 | erpnext | {
"docstring": "select project, sum(base_net_amount) as amount\n\t\tfrom `tabPurchase Receipt Item` where ifnull(project, '') != ''\n\t\tand docstatus = 1 group by project",
"language": "en",
"n_whitespaces": 18,
"n_words": 21,
"vocab_size": 21
} | 19 | Python | 17 | 494bd9ef78313436f0424b918f200dab8fc7c20b | project_wise_stock_tracking.py | 67,037 | 11 | 42 | get_purchased_items_cost | https://github.com/frappe/erpnext.git | style: format code with black | 10 | 0 | 14,414 | 10 | |
1 | 8 | def test_identity_weighted_graph_matrix(self):
A = nx.to_scipy_sparse_array(self.G3)
self.identity_conversion(self.G3, A, nx.Graph())
| networkx/tests/test_convert_scipy.py | 53 | networkx | {
"docstring": "Conversion from weighted graph to sparse matrix to weighted graph.",
"language": "en",
"n_whitespaces": 9,
"n_words": 10,
"vocab_size": 8
} | 8 | Python | 8 | 5dfd57af2a141a013ae3753e160180b82bec9469 | test_convert_scipy.py | 176,206 | 3 | 32 | test_identity_weighted_graph_matrix | https://github.com/networkx/networkx.git | Use scipy.sparse array datastructure (#5139)
* Step 1: use sparse arrays in nx.to_scipy_sparse_matrix.
Seems like a reasonable place to start.
nx.to_scipy_sparse_matrix is one of the primary interfaces to
scipy.sparse from within NetworkX.
* 1: Use np.outer instead of mult col/row vectors
Fix two instances ... | 29 | 0 | 41,766 | 9 | |
1 | 9 | def _merge_dataframes(transactions_df, articles_df, customers_df):
# Merge the transactions and articles dataframes
transactions_df = pd.merge(
transactions_df,
articles_df,
how="left",
left_on="article_id",
right_on="article_id",
)
# Merge the transactions ... | ludwig/datasets/loaders/hm_fashion_recommendations.py | 96 | ludwig | {
"docstring": "Merge the transactions, articles, and customers dataframes into a single dataframe.",
"language": "en",
"n_whitespaces": 10,
"n_words": 11,
"vocab_size": 11
} | 38 | Python | 24 | abfdc05018cc4dec5a2fed20ad09e94f1749fca9 | hm_fashion_recommendations.py | 8,572 | 16 | 58 | _merge_dataframes | https://github.com/ludwig-ai/ludwig.git | Add H&M fashion recommendation dataset (#2708)
* allow individual file downloads from kaggle
* pipe download_filenames to kaggle download fn
* add dataset config for H&M Fashion Recommendations
* add custom loader
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://p... | 132 | 0 | 1,463 | 10 | |
2 | 8 | def _get_trainable_state(self):
trainable_state = weakref.WeakKeyDictionary()
for layer in self._flatten_layers():
trainable_state[layer] = layer.trainable
return trainable_state
| keras/engine/base_layer.py | 54 | keras | {
"docstring": "Get the `trainable` state of each sublayer.\n\n Returns:\n A dict mapping all sublayers to their `trainable` value.\n ",
"language": "en",
"n_whitespaces": 40,
"n_words": 17,
"vocab_size": 16
} | 14 | Python | 12 | 84afc5193d38057e2e2badf9c889ea87d80d8fbf | base_layer.py | 270,669 | 5 | 32 | _get_trainable_state | https://github.com/keras-team/keras.git | Reformatting the codebase with black.
PiperOrigin-RevId: 450093126 | 53 | 0 | 80,516 | 9 | |
11 | 17 | def get_field_type(self, connection, table_name, row):
field_params = {}
field_notes = []
try:
field_type = connection.introspection.get_field_type(row.type_code, row)
except KeyError:
field_type = "TextField"
field_notes.append("This field t... | django/core/management/commands/inspectdb.py | 299 | django | {
"docstring": "\n Given the database connection, the table name, and the cursor row\n description, this routine will return the given field type name, as\n well as any additional keyword parameters and notes for the field.\n ",
"language": "en",
"n_whitespaces": 62,
"n_words": 33,
... | 116 | Python | 74 | 9c19aff7c7561e3a82978a272ecdaad40dda5c00 | inspectdb.py | 204,637 | 28 | 176 | get_field_type | https://github.com/django/django.git | Refs #33476 -- Reformatted code with Black. | 459 | 0 | 50,819 | 14 | |
18 | 53 | def solve_undetermined_coeffs(equ, coeffs, *syms, **flags):
r
if not (coeffs and all(i.is_Symbol for i in coeffs)):
raise ValueError('must provide symbols for coeffs')
if isinstance(equ, Eq):
eq = equ.lhs - equ.rhs
else:
eq = equ
ceq = cancel(eq)
xeq = _mexpand(ceq.as_n... | sympy/solvers/solvers.py | 580 | sympy | {
"docstring": "\n Solve a system of equations in $k$ parameters that is formed by\n matching coefficients in variables ``coeffs`` that are on\n factors dependent on the remaining variables (or those given\n explicitly by ``syms``.\n\n Explanation\n ===========\n\n The result of this function is ... | 295 | Python | 168 | 2163f938f26e75e10f2d25b92321511988eff502 | solvers.py | 199,434 | 103 | 358 | solve_undetermined_coeffs | https://github.com/sympy/sympy.git | mv solve_undetermined_coeffs and legacy behavior | 580 | 0 | 49,266 | 14 | |
7 | 53 | def populate_any_indicators(self, pair, df, tf, informative=None,coin=''):
if informative is None:
informative = self.dp.get_pair_dataframe(pair, tf)
informative[coin+'rsi'] = ta.RSI(informative, timeperiod=14)
informative[coin+'mfi'] = ta.MFI(informative, timeperiod=25)
... | freqtrade/templates/FreqaiExampleStrategy.py | 1,004 | freqtrade | {
"docstring": "\n Function designed to automatically generate, name and merge features\n from user indicated timeframes in the configuration file. User can add\n additional features here, but must follow the naming convention.\n :params:\n :pair: pair to be used as informative\n ... | 165 | Python | 109 | fc837c4daa27a18ff0e86128f4d52089b88fa5fb | FreqaiExampleStrategy.py | 149,765 | 40 | 614 | populate_any_indicators | https://github.com/freqtrade/freqtrade.git | add freqao backend machinery, user interface, documentation | 481 | 0 | 34,522 | 13 | |
1 | 6 | def shuffle(*arrays, random_state=None, n_samples=None):
return resample(
*arrays, replace=False, n_samples=n_samples, random_state=random_state
)
| sklearn/utils/__init__.py | 50 | scikit-learn | {
"docstring": "Shuffle arrays or sparse matrices in a consistent way.\n\n This is a convenience alias to ``resample(*arrays, replace=False)`` to do\n random permutations of the collections.\n\n Parameters\n ----------\n *arrays : sequence of indexable data-structures\n Indexable data-structures... | 11 | Python | 11 | 49279c3267c0c54cdba80a571820c46f25fbe883 | __init__.py | 260,817 | 4 | 33 | shuffle | https://github.com/scikit-learn/scikit-learn.git | DOC ensures sklearn.utils.shuffle passes numpydoc validation (#24367)
Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com> | 27 | 0 | 76,516 | 8 | |
1 | 8 | def _eigh(*args, **kwargs):
eigvals = kwargs.pop("subset_by_index", None)
return scipy.linalg.eigh(*args, eigvals=eigvals, **kwargs)
# remove when https://github.com/joblib/joblib/issues/1071 is fixed | sklearn/utils/fixes.py | 62 | scikit-learn | {
"docstring": "Wrapper for `scipy.linalg.eigh` that handles the deprecation of `eigvals`.",
"language": "en",
"n_whitespaces": 8,
"n_words": 9,
"vocab_size": 9
} | 17 | Python | 17 | b0bf2315a771ed10b10d1f6a24a48ebdba34cf16 | fixes.py | 261,771 | 3 | 37 | _eigh | https://github.com/scikit-learn/scikit-learn.git | MAINT fix deprecation raised in scipy-dev build (#25175)
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
Co-authored-by: Loïc Estève <loic.esteve@ymail.com> | 37 | 0 | 76,983 | 9 | |
4 | 11 | def compute_dict_delta(old_dict, new_dict) -> Tuple[dict, dict, dict]:
added_keys, removed_keys, updated_keys = compute_iterable_delta(
old_dict.keys(), new_dict.keys()
)
return (
{k: new_dict[k] for k in added_keys},
{k: old_dict[k] for k in removed_keys},
{k: new_dict[... | python/ray/serve/utils.py | 113 | ray | {
"docstring": "Given two dicts, return the entries that's (added, removed, updated).\n\n Usage:\n >>> old = {\"a\": 1, \"b\": 2}\n >>> new = {\"a\": 3, \"d\": 4}\n >>> compute_dict_delta(old, new)\n ({\"d\": 4}, {\"b\": 2}, {\"a\": 3})\n ",
"language": "en",
"n_whitespaces": 68,... | 36 | Python | 26 | 7f1bacc7dc9caf6d0ec042e39499bbf1d9a7d065 | utils.py | 131,053 | 17 | 79 | compute_dict_delta | https://github.com/ray-project/ray.git | [CI] Format Python code with Black (#21975)
See #21316 and #21311 for the motivation behind these changes. | 79 | 0 | 29,455 | 10 | |
1 | 3 | def convert_shapes(input_shape, to_tuples=True):
| keras/utils/tf_utils.py | 18 | keras | {
"docstring": "Converts nested shape representations to desired format.\n\n Performs:\n\n TensorShapes -> tuples if `to_tuples=True`.\n tuples of int or None -> TensorShapes if `to_tuples=False`.\n\n Valid objects to be converted are:\n - TensorShapes\n - tuples with elements of type int or None.\n... | 3 | Python | 3 | 84afc5193d38057e2e2badf9c889ea87d80d8fbf | tf_utils.py | 277,095 | 7 | 25 | convert_shapes | https://github.com/keras-team/keras.git | Reformatting the codebase with black.
PiperOrigin-RevId: 450093126 | 6 | 0 | 81,867 | 6 | |
3 | 16 | def get_performance_issue_description_data(self, event):
spans, matched_problem = get_span_and_problem(event)
if not matched_problem:
return ""
parent_span, repeating_spans = get_parent_and_repeating_spans(spans, matched_problem)
transaction_name = get_span_evidence... | src/sentry/integrations/mixins/issues.py | 128 | sentry | {
"docstring": "Generate the span evidence data from a performance issue to populate\n an integration's ticket description. Each integration will need to take\n this data and format it appropriately.\n ",
"language": "en",
"n_whitespaces": 48,
"n_words": 27,
"vocab_size": 25
} | 40 | Python | 30 | 0711b240a4efe79f06629914d5836cd6acbfcf78 | issues.py | 88,271 | 12 | 79 | get_performance_issue_description_data | https://github.com/getsentry/sentry.git | feat(github): Add span evidence to performance issues (#41041)
Add span evidence to the description of a GitHub issue created from a
performance issue. Currently the GitHub issue is fairly empty as for an
error issue it shows the stacktrace, but for a performance issue it's
just a link back to the Sentry issue.
... | 132 | 0 | 18,365 | 13 | |
2 | 17 | def install_src(collection, b_collection_path, b_collection_output_path, artifacts_manager):
r
collection_meta = artifacts_manager.get_direct_collection_meta(collection)
if 'build_ignore' not in collection_meta: # installed collection, not src
# FIXME: optimize this? use a different process? copy ... | lib/ansible/galaxy/collection/__init__.py | 150 | ansible | {
"docstring": "Install the collection from source control into given dir.\n\n Generates the Ansible collection artifact data from a galaxy.yml and\n installs the artifact to a directory.\n This should follow the same pattern as build_collection, but instead\n of creating an artifact, install it.\n\n :... | 63 | Python | 52 | b439e41a915ccec0ccbabecc966919ea406db74e | __init__.py | 267,136 | 33 | 93 | install_src | https://github.com/ansible/ansible.git | expand ansible-doc coverage (#74963)
* Expand ansible-doc to tests/filters and fix existing issues
enable filter/test docs if in single file or companion yaml
add docs for several filters/tests plugins
allow .yml companion for docs for other plugins, must be colocated
verify plugins are valid (not module... | 156 | 0 | 78,754 | 10 | |
23 | 58 | def in1d(ar1, ar2, assume_unique=False, invert=False, method='auto'):
# Ravel both arrays, behavior for the first array could be different
ar1 = np.asarray(ar1).ravel()
ar2 = np.asarray(ar2).ravel()
# Ensure that iteration through object arrays yields size-1 arrays
if ar2.dtype == object:
... | numpy/lib/arraysetops.py | 971 | numpy | {
"docstring": "\n Test whether each element of a 1-D array is also present in a second array.\n\n Returns a boolean array the same length as `ar1` that is True\n where an element of `ar1` is in `ar2` and False otherwise.\n\n We recommend using :func:`isin` instead of `in1d` for new code.\n\n Parameter... | 469 | Python | 245 | d7e2582cd33b22a767286e8a3d95b336dfe51a34 | arraysetops.py | 160,657 | 77 | 600 | in1d | https://github.com/numpy/numpy.git | MAINT: bool instead of np.bool_ dtype | 1,320 | 0 | 38,687 | 21 | |
6 | 18 | def world_size(self):
if is_torch_tpu_available():
return xm.xrt_world_size()
elif is_sagemaker_mp_enabled():
return smp.dp_size() if not smp.state.cfg.prescaled_batch else smp.rdp_size()
elif is_sagemaker_dp_enabled():
return sm_dist.get_world_size()... | src/transformers/training_args.py | 122 | transformers | {
"docstring": "\n The number of processes used in parallel.\n ",
"language": "en",
"n_whitespaces": 22,
"n_words": 7,
"vocab_size": 7
} | 27 | Python | 20 | 2eb7bb15e771f13192968cd4657c78f76b0799fe | training_args.py | 35,787 | 10 | 72 | world_size | https://github.com/huggingface/transformers.git | Updates in Trainer to support new features in SM Model Parallel library (#15877)
* Create optimizer after model creation for SMP
* update dp_rank to rdp_rank for opt_state_dict
* update world_size and process_index for smp
* Address comments
* Lint fix
Co-authored-by: Cavdar <dcavdar@a07817b12d7e.ant.am... | 113 | 0 | 6,535 | 13 | |
6 | 17 | def _is_packed(dtype):
align = dtype.isalignedstruct
max_alignment = 1
total_offset = 0
for name in dtype.names:
fld_dtype, fld_offset, title = _unpack_field(*dtype.fields[name])
if align:
total_offset = _aligned_offset(total_offset, fld_dtype.alignment)
max... | numpy/core/_dtype.py | 153 | numpy | {
"docstring": "\n Checks whether the structured data type in 'dtype'\n has a simple layout, where all the fields are in order,\n and follow each other with no alignment padding.\n\n When this returns true, the dtype can be reconstructed\n from a list of the field names and dtypes with no additional\n ... | 53 | Python | 32 | a0c2e826738daa0cbd83aba85852405b73878f5b | _dtype.py | 160,281 | 17 | 97 | _is_packed | https://github.com/numpy/numpy.git | API: Fix structured dtype cast-safety, promotion, and comparison
This PR replaces the old gh-15509 implementing proper type promotion
for structured voids. It further fixes the casting safety to consider
casts with equivalent field number and matching order as "safe"
and if the names, titles, and offsets match as "eq... | 152 | 0 | 38,590 | 13 | |
2 | 4 | async def _async_stop(self) -> None:
if self._cancel_watchdog:
self._cancel_watchdog()
self._cancel_watchdog = None
await self._async_stop_scanner()
| homeassistant/components/bluetooth/scanner.py | 53 | core | {
"docstring": "Cancel watchdog and bluetooth discovery under the lock.",
"language": "en",
"n_whitespaces": 7,
"n_words": 8,
"vocab_size": 8
} | 13 | Python | 13 | ced8278e3222501dde7d769ea4b57aae75f62438 | scanner.py | 304,515 | 6 | 29 | _async_stop | https://github.com/home-assistant/core.git | Auto recover when the Bluetooth adapter stops responding (#77043) | 56 | 0 | 103,322 | 9 | |
1 | 1 | def netdev():
| salt/modules/status.py | 12 | salt | {
"docstring": "\n .. versionchanged:: 2016.3.2\n Return the network device stats for this minion\n\n .. versionchanged:: 2016.11.4\n Added support for AIX\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' status.netdev\n ",
"language": "en",
"n_whitespaces": 63,
"n_word... | 2 | Python | 2 | fe48a85e8204f3840264f16235ea3bde3e664c65 | status.py | 215,934 | 14 | 56 | netdev | https://github.com/saltstack/salt.git | Allow for Python 3 using view objects for a dictionary keys() function | 5 | 0 | 54,260 | 6 | |
2 | 7 | def remove_module_load(state_dict):
new_state_dict = OrderedDict()
for k, v in state_dict.items(): new_state_dict[k[7:]] = v
return new_state_dict
| fastai/torch_core.py | 57 | DeOldify | {
"docstring": "create new OrderedDict that does not contain `module.`",
"language": "en",
"n_whitespaces": 7,
"n_words": 8,
"vocab_size": 8
} | 15 | Python | 12 | 4fc3616712edb19179b17dd270ad6cf63abf99c2 | torch_core.py | 190,450 | 4 | 34 | remove_module_load | https://github.com/jantic/DeOldify.git | Upgrading to support latest Pytorch version | 27 | 0 | 46,351 | 11 | |
5 | 18 | def in_place_subclassed_model_state_restoration(model):
assert not model._is_graph_network
# Restore layers and build attributes
if (
hasattr(model, "_original_attributes_cache")
and model._original_attributes_cache is not None
):
# Models have sticky attribute assignment, s... | keras/models/cloning.py | 181 | @keras_export("keras.__internal__.models.clone_and_build_model", v1=[]) | keras | {
"docstring": "Restores the original state of a model after it was \"reset\".\n\n This undoes this action of `_in_place_subclassed_model_reset`, which is\n called in `clone_and_build_model` if `in_place_reset` is set to True.\n\n Args:\n model: Instance of a Keras model created via subclassing, on whic... | 101 | Python | 75 | f0fc6f798937a7a5fdab469c0f16bdde7cfc4ccd | cloning.py | 278,255 | 17 | 97 | in_place_subclassed_model_state_restoration | https://github.com/keras-team/keras.git | resolve line-too-long in models | 253 | 1 | 82,432 | 14 |
5 | 23 | def _make_inc_temp(self, suffix="", prefix="", directory_name=None):
if directory_name is None:
directory_name = ray._private.utils.get_ray_temp_dir()
directory_name = os.path.expanduser(directory_name)
index = self._incremental_dict[suffix, prefix, directory_name]
#... | python/ray/node.py | 228 | ray | {
"docstring": "Return a incremental temporary file name. The file is not created.\n\n Args:\n suffix (str): The suffix of the temp file.\n prefix (str): The prefix of the temp file.\n directory_name (str) : The base directory of the temp file.\n\n Returns:\n ... | 86 | Python | 60 | 7f1bacc7dc9caf6d0ec042e39499bbf1d9a7d065 | node.py | 130,791 | 17 | 142 | _make_inc_temp | https://github.com/ray-project/ray.git | [CI] Format Python code with Black (#21975)
See #21316 and #21311 for the motivation behind these changes. | 306 | 0 | 29,365 | 17 | |
1 | 4 | def captured_stdout() -> ContextManager[StreamWrapper]:
return captured_output("stdout")
| pipenv/patched/notpip/_internal/utils/misc.py | 30 | pipenv | {
"docstring": "Capture the output of sys.stdout:\n\n with captured_stdout() as stdout:\n print('hello')\n self.assertEqual(stdout.getvalue(), 'hello\\n')\n\n Taken from Lib/support/__init__.py in the CPython repo.\n ",
"language": "en",
"n_whitespaces": 47,
"n_words": 19,
"vocab_s... | 6 | Python | 6 | f3166e673fe8d40277b804d35d77dcdb760fc3b3 | misc.py | 19,989 | 10 | 15 | captured_stdout | https://github.com/pypa/pipenv.git | check point progress on only bringing in pip==22.0.4 (#4966)
* vendor in pip==22.0.4
* updating vendor packaging version
* update pipdeptree to fix pipenv graph with new version of pip.
* Vendoring of pip-shims 0.7.0
* Vendoring of requirementslib 1.6.3
* Update pip index safety restrictions patch for p... | 12 | 0 | 3,166 | 8 | |
4 | 23 | def test_a3c_compilation(self):
config = a3c.DEFAULT_CONFIG.copy()
config["num_workers"] = 2
config["num_envs_per_worker"] = 2
num_iterations = 1
# Test against all frameworks.
for _ in framework_iterator(config, with_eager_tracing=True):
for env in... | rllib/agents/a3c/tests/test_a3c.py | 224 | ray | {
"docstring": "Test whether an A3CTrainer can be built with both frameworks.",
"language": "en",
"n_whitespaces": 9,
"n_words": 10,
"vocab_size": 10
} | 54 | Python | 42 | 7f1bacc7dc9caf6d0ec042e39499bbf1d9a7d065 | test_a3c.py | 133,631 | 18 | 129 | test_a3c_compilation | https://github.com/ray-project/ray.git | [CI] Format Python code with Black (#21975)
See #21316 and #21311 for the motivation behind these changes. | 295 | 0 | 30,064 | 15 | |
1 | 5 | def test_author_name_present(self):
response = self.get_for_author(1)
self.assertContains(response, "J. R. R. Tolkien", 2)
| wagtail/contrib/modeladmin/tests/test_simple_modeladmin.py | 42 | wagtail | {
"docstring": "\n The author name should appear twice. Once in the header, and once\n more in the field listing\n ",
"language": "en",
"n_whitespaces": 39,
"n_words": 17,
"vocab_size": 15
} | 11 | Python | 10 | d10f15e55806c6944827d801cd9c2d53f5da4186 | test_simple_modeladmin.py | 73,270 | 3 | 24 | test_author_name_present | https://github.com/wagtail/wagtail.git | Reformat with black | 32 | 0 | 16,001 | 8 | |
19 | 43 | def _update_title_position(self, renderer):
if self._autotitlepos is not None and not self._autotitlepos:
_log.debug('title position was updated manually, not adjusting')
return
titles = (self.title, self._left_title, self._right_title)
for title in titles:
... | lib/matplotlib/axes/_base.py | 662 | matplotlib | {
"docstring": "\n Update the title position based on the bounding box enclosing\n all the ticklabels and x-axis spine and xlabel...\n ",
"language": "en",
"n_whitespaces": 40,
"n_words": 18,
"vocab_size": 15
} | 245 | Python | 135 | cfabe79945743dd375db4fe8bcdbaab00330dfe8 | _base.py | 106,974 | 47 | 411 | _update_title_position | https://github.com/matplotlib/matplotlib.git | FIX: Autoposition title when yaxis has offset
Move any title above the y axis offset text it would overlap with the
offset. If multiple titles are present, they are vertically aligned to
the highest one. | 1,070 | 0 | 22,531 | 19 | |
1 | 3 | def geturl(self):
return self.url
| python3.10.4/Lib/http/client.py | 19 | XX-Net | {
"docstring": "Return the real URL of the page.\n\n In some cases, the HTTP server redirects a client to another\n URL. The urlopen() function handles this transparently, but in\n some cases the caller needs to know which URL the client was\n redirected to. The geturl() method can be used... | 4 | Python | 4 | 8198943edd73a363c266633e1aa5b2a9e9c9f526 | client.py | 217,715 | 2 | 10 | geturl | https://github.com/XX-net/XX-Net.git | add python 3.10.4 for windows | 18 | 0 | 54,897 | 6 | |
5 | 22 | def get_updated_history(self, current_stream_state, latest_record_datetime, latest_record, current_parsed_datetime, state_date):
history = current_stream_state.get("history", {})
file_modification_date = latest_record_datetime.strftime("%Y-%m-%d")
# add record to history if record mo... | airbyte-integrations/connectors/source-s3/source_s3/source_files_abstract/stream.py | 215 | airbyte | {
"docstring": "\n History is dict which basically groups files by their modified_at date.\n After reading each record we add its file to the history set if it wasn't already there.\n Then we drop from the history set any entries whose key is less than now - buffer_days\n ",
"language": ... | 73 | Python | 49 | f9348b22517556e1af5d1831db7187b912ee0126 | stream.py | 5,513 | 14 | 134 | get_updated_history | https://github.com/airbytehq/airbyte.git | 🐛 Source Amazon S3: solve possible case of files being missed during incremental syncs (#12568)
* Added history to state
* Deleted unused import
* Rollback abnormal state file
* Rollback abnormal state file
* Fixed type error issue
* Fix state issue
* Updated after review
* Bumped version | 229 | 0 | 784 | 17 | |
3 | 12 | def test_inheritance(self):
should_contain = [
'<li>Villain: <a href="%s">Bob</a>'
% reverse("admin:admin_views_villain_change", args=(self.sv1.pk,)),
'<li>Super villain: <a href="%s">Bob</a>'
% reverse("admin:admin_views_supervillain_change", args=(self.... | tests/admin_views/tests.py | 204 | django | {
"docstring": "\n In the case of an inherited model, if either the child or\n parent-model instance is deleted, both instances are listed\n for deletion, as well as any relationships they have.\n ",
"language": "en",
"n_whitespaces": 58,
"n_words": 29,
"vocab_size": 27
} | 55 | Python | 36 | 9c19aff7c7561e3a82978a272ecdaad40dda5c00 | tests.py | 207,745 | 19 | 128 | test_inheritance | https://github.com/django/django.git | Refs #33476 -- Reformatted code with Black. | 228 | 0 | 52,081 | 14 | |
3 | 14 | def store_or_execute(self, block, name):
if name:
# If storing it for further editing
self.shell.user_ns[name] = SList(block.splitlines())
print("Block assigned to '%s'" % name)
else:
b = self.preclean_input(block)
self.shell.user_ns['... | IPython/terminal/magics.py | 144 | ipython | {
"docstring": " Execute a block, or store it in a variable, per the user's request.\n ",
"language": "en",
"n_whitespaces": 21,
"n_words": 13,
"vocab_size": 12
} | 39 | Python | 33 | 75b3d1cc6d5e1e629705d8a7233a374f1e4235e7 | magics.py | 208,683 | 12 | 86 | store_or_execute | https://github.com/ipython/ipython.git | Get history from sql.
Fixes #13585
By getting history from sql we can get the transformed history.
This also skip storing history if `%paste` is used and `%paste` itself
will insert the pasted value in history which is more conveninent. | 178 | 0 | 52,454 | 14 | |
2 | 5 | def _count_righthand_zero_bits(number, bits):
if number == 0:
return bits
return min(bits, (~number & (number-1)).bit_length())
| python3.10.4/Lib/ipaddress.py | 57 | XX-Net | {
"docstring": "Count the number of zero bits on the right hand side.\n\n Args:\n number: an integer.\n bits: maximum number of bits to count.\n\n Returns:\n The number of zero bits on the right hand side of the number.\n\n ",
"language": "en",
"n_whitespaces": 66,
"n_words": 36,
... | 14 | Python | 13 | 8198943edd73a363c266633e1aa5b2a9e9c9f526 | ipaddress.py | 218,498 | 4 | 35 | _count_righthand_zero_bits | https://github.com/XX-net/XX-Net.git | add python 3.10.4 for windows | 30 | 0 | 55,351 | 13 | |
2 | 6 | def _deserialize_metric(metric_config):
from keras import (
metrics as metrics_module,
) # pylint:disable=g-import-not-at-top
if metric_config in ["accuracy", "acc", "crossentropy", "ce"]:
# Do not deserialize accuracy and cross-entropy strings as we have special
# case handli... | keras/saving/saving_utils.py | 68 | keras | {
"docstring": "Deserialize metrics, leaving special strings untouched.",
"language": "en",
"n_whitespaces": 5,
"n_words": 6,
"vocab_size": 6
} | 47 | Python | 41 | 84afc5193d38057e2e2badf9c889ea87d80d8fbf | saving_utils.py | 276,242 | 7 | 37 | _deserialize_metric | https://github.com/keras-team/keras.git | Reformatting the codebase with black.
PiperOrigin-RevId: 450093126 | 91 | 0 | 81,600 | 8 | |
1 | 3 | def __call__(self, w):
return w
| keras/constraints.py | 18 | keras | {
"docstring": "Applies the constraint to the input weight variable.\n\n By default, the inputs weight variable is not modified.\n Users should override this method to implement their own projection\n function.\n\n Args:\n w: Input weight variable.\n\n Returns:\n P... | 5 | Python | 5 | 84afc5193d38057e2e2badf9c889ea87d80d8fbf | constraints.py | 270,120 | 2 | 10 | __call__ | https://github.com/keras-team/keras.git | Reformatting the codebase with black.
PiperOrigin-RevId: 450093126 | 19 | 0 | 80,394 | 6 | |
1 | 3 | def on_click(self) -> None:
self.cycle_variant()
| src/textual/widgets/_placeholder.py | 25 | textual | {
"docstring": "Clicking on the placeholder cycles through the placeholder variants.",
"language": "en",
"n_whitespaces": 8,
"n_words": 9,
"vocab_size": 7
} | 5 | Python | 5 | 4b5fd43423a327e4cd6d477a66bebc9588fd1488 | _placeholder.py | 185,863 | 3 | 13 | on_click | https://github.com/Textualize/textual.git | Add scaffolding for the Placeholder widget. | 19 | 0 | 45,212 | 7 | |
3 | 12 | def set_tunnel(self, host, port=None, headers=None):
if self.sock:
raise RuntimeError("Can't set up tunnel for established connection")
self._tunnel_host, self._tunnel_port = self._get_hostport(host, port)
if headers:
self._tunnel_headers = headers
else... | python3.10.4/Lib/http/client.py | 96 | XX-Net | {
"docstring": "Set up host and port for HTTP CONNECT tunnelling.\n\n In a connection that uses HTTP CONNECT tunneling, the host passed to the\n constructor is used as a proxy server that relays all communication to\n the endpoint passed to `set_tunnel`. This done by sending an HTTP\n CONN... | 27 | Python | 25 | 8198943edd73a363c266633e1aa5b2a9e9c9f526 | client.py | 217,711 | 8 | 59 | set_tunnel | https://github.com/XX-net/XX-Net.git | add python 3.10.4 for windows | 95 | 0 | 54,894 | 11 | |
4 | 33 | def get_ann_info(self, idx):
img_id = self.data_infos[idx]['img_id']
bboxes = []
labels = []
bboxes_ignore = []
labels_ignore = []
is_occludeds = []
is_truncateds = []
is_group_ofs = []
is_depictions = []
is_insides = []
fo... | mmdet/datasets/openimages.py | 674 | mmdetection | {
"docstring": "Get OpenImages annotation by index.\n\n Args:\n idx (int): Index of data.\n\n Returns:\n dict: Annotation info of specified index.\n ",
"language": "en",
"n_whitespaces": 61,
"n_words": 18,
"vocab_size": 16
} | 141 | Python | 79 | 1516986a616fee8bb741d0ab2be40683045efccd | openimages.py | 243,999 | 55 | 423 | get_ann_info | https://github.com/open-mmlab/mmdetection.git | [Feature] Support OpenImages Dataset (#6331)
* [Feature] support openimage group of eval
* [Feature] support openimage group of eval
* support openimage dataset
* support openimage challenge dataset
* fully support OpenImages-V6 and OpenImages Challenge 2019
* Fix some logic error
* update config fil... | 684 | 0 | 70,189 | 14 | |
1 | 17 | def test_chord_clone_kwargs(self, subtests):
with subtests.test(msg='Verify chord cloning clones kwargs correctly'):
c = chord([signature('g'), signature('h')], signature('i'), kwargs={'U': 6})
c2 = c.clone()
assert c2.kwargs == c.kwargs
with subtests.test(... | t/unit/tasks/test_canvas.py | 222 | celery | {
"docstring": " Test that chord clone ensures the kwargs are the same ",
"language": "en",
"n_whitespaces": 11,
"n_words": 10,
"vocab_size": 9
} | 55 | Python | 39 | c3c6594b4cdea898abba218f576a669700dba98d | test_canvas.py | 208,148 | 12 | 127 | test_chord_clone_kwargs | https://github.com/celery/celery.git | BLM-2: Adding unit tests to chord clone (#7668)
* Added .python-version and .vscode to .gitignore
* Added test_chord_clone_kwargs() to verify chord cloning treats kwargs correctly
* Happify linter | 171 | 0 | 52,217 | 14 | |
2 | 18 | def save(self, filename, data):
logger.debug("filename: %s, data type: %s", filename, type(data))
filename = self._check_extension(filename)
try:
with open(filename, self._write_option) as s_file:
s_file.write(self.marshal(data))
except IOError as err... | lib/serializer.py | 131 | faceswap | {
"docstring": " Serialize data and save to a file\n\n Parameters\n ----------\n filename: str\n The path to where the serialized file should be saved\n data: varies\n The data that is to be serialized to file\n\n Example\n ------\n >>> serializer... | 36 | Python | 33 | bad5025aea1adb9126580e14e064e6c99089243d | serializer.py | 100,940 | 9 | 72 | save | https://github.com/deepfakes/faceswap.git | Core updates
- Change loss loading mechanism
- Autosize tooltips based on content size
- Random linting + code modernisation | 119 | 0 | 20,387 | 13 | |
6 | 12 | def _media_status(self):
media_status = self.media_status
media_status_received = self.media_status_received
if (
media_status is None
or media_status.player_state == MEDIA_PLAYER_STATE_UNKNOWN
):
groups = self.mz_media_status
for... | homeassistant/components/cast/media_player.py | 115 | core | {
"docstring": "\n Return media status.\n\n First try from our own cast, then groups which our cast is a member in.\n ",
"language": "en",
"n_whitespaces": 40,
"n_words": 18,
"vocab_size": 17
} | 42 | Python | 32 | 66551e6fcbd063e53c13adc8a6462b8e00ce1450 | media_player.py | 299,284 | 14 | 72 | _media_status | https://github.com/home-assistant/core.git | Add state buffering to media_player and use it in cast (#70802) | 200 | 0 | 98,218 | 14 | |
2 | 42 | def no_manual_dependency_tracking_scope(obj):
| keras/feature_column/dense_features_v2.py | 92 | """A context that disables manual dependency tracking for the given `obj`.
Sometimes library methods might track objects on their own and we might want
to disable that and do the tracking on our own. One can then use this context
manager to disable the tracking the library method does and do your own
tracking.... | keras | {
"docstring": "A context that disables manual dependency tracking for the given `obj`.\n\n Sometimes library methods might track objects on their own and we might want\n to disable that and do the tracking on our own. One can then use this context\n manager to disable the tracking the library method does and do y... | 2 | Python | 2 | 0c959a0670a2bcb12dc7a1717ce7416ff1f7cc27 | dense_features_v2.py | 268,958 | 7 | 31 | no_manual_dependency_tracking_scope | https://github.com/keras-team/keras.git | Remove deprecated TF1 Layer APIs `apply()`, `get_updates_for()`, `get_losses_for()`, and remove the `inputs` argument in the `add_loss()` method.
PiperOrigin-RevId: 428134172 | 3 | 2 | 79,789 | 8 |
3 | 13 | def load(self) -> Generator[Tuple[str, np.ndarray], None, None]:
iterator = self._load_video_frames if self._is_video else self._load_disk_frames
for filename, image in iterator():
yield filename, image
| scripts/fsmedia.py | 73 | faceswap | {
"docstring": " Generator to load frames from a folder of images or from a video file.\n\n Yields\n ------\n filename: str\n The filename of the current frame\n image: :class:`numpy.ndarray`\n A single frame\n ",
"language": "en",
"n_whitespaces": 87,
"n... | 22 | Python | 20 | 1022651eb8a7741014f5d2ec7cbfe882120dfa5f | fsmedia.py | 101,397 | 13 | 48 | load | https://github.com/deepfakes/faceswap.git | 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 | 54 | 0 | 20,812 | 9 | |
11 | 30 | def _execute_task(self, context, task_copy):
# If the task has been deferred and is being executed due to a trigger,
# then we need to pick the right method to come back to, otherwise
# we go for the default execute
execute_callable = task_copy.execute
if self.next_metho... | airflow/models/taskinstance.py | 354 | airflow | {
"docstring": "Executes Task (optionally with a Timeout) and pushes Xcom results",
"language": "en",
"n_whitespaces": 9,
"n_words": 10,
"vocab_size": 10
} | 219 | Python | 138 | d48a3a357fd89ec805d086d5b6c1f1d4daf77b9a | taskinstance.py | 43,918 | 31 | 206 | _execute_task | https://github.com/apache/airflow.git | Add TaskMap and TaskInstance.map_id (#20286)
Co-authored-by: Ash Berlin-Taylor <ash_github@firemirror.com> | 731 | 0 | 8,094 | 18 | |
6 | 32 | def update_pdfjs(target_version=None, legacy=False, gh_token=None):
if target_version is None:
version, url = get_latest_pdfjs_url(gh_token, legacy=legacy)
else:
# We need target_version as x.y.z, without the 'v' prefix, though the
# user might give it on the command line
if... | scripts/dev/update_3rdparty.py | 390 | qutebrowser | {
"docstring": "Download and extract the latest pdf.js version.\n\n If target_version is not None, download the given version instead.\n\n Args:\n target_version: None or version string ('x.y.z')\n legacy: Whether to download the legacy build for 83-based.\n gh_token: GitHub token to use fo... | 122 | Python | 94 | f6a365172afe127a4ba770e14569f2d3cd7569b4 | update_3rdparty.py | 320,711 | 26 | 208 | update_pdfjs | https://github.com/qutebrowser/qutebrowser.git | Use legacy PDF.js build for macOS/Windows releases
Fixes #7108 | 309 | 0 | 117,302 | 14 | |
1 | 9 | def test_callback_error(self) -> None:
request = Mock(args={})
request.args[b"error"] = [b"invalid_client"]
self.get_success(self.handler.handle_oidc_callback(request))
self.assertRenderedError("invalid_client", "")
request.args[b"error_description"] = [b"some descripti... | tests/handlers/test_oidc.py | 143 | synapse | {
"docstring": "Errors from the provider returned in the callback are displayed.",
"language": "en",
"n_whitespaces": 9,
"n_words": 10,
"vocab_size": 9
} | 21 | Python | 17 | 5dd949bee6158a8b651db9f2ae417a62c8184bfd | test_oidc.py | 247,637 | 9 | 83 | test_callback_error | https://github.com/matrix-org/synapse.git | Add type hints to some tests/handlers files. (#12224) | 77 | 0 | 71,801 | 10 | |
1 | 3 | def _Filters():
return _cpplint_state.filters
| code/deep/BJMMD/caffe/scripts/cpp_lint.py | 18 | transferlearning | {
"docstring": "Returns the module's list of output filters, as a list.",
"language": "en",
"n_whitespaces": 9,
"n_words": 10,
"vocab_size": 10
} | 4 | Python | 4 | cc4d0564756ca067516f71718a3d135996525909 | cpp_lint.py | 60,414 | 2 | 9 | _Filters | https://github.com/jindongwang/transferlearning.git | Balanced joint maximum mean discrepancy for deep transfer learning | 6 | 0 | 12,142 | 6 | |
1 | 2 | def notchspansrc(self):
return self["notchspansrc"]
| packages/python/plotly/plotly/graph_objs/_box.py | 22 | plotly.py | {
"docstring": "\n Sets the source reference on Chart Studio Cloud for\n `notchspan`.\n\n The 'notchspansrc' property must be specified as a string or\n as a plotly.grid_objs.Column object\n\n Returns\n -------\n str\n ",
"language": "en",
"n_whitespaces": 8... | 4 | Python | 4 | 43e3a4011080911901176aab919c0ecf5046ddd3 | _box.py | 226,282 | 2 | 11 | notchspansrc | https://github.com/plotly/plotly.py.git | switch to black .22 | 18 | 0 | 57,955 | 7 | |
14 | 34 | def get_random_transform(self, img_shape, seed=None):
img_row_axis = self.row_axis - 1
img_col_axis = self.col_axis - 1
if seed is not None:
np.random.seed(seed)
if self.rotation_range:
theta = np.random.uniform(-self.rotation_range, self.rotation_range... | keras/preprocessing/image.py | 703 | keras | {
"docstring": "Generates random parameters for a transformation.\n\n Args:\n img_shape: Tuple of integers.\n Shape of the image that is transformed.\n seed: Random seed.\n\n Returns:\n A dictionary containing randomly chosen parameters describing the\n ... | 203 | Python | 108 | 84afc5193d38057e2e2badf9c889ea87d80d8fbf | image.py | 275,708 | 68 | 450 | get_random_transform | https://github.com/keras-team/keras.git | Reformatting the codebase with black.
PiperOrigin-RevId: 450093126 | 931 | 0 | 81,446 | 15 | |
4 | 2 | def test_dynamic_event_by_http(workflow_start_regular_shared_serve):
| python/ray/workflow/tests/test_http_events.py | 13 | ray | {
"docstring": "If a workflow has dynamically generated event arguments, it should\n return the event as if the event was declared statically.\n ",
"language": "en",
"n_whitespaces": 26,
"n_words": 20,
"vocab_size": 17
} | 2 | Python | 2 | 659d25a3a9c4794db9dbe8f428ec587470b261b0 | test_http_events.py | 126,132 | 20 | 91 | test_dynamic_event_by_http | https://github.com/ray-project/ray.git | [workflow] http_event_provider and accompanied listener (#26010)
### Why are these changes needed?
This PR enhances workflow functionality to receive external events from a Serve based HTTP endpoint. A workflow can then consume events asynchronously as they arrive.
### Design Logic
A `workflow.wait_for_event` no... | 5 | 0 | 28,063 | 6 | |
2 | 13 | def select_query(self, targets, from_stmt, where_stmt):
query = f"SELECT {','.join([t.__str__() for t in targets])} FROM {from_stmt.parts[-1]}"
if where_stmt:
query += f" WHERE {str(where_stmt)}"
result = self.run_native_query(query)
return result
#TODO: JOIN, ... | mindsdb/integrations/postgres_handler/postgres_handler.py | 106 | mindsdb | {
"docstring": "\n Retrieve the data from the SQL statement with eliminated rows that dont satisfy the WHERE condition\n ",
"language": "en",
"n_whitespaces": 31,
"n_words": 16,
"vocab_size": 14
} | 31 | Python | 28 | 32edb0b1468a705d89af89ed2b3dca2a459dc23f | postgres_handler.py | 114,589 | 6 | 33 | select_query | https://github.com/mindsdb/mindsdb.git | Select query | 80 | 0 | 25,224 | 13 | |
1 | 5 | def patch(url, data=None, **kwargs):
r
return request("patch", url, data=data, **kwargs)
| pipenv/patched/pip/_vendor/requests/api.py | 43 | pipenv | {
"docstring": "Sends a PATCH request.\n\n :param url: URL for the new :class:`Request` object.\n :param data: (optional) Dictionary, list of tuples, bytes, or file-like\n object to send in the body of the :class:`Request`.\n :param json: (optional) json data to send in the body of the :class:`Request... | 10 | Python | 10 | cd5a9683be69c86c8f3adcd13385a9bc5db198ec | api.py | 22,051 | 12 | 28 | patch | https://github.com/pypa/pipenv.git | Rename notpip to pip. Vendor in pip-22.2.1 and latest requirementslib and vistir. | 15 | 0 | 4,138 | 8 | |
4 | 29 | def test_install_venv_project_directory(PipenvInstance):
with PipenvInstance(chdir=True) as p:
with temp_environ(), TemporaryDirectory(
prefix="pipenv-", suffix="temp_workon_home"
) as workon_home:
os.environ["WORKON_HOME"] = workon_home
c = p.pipenv("instal... | tests/integration/test_install_basic.py | 232 | @pytest.mark.cli
@pytest.mark.deploy
@pytest.mark.system | pipenv | {
"docstring": "Test the project functionality during virtualenv creation.\n ",
"language": "en",
"n_whitespaces": 10,
"n_words": 7,
"vocab_size": 7
} | 49 | Python | 39 | 949ee95d6748e8777bed589f0d990aa4792b28f8 | test_install_basic.py | 19,833 | 16 | 129 | test_install_venv_project_directory | https://github.com/pypa/pipenv.git | More granular control over PIPENV_VENV_IN_PROJECT variable. (#5026)
* Allow PIPENV_VENV_IN_PROJECT to be read in as None, and ensure if it is set to False that it does not use .venv directory.
* refactor based on PR feedback and add news fragment.
* Review unit test coverage and add new tests. Remove unneccesar... | 188 | 1 | 3,106 | 22 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.