file stringlengths 8 116 | function stringlengths 2 72 | version_data listlengths 2 2 | diff_code stringlengths 87 17.4k | diff_docstring stringlengths 31 12k | whitespace_only_code bool 1
class | whitespace_only_docstring bool 1
class | file_path stringlengths 9 116 | filename stringlengths 5 52 | project stringclasses 100
values | owner stringclasses 96
values |
|---|---|---|---|---|---|---|---|---|---|---|
python_ccxt_bybit.py | bybit.fetch_canceled_orders | [
{
"version": "v567",
"docstring_lines": {
"start_line": 4322,
"end_line": 4334
},
"code_lines": {
"start_line": 4334,
"end_line": 4339
},
"commit_date_time": "2024-02-09 13:33:36",
"commit_sha": "29effaaf60d6746cc0db80c9f4115b40a01737a9",
"commit_message": "4.... | def fetch_canceled_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
self.load_markets()
request = {
'orderStatus': 'Cancelled',
}
- return self.fetch_orders(symbol, since, limit, self.extend(request,... | fetches information on multiple canceled orders made by the user
:see: https://bybit-exchange.github.io/docs/v5/order/order-list
- :param str symbol: unified market symbol of the market orders were made in
+ :param str [symbol]: unified market symbol of the market orders were made in
? ... | false | false | python/ccxt/bybit.py | bybit.py | ccxt | ccxt |
python_ccxt_bybit.py | bybit.create_order | [
{
"version": "v551",
"docstring_lines": {
"start_line": 3323,
"end_line": 3349
},
"code_lines": {
"start_line": 3349,
"end_line": 3372
},
"commit_date_time": "2024-01-04 12:41:45",
"commit_sha": "6b19125a0a32349e546e1569c7fa973dd6249cfb",
"commit_message": "4.... | def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount, price=None, params={}):
self.load_markets()
market = self.market(symbol)
enableUnifiedMargin, enableUnifiedAccount = self.is_unified_enabled()
isUnifiedAccount = (enab... | create a trade order
:see: https://bybit-exchange.github.io/docs/v5/order/create-order
+ :see: https://bybit-exchange.github.io/docs/v5/position/trading-stop
:param str symbol: unified symbol of the market to create an order in
:param str type: 'market' or 'limit'
:para... | false | false | python/ccxt/bybit.py | bybit.py | ccxt | ccxt |
python_ccxt_bybit.py | bybit.edit_order | [
{
"version": "v501",
"docstring_lines": {
"start_line": 3796,
"end_line": 3810
},
"code_lines": {
"start_line": 3810,
"end_line": 3885
},
"commit_date_time": "2023-09-30 12:22:54",
"commit_sha": "09f212a1436659c39989b44670be9ef2e2cbb1b5",
"commit_message": "Me... | def edit_order(self, id: str, symbol, type, side, amount=None, price=None, params={}):
self.check_required_symbol('editOrder', symbol)
self.load_markets()
market = self.market(symbol)
enableUnifiedMargin, enableUnifiedAccount = self.is_unified_e... | edit a trade order
see https://bybit-exchange.github.io/docs/v5/order/amend-order
see https://bybit-exchange.github.io/docs/derivatives/unified/replace-order
see https://bybit-exchange.github.io/docs/api-explorer/derivatives/trade/contract/replace-order
:param str id: cancel or... | false | false | python/ccxt/bybit.py | bybit.py | ccxt | ccxt |
python_ccxt_bybit.py | bybit.fetch_my_trades | [
{
"version": "v556",
"docstring_lines": {
"start_line": 4508,
"end_line": 4521
},
"code_lines": {
"start_line": 4521,
"end_line": 4599
},
"commit_date_time": "2024-01-17 13:16:45",
"commit_sha": "d321a6743d8efaee24c24a1fb480035e27a0b1a6",
"commit_message": "bi... | def fetch_my_trades(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
self.load_markets()
paginate = False
paginate, params = self.handle_option_and_params(params, 'fetchMyTrades', 'paginate')
if paginate:
... | fetch all trades made by the user
:see: https://bybit-exchange.github.io/docs/api-explorer/v5/position/execution
:param str symbol: unified market symbol
:param int [since]: the earliest time in ms to fetch trades for
:param int [limit]: the maximum number of trades structures ... | false | false | python/ccxt/bybit.py | bybit.py | ccxt | ccxt |
python_ccxt_bybit.py | bybit.fetch_leverage_tiers | [
{
"version": "v602",
"docstring_lines": {
"start_line": 7585,
"end_line": 7593
},
"code_lines": {
"start_line": 7593,
"end_line": 7609
},
"commit_date_time": "2024-05-10 11:27:29",
"commit_sha": "7cba74d4b15719314d4686a9a51e1ce4513ddfe5",
"commit_message": "by... | def fetch_leverage_tiers(self, symbols: Strings = None, params={}):
self.load_markets()
market = None
+ symbol = None
if symbols is not None:
market = self.market(symbols[0])
if market['spot']:
raise N... | :see: https://bybit-exchange.github.io/docs/v5/market/risk-limit
retrieve information on the maximum leverage, for different trade sizes
:param str[] [symbols]: a list of unified market symbols
:param dict [params]: extra parameters specific to the exchange API endpoint
:param ... | false | false | python/ccxt/bybit.py | bybit.py | ccxt | ccxt |
chainer_dataset_tabular_tabular_dataset.py | TabularDataset.fetch | [
{
"version": "v35",
"docstring_lines": {
"start_line": 126,
"end_line": 139
},
"code_lines": {
"start_line": 139,
"end_line": 144
},
"commit_date_time": "2019-06-25 06:04:02",
"commit_sha": "148db3108e3fabc687df7239f892ccb62b01219c",
"commit_message": "add __i... | def fetch(self):
examples = self.get_examples(None, None)
if self.mode is tuple:
return examples
elif self.mode is dict:
return dict(six.moves.zip(self.keys, examples))
+ elif self.mode is None:
+ return examples[0] | Fetch data.
This method fetches all data of the dataset/view.
Note that this method returns a column-major data
- (i.e. :obj:`([a[0], ..., a[3]], ..., [c[0], ... c[3]])` or
? ^^^
+ (i.e. :obj:`([a[0], ..., a[3]], ..... | false | false | chainer/dataset/tabular/tabular_dataset.py | tabular_dataset.py | chainer | chainer |
chainer_dataset_tabular_tabular_dataset.py | TabularDataset.convert | [
{
"version": "v39",
"docstring_lines": {
"start_line": 151,
"end_line": 166
},
"code_lines": {
"start_line": 166,
"end_line": 170
},
"commit_date_time": "2019-06-28 07:52:48",
"commit_sha": "fe48a58fc97c5c1d009d6954053fc8a105ba5e77",
"commit_message": "data ->... | - def convert(self, *args, **kwargs):
+ def convert(self, data):
- if args and not kwargs:
+ if isinstance(data, tuple):
- return tuple(_as_array(d) for d in args)
? ^^^
+ return tuple(_as_array(d) for d in da... | Convert fetched data.
This method takes data fetched by :meth:`fetch` and
pre-process them before passing them to models.
The default behaviour is converting each column into an ndarray.
This behaviour can be overloaded by :meth:`with_converter`.
Args:
- ... | false | false | chainer/dataset/tabular/tabular_dataset.py | tabular_dataset.py | chainer | chainer |
samcli_local_services_base_local_service.py | LambdaOutputParser.get_lambda_output | [
{
"version": "v19",
"docstring_lines": {
"start_line": 89,
"end_line": 106
},
"code_lines": {
"start_line": 106,
"end_line": 116
},
"commit_date_time": "2024-01-10 00:43:55",
"commit_sha": "335e529d819d0f8b938a491b1c69e232daa22ce8",
"commit_message": "Revert \... | - def get_lambda_output(stdout_stream: io.StringIO) -> Tuple[str, bool]:
+ def get_lambda_output(
+ stdout_stream_str: io.StringIO, stdout_stream_bytes: Optional[io.BytesIO] = None
+ ) -> Tuple[Union[str, bytes], bool]:
+ lambda_response: Union[str, bytes] = stdout_s... | This method will extract read the given stream and return the response from Lambda function separated out
from any log statements it might have outputted. Logs end up in the stdout stream if the Lambda function
wrote directly to stdout using System.out.println or equivalents.
Paramete... | false | false | samcli/local/services/base_local_service.py | base_local_service.py | aws-sam-cli | aws |
machine_learning_decision_tree.py | Decision_Tree.mean_squared_error | [
{
"version": "v6",
"docstring_lines": {
"start_line": 103,
"end_line": 109
},
"code_lines": {
"start_line": 109,
"end_line": 120
},
"commit_date_time": "2019-10-05 05:14:13",
"commit_sha": "9eac17a4083ad08c4bb0520cb0b8e5ce385f9ce0",
"commit_message": "psf/blac... | def mean_squared_error(self, labels, prediction):
+
if labels.ndim != 1:
print("Error: Input labels must be one dimensional")
return np.mean((labels - prediction) ** 2) | mean_squared_error:
@param labels: a one dimensional numpy array
@param prediction: a floating point value
return value: mean_squared_error calculates the error if prediction is used to estimate the labels
+ >>> tester = Decision_Tree()
+ >>> test_labels = np.array([1,2,3... | false | false | machine_learning/decision_tree.py | decision_tree.py | Python | TheAlgorithms |
Lib_mimetypes.py | guess_extension | [
{
"version": "v6",
"docstring_lines": {
"start_line": 70,
"end_line": 78
},
"code_lines": {
"start_line": 78,
"end_line": 83
},
"commit_date_time": "1998-05-18 16:27:20",
"commit_sha": "5109ffd607b58237a35fcb364a9c6698ab511cde",
"commit_message": "guess_extens... | def guess_extension(type):
+ global inited
+ if not inited:
+ init()
type = string.lower(type)
for ext, stype in types_map.items():
if type == stype:
return ext
return None | Guess the extension for a file based on its MIME type.
Return value is a string giving a filename extension, including the
leading dot ('.'). The extension is not guaranteed to have been
- associated with any particular data stream, but has been known to be
? ... | false | false | Lib/mimetypes.py | mimetypes.py | cpython | python |
Lib_mimetypes.py | MimeTypes.guess_extension | [
{
"version": "v20",
"docstring_lines": {
"start_line": 153,
"end_line": 167
},
"code_lines": {
"start_line": 167,
"end_line": 170
},
"commit_date_time": "2001-09-07 16:49:12",
"commit_sha": "a3689fe78675c89d5979c0c5acdb1c173cc75ed6",
"commit_message": "Patch #... | - def guess_extension(self, type):
+ def guess_extension(self, type, strict=1):
? ++++++++++
type = type.lower()
for ext, stype in self.types_map.items():
if type == stype:
return ext
+ if not strict:
+ ... | Guess the extension for a file based on its MIME type.
Return value is a string giving a filename extension,
including the leading dot ('.'). The extension is not
guaranteed to have been associated with any particular data
stream, but would be mapped to the MIME type `type'... | false | false | Lib/mimetypes.py | mimetypes.py | cpython | python |
build_mdbook_utils_github_md_utils.py | md_expand_links | [
{
"version": "v13",
"docstring_lines": {
"start_line": 138,
"end_line": 143
},
"code_lines": {
"start_line": 143,
"end_line": 188
},
"commit_date_time": "2024-01-23 06:08:28",
"commit_sha": "65855a01cea9c680a6fc071aa488d176681ece6a",
"commit_message": "fix",
... | def md_expand_links(text, cwd_rel_path, repo_url=""):
link_text, link, anchor = md_link_break_up(text)
#print(link_text, link, anchor)
# skip:
# - empty links (i.e. just local anchor to the same doc)
# - skip explicit .md links
# - external links like ... | Perform link rewrites as following:
- - if the link ends in .md or contains protocol :// return unmodified
+ - return unmodified if the link:
+ * is empty (same doc internal anchor)
+ * ends in .md (well defined)
+ * is remote - i.e. contains protocol :// return unmodified
- - convert... | false | false | build/mdbook/utils/github_md_utils.py | github_md_utils.py | ml-engineering | stas00 |
libs_langchain_langchain_document_loaders_blob_loaders_schema.py | Blob.from_data | [
{
"version": "v8",
"docstring_lines": {
"start_line": 129,
"end_line": 140
},
"code_lines": {
"start_line": 140,
"end_line": 141
},
"commit_date_time": "2023-11-20 21:09:30",
"commit_sha": "d82cbf5e764c6e0a9d0bee2558119d302b0b57ad",
"commit_message": "Separate... | def from_data(
cls,
data: Union[str, bytes],
*,
encoding: str = "utf-8",
mime_type: Optional[str] = None,
path: Optional[str] = None,
+ metadata: Optional[dict] = None,
) -> Blob:
- return cls(data=data, mimetype=m... | Initialize the blob from in-memory data.
Args:
data: the in-memory data associated with the blob
encoding: Encoding to use if decoding the bytes into a string
mime_type: if provided, will be set as the mime-type of the data
path: if provided, will b... | false | false | libs/langchain/langchain/document_loaders/blob_loaders/schema.py | schema.py | langchain | langchain-ai |
vpype_cli_transforms.py | rotate | [
{
"version": "v16",
"docstring_lines": {
"start_line": 263,
"end_line": 270
},
"code_lines": {
"start_line": 270,
"end_line": 286
},
"commit_date_time": "2020-11-30 16:22:39",
"commit_sha": "5391fade4b8f25bba7568a2953e6e6ea639bc040",
"commit_message": "Added A... | def rotate(
- document: Document,
+ document: vp.Document,
? +++
angle: float,
layer: Union[int, List[int]],
- radian: bool,
origin_coords: Union[Tuple[()], Tuple[float, float]],
):
-
- if not radian:
- angle *= math.pi / 180.0
try:
... | Rotate the geometries (clockwise positive).
The origin used is the bounding box center, unless the `--origin` option is used.
+ ANGLE is in degrees by default, but alternative CSS unit may be provided.
+
By default, act on all layers. If one or more layer IDs are provided with the `--layer`
... | false | false | vpype_cli/transforms.py | transforms.py | vpype | abey79 |
python_ray_air__internal_util.py | skip_exceptions | [
{
"version": "v10",
"docstring_lines": {
"start_line": 37,
"end_line": 39
},
"code_lines": {
"start_line": 39,
"end_line": 55
},
"commit_date_time": "2023-11-09 20:12:30",
"commit_sha": "837ec26326a25ee9b8ea35aed5aa3f511f1cc972",
"commit_message": "[tune] New ... | def skip_exceptions(exc: Optional[Exception]) -> Exception:
+
should_not_shorten = bool(int(os.environ.get("RAY_AIR_FULL_TRACEBACKS", "0")))
if should_not_shorten:
return exc
if isinstance(exc, StartTraceback):
# If this is a StartTraceback, skip
retur... | - Skip all contained `StartTracebacks` to reduce traceback output
+ Skip all contained `StartTracebacks` to reduce traceback output.
? +
+
+ Returns a shallow copy of the exception with all `StartTracebacks` removed.
+
+ If the RAY_AIR_FULL_TRACE... | false | false | python/ray/air/_internal/util.py | util.py | ray | ray-project |
gensim_downloader.py | info | [
{
"version": "v4",
"docstring_lines": {
"start_line": 158,
"end_line": 193
},
"code_lines": {
"start_line": 193,
"end_line": 213
},
"commit_date_time": "2018-05-30 08:34:59",
"commit_sha": "0f42adb7fe66e1a7193ea14374ed11175e746b3c",
"commit_message": "fix logg... | - def info(name=None, show_only_latest=True):
+ def info(name=None, show_only_latest=True, name_only=False):
? +++++++++++++++++
information = json.loads(urlopen(DATA_LIST_URL).read().decode("utf-8"))
if name is not None:
corpora = info... | Provide the information related to model/dataset.
Parameters
----------
name : str, optional
Name of model/dataset. If not set - shows all available data.
show_only_latest : bool, optional
If storage contains different versions for one data/model, this flag allow to hid... | false | false | gensim/downloader.py | downloader.py | gensim | piskvorky |
Lib_asyncio_events.py | AbstractEventLoop.create_server | [
{
"version": "v43",
"docstring_lines": {
"start_line": 340,
"end_line": 357
},
"code_lines": {
"start_line": 357,
"end_line": 365
},
"commit_date_time": "2015-09-21 16:33:43",
"commit_sha": "5e4a7d8dc7781a4c0dfacecdc4db0eb34beb1391",
"commit_message": "Issue #... | def create_server(self, protocol_factory, host=None, port=None, *,
family=socket.AF_UNSPEC, flags=socket.AI_PASSIVE,
- sock=None, backlog=100, ssl=None, reuse_address=None):
? ^^
+ ... | A coroutine which creates a TCP server bound to host and port.
The return value is a Server object which can be used to stop
the service.
If host is an empty string or None all interfaces are assumed
and a list of multiple sockets will be returned (most likely
o... | false | false | Lib/asyncio/events.py | events.py | cpython | python |
Lib_asyncio_events.py | get_event_loop | [
{
"version": "v50",
"docstring_lines": {
"start_line": 634,
"end_line": 636
},
"code_lines": {
"start_line": 636,
"end_line": 638
},
"commit_date_time": "2016-11-03 22:09:24",
"commit_sha": "491a912659a4aeb57c400f37b8059fa1ef7bed73",
"commit_message": "Issue #... | def get_event_loop():
+
+ current_loop = _get_running_loop()
+ if current_loop is not None:
+ return current_loop
return get_event_loop_policy().get_event_loop() | - Equivalent to calling get_event_loop_policy().get_event_loop().
+ Return an asyncio event loop.
+
+ When called from a coroutine or a callback (e.g. scheduled with call_soon
+ or similar API), this function will always return the running event loop.
+
+ If there is no running event loop set, the functio... | false | false | Lib/asyncio/events.py | events.py | cpython | python |
homeassistant_helpers_aiohttp_client.py | async_aiohttp_proxy_stream | [
{
"version": "v7",
"docstring_lines": {
"start_line": 50,
"end_line": 77
},
"code_lines": {
"start_line": 77,
"end_line": 113
},
"commit_date_time": "2017-02-13 05:24:07",
"commit_sha": "41849eab062171bc400ca5866e53c40e5da1cc3c",
"commit_message": "Core cleanu... | - def async_aiohttp_proxy_stream(hass, request, stream_coro, buffer_size=102400,
? ^ ^^ --------------------
+ def async_aiohttp_proxy_stream(hass, request, stream, content_type,
? ^^ ^^^^^^^^^^
- ... | - Stream websession request to aiohttp web response.
? ^^^ ^^^^^^^ ^^^^^
+ Stream a stream to aiohttp web response.
? ^^ ^ ^^
| false | false | homeassistant/helpers/aiohttp_client.py | aiohttp_client.py | core | home-assistant |
django_db_backends_oracle_schema.py | DatabaseSchemaEditor._alter_field_type_workaround | [
{
"version": "v23",
"docstring_lines": {
"start_line": 63,
"end_line": 71
},
"code_lines": {
"start_line": 71,
"end_line": 104
},
"commit_date_time": "2017-05-23 15:02:40",
"commit_sha": "538bf43458a147b7edeb7118c9f325c3f59ff6fb",
"commit_message": "Fixed #278... | def _alter_field_type_workaround(self, model, old_field, new_field):
# Make a new field that's like the new one but with a temporary
# column name.
new_temp_field = copy.deepcopy(new_field)
- new_temp_field.null = True
+ new_temp_field.nul... | Oracle refuses to change from some type to other type.
What we need to do instead is:
- - Add a nullable version of the desired field with a temporary name
+ - Add a nullable version of the desired field with a temporary name. If
? ... | false | false | django/db/backends/oracle/schema.py | schema.py | django | django |
packaging_MacOS_build_macos.py | build_pkg | [
{
"version": "v26",
"docstring_lines": {
"start_line": 31,
"end_line": 38
},
"code_lines": {
"start_line": 38,
"end_line": 83
},
"commit_date_time": "2023-01-13 08:26:54",
"commit_sha": "0f683d301afea7a6cc67af8195021222b5a31a04",
"commit_message": "Remove doub... | - def build_pkg(dist_path: str, app_filename: str, component_filename: str, installer_filename: str) -> None:
+ def build_pkg(dist_path: str, app_filename: str, component_filename: str, cura_version: str, installer_filename: str) -> None:
? ++++++... | Builds and signs the pkg installer.
@param dist_path: Path to put output pkg in
@param app_filename: name of the .app file to bundle inside the pkg
@param component_filename: Name of the pkg component package to bundle the app in
+ @param cura_version: The version is used when automatically r... | false | false | packaging/MacOS/build_macos.py | build_macos.py | Cura | Ultimaker |
homeassistant_components_skybell_switch.py | SkybellSwitch.is_on | [
{
"version": "v14",
"docstring_lines": {
"start_line": 85,
"end_line": 87
},
"code_lines": {
"start_line": 87,
"end_line": 88
},
"commit_date_time": "2022-01-05 16:34:47",
"commit_sha": "4c48705fe891f378a0087e51f16ff3ac5d2616de",
"commit_message": "Add setup t... | - def is_on(self):
+ def is_on(self) -> bool:
? ++++++++
- return getattr(self._device, self.entity_description.key)
+ return cast(bool, getattr(self._device, self.entity_description.key))
? +++++++++++ +
| - Return true if device is on.
? - ^ ^^
+ Return true if entity is on.
? ^^ ^^
| false | false | homeassistant/components/skybell/switch.py | switch.py | core | home-assistant |
homeassistant_components_xiaomi_aqara___init__.py | XiaomiDevice.push_data | [
{
"version": "v92",
"docstring_lines": {
"start_line": 355,
"end_line": 357
},
"code_lines": {
"start_line": 357,
"end_line": 363
},
"commit_date_time": "2022-12-24 12:19:51",
"commit_sha": "8819634b613f6bfd55885283bab86c3852ae40c4",
"commit_message": "String ... | - def push_data(self, data, raw_data):
+ def push_data(self, data: dict[str, Any], raw_data: dict[Any, Any]) -> None:
+ self.hass.loop.call_soon(self.async_push_data, data, raw_data)
- _LOGGER.debug("PUSH >> %s: %s", self, data)
- was_unavailable = self._async_track_unavailable()
- ... | - Push from Hub.
+ Push from Hub running in another thread. | false | false | homeassistant/components/xiaomi_aqara/__init__.py | __init__.py | core | home-assistant |
tests_view_tests_tests_test_static.py | StaticHelperTest.test_special_prefix | [
{
"version": "v47",
"docstring_lines": {
"start_line": 155,
"end_line": 155
},
"code_lines": {
"start_line": 156,
"end_line": 159
},
"commit_date_time": "2017-09-20 22:04:42",
"commit_sha": "df41b5a05d4e00e80e73afe629072e37873e767a",
"commit_message": "Fixed #... | def test_special_prefix(self):
- self.assertEqual(static('http://'), [])
+ self.assertEqual(static('http://example.org'), [])
? +++++++++++
+ self.assertEqual(static('//example.org'), []) | - No URLs are served if prefix contains '://'.
? ^^^^^
+ No URLs are served if prefix contains a netloc part.
? ^^^^^^^^^^^^^
| false | false | tests/view_tests/tests/test_static.py | test_static.py | django | django |
spleeter_model_ | _get_deconv_activation_layer | [
{
"version": "v4",
"docstring_lines": {
"start_line": 73,
"end_line": 81
},
"code_lines": {
"start_line": 81,
"end_line": 172
},
"commit_date_time": "2020-07-17 11:30:42",
"commit_sha": "227020c256ef5c09674238979b2a76f91b5f0c68",
"commit_message": "replace mai... | - def _get_deconv_activation_layer(params):
+ def _get_deconv_activation_layer(params: Dict) -> Any:
? ++++++ +++++++
-
+
-
- deconv_activation = params.get('deconv_activation')
+ deconv_activation: str = params.get('deconv_activation')
? ... | - :param params:
+ > To be documented.
+
+ Parameters:
+ params (Dict):
+
+ Returns:
+ Any:
- :returns: Required Activation function.
? ^^^^^^^^^
+ Required Activation function.
? ^^^^^^^^^^^
| false | false | spleeter/model/functions/unet.py | unet.py | spleeter | deezer |
orbit_controller.py | Controller.__init__ | [
{
"version": "v45",
"docstring_lines": {
"start_line": 535,
"end_line": 545
},
"code_lines": {
"start_line": 545,
"end_line": 545
},
"commit_date_time": "2023-03-29 17:55:19",
"commit_sha": "00b830c7ca641413f37e5147cf059c89f79b0e8e",
"commit_message": "Interna... | def __init__(
self,
*, # Makes all args keyword only.
global_step: tf.Variable,
trainer: Optional[runner.AbstractTrainer] = None,
evaluator: Optional[runner.AbstractEvaluator] = None,
strategy: Optional[tf.distribute.Strategy] = None,
# Actions
train_ac... | Initializes a `Controller` instance.
Note that if `checkpoint_manager` is provided and there are checkpoints in
the associated model directory, the model will be restored from the most
recent checkpoint during this `__init__` method.
Args:
global_step: An integer `tf.Variable` st... | false | false | orbit/controller.py | controller.py | models | tensorflow |
orbit_controller.py | Controller.evaluate_continuously | [
{
"version": "v40",
"docstring_lines": {
"start_line": 358,
"end_line": 377
},
"code_lines": {
"start_line": 377,
"end_line": 386
},
"commit_date_time": "2023-01-30 18:10:13",
"commit_sha": "03c9bfb7d307f9ec84482e56806f0a6789636ef6",
"commit_message": "Interna... | - def evaluate_continuously(self,
? -----
+ def evaluate_continuously(
- steps: int = -1,
+ self,
+ steps: int = -1,
- timeout: Optional[Union[int, float]] = None,
? ----------------------
+ timeout: Optional[Union[int... | Continuously monitors a directory and evaluates new checkpoints in it.
This method continuously monitors a directory as specified by this
Controller's CheckpointManager init arg and runs evaluation on the
checkpoints found there.
Args:
steps: The number of steps to run when evalu... | false | false | orbit/controller.py | controller.py | models | tensorflow |
research_object_detection_utils_label_map_util.py | get_label_map_dict | [
{
"version": "v4",
"docstring_lines": {
"start_line": 128,
"end_line": 136
},
"code_lines": {
"start_line": 136,
"end_line": 141
},
"commit_date_time": "2017-09-21 19:58:20",
"commit_sha": "f87a58cd96d45de73c9a8330a06b2ab56749a7fa",
"commit_message": "Move the... | - def get_label_map_dict(label_map_path):
+ def get_label_map_dict(label_map_path, use_display_name=False):
? ++++++++++++++++++++++++
label_map = load_labelmap(label_map_path)
label_map_dict = {}
for item in label_map.item:
+ if use_display_name:
+ ... | Reads a label map and returns a dictionary of label names to id.
Args:
label_map_path: path to label_map.
+ use_display_name: whether to use the label map items' display names as keys.
Returns:
A dictionary mapping label names to id. | false | false | research/object_detection/utils/label_map_util.py | label_map_util.py | models | tensorflow |
python_ray_train_tests_test_data_parallel_trainer_checkpointing.py | test_checkpoint | [
{
"version": "v4",
"docstring_lines": {
"start_line": 52,
"end_line": 59
},
"code_lines": {
"start_line": 59,
"end_line": 81
},
"commit_date_time": "2023-08-22 22:55:54",
"commit_sha": "8db2a4757465ead5123ca7c4a17842d6d1de0985",
"commit_message": "[Train] Depr... | - def test_checkpoint(ray_start_4_cpus, checkpoint_type_and_should_copy):
+ def test_checkpoint(ray_start_4_cpus):
-
-
- checkpoint_type, should_copy = checkpoint_type_and_should_copy
- with patch.dict(
- os.environ,
- {
- DISABLE_LAZY_CHECKPOINTING_ENV: str(int(chec... | Test that a checkpoint is created and accessible.
-
- - Assert that the data from the returned checkpoint has an expected state.
- - Assert that the directory was moved/copied depending on
- ``checkpoint_type_and_should_copy``. | false | false | python/ray/train/tests/test_data_parallel_trainer_checkpointing.py | test_data_parallel_trainer_checkpointing.py | ray | ray-project |
python_ray_runtime_context.py | RuntimeContext.get | [
{
"version": "v12",
"docstring_lines": {
"start_line": 16,
"end_line": 24
},
"code_lines": {
"start_line": 24,
"end_line": 36
},
"commit_date_time": "2021-02-16 23:27:30",
"commit_sha": "4d7ab3c88673aa827e20fc708ead4e74dc6c641e",
"commit_message": "[Doc] Ray l... | def get(self):
context = {
"job_id": self.job_id,
"node_id": self.node_id,
+ "namespace": self.namespace,
}
if self.worker.mode == ray.worker.WORKER_MODE:
if self.task_id is not None:
context["t... | Get a dictionary of the current context.
+
- Fields that are not available (e.g., actor ID inside a task) won't be
- included in the field.
Returns:
dict: Dictionary of the current context. | false | false | python/ray/runtime_context.py | runtime_context.py | ray | ray-project |
mps_youtube_util.py | parse_multi | [
{
"version": "v35",
"docstring_lines": {
"start_line": 318,
"end_line": 320
},
"code_lines": {
"start_line": 320,
"end_line": 343
},
"commit_date_time": "2016-05-08 16:43:31",
"commit_sha": "f61c0d0a51cfbaa3eeeb998b32c14a61959a2b21",
"commit_message": "Update ... | def parse_multi(choice, end=None):
-
? --
+
+
+
+
end = end or str(len(g.model))
- pattern = r'(?<![-\d])(\d+-\d+|-\d+|\d+-|\d+)(?![-\d])'
+ pattern = r'(?<![-\d\[\]])(\d+-\d+|-\d+|\d+-|\d+)(?:\[(\d+)\])?(?![-\d\[\]])'
? ++++ ... | - Handle ranges like 5-9, 9-5, 5- and -5. Return list of ints.
+ Handle ranges like 5-9, 9-5, 5- and -5 with optional repetitions number [n]
+
+ eg. 2-4[2] is the same as 2 3 4 2 3 4 and 3[4] is 3 3 3 3
+
+ Return list of ints. | false | false | mps_youtube/util.py | util.py | yewtube | mps-youtube |
mps_youtube_util.py | yt_datetime | [
{
"version": "v37",
"docstring_lines": {
"start_line": 309,
"end_line": 311
},
"code_lines": {
"start_line": 311,
"end_line": 317
},
"commit_date_time": "2016-06-01 23:46:10",
"commit_sha": "94c6b431da9c5e4cc093571cff025c888035f3e2",
"commit_message": "Add g.m... | def yt_datetime(yt_date_time):
time_obj = time.strptime(yt_date_time, "%Y-%m-%dT%H:%M:%S.%fZ")
locale_date = time.strftime("%x", time_obj)
+ locale_time = time.strftime("%X", time_obj)
# strip first two digits of four digit year
short_date = re.sub(r"(\d\d\D\d\d\D)20(\d\d)$", r"\1... | - Return a time object and locale formated date string.
+ Return a time object, locale formated date string and locale formatted time string. | false | false | mps_youtube/util.py | util.py | yewtube | mps-youtube |
homeassistant_components_group___init__.py | GroupIntegrationRegistry.on_off_states | [
{
"version": "v139",
"docstring_lines": {
"start_line": 101,
"end_line": 103
},
"code_lines": {
"start_line": 103,
"end_line": 110
},
"commit_date_time": "2020-09-30 15:25:50",
"commit_sha": "42ad36e9f80ea9d817a324a0bb01ff671f46b137",
"commit_message": "Switch... | def on_off_states(self, on_states: Set, off_state: str) -> None:
for on_state in on_states:
if on_state not in self.on_off_mapping:
self.on_off_mapping[on_state] = off_state
+ if len(on_states) == 1 and off_state not in self.off_on_mapping:
+ ... | - Registry on and off states for the current domain.
? -
+ Register on and off states for the current domain.
? +
| false | false | homeassistant/components/group/__init__.py | __init__.py | core | home-assistant |
localstack_services_kinesis_kinesis_mock_server.py | KinesisMockServer._create_shell_command | [
{
"version": "v1",
"docstring_lines": {
"start_line": 41,
"end_line": 41
},
"code_lines": {
"start_line": 42,
"end_line": 53
},
"commit_date_time": "2022-01-27 19:13:52",
"commit_sha": "dc2f658cbc2e3d17727cff2a8317ece4123d8be4",
"commit_message": "Kinesis refa... | - def _create_shell_command(self) -> str:
? ^
+ def _create_shell_command(self) -> Tuple[List, Dict]:
? ++++++++ ^^^^^^^
+ env_vars = {"KINESIS_MOCK_PLAIN_PORT": self.port, "SHARD_LIMIT": config.KINESIS_S... | - helper method for creating kinesis mock invocation command
? ^
+ Helper method for creating kinesis mock invocation command
? ^
+ :return: returns a tuple containing the command list and a dictionary with the environment variables | false | false | localstack/services/kinesis/kinesis_mock_server.py | kinesis_mock_server.py | localstack | localstack |
localstack_services_kinesis_kinesis_mock_server.py | KinesisServerManager._create_kinesis_mock_server | [
{
"version": "v10",
"docstring_lines": {
"start_line": 138,
"end_line": 146
},
"code_lines": {
"start_line": 146,
"end_line": 177
},
"commit_date_time": "2023-09-18 20:42:19",
"commit_sha": "7305e583d8bc0e8aab3fafb8442a7f8a621ce911",
"commit_message": "added s... | def _create_kinesis_mock_server(self, account_id: str) -> KinesisMockServer:
port = get_free_tcp_port()
kinesismock_package.install()
kinesis_mock_js_path = Path(kinesismock_package.get_installer().get_executable_path())
# kinesis-mock stores... | Creates a new Kinesis Mock server instance. Installs Kinesis Mock on the host first if necessary.
Introspects on the host config to determine server configuration:
config.dirs.data -> if set, the server runs with persistence using the path to store data
config.LS_LOG -> configure kinesis... | false | false | localstack/services/kinesis/kinesis_mock_server.py | kinesis_mock_server.py | localstack | localstack |
django_db_migrations_autodetector.py | MigrationAutodetector.suggest_name | [
{
"version": "v27",
"docstring_lines": {
"start_line": 351,
"end_line": 356
},
"code_lines": {
"start_line": 356,
"end_line": 369
},
"commit_date_time": "2013-12-11 13:16:29",
"commit_sha": "248fdb1110abefbdc14e3464c556b8a22abe4edc",
"commit_message": "Change ... | def suggest_name(cls, ops):
if len(ops) == 1:
if isinstance(ops[0], operations.CreateModel):
return ops[0].name.lower()
elif isinstance(ops[0], operations.DeleteModel):
return "delete_%s" % ops[0].name.lower()
... | Given a set of operations, suggests a name for the migration
- they might represent. Names not guaranteed to be unique; they
? ^^^^^^
+ they might represent. Names are not guaranteed to be unique,
? +++... | false | false | django/db/migrations/autodetector.py | autodetector.py | django | django |
django_db_migrations_autodetector.py | MigrationAutodetector.check_dependency | [
{
"version": "v95",
"docstring_lines": {
"start_line": 322,
"end_line": 325
},
"code_lines": {
"start_line": 325,
"end_line": 375
},
"commit_date_time": "2014-10-29 11:59:35",
"commit_sha": "c9178ef17a0e1070f5a25096d8e13385d404dc92",
"commit_message": "Limited... | def check_dependency(self, operation, dependency):
# Created model
if dependency[2] is None and dependency[3] is True:
return (
isinstance(operation, operations.CreateModel) and
operation.name.lower() == dependency[... | - Checks if an operation dependency matches an operation.
+ Returns ``True`` if the given operation depends on the given dependency,
+ ``False`` otherwise. | false | false | django/db/migrations/autodetector.py | autodetector.py | django | django |
django_db_migrations_autodetector.py | MigrationAutodetector.parse_number | [
{
"version": "v175",
"docstring_lines": {
"start_line": 1330,
"end_line": 1334
},
"code_lines": {
"start_line": 1334,
"end_line": 1338
},
"commit_date_time": "2021-10-06 06:05:33",
"commit_sha": "47f791f1328bb434bae312aa7ff190d49884395b",
"commit_message": "Fi... | def parse_number(cls, name):
+ if squashed_match := re.search(r'.*_squashed_(\d+)', name):
+ return int(squashed_match[1])
match = re.match(r'^\d+', name)
if match:
return int(match[0])
return None | Given a migration name, try to extract a number from the beginning of
- it. If no number is found, return None.
+ it. For a squashed migration such as '0001_squashed_0004…', return the
+ second number. If no number is found, return None. | false | false | django/db/migrations/autodetector.py | autodetector.py | django | django |
django_db_migrations_autodetector.py | MigrationAutodetector.generate_renamed_fields | [
{
"version": "v183",
"docstring_lines": {
"start_line": 910,
"end_line": 912
},
"code_lines": {
"start_line": 912,
"end_line": 980
},
"commit_date_time": "2022-05-16 15:46:24",
"commit_sha": "c6cec3c2d287b5d2bd36d9c3002712ae89b5ab17",
"commit_message": "Refs #... | def generate_renamed_fields(self):
- self.renamed_fields = {}
- for app_label, model_name, field_name in sorted(
- self.new_field_keys - self.old_field_keys
- ):
- old_model_name = self.renamed_models.get(
+ for (
+ rem_app_label,
+ ... | - Work out renamed fields.
+ Generate RenameField operations. | false | false | django/db/migrations/autodetector.py | autodetector.py | django | django |
Lib_asyncio_base_events.py | BaseEventLoop._assert_is_current_event_loop | [
{
"version": "v75",
"docstring_lines": {
"start_line": 675,
"end_line": 681
},
"code_lines": {
"start_line": 681,
"end_line": 747
},
"commit_date_time": "2014-07-12 01:11:53",
"commit_sha": "e912e652f85bfd92d7209aa0cb23e5d3975a8d72",
"commit_message": "asyncio... | def _assert_is_current_event_loop(self):
try:
current = events.get_event_loop()
except AssertionError:
return
if current is not self:
raise RuntimeError(
- "non-threadsafe operation invoked on an event loop o... | Asserts that this event loop is the current event loop.
- Non-threadsafe methods of this class make this assumption and will
+ Non-thread-safe methods of this class make this assumption and will
? +
likely behave incorrectly when the assumption is violated.
- ... | false | false | Lib/asyncio/base_events.py | base_events.py | cpython | python |
Lib_asyncio_base_events.py | BaseEventLoop.stop | [
{
"version": "v108",
"docstring_lines": {
"start_line": 346,
"end_line": 352
},
"code_lines": {
"start_line": 352,
"end_line": 353
},
"commit_date_time": "2015-10-05 16:15:28",
"commit_sha": "b9bf913ab32d27d221fb765fd90d64d07e926000",
"commit_message": "Issue ... | def stop(self):
- self.call_soon(_raise_stop_error)
+ self._stopping = True | Stop running the event loop.
+ Every callback already scheduled will still run. This simply informs
+ run_forever to stop looping after a complete iteration.
- Every callback scheduled before stop() is called will run. Callbacks
- scheduled after stop() is called will not run. Howe... | false | false | Lib/asyncio/base_events.py | base_events.py | cpython | python |
speechbrain_utils_DER.py | DER | [
{
"version": "v4",
"docstring_lines": {
"start_line": 48,
"end_line": 82
},
"code_lines": {
"start_line": 82,
"end_line": 148
},
"commit_date_time": "2020-08-10 09:18:37",
"commit_sha": "be6f6bffeb8df3d56ce4ed95d86e81115549c87f",
"commit_message": "Fixing test... | def DER(
ref_rttm,
sys_rttm,
ignore_overlap=False,
collar=0.25,
individual_file_scores=False,
):
curr = os.path.abspath(os.path.dirname(__file__))
mdEval = os.path.join(curr, "../../tools/der_eval/md-eval.pl")
cmd = [
mdEval,
"-... | Computes Missed Speaker percentage (MS), False Alarm (FA),
Speaker Error Rate (SER), and Diarization Error Rate (DER).
Arguments
---------
ref_rttm : str
The path of reference/groundtruth RTTM file.
sys_rttm : str
The path of system generated RTTM file.
indiv... | false | false | speechbrain/utils/DER.py | DER.py | speechbrain | speechbrain |
localstack_services_plugins.py | Service.for_provider | [
{
"version": "v40",
"docstring_lines": {
"start_line": 147,
"end_line": 158
},
"code_lines": {
"start_line": 158,
"end_line": 175
},
"commit_date_time": "2023-11-11 10:06:12",
"commit_sha": "76483ac5c6edf47698eed969ddef326cb6fe10a2",
"commit_message": "fix SQS... | def for_provider(
provider: ServiceProvider,
dispatch_table_factory: Callable[[ServiceProvider], DispatchTable] = None,
service_lifecycle_hook: ServiceLifecycleHook = None,
- custom_service_name: Optional[str] = None,
) -> "Service":
... | Factory method for creating services for providers. This method hides a bunch of legacy code and
band-aids/adapters to make persistence visitors work, while providing compatibility with the legacy edge proxy.
:param provider: the service provider, i.e., the implementation of the generated ASF s... | false | false | localstack/services/plugins.py | plugins.py | localstack | localstack |
jina_clients___init__.py | Client.delete | [
{
"version": "v29",
"docstring_lines": {
"start_line": 158,
"end_line": 167
},
"code_lines": {
"start_line": 167,
"end_line": 172
},
"commit_date_time": "2021-03-05 16:18:45",
"commit_sha": "640daf4d389768be216dac4125ef4e837ee65d23",
"commit_message": "ci: add... | def delete(
self,
- inputs: Iterable[str],
+ inputs: InputDeleteType,
on_done: CallbackFnType = None,
on_error: CallbackFnType = None,
on_always: CallbackFnType = None,
**kwargs
) -> None:
self.mode = RequestType.D... | Issue 'update' request to the Flow.
- :param inputs: input data which can be an Iterable, a function which returns an Iterable, or a single Document
+ :param inputs: input data which can be an Iterable, a function which returns an Iterable, or a single Document id.
? ... | false | false | jina/clients/__init__.py | __init__.py | jina | jina-ai |
jina_clients___init__.py | Client.reload | [
{
"version": "v31",
"docstring_lines": {
"start_line": 180,
"end_line": 189
},
"code_lines": {
"start_line": 189,
"end_line": 205
},
"commit_date_time": "2021-04-04 06:47:24",
"commit_sha": "9c9ad1737172eeaf62e99db185a349dab6dcec3c",
"commit_message": "feat(fl... | def reload(
self,
- devices: Union[str, List[str]],
? ^ ^^^^
+ targets: Union[str, List[str]],
? ^^^^ ^
on_done: CallbackFnType = None,
on_error: CallbackFnType = None,
on_always: CallbackFnType = None,
**kwargs
):
... | Send 'reload' request to the Flow.
- :param devices: the regex string or list of regex strings to match the pea/pod names.
? ^ ^^^^
+ :param targets: the regex string or list of regex strings to match the pea/pod names.
? ^^^^ ^
:param on_done: the function... | false | false | jina/clients/__init__.py | __init__.py | jina | jina-ai |
samcli_lib_delete_cfn_utils.py | CfnUtils.get_stack_template | [
{
"version": "v5",
"docstring_lines": {
"start_line": 110,
"end_line": 115
},
"code_lines": {
"start_line": 115,
"end_line": 132
},
"commit_date_time": "2023-02-18 01:29:23",
"commit_sha": "93462eea9b82d45e386c334490df87a653912594",
"commit_message": "ruff: by... | - def get_stack_template(self, stack_name: str, stage: str) -> Dict:
? ^^^
+ def get_stack_template(self, stack_name: str, stage: str) -> str:
? ^ +
try:... | Return the Cloudformation template of the given stack_name
- :param stack_name: Name or ID of the stack
+ Parameters
+ ----------
+
+ stack_name: str
+ Name or ID of the stack
+ stage: str
- :param stage: The Stage of the template Original or Processed
?... | false | false | samcli/lib/delete/cfn_utils.py | cfn_utils.py | aws-sam-cli | aws |
libs_community_langchain_community_vectorstores_azure_cosmos_db.py | AzureCosmosDBVectorSearch._similarity_search_with_score | [
{
"version": "v7",
"docstring_lines": {
"start_line": 334,
"end_line": 343
},
"code_lines": {
"start_line": 343,
"end_line": 426
},
"commit_date_time": "2023-12-11 21:53:30",
"commit_sha": "ed58eeb9c50b16c9927b6c395518cf610c963f5d",
"commit_message": "communit... | def _similarity_search_with_score(
+ self,
- self, embeddings: List[float], k: int = 4
? ------ -----------
+ embeddings: List[float],
+ k: int = 4,
+ kind: CosmosDBVectorSearchType = CosmosDBVectorSearchType.VECTOR_IVF,
+ ef_search: int ... | Returns a list of documents with their scores
Args:
embeddings: The query vector
k: the number of documents to return
+ kind: Type of vector index to create.
+ Possible options are:
+ - vector-ivf
+ - vector-h... | false | false | libs/community/langchain_community/vectorstores/azure_cosmos_db.py | azure_cosmos_db.py | langchain | langchain-ai |
test_lib_ansible_test__internal_venv.py | create_virtual_environment | [
{
"version": "v22",
"docstring_lines": {
"start_line": 175,
"end_line": 254
},
"code_lines": {
"start_line": 254,
"end_line": 282
},
"commit_date_time": "2023-02-13 18:49:58",
"commit_sha": "715ab99462b1799f4a0c1caeddf161e930adf13f",
"commit_message": "ansible... | def create_virtual_environment(
args: EnvironmentConfig,
python: PythonConfig,
path: str,
system_site_packages: bool = False,
pip: bool = False,
) -> bool:
if not os.path.exists(python.path):
# the requested python version could not be found
return Fals... | - Create a virtual environment using venv or virtualenv for the requested Python version.
? --------------
+ Create a virtual environment using venv for the requested Python version. | false | false | test/lib/ansible_test/_internal/venv.py | venv.py | ansible | ansible |
tests_integration_local_start_api_test_start_api.py | TestCFNTemplateQuickCreatedHttpApiWithDefaultRoute.test_cors_options | [
{
"version": "v62",
"docstring_lines": {
"start_line": 1869,
"end_line": 1872
},
"code_lines": {
"start_line": 1872,
"end_line": 1889
},
"commit_date_time": "2023-05-08 17:39:31",
"commit_sha": "632792fdc9078dc432c8c4fa3df93be91596e880",
"commit_message": "fix... | def test_cors_options(self):
- response = requests.options(self.url + "/anypath/anypath", timeout=300)
+ response = requests.options(
+ self.url + "/anypath/anypath", headers={"Origin": "https://example.com"}, timeout=300
+ )
self.asser... | - This tests that the Cors are added to option requests in the swagger template
+ This tests that the Cors headers are added to option requests in the swagger template
? ++++++++
| false | false | tests/integration/local/start_api/test_start_api.py | test_start_api.py | aws-sam-cli | aws |
test_lib_ansible_test__internal_commands_sanity_integration_aliases.py | IntegrationAliasesTest.check_changes | [
{
"version": "v25",
"docstring_lines": {
"start_line": 280,
"end_line": 377
},
"code_lines": {
"start_line": 377,
"end_line": 390
},
"commit_date_time": "2021-12-09 16:58:14",
"commit_sha": "16cdac66fe01a2492e6737849d0fb81e812ee96b",
"commit_message": "ansible... | - def check_changes(self, args, results): # type: (SanityConfig, t.Dict[str, t.Any]) -> None
? ------ ----------
+ def check_changes(self, args, results): # type: (SanityConfig, Results) -> None
? ... | - Check changes and store results in the provided results dictionary.
? -
+ Check changes and store results in the provided result dictionary. | false | false | test/lib/ansible_test/_internal/commands/sanity/integration_aliases.py | integration_aliases.py | ansible | ansible |
openbb_platform_openbb_package_equity_calendar.py | ROUTER_equity_calendar.dividend | [
{
"version": "v11",
"docstring_lines": {
"start_line": 385,
"end_line": 430
},
"code_lines": {
"start_line": 430,
"end_line": 444
},
"commit_date_time": "2024-02-08 16:47:55",
"commit_sha": "6088c98ceb290ed8c9f843455050a2bee5560331",
"commit_message": "[Featur... | def dividend(
self,
start_date: Annotated[
Union[datetime.date, None, str],
OpenBBCustomParameter(
description="Start date of the data, in YYYY-MM-DD format."
),
] = None,
end_date: Annotated[
Union[datet... | Upcoming and Historical Dividend Calendar.
Parameters
----------
- start_date : Optional[datetime.date]
? ^^^ --
+ start_date : Union[datetime.date, None, str]
? ^^ +++++++++++
Start date of the data, in... | false | false | openbb_platform/openbb/package/equity_calendar.py | equity_calendar.py | OpenBBTerminal | OpenBB-finance |
sklearn_datasets__kddcup99.py | _fetch_brute_kddcup99 | [
{
"version": "v43",
"docstring_lines": {
"start_line": 246,
"end_line": 279
},
"code_lines": {
"start_line": 279,
"end_line": 391
},
"commit_date_time": "2023-02-07 15:53:09",
"commit_sha": "7671e54b8b1cdce110b58d9c81db82be3d507de0",
"commit_message": "MAINT P... | def _fetch_brute_kddcup99(data_home=None, download_if_missing=True, percent10=True):
data_home = get_data_home(data_home=data_home)
dir_suffix = "-py3"
if percent10:
kddcup_dir = join(data_home, "kddcup99_10" + dir_suffix)
archive = ARCHIVE_10_PERCENT
... | Load the kddcup99 dataset, downloading it if necessary.
Parameters
----------
data_home : str, default=None
Specify another download and cache folder for the datasets. By default
all scikit-learn data is stored in '~/scikit_learn_data' subfolders.
download_if_missing ... | false | false | sklearn/datasets/_kddcup99.py | _kddcup99.py | scikit-learn | scikit-learn |
readthedocs_projects_templatetags_projects_tags.py | is_project_user | [
{
"version": "v24",
"docstring_lines": {
"start_line": 25,
"end_line": 27
},
"code_lines": {
"start_line": 27,
"end_line": 28
},
"commit_date_time": "2019-08-08 05:56:48",
"commit_sha": "db9e12c61795f77b1fac2de2970bb5c17b5e69c3",
"commit_message": "Sort versio... | def is_project_user(user, project):
- return user in project.users.all()
+ return user in AdminPermission.members(project) | - Return if user is a member of project.users.
+ Checks if the user has access to the project. | false | false | readthedocs/projects/templatetags/projects_tags.py | projects_tags.py | readthedocs.org | readthedocs |
libs_partners_upstage_langchain_upstage_layout_analysis.py | UpstageLayoutAnalysisLoader.__init__ | [
{
"version": "v1",
"docstring_lines": {
"start_line": 98,
"end_line": 116
},
"code_lines": {
"start_line": 116,
"end_line": 126
},
"commit_date_time": "2024-04-24 22:17:20",
"commit_sha": "c8fd51e8c8a1021b94efbf8928ca8710480cbbc6",
"commit_message": "upstage: ... | def __init__(
self,
file_path: Union[str, Path, List[str], List[Path]],
- output_type: Union[OutputType, dict] = "text",
? ^^^
+ output_type: Union[OutputType, dict] = "html",
? + ^^
... | Initializes an instance of the Upstage document loader.
Args:
file_path (Union[str, Path, List[str], List[Path]): The path to the document
to be loaded.
output_type (Union[OutputType, dict], optional): The type ... | false | false | libs/partners/upstage/langchain_upstage/layout_analysis.py | layout_analysis.py | langchain | langchain-ai |
metagpt_repo_parser.py | RepoParser._split_relationship_line | [
{
"version": "v18",
"docstring_lines": {
"start_line": 832,
"end_line": 842
},
"code_lines": {
"start_line": 842,
"end_line": 865
},
"commit_date_time": "2024-02-01 11:28:05",
"commit_sha": "df8f92966517920d3998c2144e94a979e7cb2461",
"commit_message": "feat: +... | - def _split_relationship_line(line: str) -> str:
? ^
+ def _split_relationship_line(line: str) -> DotClassRelationship:
? ++++++ +++++ ^^^^^^^
splitters = [" -> ", " [", "];"]
... | Parses a dot format line about the relationship of two classes and returns 'Generalize', 'Composite',
or 'Aggregate'.
Args:
line (str): The dot format line containing relationship information.
Returns:
- str: The type of relationship, either 'Generalize', ... | false | false | metagpt/repo_parser.py | repo_parser.py | MetaGPT | geekan |
theano_sandbox_rng_mrg.py | MRG_RandomStreams.inc_rstate | [
{
"version": "v1",
"docstring_lines": {
"start_line": 156,
"end_line": 158
},
"code_lines": {
"start_line": 158,
"end_line": 159
},
"commit_date_time": "2010-03-17 23:23:04",
"commit_sha": "149c9b535ec853ac8bf333b14f7ed5cce8288502",
"commit_message": "initial ... | def inc_rstate(self):
- print >> sys.stderr, "TODO: skip forward the state"
+ self.rstate = ff_2p134(self.rstate)
+ assert self.rstate.dtype == numpy.int32 | - Skip self.rstate forward to the next stream point
+ Update self.rstate to be skipped 2^134 steps forward to the next stream start | false | false | theano/sandbox/rng_mrg.py | rng_mrg.py | Theano | Theano |
theano_sandbox_rng_mrg.py | MRG_RandomStreams.uniform | [
{
"version": "v110",
"docstring_lines": {
"start_line": 44,
"end_line": 44
},
"code_lines": {
"start_line": 45,
"end_line": 87
},
"commit_date_time": "2014-04-23 17:53:29",
"commit_sha": "c749187caaf5fd456d01de2a423da48f6f2d8b66",
"commit_message": "Add checks... | def uniform(self, size, low=0.0, high=1.0, ndim=None, dtype=None,
nstreams=None):
low = as_tensor_variable(low)
high = as_tensor_variable(high)
if dtype is None:
dtype = scal.upcast(config.floatX, low.dtype, high.dtype)
... | Sample a tensor of given size whose element from a uniform
distribution between low and high.
If the size argument is ambiguous on the number of dimensions,
ndim may be a plain integer to supplement the missing
information.
:param low: Lower bound of the interva... | false | false | theano/sandbox/rng_mrg.py | rng_mrg.py | Theano | Theano |
theano_sandbox_rng_mrg.py | MRG_RandomStreams.__init__ | [
{
"version": "v27",
"docstring_lines": {
"start_line": 566,
"end_line": 572
},
"code_lines": {
"start_line": 572,
"end_line": 583
},
"commit_date_time": "2010-06-10 17:43:50",
"commit_sha": "45c5780fe77e9da4fcc2a1d4918c079f1b9c3c73",
"commit_message": "added m... | def __init__(self, seed=12345, use_cuda=None):
+
super(MRG_RandomStreams, self).__init__()
if isinstance(seed, int):
+ if seed == 0:
+ raise ValueError('seed should not be 0', seed)
+ elif seed >= M2:
+ raise... | - :type seed: None or int
+ :type seed: int or list of 6 int.
- :param seed: a default seed to initialize the RandomState instances after build. See
? ^ ^ ---------------------- -----
+ :param seed: a default seed to initialize the random... | false | false | theano/sandbox/rng_mrg.py | rng_mrg.py | Theano | Theano |
theano_sandbox_rng_mrg.py | MRG_RandomStreams.normal | [
{
"version": "v59",
"docstring_lines": {
"start_line": 820,
"end_line": 828
},
"code_lines": {
"start_line": 828,
"end_line": 891
},
"commit_date_time": "2011-06-11 02:55:21",
"commit_sha": "952226570ffe4a1c6a6ce94feb8b18f86dae3156",
"commit_message": "Use war... | - def normal(self, size=None, avg=0, std=1, ndim=None,
+ def normal(self, size=None, avg=0.0, std=1.0, ndim=None,
? ++ ++
- dtype='floatX', nstreams=None):
? ^^^ ^^^^
+ dtype=None, nstreams=None):
? ^ ^^
... | :param size: Can be a list of integers or Theano variables (ex: the
shape of another Theano Variable)
- :param dtype: The output data type.
+ :param dtype: The output data type. If dtype is not specified, it will
+ be inferred from the dtype of low and high, but will be at least a... | false | false | theano/sandbox/rng_mrg.py | rng_mrg.py | Theano | Theano |
theano_sandbox_rng_mrg.py | guess_n_streams | [
{
"version": "v68",
"docstring_lines": {
"start_line": 604,
"end_line": 610
},
"code_lines": {
"start_line": 610,
"end_line": 630
},
"commit_date_time": "2012-07-03 20:40:20",
"commit_sha": "6341d126efe0eeb6a3da546bd0c40a10a7bd7fc9",
"commit_message": "ENH: mo... | def guess_n_streams(size, warn=True):
# TODO: a smart way of choosing the number of streams, see #612.
# Note that this code was moved out of `MRG_RandomStreams` so that it can
# be easily accessed from tests, where we want to disable the warning.
if (isinstance(size, (tup... | Return a guess at a good number of streams.
:param warn: If True, warn when a guess cannot be made (in which case
- we return 30 * 256).
? ^
+ we return 60 * 256).
? ^
| false | false | theano/sandbox/rng_mrg.py | rng_mrg.py | Theano | Theano |
django_template_loader_tags.py | do_include | [
{
"version": "v39",
"docstring_lines": {
"start_line": 203,
"end_line": 210
},
"code_lines": {
"start_line": 210,
"end_line": 221
},
"commit_date_time": "2010-11-27 05:47:30",
"commit_sha": "0be14b0b9647b1662c41e7e408072ebe19f28929",
"commit_message": "Fixed #... | def do_include(parser, token):
bits = token.split_contents()
- if len(bits) != 2:
? ^^
+ if len(bits) < 2:
? ^
- raise TemplateSyntaxError("%r tag takes one argument: the name of the template to be included" % bits[0])
+ raise Temp... | - Loads a template and renders it with the current context.
+ Loads a template and renders it with the current context. You can pass
? +++++++++++++
+ additional context using keyword arguments.
Example::
{% include "foo/some_include" %... | false | false | django/template/loader_tags.py | loader_tags.py | django | django |
rllib_execution_train_ops.py | multi_gpu_train_one_step | [
{
"version": "v47",
"docstring_lines": {
"start_line": 90,
"end_line": 108
},
"code_lines": {
"start_line": 108,
"end_line": 200
},
"commit_date_time": "2022-06-01 18:27:54",
"commit_sha": "905258dbc19753c81039f993477e7ab027960729",
"commit_message": "Clean up... | - def multi_gpu_train_one_step(trainer, train_batch) -> Dict:
? ^^^^^^
+ def multi_gpu_train_one_step(algorithm, train_batch) -> Dict:
? ++++++ ^^
- config = trainer.config
? ^^^^^^
+ config = algorithm.config
? ... | Multi-GPU version of train_one_step.
Uses the policies' `load_batch_into_buffer` and `learn_on_loaded_batch` methods
to be more efficient wrt CPU/GPU data transfers. For example, when doing multiple
passes through a train batch (e.g. for PPO) using `config.num_sgd_iter`, the
actual train ba... | false | false | rllib/execution/train_ops.py | train_ops.py | ray | ray-project |
sklearn_feature_extraction__dict_vectorizer.py | DictVectorizer.fit | [
{
"version": "v58",
"docstring_lines": {
"start_line": 102,
"end_line": 115
},
"code_lines": {
"start_line": 115,
"end_line": 134
},
"commit_date_time": "2020-06-16 08:44:13",
"commit_sha": "00bc681e1045541fdcecfd3b22e33cfce07ffec8",
"commit_message": "DOC sho... | def fit(self, X, y=None):
feature_names = []
vocab = {}
for x in X:
for f, v in x.items():
if isinstance(v, str):
- f = "%s%s%s" % (f, self.separator, v)
+ feature_name = "%s%s%s" % (f, self.... | Learn a list of feature name -> indices mappings.
Parameters
----------
X : Mapping or iterable over Mappings
Dict(s) or Mapping(s) from feature names (arbitrary Python
objects) to feature values (strings or convertible to dtype).
+
+ .. versio... | false | false | sklearn/feature_extraction/_dict_vectorizer.py | _dict_vectorizer.py | scikit-learn | scikit-learn |
readthedocs_doc_builder_backends_sphinx.py | BaseSphinx.append_conf | [
{
"version": "v297",
"docstring_lines": {
"start_line": 269,
"end_line": 274
},
"code_lines": {
"start_line": 274,
"end_line": 317
},
"commit_date_time": "2023-08-17 13:19:33",
"commit_sha": "2066e3486a25bbd76431e1f8c20be3da0043f03a",
"commit_message": "Build:... | def append_conf(self):
+ if self.config_file is None:
+ raise ProjectConfigurationError(ProjectConfigurationError.NOT_FOUND)
+ self.config_file = self.config_file or self.project.conf_file(self.version.slug)
- # Generate a `conf.py` from a templa... | - Find or create a ``conf.py`` and appends default content.
? ------ ----
+ Find a ``conf.py`` and appends default content.
The default content is rendered from ``doc_builder/conf.py.tmpl``. | false | false | readthedocs/doc_builder/backends/sphinx.py | sphinx.py | readthedocs.org | readthedocs |
theano_sparse_basic.py | _is_dense_result | [
{
"version": "v53",
"docstring_lines": {
"start_line": 44,
"end_line": 48
},
"code_lines": {
"start_line": 48,
"end_line": 51
},
"commit_date_time": "2009-03-16 20:10:11",
"commit_sha": "6134415539097024362235c8a3d821e58edcbfd2",
"commit_message": "fixes to St... | def _is_dense_result(x):
- if not isinstance(x.type, Sparse) and not isinstance(x.type, tensor.Tensor):
? ----
+ if not isinstance(x.type, SparseType) and not isinstance(x.type, tensor.NDArrayType):
? ... | @rtype: boolean
- @return: True unless x is a L{SparseResult} (and not a L{tensor.Tensor})
? ----
+ @return: True unless x is a L{SparseResult} (and not a L{tensor.NDArrayType})
? ... | false | false | theano/sparse/basic.py | basic.py | Theano | Theano |
theano_sparse_basic.py | _is_dense_variable | [
{
"version": "v234",
"docstring_lines": {
"start_line": 44,
"end_line": 48
},
"code_lines": {
"start_line": 48,
"end_line": 54
},
"commit_date_time": "2012-10-03 20:24:03",
"commit_sha": "2ac39b3e8707f4ab8ebd809674ee10d432141455",
"commit_message": "Move Spars... | def _is_dense_variable(x):
- if not isinstance(x.type, (SparseType, tensor.TensorType)):
+ if not isinstance(x, gof.Variable):
raise NotImplementedError("this function should only be called on "
"*variables* (of type sparse.SparseType or "
- ... | @rtype: boolean
- @return: True unless x is a L{SparseVariable} (and not a
- L{tensor.TensorType})
+ @return: True if x is a L{tensor.TensorType} (and not a
+ L{SparseVariable}, for instance) | false | false | theano/sparse/basic.py | basic.py | Theano | Theano |
skimage_feature_blob.py | blob_dog | [
{
"version": "v73",
"docstring_lines": {
"start_line": 561,
"end_line": 641
},
"code_lines": {
"start_line": 641,
"end_line": 671
},
"commit_date_time": "2021-08-15 21:41:49",
"commit_sha": "1080b31360041581a137fdf2f560ae2270129b85",
"commit_message": "Fix blo... | def blob_dog(image, min_sigma=1, max_sigma=50, sigma_ratio=1.6, threshold=0.5,
overlap=.5, *, threshold_rel=None, exclude_border=False):
image = img_as_float(image)
float_dtype = _supported_float_type(image.dtype)
image = image.astype(float_dtype, copy=False)
# ... | r"""Finds blobs in the given grayscale image.
Blobs are found using the Difference of Gaussian (DoG) method [1]_, [2]_.
For each blob found, the method returns its coordinates and the standard
deviation of the Gaussian kernel that detected the blob.
Parameters
----------
imag... | false | false | skimage/feature/blob.py | blob.py | scikit-image | scikit-image |
skimage_feature_blob.py | blob_log | [
{
"version": "v12",
"docstring_lines": {
"start_line": 207,
"end_line": 281
},
"code_lines": {
"start_line": 281,
"end_line": 311
},
"commit_date_time": "2014-03-10 17:28:37",
"commit_sha": "a067485dec1f90225518af72d50e029aedfe2fd9",
"commit_message": "added b... | - def blob_log(image, min_sigma=1, max_sigma=50, num_sigma=10, threshold=.1,
? ^
+ def blob_log(image, min_sigma=1, max_sigma=50, num_sigma=10, threshold=.2,
? ^
... | Finds blobs in the given grayscale image.
- Blobs are found using the Laplacian of Gaussian (DoG) method[1]_.
? ^
+ Blobs are found using the Laplacian of Gaussian (LoG) method[1]_.
? ^
For eac... | false | false | skimage/feature/blob.py | blob.py | scikit-image | scikit-image |
skimage_feature_blob.py | blob_doh | [
{
"version": "v79",
"docstring_lines": {
"start_line": 569,
"end_line": 657
},
"code_lines": {
"start_line": 657,
"end_line": 688
},
"commit_date_time": "2022-10-17 15:09:09",
"commit_sha": "291daed03072d2556d771204a0558fea510e2476",
"commit_message": "fix exc... | def blob_doh(image, min_sigma=1, max_sigma=30, num_sigma=10, threshold=0.01,
overlap=.5, log_scale=False, *, threshold_rel=None):
-
+ # noqa: E501
check_nD(image, 2)
image = img_as_float(image)
float_dtype = _supported_float_type(image.dtype)
image = image.a... | Finds blobs in the given grayscale image.
Blobs are found using the Determinant of Hessian method [1]_. For each blob
found, the method returns its coordinates and the standard deviation
of the Gaussian Kernel used for the Hessian matrix whose determinant
detected the blob. Determinant of H... | false | false | skimage/feature/blob.py | blob.py | scikit-image | scikit-image |
skimage_feature_blob.py | _prune_blobs | [
{
"version": "v46",
"docstring_lines": {
"start_line": 21,
"end_line": 41
},
"code_lines": {
"start_line": 41,
"end_line": 72
},
"commit_date_time": "2017-02-12 12:13:45",
"commit_sha": "348b24ed6f8f9f44eebfd89ac79b188557772710",
"commit_message": "ENH: genera... | def _prune_blobs(blobs_array, overlap):
+ sigma = blobs_array[:, -1].max()
+ distance = 2 * sigma * sqrt(blobs_array.shape[1] - 1)
+ tree = spatial.cKDTree(blobs_array[:, :-1])
+ pairs = np.array(list(tree.query_pairs(distance)))
+ if len(pairs) == 0:
+ return blobs_array
+ ... | Eliminated blobs with area overlap.
Parameters
----------
blobs_array : ndarray
- A 2d array with each row representing 3 values, ``(y,x,sigma)``
? ----------------
+ A 2d array with each row representing 3 (or 4) values,
? ... | false | false | skimage/feature/blob.py | blob.py | scikit-image | scikit-image |
skimage_feature_blob.py | _blob_overlap | [
{
"version": "v59",
"docstring_lines": {
"start_line": 85,
"end_line": 107
},
"code_lines": {
"start_line": 107,
"end_line": 128
},
"commit_date_time": "2019-09-10 00:53:40",
"commit_sha": "8e7d3316f927de37cfb6329f5595f6f789ab4f8d",
"commit_message": "Use corr... | - def _blob_overlap(blob1, blob2):
+ def _blob_overlap(blob1, blob2, *, sigma_dim=1):
? ++++++++++++++++
- n_dim = len(blob1) - 1
? - ^
+ ndim = len(blob1) - sigma_dim
? ^^^^^^^^^
+ if ndim > 3:
+ return 0.... | Finds the overlapping area fraction between two blobs.
- Returns a float representing fraction of overlapped area.
+ Returns a float representing fraction of overlapped area. Note that 0.0
? ++++++++++++++
+ is *always* returned for dimensio... | false | false | skimage/feature/blob.py | blob.py | scikit-image | scikit-image |
python_ray_experimental_state_api.py | StateApiClient.list | [
{
"version": "v18",
"docstring_lines": {
"start_line": 651,
"end_line": 654
},
"code_lines": {
"start_line": 654,
"end_line": 690
},
"commit_date_time": "2022-06-28 23:07:32",
"commit_sha": "def02bd4c99f7e797b451f1dea061eb670c42b64",
"commit_message": "Revert ... | def list(
self, resource: StateResource, options: ListApiOptions, _explain: bool = False
) -> Union[Dict, List]:
endpoint = f"/api/v0/{resource.value}"
params = self._make_param(options)
- return self._make_http_get_request(
? ^^^
+ ... | List resources states
Args:
- resource_name: Resource names, i.e. 'jobs', 'actors', 'nodes',
? -----
+ resource: Resource names, i.e. 'jobs', 'actors', 'nodes',
see `StateResource` for details.
options: List options. See `ListAp... | false | false | python/ray/experimental/state/api.py | api.py | ray | ray-project |
python_ray_experimental_state_api.py | StateApiClient._print_api_warning | [
{
"version": "v25",
"docstring_lines": {
"start_line": 315,
"end_line": 322
},
"code_lines": {
"start_line": 322,
"end_line": 345
},
"commit_date_time": "2022-07-25 02:55:36",
"commit_sha": "15b711ae6abcfa525de628207c9e9ee6849812b3",
"commit_message": "[State ... | def _print_api_warning(self, resource: StateResource, api_response: dict):
# Print warnings if anything was given.
warning_msgs = api_response.get("partial_failure_warning", None)
if warning_msgs:
warnings.warn(warning_msgs)
- # Print warnin... | Print the API warnings.
+
+ We print warnings for users:
+ 1. when some data sources are not available
+ 2. when results were truncated at the data source
+ 3. when results were limited
+ 4. when callsites not enabled for listing objects
Args:
... | false | false | python/ray/experimental/state/api.py | api.py | ray | ray-project |
gensim_models_ldamodel.py | LdaModel.__init__ | [
{
"version": "v316",
"docstring_lines": {
"start_line": 530,
"end_line": 553
},
"code_lines": {
"start_line": 553,
"end_line": 597
},
"commit_date_time": "2021-04-28 05:39:16",
"commit_sha": "a9b91ba379c44903009e5da476a774c82ed487ee",
"commit_message": "Fix UR... | def __init__(self, corpus=None, num_topics=100, id2word=None,
distributed=False, chunksize=2000, passes=1, update_every=1,
alpha='symmetric', eta=None, decay=0.5, offset=1.0, eval_every=10,
iterations=50, gamma_threshold=0.001, minimum_probability=0.01,
... | Parameters
----------
corpus : iterable of list of (int, float), optional
Stream of document vectors or sparse matrix of shape (`num_documents`, `num_terms`).
If you have a CSC in-memory matrix, you can convert it to a
streamed corpus with the help of gens... | false | false | gensim/models/ldamodel.py | ldamodel.py | gensim | piskvorky |
gensim_models_ldamodel.py | LdaModel.clear | [
{
"version": "v133",
"docstring_lines": {
"start_line": 371,
"end_line": 375
},
"code_lines": {
"start_line": 375,
"end_line": 381
},
"commit_date_time": "2011-11-30 03:13:09",
"commit_sha": "37ea69ce3d9cbe761f937f81df2c05d7bada2478",
"commit_message": "added ... | def clear(self):
self.state = None
- self._lambda = None
- self.expElogbeta = None
? ---
+ self.Elogbeta = None | - Clear model state (free up some memory).
+ Clear model state (free up some memory). Used in the distributed algo. | false | false | gensim/models/ldamodel.py | ldamodel.py | gensim | piskvorky |
gensim_models_ldamodel.py | LdaModel.update | [
{
"version": "v142",
"docstring_lines": {
"start_line": 378,
"end_line": 394
},
"code_lines": {
"start_line": 394,
"end_line": 483
},
"commit_date_time": "2013-04-20 10:29:47",
"commit_sha": "410a7b993d5cdfb0579ddf8555a73d5caf482aaf",
"commit_message": "ignore... | def update(self, corpus, chunksize=None, decay=None, passes=None, update_every=None):
# use parameters given in constructor, unless user explicitly overrode them
if chunksize is None:
chunksize = self.chunksize
if decay is None:
... | Train the model with new documents, by EM-iterating over `corpus` until
the topics converge (or until the maximum number of allowed iterations
- is reached).
+ is reached). `corpus` must be an iterable (repeatable stream of documents),
In distributed mode, the E step is distribu... | false | false | gensim/models/ldamodel.py | ldamodel.py | gensim | piskvorky |
gensim_models_ldamodel.py | LdaModel.update_alpha | [
{
"version": "v221",
"docstring_lines": {
"start_line": 465,
"end_line": 473
},
"code_lines": {
"start_line": 473,
"end_line": 493
},
"commit_date_time": "2015-10-10 21:35:29",
"commit_sha": "b96975e3a97abcf38e366d07343cafa28697be7e",
"commit_message": "Add au... | def update_alpha(self, gammat, rho):
-
N = float(len(gammat))
logphat = sum(dirichlet_expectation(gamma) for gamma in gammat) / N
- dalpha = numpy.copy(self.alpha)
- gradf = N * (psi(numpy.sum(self.alpha)) - psi(self.alpha) + logphat)
+ ... | Update parameters for the Dirichlet prior on the per-document
topic weights `alpha` given the last `gammat`.
-
- Uses Newton's method, described in **Huang: Maximum Likelihood Estimation of Dirichlet Distribution Parameters.**
- http://jonathan-huang.org/research/dirichlet/dirichlet.pdf | false | false | gensim/models/ldamodel.py | ldamodel.py | gensim | piskvorky |
gensim_models_ldamodel.py | LdaModel.show_topics | [
{
"version": "v169",
"docstring_lines": {
"start_line": 657,
"end_line": 671
},
"code_lines": {
"start_line": 671,
"end_line": 689
},
"commit_date_time": "2014-05-30 17:03:53",
"commit_sha": "668d701e465f7a1f617172be6cea9a16d760a715",
"commit_message": "improv... | - def show_topics(self, topics=10, topn=10, log=False, formatted=True):
? ^ ^^
+ def show_topics(self, num_topics=10, num_words=10, log=False, formatted=True):
? ++++ ^^^^^ ^^^
- if topics < 0 or topics >= sel... | - For `topics` number of topics, return `topn` most significant words
? ^ ^^
+ For `num_topics` number of topics, return `num_words` most significant words
? ++++ ^^^^^ ^^^
(10 words per topic, by default).
The topics ... | false | false | gensim/models/ldamodel.py | ldamodel.py | gensim | piskvorky |
gensim_models_ldamodel.py | LdaModel.inference | [
{
"version": "v168",
"docstring_lines": {
"start_line": 325,
"end_line": 339
},
"code_lines": {
"start_line": 339,
"end_line": 405
},
"commit_date_time": "2014-05-25 10:13:39",
"commit_sha": "6db0e572f327f1352da331ed20fc0663b0fb2d05",
"commit_message": "change... | def inference(self, chunk, collect_sstats=False):
try:
_ = len(chunk)
except:
chunk = list(chunk) # convert iterators/generators to plain list, so we have len() etc.
if len(chunk) > 1:
logger.debug("performing ... | Given a chunk of sparse document vectors, estimate gamma (parameters
controlling the topic weights) for each document in the chunk.
This function does not modify the model (=is read-only aka const). The
whole input chunk of document is assumed to fit in RAM; chunking of a
la... | false | false | gensim/models/ldamodel.py | ldamodel.py | gensim | piskvorky |
gensim_models_ldamodel.py | LdaModel.show_topic | [
{
"version": "v217",
"docstring_lines": {
"start_line": 726,
"end_line": 733
},
"code_lines": {
"start_line": 733,
"end_line": 734
},
"commit_date_time": "2015-09-13 17:05:22",
"commit_sha": "da7f9e30d7a2ceeb9b874948f821cbec7ae439df",
"commit_message": "Update... | def show_topic(self, topicid, topn=10):
- return [(self.id2word[id], value) for id, value in self.get_topic_terms(topicid, topn)]
+ topic = self.state.get_lambda()[topicid]
+ topic = topic / topic.sum() # normalize to probability distribution
+ best... | - Return a list of `(word, probability)` 2-tuples for the most probable
? ^^
+ Return a list of `(words_probability, word)` 2-tuples for the most probable
? ^^ ++++++
words in topic `topicid`.
Only return 2-tuples for the topn most probabl... | false | false | gensim/models/ldamodel.py | ldamodel.py | gensim | piskvorky |
gensim_models_ldamodel.py | LdaModel.load | [
{
"version": "v194",
"docstring_lines": {
"start_line": 827,
"end_line": 833
},
"code_lines": {
"start_line": 833,
"end_line": 841
},
"commit_date_time": "2015-04-03 18:37:14",
"commit_sha": "caf4e9045b99c4bf3af6c0893a691ba6682e51b7",
"commit_message": "remove... | def load(cls, fname, *args, **kwargs):
- kwargs['mmap'] = kwargs.get('mmap', 'r')
? ^^^
+ kwargs['mmap'] = kwargs.get('mmap', None)
? ^^^^
result = super(LdaModel, cl... | Load a previously saved object from file (also see `save`).
- Large arrays are mmap'ed back as read-only (shared memory).
? ^ ^
+ Large arrays can be memmap'ed back as read-only (shared memory) by setting `mmap='r'`:
? ... | false | false | gensim/models/ldamodel.py | ldamodel.py | gensim | piskvorky |
gensim_models_ldamodel.py | LdaModel.save | [
{
"version": "v202",
"docstring_lines": {
"start_line": 739,
"end_line": 744
},
"code_lines": {
"start_line": 744,
"end_line": 793
},
"commit_date_time": "2015-04-23 10:31:00",
"commit_sha": "c5fb4a17a567652588865ef112854aeac5d384ff",
"commit_message": "Added ... | def save(self, fname, *args, **kwargs):
+
if self.state is not None:
self.state.save(utils.smart_extension(fname, '.state'), *args, **kwargs)
super(LdaModel, self).save(fname, *args, ignore=['state', 'dispatcher'], **kwargs) | Save the model to file.
Large internal arrays may be stored into separate files, with `fname` as prefix.
Note: do not save as a compressed file if you intend to load the file back with `mmap`.
-
- Note: If you intend to use models across Python 2/3 versions there are a few t... | false | false | gensim/models/ldamodel.py | ldamodel.py | gensim | piskvorky |
gensim_models_ldamodel.py | LdaModel.get_document_topics | [
{
"version": "v234",
"docstring_lines": {
"start_line": 887,
"end_line": 894
},
"code_lines": {
"start_line": 894,
"end_line": 907
},
"commit_date_time": "2016-05-31 01:27:48",
"commit_sha": "97c8455a85dbafd14bfb4c81e5cfd0ba9f4e544b",
"commit_message": "Return... | - def get_document_topics(self, bow, minimum_probability=None):
+ def get_document_topics(self, bow, minimum_probability=None, minimum_phi_probability=None, per_word_topics=False):
if minimum_probability is None:
minimum_probability = self.minimum_probability
... | Return topic distribution for the given document `bow`, as a list of
(topic_id, topic_probability) 2-tuples.
Ignore topics with very low probability (below `minimum_probability`).
+
+ If per_word_topics is True, it also returns a list of topics, sorted in descending order of most likel... | false | false | gensim/models/ldamodel.py | ldamodel.py | gensim | piskvorky |
gensim_models_ldamodel.py | LdaModel.__getitem__ | [
{
"version": "v276",
"docstring_lines": {
"start_line": 819,
"end_line": 826
},
"code_lines": {
"start_line": 826,
"end_line": 830
},
"commit_date_time": "2017-08-03 07:03:14",
"commit_sha": "3cb8495e8230aa6d436e19cf2459dec78929bb40",
"commit_message": "Add 'd... | def __getitem__(self, bow, eps=None):
-
return self.get_document_topics(bow, eps, self.minimum_phi_value, self.per_word_topics) | - Return topic distribution for the given document `bow`, as a list of
- (topic_id, topic_probability) 2-tuples.
+ Args:
+ bow (list): Bag-of-words representation of a document.
+ eps (float): Ignore topics with probability below `eps`.
- Ignore topics with very low probabilit... | false | false | gensim/models/ldamodel.py | ldamodel.py | gensim | piskvorky |
gensim_models_ldamodel.py | LdaModel.sync_state | [
{
"version": "v300",
"docstring_lines": {
"start_line": 597,
"end_line": 599
},
"code_lines": {
"start_line": 599,
"end_line": 601
},
"commit_date_time": "2019-01-09 05:52:04",
"commit_sha": "1b07f81b8276a0ced35c11824deb961ed128246a",
"commit_message": "Replac... | - def sync_state(self):
+ def sync_state(self, current_Elogbeta=None):
+
+
+ if current_Elogbeta is None:
+ current_Elogbeta = self.state.get_Elogbeta()
- self.expElogbeta = np.exp(self.state.get_Elogbeta())
? ^ ^^^^^^^^^^^ - -
... | Propagate the states topic probabilities to the inner object's attribute.
+
+ Parameters
+ ----------
+ current_Elogbeta: numpy.ndarray
+ Posterior probabilities for each topic, optional.
+ If omitted, it will get Elogbeta from state. | false | false | gensim/models/ldamodel.py | ldamodel.py | gensim | piskvorky |
gensim_models_ldamodel.py | LdaModel.init_dir_prior | [
{
"version": "v309",
"docstring_lines": {
"start_line": 525,
"end_line": 546
},
"code_lines": {
"start_line": 546,
"end_line": 586
},
"commit_date_time": "2020-07-26 10:40:18",
"commit_sha": "78778a9d7ef7805153714bc9eaa985a310879163",
"commit_message": "Update... | def init_dir_prior(self, prior, name):
if prior is None:
prior = 'symmetric'
if name == 'alpha':
prior_shape = self.num_topics
elif name == 'eta':
prior_shape = self.num_terms
else:
raise ValueErro... | Initialize priors for the Dirichlet distribution.
Parameters
----------
prior : {str, list of float, numpy.ndarray of float, float}
A-priori belief on word probability. If `name` == 'eta' then the prior can be:
* scalar for a symmetric prior over top... | false | false | gensim/models/ldamodel.py | ldamodel.py | gensim | piskvorky |
python_ray_util_iter.py | LocalIterator.__init__ | [
{
"version": "v9",
"docstring_lines": {
"start_line": 569,
"end_line": 587
},
"code_lines": {
"start_line": 587,
"end_line": 594
},
"commit_date_time": "2020-03-12 07:54:08",
"commit_sha": "f5d12a958be73349fb36c92536f3576d40d0d0fc",
"commit_message": "[rllib] ... | def __init__(self,
base_iterator: Callable[[], Iterable[T]],
- metrics: MetricsContext,
? -------
+ shared_metrics: SharedMetrics,
? +++++++ ++++++
local_transforms: List[Callable[[Itera... | Create a local iterator (this is an internal function).
Args:
base_iterator (func): A function that produces the base iterator.
This is a function so that we can ensure LocalIterator is
serializable.
- metrics (MetricsContext): Existing metric... | false | false | python/ray/util/iter.py | iter.py | ray | ray-project |
research_object_detection_meta_architectures_ssd_meta_arch.py | SSDKerasFeatureExtractor.__init__ | [
{
"version": "v32",
"docstring_lines": {
"start_line": 153,
"end_line": 181
},
"code_lines": {
"start_line": 181,
"end_line": 195
},
"commit_date_time": "2019-05-31 05:27:44",
"commit_sha": "9bbf8015dba2133ab2343ec6d6b5096033504e36",
"commit_message": "Merged ... | def __init__(self,
is_training,
depth_multiplier,
min_depth,
pad_to_multiple,
conv_hyperparams,
freeze_batchnorm,
inplace_batchnorm_update,
use_explicit_padding=False,
... | Constructor.
Args:
is_training: whether the network is in training mode.
depth_multiplier: float depth multiplier for feature extractor.
min_depth: minimum feature extractor depth.
pad_to_multiple: the nearest multiple to zero pad the input height and
width dimension... | false | false | research/object_detection/meta_architectures/ssd_meta_arch.py | ssd_meta_arch.py | models | tensorflow |
cookiecutter_vcs.py | git_clone | [
{
"version": "v8",
"docstring_lines": {
"start_line": 19,
"end_line": 19
},
"code_lines": {
"start_line": 20,
"end_line": 27
},
"commit_date_time": "2013-08-27 14:05:21",
"commit_sha": "e672b861d1df4c41cf9157f3bb7e8ebd4c219aa3",
"commit_message": "Added suppor... | - def git_clone(repo):
+ def git_clone(repo, checkout=None):
# Return repo dir
tail = os.path.split(repo)[1]
repo_dir = tail.rsplit('.git')[0]
logging.debug('repo_dir is {0}'.format(repo_dir))
if os.path.isdir(repo_dir):
delete_repo(repo_dir)
o... | Clone a git repo to the current directory.
:param repo: Git repo URL ending with .git.
+ :param checkout: The branch, tag or commit ID to checkout after clone | false | false | cookiecutter/vcs.py | vcs.py | cookiecutter | cookiecutter |
cookiecutter_vcs.py | identify_repo | [
{
"version": "v40",
"docstring_lines": {
"start_line": 50,
"end_line": 57
},
"code_lines": {
"start_line": 57,
"end_line": 72
},
"commit_date_time": "2016-07-11 20:03:50",
"commit_sha": "173b5449c6ba6e7829fb0f3be6ba33556a4f9ad3",
"commit_message": "Capture vcs... | def identify_repo(repo_url):
repo_url_values = repo_url.split('+')
if len(repo_url_values) == 2:
repo_type = repo_url_values[0]
if repo_type in ["git", "hg"]:
return repo_type, repo_url_values[1]
else:
raise UnknownRepoType
... | Determines if `repo_url` should be treated as a URL to a git or hg repo.
- Repos can be identified prepeding "hg+" or "git+" to repo URL.
+ Repos can be identified by prepending "hg+" or "git+" to the repo URL.
? +++ + ++++
:param repo_url: Repo ... | false | false | cookiecutter/vcs.py | vcs.py | cookiecutter | cookiecutter |
cookiecutter_vcs.py | clone | [
{
"version": "v65",
"docstring_lines": {
"start_line": 58,
"end_line": 67
},
"code_lines": {
"start_line": 67,
"end_line": 126
},
"commit_date_time": "2022-05-31 23:32:38",
"commit_sha": "e26c46582cd9033dcea318f1c29a1f06fb74f456",
"commit_message": "Sanitize M... | def clone(repo_url, checkout=None, clone_to_dir='.', no_input=False):
# Ensure that clone_to_dir exists
clone_to_dir = os.path.expanduser(clone_to_dir)
make_sure_path_exists(clone_to_dir)
# identify the repo_type
repo_type, repo_url = identify_repo(repo_url)
# c... | Clone a repo to the current directory.
:param repo_url: Repo URL of unknown type.
:param checkout: The branch, tag or commit ID to checkout after clone.
:param clone_to_dir: The directory to clone to.
Defaults to the current directory.
- :param no_input: Suppress al... | false | false | cookiecutter/vcs.py | vcs.py | cookiecutter | cookiecutter |
homeassistant_components_ihc___init__.py | get_discovery_info | [
{
"version": "v24",
"docstring_lines": {
"start_line": 316,
"end_line": 318
},
"code_lines": {
"start_line": 318,
"end_line": 343
},
"commit_date_time": "2021-02-09 19:21:04",
"commit_sha": "57ce18295959de1b6a2f661c265499056a3c7c41",
"commit_message": "Remove ... | - def get_discovery_info(component_setup, groups, controller_id):
? ^ ------
+ def get_discovery_info(platform_setup, groups, controller_id):
? ^^^^^ +
discovery_data = {}
for group in groups:
groupname = group.attrib["name"]
- for pr... | - Get discovery info for specified IHC component.
? ^ ------
+ Get discovery info for specified IHC platform.
? ^^^^^ +
| false | false | homeassistant/components/ihc/__init__.py | __init__.py | core | home-assistant |
openbb_platform_openbb_package_equity.py | ROUTER_equity.search | [
{
"version": "v12",
"docstring_lines": {
"start_line": 516,
"end_line": 570
},
"code_lines": {
"start_line": 570,
"end_line": 585
},
"commit_date_time": "2024-02-04 18:39:29",
"commit_sha": "3de1bddc2de0a76439e4bc3b09aa9d7ff9ef68a3",
"commit_message": "feature... | def search(
self,
query: Annotated[str, OpenBBCustomParameter(description="Search query.")] = "",
is_symbol: Annotated[
bool,
OpenBBCustomParameter(description="Whether to search by ticker symbol."),
] = False,
+ use_cache: Annotated[
+ ... | Equity Search. Search for a company or stock ticker.
Parameters
----------
query : str
Search query.
is_symbol : bool
Whether to search by ticker symbol.
+ use_cache : Optional[bool]
+ Whether to use the cache or not.
... | false | false | openbb_platform/openbb/package/equity.py | equity.py | OpenBBTerminal | OpenBB-finance |
openbb_platform_openbb_package_equity.py | ROUTER_equity.profile | [
{
"version": "v19",
"docstring_lines": {
"start_line": 238,
"end_line": 392
},
"code_lines": {
"start_line": 392,
"end_line": 416
},
"commit_date_time": "2024-02-22 19:06:57",
"commit_sha": "274a027bf55104c64c86b35b457c66e6fad85943",
"commit_message": "[Featur... | def profile(
self,
symbol: Annotated[
Union[str, List[str]],
OpenBBCustomParameter(
- description="Symbol to get data for. Multiple items allowed: fmp, intrinio, yfinance."
+ description="Symbol to get data for. Multiple items allowed for... | Get general information about a company. This includes company name, industry, sector and price data.
Parameters
----------
symbol : Union[str, List[str]]
- Symbol to get data for. Multiple items allowed: fmp, intrinio, yfinance.
+ Symbol to get data for. Multi... | false | false | openbb_platform/openbb/package/equity.py | equity.py | OpenBBTerminal | OpenBB-finance |
vnpy_chart_manager.py | BarManager._clear_cache | [
{
"version": "v2",
"docstring_lines": {
"start_line": 137,
"end_line": 140
},
"code_lines": {
"start_line": 140,
"end_line": 142
},
"commit_date_time": "2019-07-18 04:35:28",
"commit_sha": "5585d774d4bde6260a3f68004dd1f4ea11db0db0",
"commit_message": "[Add] cu... | def _clear_cache(self) -> None:
- self.get_price_range.cache_clear()
? --- ------
+ self._price_ranges.clear()
? +
- self.get_volume_range.cache_clear()
? --- ------
+ self._... | - Clear lru_cache range data.
? ----
+ Clear cached range data.
? +
| false | false | vnpy/chart/manager.py | manager.py | vnpy | vnpy |
cookiecutter_prompt.py | prompt_choice_for_config | [
{
"version": "v76",
"docstring_lines": {
"start_line": 179,
"end_line": 184
},
"code_lines": {
"start_line": 184,
"end_line": 237
},
"commit_date_time": "2022-05-30 16:52:10",
"commit_sha": "9ee72e1926de5dbe50608dca26ec5e7c9cf26321",
"commit_message": "houseke... | def prompt_choice_for_config(cookiecutter_dict, env, key, options, no_input):
rendered_options = [render_variable(env, raw, cookiecutter_dict) for raw in options]
-
if no_input:
return rendered_options[0]
return read_user_choice(key, rendered_options) | Prompt user with a set of options to choose from.
- Each of the possible choices is rendered beforehand.
+ :param no_input: Do not prompt for user input and return the first available option. | false | false | cookiecutter/prompt.py | prompt.py | cookiecutter | cookiecutter |
theano_gof_optdb.py | SequenceDB.query | [
{
"version": "v30",
"docstring_lines": {
"start_line": 124,
"end_line": 124
},
"code_lines": {
"start_line": 125,
"end_line": 125
},
"commit_date_time": "2011-10-28 15:34:56",
"commit_sha": "43cb38b88a5a436f1e003e8538e7d9974f338800",
"commit_message": "Add a t... | def query(self, *tags, **kwtags):
opts = super(SequenceDB, self).query(*tags, **kwtags)
- position_cutoff = kwtags.pop('position_cutoff', config.optdb.position_cutoff)
? ------------------------------
+ ... | :type position_cutoff: float or int
- :param position_cutoff: only optimizations with position less than the cutoff are returned.
? -------------------------
+ :param position_cutoff: only optimizations with position less than
... | false | false | theano/gof/optdb.py | optdb.py | Theano | Theano |
gyp_pylib_gyp_MSVSVersion.py | _DetectVisualStudioVersions | [
{
"version": "v5",
"docstring_lines": {
"start_line": 169,
"end_line": 177
},
"code_lines": {
"start_line": 177,
"end_line": 186
},
"commit_date_time": "2014-01-21 20:56:33",
"commit_sha": "4815bf1ba5ac737f16700d618b925352d6bcc0a0",
"commit_message": "gyp: upd... | def _DetectVisualStudioVersions(versions_to_check, force_express):
version_to_year = {
'8.0': '2005',
'9.0': '2008',
'10.0': '2010',
'11.0': '2012',
'12.0': '2013',
+ '14.0': '2015',
}
versions = []
for version in versions_to_check:
# Old m... | Collect the list of installed visual studio versions.
Returns:
A list of visual studio versions installed in descending order of
usage preference.
Base this on the registry and a quick check if devenv.exe exists.
Only versions 8-10 are considered.
Possibilities are:
2005(e... | false | false | gyp/pylib/gyp/MSVSVersion.py | MSVSVersion.py | node-gyp | nodejs |
gyp_pylib_gyp_MSVSVersion.py | _RegistryGetValueUsingWinReg | [
{
"version": "v13",
"docstring_lines": {
"start_line": 217,
"end_line": 226
},
"code_lines": {
"start_line": 226,
"end_line": 241
},
"commit_date_time": "2020-05-26 05:14:13",
"commit_sha": "ebc34ec823d20b593ee9713bb0887daaa363cbe2",
"commit_message": "gyp: up... | def _RegistryGetValueUsingWinReg(key, value):
- try:
- # Python 2
- from _winreg import HKEY_LOCAL_MACHINE, OpenKey, QueryValueEx
- except ImportError:
- # Python 3
- from winreg import HKEY_LOCAL_MACHINE, OpenKey, QueryValueEx
? ----
+ from winreg import HKEY_... | Use the _winreg module to obtain the value of a registry key.
Args:
key: The registry key.
value: The particular registry value to read.
Return:
contents of the registry key's value, or None on failure. Throws
- ImportError if _winreg is unavailable.
? -
+ Imp... | false | false | gyp/pylib/gyp/MSVSVersion.py | MSVSVersion.py | node-gyp | nodejs |
homeassistant_components_konnected___init__.py | DiscoveredDevice.sync_device_config | [
{
"version": "v15",
"docstring_lines": {
"start_line": 314,
"end_line": 316
},
"code_lines": {
"start_line": 316,
"end_line": 359
},
"commit_date_time": "2019-02-14 04:35:12",
"commit_sha": "161c368c9d6e7106721c2e0ab99066b902a38d0f",
"commit_message": "Update ... | def sync_device_config(self):
- desired_sensor_configuration = self.sensor_configuration()
- current_sensor_configuration = [
- {'pin': s[CONF_PIN]} for s in self.status.get('sensors')]
- _LOGGER.debug('%s: desired sensor config: %s', self.device_id,
? ... | - Sync the new pin configuration to the Konnected device.
+ Sync the new pin configuration to the Konnected device if needed.
? ++++++++++
| false | false | homeassistant/components/konnected/__init__.py | __init__.py | core | home-assistant |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.