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 |
|---|---|---|---|---|---|---|---|---|---|---|
faker_providers_person_pl_PL___init__.py | Provider.pesel | [
{
"version": "v14",
"docstring_lines": {
"start_line": 710,
"end_line": 721
},
"code_lines": {
"start_line": 721,
"end_line": 738
},
"commit_date_time": "2021-01-19 20:33:24",
"commit_sha": "da1ae11a06a8f64bd4b0f7d1391d7661521e4caf",
"commit_message": "use f-s... | def pesel(self, date_of_birth=None, sex=None):
if date_of_birth is None:
date_of_birth = self.generator.date_of_birth()
- month = date_of_birth.month if date_of_birth.year < 2000 else date_of_birth.month + 20
- pesel_date = f'{date_of_birth:%... | Returns 11 characters of Universal Electronic System for Registration of the Population.
Polish: Powszechny Elektroniczny System Ewidencji Ludności.
PESEL has 11 digits which identifies just one person.
- pesel_date: if person was born in 1900-2000, december is 12. If person was born > ... | false | false | faker/providers/person/pl_PL/__init__.py | __init__.py | faker | joke2k |
localstack_services_moto.py | call_moto_with_request | [
{
"version": "v11",
"docstring_lines": {
"start_line": 91,
"end_line": 99
},
"code_lines": {
"start_line": 99,
"end_line": 103
},
"commit_date_time": "2022-07-13 22:57:18",
"commit_sha": "b848ed372e7de1c83e029c479426a4f54e6a3e13",
"commit_message": "fix moto f... | def call_moto_with_request(
context: RequestContext, service_request: ServiceRequest
) -> ServiceResponse:
local_context = create_aws_request_context(
service_name=context.service.service_name,
action=context.operation.name,
parameters=service_request,
... | Like `call_moto`, but you can pass a modified version of the service request before calling moto. The caveat is
that a new HTTP request has to be created. The service_request is serialized into a new RequestContext object,
and headers from the old request are merged into the new one.
:param conte... | false | false | localstack/services/moto.py | moto.py | localstack | localstack |
localstack_services_moto.py | proxy_moto | [
{
"version": "v6",
"docstring_lines": {
"start_line": 218,
"end_line": 233
},
"code_lines": {
"start_line": 233,
"end_line": 261
},
"commit_date_time": "2022-03-10 23:26:42",
"commit_sha": "a2dd0b628492bbecc2e875e39520d77173ac7f73",
"commit_message": "fix moto... | - def proxy_moto(context: RequestContext) -> HttpResponse:
+ def proxy_moto(context: RequestContext, service_request: ServiceRequest = None) -> HttpResponse:
status, headers, content = dispatch_to_moto(context)
return HttpResponse(response=content, status=status, headers=headers) | Similar to ``call``, only that ``proxy`` does not parse the HTTP response into a ServiceResponse, but instead
returns directly the HTTP response. This can be useful to pass through moto's response directly to the client.
:param context: the request context
+ :param service_request: currently not be... | false | false | localstack/services/moto.py | moto.py | localstack | localstack |
openbb_platform_core_openbb_core_app_static_package_builder.py | PackageBuilder._diff | [
{
"version": "v36",
"docstring_lines": {
"start_line": 123,
"end_line": 136
},
"code_lines": {
"start_line": 136,
"end_line": 145
},
"commit_date_time": "2024-04-01 16:59:31",
"commit_sha": "11023f8c2785ddea77496c77d4353938a5640903",
"commit_message": "[Releas... | - def _diff(path: Path) -> Tuple[Set[str], Set[str]]:
+ def _diff(ext_map: Dict[str, List[str]]) -> Tuple[Set[str], Set[str]]:
- ext_map = PackageBuilder._read(path)
-
add: Set[str] = set()
remove: Set[str] = set()
groups = OpenBBGroups.groups()
... | Check differences between built and installed extensions.
Parameters
----------
- path: Path
- The path to the folder where the extension map is stored.
+ ext_map: Dict[str, List[str]]
+ Dictionary containing the extensions.
+ Example:
+ ... | false | false | openbb_platform/core/openbb_core/app/static/package_builder.py | package_builder.py | OpenBBTerminal | OpenBB-finance |
freqtrade_strategy_interface.py | IStrategy.analyze_ticker | [
{
"version": "v383",
"docstring_lines": {
"start_line": 399,
"end_line": 417
},
"code_lines": {
"start_line": 417,
"end_line": 418
},
"commit_date_time": "2022-03-20 08:00:53",
"commit_sha": "95f69b905aec70c2e13b9def10dae6c0275df8ab",
"commit_message": "Remove... | def analyze_ticker(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
logger.debug("TA Analysis Launched")
dataframe = self.advise_indicators(dataframe, metadata)
- dataframe = self.advise_buy(dataframe, metadata)
? ^^... | Parses the given candle (OHLCV) data and returns a populated DataFrame
- add several TA indicators and buy signal to it
? ^^
+ add several TA indicators and entry order signal to it
? ^^^^ ++++++
:param dataframe: ... | false | false | freqtrade/strategy/interface.py | interface.py | freqtrade | freqtrade |
freqtrade_strategy_interface.py | IStrategy.advise_all_indicators | [
{
"version": "v327",
"docstring_lines": {
"start_line": 347,
"end_line": 359
},
"code_lines": {
"start_line": 359,
"end_line": 360
},
"commit_date_time": "2021-10-12 22:22:53",
"commit_sha": "80b71790bc7612056b81630245384f8a19ef3ad4",
"commit_message": "Added ... | def advise_all_indicators(self, data: Dict[str, DataFrame]) -> Dict[str, DataFrame]:
- return {pair: self.advise_indicators(pair_data.copy(), {'pair': pair})
+ return {pair: self.advise_indicators(pair_data.copy(), {'pair': pair}).copy()
? ... | Populates indicators for given candle (OHLCV) data (for multiple pairs)
- Does not run advise_buy or advise_sell!
? ^^ - ^^
+ Does not run advise_entry or advise_exit!
? ^^^^ ^^^
Used by optimize operations only... | false | false | freqtrade/strategy/interface.py | interface.py | freqtrade | freqtrade |
freqtrade_strategy_interface.py | IStrategy.advise_buy | [
{
"version": "v313",
"docstring_lines": {
"start_line": 866,
"end_line": 874
},
"code_lines": {
"start_line": 874,
"end_line": 881
},
"commit_date_time": "2021-09-18 07:48:53",
"commit_sha": "e88c4701bb2c321ed7cd5d6fed7fa6db6f4f41f6",
"commit_message": "[SQUAS... | def advise_buy(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
+
- logger.debug(f"Populating buy signals for pair {metadata.get('pair')}.")
? ^^^
+ logger.debug(f"Populating enter signals for pair {metadata.get('pair')}.")
... | - Based on TA indicators, populates the buy signal for the given dataframe
? ^^
+ Based on TA indicators, populates the entry order signal for the given dataframe
? ^^^^ ++++++
This method should not be overridden.
:param ... | false | false | freqtrade/strategy/interface.py | interface.py | freqtrade | freqtrade |
freqtrade_strategy_interface.py | IStrategy.check_buy_timeout | [
{
"version": "v358",
"docstring_lines": {
"start_line": 183,
"end_line": 189
},
"code_lines": {
"start_line": 189,
"end_line": 190
},
"commit_date_time": "2022-01-22 14:59:10",
"commit_sha": "7bef9a9b3ec8593dac0701e7c5f8df6d77b5d4e0",
"commit_message": "Extrac... | - def check_buy_timeout(self, pair: str, trade: Trade, order: dict, **kwargs) -> bool:
? -------------------
+ def check_buy_timeout(self, pair: str, trade: Trade, order: dict,
+ current_time: datetime, **kwargs) -> bool:
... | Check buy timeout function callback.
This method can be used to override the buy-timeout.
It is called whenever a limit buy order has been created,
and is not yet fully filled.
Configuration options in `unfilledtimeout` will be verified before this,
so ensure to set t... | false | false | freqtrade/strategy/interface.py | interface.py | freqtrade | freqtrade |
freqtrade_strategy_interface.py | IStrategy.leverage | [
{
"version": "v435",
"docstring_lines": {
"start_line": 544,
"end_line": 547
},
"code_lines": {
"start_line": 547,
"end_line": 552
},
"commit_date_time": "2022-06-09 17:41:08",
"commit_sha": "1ddd5f1901d08073dd7d8c9cc3b819c728a20350",
"commit_message": "Update... | def leverage(self, pair: str, current_time: datetime, current_rate: float,
- proposed_leverage: float, max_leverage: float, entry_tag: Optional[str],
? -------- --------- -
+ proposed_leverage: float, max_leverage: ... | Customize leverage for each new trade. This method is only called in futures mode.
:param pair: Pair that's currently analyzed
:param current_time: datetime object, containing the current datetime
:param current_rate: Rate, calculated based on pricing settings in exit_pricing.
... | false | false | freqtrade/strategy/interface.py | interface.py | freqtrade | freqtrade |
freqtrade_strategy_interface.py | IStrategy.lock_pair | [
{
"version": "v135",
"docstring_lines": {
"start_line": 168,
"end_line": 175
},
"code_lines": {
"start_line": 175,
"end_line": 176
},
"commit_date_time": "2019-12-17 07:53:30",
"commit_sha": "a2964afd42c4ccf84ff315e140e0064efd62d6a7",
"commit_message": "Rename... | def lock_pair(self, pair: str, until: datetime) -> None:
+ if pair not in self._pair_locked_until or self._pair_locked_until[pair] < until:
- self._pair_locked_until[pair] = until
+ self._pair_locked_until[pair] = until
? ++++
| Locks pair until a given timestamp happens.
Locked pairs are not analyzed, and are prevented from opening new trades.
+ Locks can only count up (allowing users to lock pairs for a longer period of time).
+ To remove a lock from a pair, use `unlock_pair()`
:param pair: Pair to lock
... | false | false | freqtrade/strategy/interface.py | interface.py | freqtrade | freqtrade |
freqtrade_strategy_interface.py | IStrategy.is_pair_locked | [
{
"version": "v421",
"docstring_lines": {
"start_line": 601,
"end_line": 610
},
"code_lines": {
"start_line": 610,
"end_line": 617
},
"commit_date_time": "2022-04-28 21:10:17",
"commit_sha": "17650d7e6025385f8d9dbd3dbe44d097b50ce9eb",
"commit_message": "Mainta... | - def is_pair_locked(self, pair: str, candle_date: datetime = None) -> bool:
+ def is_pair_locked(self, pair: str, *, candle_date: datetime = None, side: str = '*') -> bool:
? +++ +++++++++++++++++
if not candl... | Checks if a pair is currently locked
The 2nd, optional parameter ensures that locks are applied until the new candle arrives,
and not stop at 14:00:00 - while the next candle arrives at 14:00:02 leaving a gap
of 2 seconds for an entry order to happen on an old signal.
:param pa... | false | false | freqtrade/strategy/interface.py | interface.py | freqtrade | freqtrade |
freqtrade_strategy_interface.py | IStrategy.get_signal | [
{
"version": "v176",
"docstring_lines": {
"start_line": 263,
"end_line": 295
},
"code_lines": {
"start_line": 295,
"end_line": 296
},
"commit_date_time": "2020-06-18 04:50:05",
"commit_sha": "95f3ac08d406dd635f74dd68552fd93680c62267",
"commit_message": "Update... | - def get_signal(self, pair: str, interval: str, dataframe: DataFrame) -> Tuple[bool, bool]:
? ^^ --------------- ^^ -- ---
+ def get_signal(self, pair: str, timeframe: str) -> Tuple[bool, bool]:
? + ^ ^
+
... | Calculates current signal based several technical analysis indicators
Used by Bot to get the latest signal
:param pair: pair in format ANT/BTC
- :param interval: Interval to use (in min)
+ :param timeframe: timeframe to use
:param dataframe: Dataframe to analyze
... | false | false | freqtrade/strategy/interface.py | interface.py | freqtrade | freqtrade |
freqtrade_strategy_interface.py | IStrategy.assert_df | [
{
"version": "v189",
"docstring_lines": {
"start_line": 263,
"end_line": 294
},
"code_lines": {
"start_line": 294,
"end_line": 295
},
"commit_date_time": "2020-07-03 04:58:27",
"commit_sha": "133947988238905752513992b4ad2caafb5eead3",
"commit_message": "Have s... | def assert_df(self, dataframe: DataFrame, df_len: int, df_close: float, df_date: datetime):
-
? --
+
+
+
message = ""
if df_len != len(dataframe):
message = "length"
elif df_close != dataframe["close"].iloc[-1]:
m... | - make sure data is unmodified
+ Ensure dataframe (length, last candle) was not modified, and has all elements we need. | false | false | freqtrade/strategy/interface.py | interface.py | freqtrade | freqtrade |
freqtrade_strategy_interface.py | IStrategy.stoploss_value | [
{
"version": "v206",
"docstring_lines": {
"start_line": 233,
"end_line": 255
},
"code_lines": {
"start_line": 255,
"end_line": 256
},
"commit_date_time": "2020-12-18 05:56:56",
"commit_sha": "768a24c375014f755fa857c4b09c8bf4e0154922",
"commit_message": "Add st... | - def stoploss_value(self, pair: str, trade: Trade, rate: float, **kwargs) -> float:
? ^^^^^ ^^^^^^ ^
+ def stoploss_value(self, pair: str, trade: Trade, current_rate: float, current_profit: float,
? +... | Define custom stoploss logic
The custom stoploss can never be below self.stoploss, which serves as a hard maximum loss.
-
For full documentation please go to https://www.freqtrade.io/en/latest/strategy-advanced/
When not implemented by a strategy, returns the initial stoploss valu... | false | false | freqtrade/strategy/interface.py | interface.py | freqtrade | freqtrade |
freqtrade_strategy_interface.py | IStrategy.custom_sell | [
{
"version": "v235",
"docstring_lines": {
"start_line": 290,
"end_line": 307
},
"code_lines": {
"start_line": 307,
"end_line": 308
},
"commit_date_time": "2021-04-25 06:48:40",
"commit_sha": "1292e08fe47ab5ae8455c24f70612708988bd46c",
"commit_message": "Use st... | def custom_sell(self, pair: str, trade: Trade, current_time: datetime, current_rate: float,
- current_profit: float, **kwargs) -> bool:
+ current_profit: float, **kwargs) -> Optional[Union[str, bool]]:
? +++++++++++++++++++... | - Custom sell signal logic indicating that specified position should be sold. Returning True
? ^^^^
+ Custom sell signal logic indicating that specified position should be sold. Returning a
? ... | false | false | freqtrade/strategy/interface.py | interface.py | freqtrade | freqtrade |
freqtrade_strategy_interface.py | IStrategy.custom_stake_amount | [
{
"version": "v437",
"docstring_lines": {
"start_line": 538,
"end_line": 550
},
"code_lines": {
"start_line": 550,
"end_line": 555
},
"commit_date_time": "2022-07-03 10:15:59",
"commit_sha": "4ff0ef7359e2bd9e523090ca0a51ab792bdaf8a4",
"commit_message": "fix bu... | def custom_stake_amount(self, pair: str, current_time: datetime, current_rate: float,
- proposed_stake: float, min_stake: float, max_stake: float,
+ proposed_stake: float, min_stake: Optional[float], max_stake: float,
? ... | Customize stake size for each new trade.
:param pair: Pair that's currently analyzed
:param current_time: datetime object, containing the current datetime
:param current_rate: Rate, calculated based on pricing settings in exit_pricing.
:param proposed_stake: A stake amount p... | false | false | freqtrade/strategy/interface.py | interface.py | freqtrade | freqtrade |
freqtrade_strategy_interface.py | IStrategy.order_filled | [
{
"version": "v527",
"docstring_lines": {
"start_line": 349,
"end_line": 373
},
"code_lines": {
"start_line": 373,
"end_line": 374
},
"commit_date_time": "2024-03-18 19:46:47",
"commit_sha": "18a3489a6f40551a331cbaf5f117a72e865ff117",
"commit_message": "add or... | - def order_filled(self, pair: str, trade: Trade, current_time: datetime, **kwargs) -> None:
+ def order_filled(self, pair: str, trade: Trade, order: Order,
+ current_time: datetime, **kwargs) -> None:
pass | Called just ofter order filling
:param pair: Pair for trade that's just exited.
:param trade: trade object.
+ :param order: Order object.
:param current_time: datetime object, containing the current datetime
:param **kwargs: Ensure to keep this here so updates to this w... | false | false | freqtrade/strategy/interface.py | interface.py | freqtrade | freqtrade |
freqtrade_strategy_interface.py | IStrategy.adjust_trade_position | [
{
"version": "v444",
"docstring_lines": {
"start_line": 555,
"end_line": 558
},
"code_lines": {
"start_line": 558,
"end_line": 563
},
"commit_date_time": "2022-07-31 12:19:04",
"commit_sha": "a4bada3ebe5ff927503b067545260ef5fe608c87",
"commit_message": "Partia... | def adjust_trade_position(self, trade: Trade, current_time: datetime,
current_rate: float, current_profit: float,
min_stake: Optional[float], max_stake: float,
- current_entry_rate: float, current_exit_rate: float,
- ... | - Custom trade adjustment logic, returning the stake amount that a trade should be
+ Custom trade adjustment logic, returning the stake amount that a trade should be increased.
? +++++++++++
- increased or decreased.
- This... | false | false | freqtrade/strategy/interface.py | interface.py | freqtrade | freqtrade |
freqtrade_strategy_interface.py | IStrategy.feature_engineering_expand_all | [
{
"version": "v486",
"docstring_lines": {
"start_line": 698,
"end_line": 711
},
"code_lines": {
"start_line": 711,
"end_line": 716
},
"commit_date_time": "2023-02-04 15:56:36",
"commit_sha": "0dd2472385766f76d392fe136365812ecf2ea99e",
"commit_message": "add me... | - def feature_engineering_expand_all(self, dataframe: DataFrame,
+ def feature_engineering_expand_all(self, dataframe: DataFrame, period: int,
? +++++++++++++
- period: int, **kwargs):
? ... | *Only functional with FreqAI enabled strategies*
This function will automatically expand the defined features on the config defined
`indicator_periods_candles`, `include_timeframes`, `include_shifted_candles`, and
`include_corr_pairs`. In other words, a single feature defined in this fun... | false | false | freqtrade/strategy/interface.py | interface.py | freqtrade | freqtrade |
timm_models_swin_transformer_v2.py | window_reverse | [
{
"version": "v17",
"docstring_lines": {
"start_line": 111,
"end_line": 121
},
"code_lines": {
"start_line": 121,
"end_line": 126
},
"commit_date_time": "2022-05-13 05:31:55",
"commit_sha": "c0211b0bf79ee7e1009d04f11d27a061caa670b6",
"commit_message": "Swin-V2... | - def window_reverse(windows, window_size, H, W):
+ def window_reverse(windows, window_size: Tuple[int, int], img_size: Tuple[int, int]):
+ H, W = img_size
- B = int(windows.shape[0] / (H * W / window_size / window_size))
+ B = int(windows.shape[0] / (H * W / window_size[0] / window_siz... | Args:
- windows: (num_windows*B, window_size, window_size, C)
+ windows: (num_windows * B, window_size[0], window_size[1], C)
? + + +++ +++
- window_size (int): Window size
+ window_size (Tuple[int, int]): Window size
? ... | false | false | timm/models/swin_transformer_v2.py | swin_transformer_v2.py | pytorch-image-models | huggingface |
homeassistant_components_yeelight___init__.py | YeelightDevice.update | [
{
"version": "v19",
"docstring_lines": {
"start_line": 255,
"end_line": 257
},
"code_lines": {
"start_line": 257,
"end_line": 269
},
"commit_date_time": "2019-05-22 02:47:10",
"commit_sha": "fdf1fa48e385c8270fef8e89ceef50ba339b5fa7",
"commit_message": "Improve... | def update(self):
+ self._update_properties()
- if not self.bulb:
- return
-
- try:
- self.bulb.get_properties(UPDATE_REQUEST_PROPERTIES)
- self._available = True
- except BulbException as ex:
- if self._available: # just inf... | - Read new properties from the device.
+ Update device properties and send data updated signal. | false | false | homeassistant/components/yeelight/__init__.py | __init__.py | core | home-assistant |
homeassistant_components_yeelight___init__.py | YeelightDevice.model | [
{
"version": "v29",
"docstring_lines": {
"start_line": 236,
"end_line": 238
},
"code_lines": {
"start_line": 238,
"end_line": 240
},
"commit_date_time": "2020-04-04 16:21:14",
"commit_sha": "e8a0abd107010b5db989001172516e295565ac10",
"commit_message": "String ... | def model(self):
- return self._model
+ return self._bulb_device.model
? ++++++++++++
| - Return configured device model.
+ Return configured/autodetected device model.
? +++++++++++++
| false | false | homeassistant/components/yeelight/__init__.py | __init__.py | core | home-assistant |
homeassistant_components_yeelight___init__.py | YeelightDevice.is_nightlight_supported | [
{
"version": "v30",
"docstring_lines": {
"start_line": 241,
"end_line": 243
},
"code_lines": {
"start_line": 243,
"end_line": 249
},
"commit_date_time": "2020-05-14 17:44:32",
"commit_sha": "8cf354c042d054840e101c1d66ab1adfb516b471",
"commit_message": "Provide... | def is_nightlight_supported(self) -> bool:
- if self.model:
- return self.bulb.get_model_specs().get("night_light", False)
+
+
- # It should support both ceiling and other lights
return self._nightlight_brightness is not None | Return true / false if nightlight is supported.
+
+ Uses brightness as it appears to be supported in both ceiling and other lights. | false | false | homeassistant/components/yeelight/__init__.py | __init__.py | core | home-assistant |
official_modeling_tf_utils.py | get_activation | [
{
"version": "v23",
"docstring_lines": {
"start_line": 88,
"end_line": 108
},
"code_lines": {
"start_line": 108,
"end_line": 139
},
"commit_date_time": "2023-03-29 17:55:19",
"commit_sha": "00b830c7ca641413f37e5147cf059c89f79b0e8e",
"commit_message": "Internal... | def get_activation(identifier, use_keras_layer=False, **kwargs):
if isinstance(identifier, six.string_types):
identifier = str(identifier).lower()
if use_keras_layer:
keras_layer_allowlist = {
"relu": "relu",
"linear": "linear",
"identity": "linear... | Maps an identifier to a Python function, e.g., "relu" => `tf.nn.relu`.
It checks string first and if it is one of customized activation not in TF,
the corresponding activation will be returned. For non-customized activation
- names and callable identifiers, always fallback to tf.keras.activations.get.
? ... | false | false | official/modeling/tf_utils.py | tf_utils.py | models | tensorflow |
skimage_feature_peak.py | peak_local_max | [
{
"version": "v67",
"docstring_lines": {
"start_line": 208,
"end_line": 233
},
"code_lines": {
"start_line": 233,
"end_line": 307
},
"commit_date_time": "2019-07-27 09:15:33",
"commit_sha": "15ccf994fd2cb9bac5088a9f838bdc1e46fa7364",
"commit_message": "Add see... | def peak_local_max(image, min_distance=1, threshold_abs=None,
threshold_rel=None, exclude_border=True, indices=True,
num_peaks=np.inf, footprint=None, labels=None,
num_peaks_per_label=np.inf):
+ out = np.zeros_like(image, dtype=np.boo... | Find peaks in an image as coordinate list or boolean mask.
Peaks are the local maxima in a region of `2 * min_distance + 1`
(i.e. peaks are separated by at least `min_distance`).
If there are multiple local maxima with identical pixel intensities
inside the region defined with `min_dista... | false | false | skimage/feature/peak.py | peak.py | scikit-image | scikit-image |
skimage_feature_peak.py | _exclude_border | [
{
"version": "v78",
"docstring_lines": {
"start_line": 281,
"end_line": 306
},
"code_lines": {
"start_line": 306,
"end_line": 380
},
"commit_date_time": "2020-10-30 05:15:56",
"commit_sha": "4e01acfa5830748e2e49b6826146511b9a6c905a",
"commit_message": "Depreca... | - def _exclude_border(mask, exclude_border):
+ def _exclude_border(label, border_width):
+
-
- # zero out the image borders
? ^^ ^^^^^^
+ # zero out label borders
? ^^^ ^
- for i, excluded in enumerate(exclude_border):
+ for i, width in enumerate(borde... | - Remove peaks near the borders
+ Set label border values to 0. | false | false | skimage/feature/peak.py | peak.py | scikit-image | scikit-image |
src_datasets_io_json.py | JsonDatasetWriter._write | [
{
"version": "v3",
"docstring_lines": {
"start_line": 72,
"end_line": 72
},
"code_lines": {
"start_line": 73,
"end_line": 81
},
"commit_date_time": "2021-04-27 15:29:20",
"commit_sha": "1f0fc12d44598a3e2d490d2797cad4f62d29b79d",
"commit_message": "Implement Da... | - def _write(self, file_obj: BinaryIO, batch_size: int, encoding: str = "utf-8", **to_json_kwargs) -> int:
+ def _write(
+ self,
+ file_obj: BinaryIO,
+ batch_size: int,
+ encoding: str = "utf-8",
+ orient="records",
+ lines=True,
+ **to_json_kwargs,
+ ) -> in... | - Writes the pyarrow table as JSON to a binary file handle.
+ Writes the pyarrow table as JSON lines to a binary file handle.
? ++++++
Caller is responsible for opening and closing the handle. | false | false | src/datasets/io/json.py | json.py | datasets | huggingface |
lib_utils_api.py | LogRecorder.emit | [
{
"version": "v36",
"docstring_lines": {
"start_line": 372,
"end_line": 375
},
"code_lines": {
"start_line": 375,
"end_line": 386
},
"commit_date_time": "2013-01-27 12:26:40",
"commit_sha": "d07881b6c33408f488872405d763ba454b3a07e6",
"commit_message": "apply a... | def emit(self, record):
- conf.ipc_database_cursor.execute("INSERT INTO logs VALUES(NULL, ?, ?, ?)",
? ----
+ conf.database_cursor.execute("INSERT INTO logs VALUES(NULL, ?, ?, ?, ?)",
? ... | - Record emitted events to temporary database for asynchronous I/O
? ^^^^^^^^^
+ Record emitted events to IPC database for asynchronous I/O
? ^^^
communication with the parent process | false | false | lib/utils/api.py | api.py | sqlmap | sqlmapproject |
lib_utils_api.py | task_flush | [
{
"version": "v37",
"docstring_lines": {
"start_line": 277,
"end_line": 280
},
"code_lines": {
"start_line": 280,
"end_line": 285
},
"commit_date_time": "2013-01-29 01:39:27",
"commit_sha": "f1ab887c55433f324ac7f6f03b109f1e20132dea",
"commit_message": "major e... | def task_flush(taskid):
global tasks
if is_admin(taskid):
for task in tasks:
tasks[task].clean_filesystem()
tasks = dict()
+ logger.debug("Flushed task poll")
return jsonize({"success": True})
else:
abort(401) | - Flush task spool (destroy all tasks)
? ^ ^^^
+ Flush task spool (delete all tasks)
? ^^ ^
| false | false | lib/utils/api.py | api.py | sqlmap | sqlmapproject |
lib_utils_api.py | task_list | [
{
"version": "v38",
"docstring_lines": {
"start_line": 298,
"end_line": 301
},
"code_lines": {
"start_line": 301,
"end_line": 307
},
"commit_date_time": "2013-01-29 15:38:09",
"commit_sha": "1152cf8958eee13e827503812f3902f01d7a9c8f",
"commit_message": "increas... | def task_list(taskid):
if is_admin(taskid):
- logger.debug("Listed task poll")
? ^
+ logger.debug("Listed task pull")
? ^
return jsonize({"tasks": tasks, "tasks_num": len(tasks)})
else:
... | - List task poll
? ^
+ List task pull
? ^
| false | false | lib/utils/api.py | api.py | sqlmap | sqlmapproject |
lib_utils_api.py | task_delete | [
{
"version": "v143",
"docstring_lines": {
"start_line": 373,
"end_line": 376
},
"code_lines": {
"start_line": 376,
"end_line": 389
},
"commit_date_time": "2018-06-20 21:21:55",
"commit_sha": "4badb546078e320cb224ad86e8682ec208978c5f",
"commit_message": "Couple... | def task_delete(taskid):
if taskid in DataStore.tasks:
DataStore.tasks.pop(taskid)
logger.debug("[%s] Deleted task" % taskid)
return jsonize({"success": True})
else:
+ response.status = 404
- logger.warning("[%s] Invalid task ID provide... | - Delete own task ID
+ Delete an existing task | false | false | lib/utils/api.py | api.py | sqlmap | sqlmapproject |
lib_utils_api.py | option_get | [
{
"version": "v144",
"docstring_lines": {
"start_line": 439,
"end_line": 442
},
"code_lines": {
"start_line": 442,
"end_line": 455
},
"commit_date_time": "2018-11-15 14:27:17",
"commit_sha": "2895e5c20f6585da905e345e657c362ea0baec39",
"commit_message": "Initia... | def option_get(taskid):
if taskid not in DataStore.tasks:
logger.warning("[%s] Invalid task ID provided to option_get()" % taskid)
return jsonize({"success": False, "message": "Invalid task ID"})
- option = request.json.get("option", "")
+ options = request.js... | - Get the value of an option (command line switch) for a certain task ID
? ---- --- - ------------- -----
+ Get value of option(s) for a certain task ID | false | false | lib/utils/api.py | api.py | sqlmap | sqlmapproject |
chainer_serializers_npz.py | load_npz | [
{
"version": "v39",
"docstring_lines": {
"start_line": 158,
"end_line": 177
},
"code_lines": {
"start_line": 177,
"end_line": 180
},
"commit_date_time": "2018-03-21 01:32:13",
"commit_sha": "e9c9945e4064b977bdb5da71443499013692fe5b",
"commit_message": "Support... | - def load_npz(file, obj, path='', strict=True):
+ def load_npz(file, obj, path='', strict=True, ignore_names=None):
? +++++++++++++++++++
with numpy.load(file) as f:
- d = NpzDeserializer(f, path=path, strict=strict)
+ d = NpzDeseriali... | Loads an object from the file in NPZ format.
This is a short-cut function to load from an `.npz` file that contains only
one object.
Args:
file (str or file-like): File to be loaded.
obj: Object to be deserialized. It must support serialization protocol.
path (str... | false | false | chainer/serializers/npz.py | npz.py | chainer | chainer |
conans_model_manifest.py | FileTreeManifest.create | [
{
"version": "v9",
"docstring_lines": {
"start_line": 46,
"end_line": 49
},
"code_lines": {
"start_line": 49,
"end_line": 73
},
"commit_date_time": "2016-11-25 14:14:52",
"commit_sha": "ac4d1cd117689cd7e687e50f518c210aa56a68df",
"commit_message": "Feature/sett... | def create(cls, folder):
+ filterfiles = (PACKAGE_TGZ_NAME, EXPORT_TGZ_NAME, CONAN_MANIFEST, CONANFILE + "c",
+ ".DS_Store")
file_dict = {}
- for root, _, files in os.walk(folder):
? ^
+ for root, dirs, files in os.walk... | - Walks a folder and create a TreeDigest for it, reading file contents
? ^ ^
+ Walks a folder and create a FileTreeManifest for it, reading file contents
? ++++ ^^^ ^
from disk, and capturing current time | false | false | conans/model/manifest.py | manifest.py | conan | conan-io |
conans_model_manifest.py | FileTreeManifest.loads | [
{
"version": "v35",
"docstring_lines": {
"start_line": 26,
"end_line": 29
},
"code_lines": {
"start_line": 29,
"end_line": 38
},
"commit_date_time": "2021-12-13 16:58:11",
"commit_sha": "a72c802969599adc3de6012b4cf90e62509f9099",
"commit_message": "2.0 symlink... | def loads(text):
tokens = text.split("\n")
the_time = int(tokens[0])
file_sums = {}
+ keep_python = get_env("CONAN_KEEP_PYTHON_FILES", False)
for md5line in tokens[1:]:
if md5line:
- filename, file_md5 = md5line.split... | - parses a string representation, generated with __repr__ of a
? -----
+ parses a string representation, generated with __repr__
- ConanDigest | false | false | conans/model/manifest.py | manifest.py | conan | conan-io |
django_db_backends_mysql_introspection.py | DatabaseIntrospection.get_relations | [
{
"version": "v39",
"docstring_lines": {
"start_line": 91,
"end_line": 95
},
"code_lines": {
"start_line": 95,
"end_line": 103
},
"commit_date_time": "2014-12-27 11:52:44",
"commit_sha": "2ceb10f3b02cbebad6ed908880f49a7c3e901d12",
"commit_message": "Fixed #141... | def get_relations(self, cursor, table_name):
- my_field_dict = self._name_to_index(cursor, table_name)
constraints = self.get_key_columns(cursor, table_name)
relations = {}
for my_fieldname, other_table, other_field in constraints:
- o... | - Returns a dictionary of {field_index: (field_index_other_table, other_table)}
? - ^ - - ^ -
+ Returns a dictionary of {field_name: (field_name_other_table, other_table)}
? ^^ ^^
- representing all relationships to the given tab... | false | false | django/db/backends/mysql/introspection.py | introspection.py | django | django |
django_db_backends_mysql_introspection.py | DatabaseIntrospection.get_storage_engine | [
{
"version": "v38",
"docstring_lines": {
"start_line": 144,
"end_line": 147
},
"code_lines": {
"start_line": 147,
"end_line": 152
},
"commit_date_time": "2014-12-08 12:58:23",
"commit_sha": "4468c08d70b5b722f3ebd4872909e56580ec7d68",
"commit_message": "Fixed #... | def get_storage_engine(self, cursor, table_name):
cursor.execute(
"SELECT engine "
"FROM information_schema.tables "
"WHERE table_name = %s", [table_name])
- return cursor.fetchone()[0]
? ^^^ ---
... | - Retrieves the storage engine for a given table.
+ Retrieves the storage engine for a given table. Returns the default
? ++++++++++++++++++++
+ storage engine if the table doesn't exist. | false | false | django/db/backends/mysql/introspection.py | introspection.py | django | django |
python_ray_tests_kuberay_test_autoscaling_e2e.py | KubeRayAutoscalingTest._get_ray_cr_config | [
{
"version": "v2",
"docstring_lines": {
"start_line": 51,
"end_line": 53
},
"code_lines": {
"start_line": 53,
"end_line": 86
},
"commit_date_time": "2022-04-21 21:54:37",
"commit_sha": "8c5fe44542668c76d94557be06493a551b5ea77e",
"commit_message": "[KubeRay] Fi... | def _get_ray_cr_config(
self, min_replicas=0, max_replicas=300, replicas=0
) -> Dict[str, Any]:
- with open(self._get_ray_cr_config_file()) as ray_config_file:
+ with open(EXAMPLE_CLUSTER_PATH) as ray_cr_config_file:
- ray_config_str = ray_config_file.... | Get Ray CR config yaml.
- Use configurable replica fields for a CPU workerGroup.
+ - Use configurable replica fields for a CPU workerGroup.
? ++
- Also add a GPU-annotated group for testing GPU upscaling.
? -----
+ - Add a GPU-annotated group for testing GPU ups... | false | false | python/ray/tests/kuberay/test_autoscaling_e2e.py | test_autoscaling_e2e.py | ray | ray-project |
python_ray_tests_kuberay_test_autoscaling_e2e.py | KubeRayAutoscalingTest._apply_ray_cr | [
{
"version": "v7",
"docstring_lines": {
"start_line": 172,
"end_line": 181
},
"code_lines": {
"start_line": 181,
"end_line": 197
},
"commit_date_time": "2022-06-02 00:36:47",
"commit_sha": "e45054c13098f5a4ef6ce1a9f3ac988f59ad824a",
"commit_message": "[autosca... | def _apply_ray_cr(
self,
min_replicas=0,
- max_replicas=300,
- replicas=0,
+ cpu_replicas=0,
? ++++
+ gpu_replicas=0,
validate_replicas: bool = False,
) -> None:
with tempfile.NamedTemporaryFile("w") as config... | Apply Ray CR config yaml, with configurable replica fields for the cpu
workerGroup.
If the CR does not yet exist, `replicas` can be set as desired.
If the CR does already exist, the recommended usage is this:
- (1) Set `replicas` to what we currently expect it to be.
? ... | false | false | python/ray/tests/kuberay/test_autoscaling_e2e.py | test_autoscaling_e2e.py | ray | ray-project |
django_db_backends_mysql_validation.py | DatabaseValidation.check_field_type | [
{
"version": "v23",
"docstring_lines": {
"start_line": 30,
"end_line": 35
},
"code_lines": {
"start_line": 35,
"end_line": 46
},
"commit_date_time": "2017-05-14 16:34:45",
"commit_sha": "5cff2cb4c09363ee871d1993e3acbad6fb96c05b",
"commit_message": "Refs #27859... | def check_field_type(self, field, field_type):
errors = []
if (field_type.startswith('varchar') and field.unique and
(field.max_length is None or int(field.max_length) > 255)):
errors.append(
checks.Error(
... | MySQL has the following field length restriction:
No character (varchar) fields can have a length exceeding 255
characters if they have a unique index on them.
+ MySQL doesn't support a database index on some data types. | false | false | django/db/backends/mysql/validation.py | validation.py | django | django |
python_ccxt_bingx.py | bingx.fetch_balance | [
{
"version": "v6",
"docstring_lines": {
"start_line": 1881,
"end_line": 1892
},
"code_lines": {
"start_line": 1892,
"end_line": 1962
},
"commit_date_time": "2023-08-06 11:51:22",
"commit_sha": "1afa2add886050f29607eab07ec0ea32c4d4de57",
"commit_message": "reve... | def fetch_balance(self, params={}):
self.load_markets()
response = None
+ standard = None
+ standard, params = self.handle_option_and_params(params, 'fetchBalance', 'standard', False)
marketType, marketTypeQuery = self.handle_market_type_a... | query for balance and get the amount of funds available for trading or funds locked in orders
see https://bingx-api.github.io/docs/#/spot/trade-api.html#Query%20Assets
see https://bingx-api.github.io/docs/#/swapV2/account-api.html#Get%20Perpetual%20Swap%20Account%20Asset%20Information
+ se... | false | false | python/ccxt/bingx.py | bingx.py | ccxt | ccxt |
python_ccxt_bingx.py | bingx.cancel_all_orders | [
{
"version": "v49",
"docstring_lines": {
"start_line": 2887,
"end_line": 2897
},
"code_lines": {
"start_line": 2897,
"end_line": 2935
},
"commit_date_time": "2023-11-16 12:46:12",
"commit_sha": "8d2f99100013351c73cf0629d66e28e7a2e45c0a",
"commit_message": "Mer... | def cancel_all_orders(self, symbol: Str = None, params={}):
- self.check_required_symbol('cancelAllOrders', symbol)
+ if symbol is None:
+ raise ArgumentsRequired(self.id + ' cancelAllOrders() requires a symbol argument')
self.load_markets()
... | cancel all open orders
:see: https://bingx-api.github.io/docs/#/swapV2/trade-api.html#Cancel%20All%20Orders
:param str [symbol]: unified market symbol, only orders in the market of self symbol are cancelled when symbol is not None
:param dict [params]: extra parameters specific to the bi... | false | false | python/ccxt/bingx.py | bingx.py | ccxt | ccxt |
python_ccxt_bingx.py | bingx.fetch_ohlcv | [
{
"version": "v90",
"docstring_lines": {
"start_line": 683,
"end_line": 697
},
"code_lines": {
"start_line": 697,
"end_line": 741
},
"commit_date_time": "2024-01-28 18:46:37",
"commit_sha": "fcb52616d5506f52f6427c6bd1ec7a1d268d070e",
"commit_message": "fix(bin... | def fetch_ohlcv(self, symbol: str, timeframe='1m', since: Int = None, limit: Int = None, params={}) -> List[list]:
self.load_markets()
paginate = False
paginate, params = self.handle_option_and_params(params, 'fetchOHLCV', 'paginate', False)
if ... | fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
:see: https://bingx-api.github.io/docs/#/swapV2/market-api.html#K-Line%20Data
:see: https://bingx-api.github.io/docs/#/spot/market-api.html#Candlestick%20chart%20data
:see: htt... | false | false | python/ccxt/bingx.py | bingx.py | ccxt | ccxt |
python_ccxt_bingx.py | bingx.fetch_funding_rate_history | [
{
"version": "v25",
"docstring_lines": {
"start_line": 996,
"end_line": 1005
},
"code_lines": {
"start_line": 1005,
"end_line": 1046
},
"commit_date_time": "2023-10-03 10:43:22",
"commit_sha": "3209ced07c5566455947e62883c22829f0f1b2fe",
"commit_message": "Merg... | def fetch_funding_rate_history(self, symbol: Optional[str] = None, since: Optional[int] = None, limit: Optional[int] = None, params={}):
self.check_required_symbol('fetchFundingRateHistory', symbol)
self.load_markets()
+ paginate = False
+ paginate,... | fetches historical funding rate prices
see https://bingx-api.github.io/docs/#/swapV2/market-api.html#Funding%20Rate%20History
:param str symbol: unified symbol of the market to fetch the funding rate history for
:param int [since]: timestamp in ms of the earliest funding rate to fetch
... | false | false | python/ccxt/bingx.py | bingx.py | ccxt | ccxt |
python_ccxt_bingx.py | bingx.cancel_orders | [
{
"version": "v74",
"docstring_lines": {
"start_line": 1690,
"end_line": 1710
},
"code_lines": {
"start_line": 1710,
"end_line": 1759
},
"commit_date_time": "2023-12-30 14:43:34",
"commit_sha": "307e8229f83c3102e5579a7fa5be1cfae9343546",
"commit_message": "fea... | def cancel_orders(self, ids: List[Int], symbol: Str = None, params={}):
if symbol is None:
raise ArgumentsRequired(self.id + ' cancelOrders() requires a symbol argument')
self.load_markets()
market = self.market(symbol)
request = {... | cancel multiple orders
:see: https://bingx-api.github.io/docs/#/swapV2/trade-api.html#Cancel%20a%20Batch%20of%20Orders
:see: https://bingx-api.github.io/docs/#/spot/trade-api.html#Cancel%20a%20Batch%20of%20Orders
:param str[] ids: order ids
:param str symbol: unified market sym... | false | false | python/ccxt/bingx.py | bingx.py | ccxt | ccxt |
python_ccxt_bingx.py | bingx.create_order | [
{
"version": "v105",
"docstring_lines": {
"start_line": 1856,
"end_line": 1882
},
"code_lines": {
"start_line": 1882,
"end_line": 1936
},
"commit_date_time": "2024-03-07 16:28:31",
"commit_sha": "6fbf8b7a29a0dfe64348516b57bb3ca474b8a4e3",
"commit_message": "4.... | def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: float = None, params={}):
self.load_markets()
market = self.market(symbol)
+ test = self.safe_bool(params, 'test', False)
+ params = self.omit(params, 'test'... | create a trade order
:see: https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Trade%20order
:see: https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Create%20an%20Order
:param str symbol: unified symbol of the market to create an order in
:param str type: ... | false | false | python/ccxt/bingx.py | bingx.py | ccxt | ccxt |
python_ccxt_bingx.py | bingx.cancel_order | [
{
"version": "v76",
"docstring_lines": {
"start_line": 2102,
"end_line": 2111
},
"code_lines": {
"start_line": 2111,
"end_line": 2174
},
"commit_date_time": "2024-01-04 12:41:45",
"commit_sha": "6b19125a0a32349e546e1569c7fa973dd6249cfb",
"commit_message": "4.2... | def cancel_order(self, id: str, symbol: Str = None, params={}):
if symbol is None:
raise ArgumentsRequired(self.id + ' cancelOrder() requires a symbol argument')
self.load_markets()
market = self.market(symbol)
request = {
... | cancels an open order
:see: https://bingx-api.github.io/docs/#/spot/trade-api.html#Cancel%20an%20Order
:see: https://bingx-api.github.io/docs/#/swapV2/trade-api.html#Cancel%20an%20Order
:param str id: order id
:param str symbol: unified symbol of the market the order was made i... | false | false | python/ccxt/bingx.py | bingx.py | ccxt | ccxt |
python_ccxt_bingx.py | bingx.fetch_my_trades | [
{
"version": "v80",
"docstring_lines": {
"start_line": 3059,
"end_line": 3069
},
"code_lines": {
"start_line": 3069,
"end_line": 3109
},
"commit_date_time": "2024-01-11 09:45:11",
"commit_sha": "ec391afa717ed7fac1f08a380e2813dd756aa801",
"commit_message": "4.2... | def fetch_my_trades(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
if symbol is None:
raise ArgumentsRequired(self.id + ' fetchMyTrades() requires a symbol argument')
- if since is None:
- raise ArgumentsRequired... | fetch all trades made by the user
+ :see: https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Query%20Order%20History
:see: https://bingx-api.github.io/docs/#/swapV2/trade-api.html#Query%20historical%20transaction%20orders
:param str [symbol]: unified market symbol
:para... | false | false | python/ccxt/bingx.py | bingx.py | ccxt | ccxt |
python_ccxt_bingx.py | bingx.set_leverage | [
{
"version": "v99",
"docstring_lines": {
"start_line": 3278,
"end_line": 3286
},
"code_lines": {
"start_line": 3286,
"end_line": 3308
},
"commit_date_time": "2024-02-14 13:54:19",
"commit_sha": "3469af64a2f7b9a76e8dac3a79390aedafed3ae1",
"commit_message": "4.2... | def set_leverage(self, leverage: Int, symbol: Str = None, params={}):
if symbol is None:
raise ArgumentsRequired(self.id + ' setLeverage() requires a symbol argument')
side = self.safe_string_upper(params, 'side')
- self.check_required_argumen... | set the level of leverage for a market
:see: https://bingx-api.github.io/docs/#/swapV2/trade-api.html#Switch%20Leverage
:param float leverage: the rate of leverage
:param str symbol: unified market symbol
:param dict [params]: extra parameters specific to the exchange API endpo... | false | false | python/ccxt/bingx.py | bingx.py | ccxt | ccxt |
python_ccxt_bingx.py | bingx.close_position | [
{
"version": "v110",
"docstring_lines": {
"start_line": 3652,
"end_line": 3660
},
"code_lines": {
"start_line": 3660,
"end_line": 3680
},
"commit_date_time": "2024-03-19 17:23:51",
"commit_sha": "629627af6803b7ec8128022edaab2195bc543ada",
"commit_message": "4.... | def close_position(self, symbol: str, side: OrderSide = None, params={}) -> Order:
self.load_markets()
+ positionId = self.safe_string(params, 'positionId')
+ params = self.omit(params, 'positionId')
+ response = None
+ if positionId is not No... | closes open positions for a market
:see: https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#One-Click%20Close%20All%20Positions
:param str symbol: Unified CCXT market symbol
:param str [side]: not used by bingx
:param dict [params]: extra parameters specific to the ... | false | false | python/ccxt/bingx.py | bingx.py | ccxt | ccxt |
spleeter_utils_logging.py | enable_logging | [
{
"version": "v1",
"docstring_lines": {
"start_line": 34,
"end_line": 36
},
"code_lines": {
"start_line": 36,
"end_line": 40
},
"commit_date_time": "2019-10-28 13:12:13",
"commit_sha": "556ef2121492d72398a988af1b38b55176f5973a",
"commit_message": "Initial comm... | def enable_logging():
- environ['TF_CPP_MIN_LOG_LEVEL'] = '1'
? ^
+ environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
? ^
- logger = get_logger()
+ tf_logger = get_tensorflow_logger()
? +++ +++++++++++
- l... | - Enable INFO level logging.
+ Configure default logging. | false | false | spleeter/utils/logging.py | logging.py | spleeter | deezer |
test_lib_ansible_test__internal_metadata.py | ChangeDescription.focused_targets | [
{
"version": "v15",
"docstring_lines": {
"start_line": 97,
"end_line": 97
},
"code_lines": {
"start_line": 98,
"end_line": 105
},
"commit_date_time": "2021-09-21 01:39:07",
"commit_sha": "4ea8d9a7824827cf3d4a206599ffd7fe3a09eafd",
"commit_message": "ansible-te... | + def focused_targets(self): # type: () -> t.Optional[t.List[str]]
- def focused_targets(self):
-
-
return self.focused_command_targets.get(self.command) | - :rtype: list[str] | None
+ Optional list of focused target names. | false | false | test/lib/ansible_test/_internal/metadata.py | metadata.py | ansible | ansible |
conans_client_cmd_export.py | cmd_export | [
{
"version": "v48",
"docstring_lines": {
"start_line": 45,
"end_line": 51
},
"code_lines": {
"start_line": 51,
"end_line": 69
},
"commit_date_time": "2018-08-06 15:56:17",
"commit_sha": "32a89190aecae07eea30fe5cf96f1f497e3a7a25",
"commit_message": "display com... | + def cmd_export(conanfile_path, conanfile, reference, keep_source, output, client_cache):
- def cmd_export(conanfile_path, name, version, user, channel, keep_source,
- output, client_cache):
logger.debug("Exporting %s" % conanfile_path)
+ output.highlight("Exporting package reci... | Export the recipe
param conanfile_path: the original source directory of the user containing a
conanfile.py
- param user: user under this package will be exported
- param channel: string (stable, testing,...) | false | false | conans/client/cmd/export.py | export.py | conan | conan-io |
skimage_morphology_max_tree.py | area_closing | [
{
"version": "v12",
"docstring_lines": {
"start_line": 49,
"end_line": 109
},
"code_lines": {
"start_line": 109,
"end_line": 139
},
"commit_date_time": "2018-04-25 10:05:06",
"commit_sha": "b6c6062c0ef6612f1a93d207118ca3e30d696169",
"commit_message": "pep8 is ... | - def area_closing(image, area_threshold, connectivity=2):
? ^^
+ def area_closing(image, area_threshold, connectivity=2,
? ^
+ parent=None, tree_traverser=None):
# inversio... | Performs an area closing of the image.
Area closing removes all dark structures of an image with
a surface smaller than area_threshold.
The output image is larger than or equal to the input image
for every pixel and all local minima have at least a surface of
area_threshold pixels.
... | false | false | skimage/morphology/max_tree.py | max_tree.py | scikit-image | scikit-image |
skimage_morphology_max_tree.py | local_maxima | [
{
"version": "v14",
"docstring_lines": {
"start_line": 357,
"end_line": 437
},
"code_lines": {
"start_line": 437,
"end_line": 447
},
"commit_date_time": "2018-04-30 22:14:37",
"commit_sha": "f61a491218640905bbca78164995be54797c478b",
"commit_message": "pep8",
... | - def local_maxima(image, connectivity=2,
+ def local_maxima(image, label=False, connectivity=2,
? +++++++++++++
parent=None, tree_traverser=None):
- output = np.ones(image.shape, dtype=np.uint8)
? ^
+ o... | Determine all local maxima of the image.
The local maxima are defined as connected sets of pixels with equal
grey level strictly greater than the grey levels of all pixels in direct
- neighborhood of the set.
+ neighborhood of the set. The function can also label the local maxima.
Tech... | false | false | skimage/morphology/max_tree.py | max_tree.py | scikit-image | scikit-image |
skimage_morphology_max_tree.py | max_tree_local_maxima | [
{
"version": "v22",
"docstring_lines": {
"start_line": 581,
"end_line": 660
},
"code_lines": {
"start_line": 660,
"end_line": 670
},
"commit_date_time": "2018-07-11 06:53:52",
"commit_sha": "f0baa7d7a5e355d1c22a2deaf997b6da46231ce2",
"commit_message": "visuali... | def max_tree_local_maxima(image, connectivity=2,
parent=None, tree_traverser=None):
output = np.ones(image.shape, dtype=np.uint64)
if parent is None or tree_traverser is None:
parent, tree_traverser = max_tree(image, connectivity)
- _max_tre... | Determine all local maxima of the image.
The local maxima are defined as connected sets of pixels with equal
grey level strictly greater than the grey levels of all pixels in direct
neighborhood of the set. The function labels the local maxima.
Technically, the implementation is based on... | false | false | skimage/morphology/max_tree.py | max_tree.py | scikit-image | scikit-image |
PathPlanning_RRTDubins_rrt_dubins.py | RRTDubins.__init__ | [
{
"version": "v28",
"docstring_lines": {
"start_line": 50,
"end_line": 59
},
"code_lines": {
"start_line": 59,
"end_line": 70
},
"commit_date_time": "2021-07-09 22:15:10",
"commit_sha": "6f06b535b9d614ed0c6f00dab7811d6917b8ffa1",
"commit_message": "fix dubins ... | def __init__(self, start, goal, obstacle_list, rand_area,
goal_sample_rate=10,
max_iter=200,
+ robot_radius=0.0
):
self.start = self.Node(start[0], start[1], start[2])
self.end = self.Node... | Setting Parameter
start:Start Position [x,y]
goal:Goal Position [x,y]
obstacleList:obstacle Positions [[x,y,size],...]
randArea:Random Sampling Area [min,max]
+ robot_radius: robot body modeled as circle with given radius | false | false | PathPlanning/RRTDubins/rrt_dubins.py | rrt_dubins.py | PythonRobotics | AtsushiSakai |
lib_config.py | FaceswapConfig.get_config_file | [
{
"version": "v4",
"docstring_lines": {
"start_line": 96,
"end_line": 98
},
"code_lines": {
"start_line": 98,
"end_line": 103
},
"commit_date_time": "2019-05-30 17:15:25",
"commit_sha": "236c35f11adf7655ff79ef6aa17842a96e955882",
"commit_message": "Convert set... | - def get_config_file(self):
+ def get_config_file(self, configfile):
? ++++++++++++
+ if configfile is not None:
+ if not os.path.isfile(configfile):
+ err = "Config file does not exist at: {}".format(configfile)
+ logger.error(e... | - Return the config file from the calling folder
+ Return the config file from the calling folder or the provided file
? +++++++++++++++++++++
| false | false | lib/config.py | config.py | faceswap | deepfakes |
django_core_serializers___init__.py | unregister_serializer | [
{
"version": "v8",
"docstring_lines": {
"start_line": 42,
"end_line": 44
},
"code_lines": {
"start_line": 44,
"end_line": 45
},
"commit_date_time": "2007-12-17 06:53:15",
"commit_sha": "fc413b8f611677e51ea8c24e3b56a3716652a619",
"commit_message": "Fixed #6110 ... | def unregister_serializer(format):
-
+ ""
? ++
del _serializers[format] | - Unregister a given serializer
+ Unregister a given serializer. This is not a thread-safe operation. | false | false | django/core/serializers/__init__.py | __init__.py | django | django |
python_ray_autoscaler_node_provider.py | NodeProvider.get_command_runner | [
{
"version": "v19",
"docstring_lines": {
"start_line": 216,
"end_line": 230
},
"code_lines": {
"start_line": 230,
"end_line": 233
},
"commit_date_time": "2020-06-06 21:21:44",
"commit_sha": "b07b4f2e555d3c85740178810a3512f315e43922",
"commit_message": "Revert ... | - def get_command_runner(self, log_prefix, node_id, auth_config,
- cluster_name, process_runner, use_internal_ip):
+ def get_command_runner(self,
+ log_prefix,
+ node_id,
+ auth_config,
+ ... | Returns the CommandRunner class used to perform SSH commands.
Args:
log_prefix(str): stores "NodeUpdater: {}: ".format(<node_id>). Used
to print progress in the CommandRunner.
node_id(str): the node ID.
auth_config(dict): the authentication configs from the aut... | false | false | python/ray/autoscaler/node_provider.py | node_provider.py | ray | ray-project |
python_ray_autoscaler_node_provider.py | NodeProvider.create_node | [
{
"version": "v37",
"docstring_lines": {
"start_line": 85,
"end_line": 115
},
"code_lines": {
"start_line": 115,
"end_line": 116
},
"commit_date_time": "2020-10-27 05:22:41",
"commit_sha": "349c3ec86bd318d6e64bda8ad6382ca6b41339db",
"commit_message": "Remove e... | def create_node(self, node_config: Dict[str, Any], tags: Dict[str, str],
- count: int) -> None:
? ^ ^
+ count: int) -> Optional[Dict[str, Any]]:
? ^^^^ ^^^^^^^^^^^^^^^^^^
+
r... | Creates a number of nodes within the namespace.
+
+ Optionally returns a mapping from created node ids to node metadata. | false | false | python/ray/autoscaler/node_provider.py | node_provider.py | ray | ray-project |
python_ray_autoscaler_node_provider.py | NodeProvider.terminate_node | [
{
"version": "v38",
"docstring_lines": {
"start_line": 120,
"end_line": 122
},
"code_lines": {
"start_line": 122,
"end_line": 123
},
"commit_date_time": "2021-01-19 20:17:46",
"commit_sha": "7b4a97c6100ba5a05e07d9b3712ccedd9f734e82",
"commit_message": "Make AW... | - def terminate_node(self, node_id: str) -> None:
? ^ ^
+ def terminate_node(self, node_id: str) -> Optional[Dict[str, Any]]:
? ^^^^ ^^^^^^^^^^^^^^^^^^
+
raise NotImplementedError | Terminates the specified node.
+
+ Optionally return a mapping from deleted node ids to node
+ metadata. | false | false | python/ray/autoscaler/node_provider.py | node_provider.py | ray | ray-project |
speechbrain_lobes_features.py | Features.forward | [
{
"version": "v7",
"docstring_lines": {
"start_line": 62,
"end_line": 74
},
"code_lines": {
"start_line": 74,
"end_line": 94
},
"commit_date_time": "2020-04-09 17:16:31",
"commit_sha": "7cee214a380e1a57aa0be9fba3307406ee5b43bf",
"commit_message": "Update featu... | - def forward(self, wav, wav_len=None):
? --------------
+ def forward(self, wav):
-
STFT = self.params['compute_STFT'](wav)
features = self.params['compute_spectrogram'](STFT)
if self.feature_type in ['fbank', 'mfcc']:
... | - Arguments
+ Returns a set of features generated from the input waveforms.
+
+ Arguments
---------
wav : tensor
A batch of audio signals to transform to features.
- wav_len : tensor
- Only needed for normalization, the length of each audio signal.
-
- ... | false | false | speechbrain/lobes/features.py | features.py | speechbrain | speechbrain |
speechbrain_lobes_features.py | StreamingFeatureWrapper.get_recommended_final_chunk_count | [
{
"version": "v47",
"docstring_lines": {
"start_line": 296,
"end_line": 337
},
"code_lines": {
"start_line": 337,
"end_line": 401
},
"commit_date_time": "2024-02-24 17:18:23",
"commit_sha": "f9f21c615a24aa6ee196d90504dfefe562a85c5a",
"commit_message": "Streami... | def get_recommended_final_chunk_count(self, frames_per_chunk: int) -> int:
+
return (
upalign_value(self.get_required_padding(), frames_per_chunk)
// frames_per_chunk
) | Get the recommended number of zero chunks to inject at the end of an
input stream depending on the filter properties of the extractor.
The number of injected chunks is chosen to ensure that the filter has
output frames centered on the last input frames.
See also :meth:`~Stre... | false | false | speechbrain/lobes/features.py | features.py | speechbrain | speechbrain |
src_lightning_pytorch_core_module.py | LightningModule.load_from_checkpoint | [
{
"version": "v599",
"docstring_lines": {
"start_line": 292,
"end_line": 305
},
"code_lines": {
"start_line": 305,
"end_line": 310
},
"commit_date_time": "2024-02-01 08:25:47",
"commit_sha": "5a0d2eff8c9916fe2c4fe5c8d18158dbc977f662",
"commit_message": "map op... | def load_from_checkpoint(
cls,
checkpoint_path: Union[_PATH, IO],
map_location: _MAP_LOCATION_TYPE = None,
hparams_file: Optional[_PATH] = None,
- strict: bool = True,
? ^^^
+ strict: Optional[bool] = None,
? +++++++++ ... | r"""Primary way of loading a model from a checkpoint. When Lightning saves a checkpoint it stores the arguments
passed to ``__init__`` in the checkpoint under ``"hyper_parameters"``.
Any arguments specified through \*\*kwargs will override args stored in ``"hyper_parameters"``.
Ar... | false | false | src/lightning/pytorch/core/module.py | module.py | pytorch-lightning | Lightning-AI |
src_lightning_pytorch_core_module.py | LightningModule.predict_step | [
{
"version": "v581",
"docstring_lines": {
"start_line": 773,
"end_line": 840
},
"code_lines": {
"start_line": 840,
"end_line": 840
},
"commit_date_time": "2023-06-15 15:30:02",
"commit_sha": "1204006637fd0ddb7d9c3e9ff19296d50a6b9252",
"commit_message": "Docume... | - def predict_step(self, batch: Any, batch_idx: int, dataloader_idx: int = 0) -> Any:
+ def predict_step(self, *args: Any, **kwargs: Any) -> Any:
+ # For backwards compatibility
+ batch = kwargs.get("batch", args[0])
return self(batch) | Step function called during :meth:`~lightning.pytorch.trainer.trainer.Trainer.predict`. By default, it
calls :meth:`~lightning.pytorch.core.module.LightningModule.forward`. Override to add any processing logic.
The :meth:`~lightning.pytorch.core.module.LightningModule.predict_step` is used
... | false | false | src/lightning/pytorch/core/module.py | module.py | pytorch-lightning | Lightning-AI |
python_ray_serve__private_proxy_router.py | EndpointRouter.get_handle_for_endpoint | [
{
"version": "v2",
"docstring_lines": {
"start_line": 166,
"end_line": 173
},
"code_lines": {
"start_line": 173,
"end_line": 184
},
"commit_date_time": "2023-08-21 15:15:03",
"commit_sha": "f22259bbd676a9e433c5ef0887c2a5a32887cfef",
"commit_message": "[serve] ... | def get_handle_for_endpoint(
- self, target_endpoint: str
? -------
+ self, target_app_name: str
? +++++++
) -> Optional[Tuple[str, RayServeHandle, str, bool]]:
for endpoint_tag, handle in self.handles.items():
- ... | Return the handle that matches with endpoint.
Args:
- target_endpoint: endpoint to match against.
+ target_app_name: app_name to match against.
Returns:
- (route, handle, app_name, is_cross_language) if found, else None.
? ... | false | false | python/ray/serve/_private/proxy_router.py | proxy_router.py | ray | ray-project |
Lib_email__parseaddr.py | AddrlistClass.getatom | [
{
"version": "v1",
"docstring_lines": {
"start_line": 372,
"end_line": 378
},
"code_lines": {
"start_line": 378,
"end_line": 392
},
"commit_date_time": "2002-11-05 19:54:52",
"commit_sha": "030ddf794f32be9ce4b7382fe218c1d6db812866",
"commit_message": "Jason Ma... | - def getatom(self):
+ def getatom(self, atomends=None):
atomlist = ['']
+ if atomends is None:
+ atomends = self.atomends
while self.pos < len(self.field):
- if self.field[self.pos] in self.atomends:
? -----
+ ... | - Parse an RFC-822 atom.
? ^
+ Parse an RFC 2822 atom.
? ^^
+
+ Optional atomends specifies a different set of end token delimiters
+ (the default is to use self.atomends). This is used e.g. in
+ getphraselist() since phrase endings must not include the `.' (which
+ ... | false | false | Lib/email/_parseaddr.py | _parseaddr.py | cpython | python |
Lib_email__parseaddr.py | AddrlistClass.gotonext | [
{
"version": "v36",
"docstring_lines": {
"start_line": 201,
"end_line": 203
},
"code_lines": {
"start_line": 203,
"end_line": 210
},
"commit_date_time": "2012-06-22 00:57:39",
"commit_sha": "e99d3a160ca622fff737a0f835f78e2c4705f9cc",
"commit_message": "Issue #... | def gotonext(self):
+ wslist = []
while self.pos < len(self.field):
if self.field[self.pos] in self.LWS + '\n\r':
+ if self.field[self.pos] not in '\n\r':
+ wslist.append(self.field[self.pos])
self.pos += 1
... | - Parse up to the start of the next address.
+ Skip white space and extract comments. | false | false | Lib/email/_parseaddr.py | _parseaddr.py | cpython | python |
Lib_email__parseaddr.py | mktime_tz | [
{
"version": "v34",
"docstring_lines": {
"start_line": 154,
"end_line": 156
},
"code_lines": {
"start_line": 156,
"end_line": 163
},
"commit_date_time": "2011-11-11 18:35:42",
"commit_sha": "992d9e081fab2061185b80c6decb57249b4612fe",
"commit_message": "Fix few... | def mktime_tz(data):
if data[9] is None:
# No zone info, so localtime is better assumption than GMT
return time.mktime(data[:8] + (-1,))
else:
- t = time.mktime(data[:8] + (0,))
+ t = calendar.timegm(data)
- return t - data[9] - time.timezone
? ... | - Turn a 10-tuple as returned by parsedate_tz() into a UTC timestamp.
? ^^^
+ Turn a 10-tuple as returned by parsedate_tz() into a POSIX timestamp.
? ^^^^^
| false | false | Lib/email/_parseaddr.py | _parseaddr.py | cpython | python |
src_lightning_fabric_fabric.py | Fabric._setup_dataloader | [
{
"version": "v85",
"docstring_lines": {
"start_line": 303,
"end_line": 316
},
"code_lines": {
"start_line": 316,
"end_line": 331
},
"commit_date_time": "2023-02-17 10:41:18",
"commit_sha": "ac5fa03385d8b5d5872f3b610fbca38898ec6fd2",
"commit_message": "Introdu... | def _setup_dataloader(
- self, dataloader: DataLoader, replace_sampler: bool = True, move_to_device: bool = True
? ^^^^^
+ self, dataloader: DataLoader, use_distributed_sampler: bool = True, move_to_device: bool = True
? ++... | Set up a single dataloader for accelerated training.
Args:
dataloader: The dataloader to accelerate.
- replace_sampler: If set ``True`` (default), automatically wraps or replaces the sampler on the dataloader
? ^^^^^ ... | false | false | src/lightning/fabric/fabric.py | fabric.py | pytorch-lightning | Lightning-AI |
src_lightning_fabric_fabric.py | Fabric.load | [
{
"version": "v115",
"docstring_lines": {
"start_line": 656,
"end_line": 670
},
"code_lines": {
"start_line": 670,
"end_line": 682
},
"commit_date_time": "2023-06-06 16:04:19",
"commit_sha": "f67031b832026d44d53fbb399e72363d4cc8991d",
"commit_message": "Add Fa... | def load(
+ self,
+ path: Union[str, Path],
- self, path: Union[str, Path], state: Optional[Dict[str, Union[nn.Module, Optimizer, Any]]] = None
? ------------------------------
+ state: Optional[Dict[str, Union[nn.Module, Optimizer, Any]]] = None,
? ... | Load a checkpoint from a file and restore the state of objects (modules, optimizers, etc.)
How and which processes load gets determined by the `strategy`.
This method must be called on all processes!
Args:
path: A path to where the file is located
state:... | false | false | src/lightning/fabric/fabric.py | fabric.py | pytorch-lightning | Lightning-AI |
src_lightning_fabric_fabric.py | Fabric.sharded_model | [
{
"version": "v100",
"docstring_lines": {
"start_line": 575,
"end_line": 586
},
"code_lines": {
"start_line": 586,
"end_line": 591
},
"commit_date_time": "2023-04-25 20:20:05",
"commit_sha": "d48ec08d76ec090fb0836b5da7f8f9d136f85426",
"commit_message": "Update... | def sharded_model(self) -> Generator:
+ rank_zero_deprecation("`Fabric.sharded_model()` is deprecated in favor of `Fabric.init_module()`.")
+ with _old_sharded_model_context(self._strategy):
- if isinstance(self._strategy, _Sharded):
- with self._strategy.modu... | Shard the parameters of the model instantly when instantiating the layers.
+ .. deprecated:: This context manager is deprecated in favor of :meth:`init_module`, use it instead.
- Use this context manager with strategies that support sharding the model parameters to save peak memory usage.
-
- ... | false | false | src/lightning/fabric/fabric.py | fabric.py | pytorch-lightning | Lightning-AI |
src_lightning_fabric_fabric.py | Fabric.init_module | [
{
"version": "v154",
"docstring_lines": {
"start_line": 701,
"end_line": 707
},
"code_lines": {
"start_line": 707,
"end_line": 715
},
"commit_date_time": "2024-03-08 10:48:16",
"commit_sha": "06eb3cc28ba07b9f213c78419c070b94e10a4fef",
"commit_message": "Pass `... | def init_module(self, empty_init: Optional[bool] = None) -> ContextManager:
self._validate_launched()
- if not _TORCH_GREATER_EQUAL_2_0 and self.device.type != "cpu":
- rank_zero_warn(
- "`Fabric.init_module()` can't place the model parameters on ... | Instantiate the model and its parameters under this context manager to reduce peak memory usage.
The parameters get created on the device and with the right data type right away without wasting memory being
+ allocated unnecessarily.
- allocated unnecessarily. The automatic device placeme... | false | false | src/lightning/fabric/fabric.py | fabric.py | pytorch-lightning | Lightning-AI |
src_lightning_fabric_fabric.py | Fabric.save | [
{
"version": "v122",
"docstring_lines": {
"start_line": 649,
"end_line": 660
},
"code_lines": {
"start_line": 660,
"end_line": 669
},
"commit_date_time": "2023-06-15 16:02:09",
"commit_sha": "f78db4c674dbd0694c525dd4dc0c9b27344ec09e",
"commit_message": "Remove... | - def save(self, path: Union[str, Path], state: Dict[str, Union[nn.Module, Optimizer, Any]]) -> None:
+ def save(
+ self,
+ path: Union[str, Path],
+ state: Dict[str, Union[nn.Module, Optimizer, Any]],
+ filter: Optional[Dict[str, Callable[[str, Any], bool]]] = None,
+ ) -> None:
... | Save checkpoint contents to a file.
How and which processes save gets determined by the `strategy`. For example, the `ddp` strategy
saves checkpoints only on process 0, while the `fsdp` strategy saves files from every rank.
This method must be called on all processes!
Arg... | false | false | src/lightning/fabric/fabric.py | fabric.py | pytorch-lightning | Lightning-AI |
src_lightning_fabric_fabric.py | Fabric.setup | [
{
"version": "v143",
"docstring_lines": {
"start_line": 217,
"end_line": 229
},
"code_lines": {
"start_line": 229,
"end_line": 272
},
"commit_date_time": "2023-12-14 23:00:21",
"commit_sha": "234ded89d4935fb7fe5fc1c2bf0d09adab36acf8",
"commit_message": "Avoid ... | def setup(
self,
module: nn.Module,
*optimizers: Optimizer,
move_to_device: bool = True,
+ _reapply_compile: Optional[bool] = None,
) -> Any: # no specific return because the way we want our API to look does not play well with mypy
... | r"""Set up a model and its optimizers for accelerated training.
Args:
module: A :class:`torch.nn.Module` to set up
*optimizers: The optimizer(s) to set up (no optimizers is also possible)
move_to_device: If set ``True`` (default), moves the model to the correct d... | false | false | src/lightning/fabric/fabric.py | fabric.py | pytorch-lightning | Lightning-AI |
official_modeling_grad_utils.py | minimize_using_explicit_allreduce | [
{
"version": "v15",
"docstring_lines": {
"start_line": 90,
"end_line": 119
},
"code_lines": {
"start_line": 119,
"end_line": 152
},
"commit_date_time": "2023-03-29 17:55:19",
"commit_sha": "00b830c7ca641413f37e5147cf059c89f79b0e8e",
"commit_message": "Internal... | def minimize_using_explicit_allreduce(tape,
optimizer,
loss,
trainable_variables,
pre_allreduce_callbacks=None,
post_a... | Minimizes loss for one step by updating `trainable_variables`.
Minimizes loss for one step by updating `trainable_variables`.
This explicitly performs gradient allreduce, instead of relying on implicit
allreduce in optimizer.apply_gradients(). If training using FP16 mixed
precision, explicit allred... | false | false | official/modeling/grad_utils.py | grad_utils.py | models | tensorflow |
tests_unit_aws_test_spec.py | test_loading_own_specs | [
{
"version": "v4",
"docstring_lines": {
"start_line": 65,
"end_line": 67
},
"code_lines": {
"start_line": 67,
"end_line": 73
},
"commit_date_time": "2023-11-13 14:20:12",
"commit_sha": "8e112c5f36bbb16c997f4933d8425cfa8359ed5a",
"commit_message": "fix SQS JSON... | def test_loading_own_specs():
loader = CustomLoader({})
# first test that specs remain intact
- sqs_query_description = loader.load_service_model("sqs-query", "service-2")
? ------
+ sqs_query_description = loader.load_service_model... | - Ensure that the internalized specifications (f.e. the sqs-query spec) can be handled by the CustomLoader.
? ^^^^^
+ Ensure that the internalized specifications (f.e. the sqs-json spec) can be handled by the CustomLoader.
? ... | false | false | tests/unit/aws/test_spec.py | test_spec.py | localstack | localstack |
rllib_algorithms_ppo_ppo.py | PPO.validate_config | [
{
"version": "v163",
"docstring_lines": {
"start_line": 281,
"end_line": 289
},
"code_lines": {
"start_line": 289,
"end_line": 367
},
"commit_date_time": "2022-06-10 15:09:18",
"commit_sha": "7c39aa5facff1511a83c35a2c16704b45bfbaf5e",
"commit_message": "[RLlib... | - def validate_config(self, config: TrainerConfigDict) -> None:
? ^ - ^^^
+ def validate_config(self, config: AlgorithmConfigDict) -> None:
? ^^^^ ^^^
# Call super's validation method.
super().validate_confi... | - Validates the Trainer's config dict.
? ^ - ^^^
+ Validates the Algorithm's config dict.
? ^^^^ ^^^
Args:
- config: The Trainer's config to check.
? ^ - ^^^
+ config: The Algorithm's config to check.
? ... | false | false | rllib/algorithms/ppo/ppo.py | ppo.py | ray | ray-project |
rllib_algorithms_ppo_ppo.py | PPOConfig.training | [
{
"version": "v230",
"docstring_lines": {
"start_line": 379,
"end_line": 558
},
"code_lines": {
"start_line": 558,
"end_line": 574
},
"commit_date_time": "2024-01-10 17:21:16",
"commit_sha": "806701ede17d60509e0f8c64ba030ddbec6cb08f",
"commit_message": "[RLlib... | def training(
self,
*,
lr_schedule: Optional[List[List[Union[int, float]]]] = NotProvided,
use_critic: Optional[bool] = NotProvided,
use_gae: Optional[bool] = NotProvided,
lambda_: Optional[float] = NotProvided,
use_kl_loss: Optional[bool] = NotPro... | Sets the training related configuration.
Args:
lr_schedule: Learning rate schedule. In the format of
[[timestep, lr-value], [timestep, lr-value], ...]
Intermediary timesteps will be assigned to interpolated learning rate
values. A schedu... | false | false | rllib/algorithms/ppo/ppo.py | ppo.py | ray | ray-project |
ultralytics_utils_downloads.py | delete_dsstore | [
{
"version": "v50",
"docstring_lines": {
"start_line": 43,
"end_line": 60
},
"code_lines": {
"start_line": 60,
"end_line": 66
},
"commit_date_time": "2023-08-22 02:23:28",
"commit_sha": "6da8f7f51e985cb3b4f42043f1791fe8a7368c9b",
"commit_message": "Add `utils.... | - def delete_dsstore(path):
+ def delete_dsstore(path, files_to_delete=('.DS_Store', '__MACOSX')):
# Delete Apple .DS_store files
- files = list(Path(path).rglob('.DS_store'))
+ for file in files_to_delete:
+ matches = list(Path(path).rglob(file))
- LOGGER.info(f'Deleting ... | Deletes all ".DS_store" files under a specified directory.
Args:
path (str, optional): The directory path where the ".DS_store" files should be deleted.
+ files_to_delete (tuple): The files to be deleted.
Example:
```python
- from ultralytics.data.utils import del... | false | false | ultralytics/utils/downloads.py | downloads.py | ultralytics | ultralytics |
ultralytics_utils_downloads.py | safe_download | [
{
"version": "v58",
"docstring_lines": {
"start_line": 249,
"end_line": 266
},
"code_lines": {
"start_line": 266,
"end_line": 327
},
"commit_date_time": "2023-10-09 00:25:22",
"commit_sha": "7517667a33b08a1c2f7cca0dd3e2fa29f335e9f3",
"commit_message": "Add `do... | def safe_download(url,
file=None,
dir=None,
unzip=True,
delete=False,
curl=False,
retry=3,
min_bytes=1E0,
progress=True):
# Chec... | Downloads files from a URL, with options for retrying, unzipping, and deleting the downloaded file.
Args:
url (str): The URL of the file to be downloaded.
file (str, optional): The filename of the downloaded file.
If not provided, the file will be saved with the same name as... | false | false | ultralytics/utils/downloads.py | downloads.py | ultralytics | ultralytics |
ultralytics_utils_downloads.py | download | [
{
"version": "v64",
"docstring_lines": {
"start_line": 441,
"end_line": 459
},
"code_lines": {
"start_line": 459,
"end_line": 472
},
"commit_date_time": "2023-12-01 22:20:14",
"commit_sha": "8c4094e7d9ae4ff57a6585c2cb69d4f1463a009f",
"commit_message": "Add rea... | - def download(url, dir=Path.cwd(), unzip=True, delete=False, curl=False, threads=1, retry=3):
+ def download(url, dir=Path.cwd(), unzip=True, delete=False, curl=False, threads=1, retry=3, exist_ok=False):
? ++++++++++++++++
... | Downloads files from specified URLs to a given directory. Supports concurrent downloads if multiple threads are
specified.
Args:
url (str | list): The URL or list of URLs of the files to be downloaded.
dir (Path, optional): The directory where the files will be saved. Defaults to th... | false | false | ultralytics/utils/downloads.py | downloads.py | ultralytics | ultralytics |
ultralytics_utils_downloads.py | attempt_download_asset | [
{
"version": "v77",
"docstring_lines": {
"start_line": 406,
"end_line": 424
},
"code_lines": {
"start_line": 424,
"end_line": 458
},
"commit_date_time": "2024-03-31 22:16:52",
"commit_sha": "ea527507fecb72cbdb1881dbd8d46c246efce90b",
"commit_message": "`ultral... | - def attempt_download_asset(file, repo="ultralytics/assets", release="v8.1.0", **kwargs):
? ^
+ def attempt_download_asset(file, repo="ultralytics/assets", release="v8.2.0", **kwargs):
? ... | Attempt to download a file from GitHub release assets if it is not found locally. The function checks for the file
locally first, then tries to download it from the specified GitHub repository release.
Args:
file (str | Path): The filename or file path to be downloaded.
repo (str, o... | false | false | ultralytics/utils/downloads.py | downloads.py | ultralytics | ultralytics |
algorithms_strings_min_distance.py | lcs | [
{
"version": "v1",
"docstring_lines": {
"start_line": 18,
"end_line": 21
},
"code_lines": {
"start_line": 21,
"end_line": 29
},
"commit_date_time": "2018-07-18 09:31:03",
"commit_sha": "77054e71123a7d65485a92c85a990301475e8152",
"commit_message": "PR to add so... | - def lcs(s1, s2, i, j):
? ^ ^
+ def lcs(word1, word2, i, j):
? ^^^^ ^^^^
if i == 0 or j == 0:
return 0
- elif s1[i - 1] == s2[j - 1]:
? -- ^ ^
+ if word1[i - 1] == word2[j - 1]:
? ^^^^ ^^^^
- return 1 + lcs(... | - The length of longest common subsequence among the two given strings s1 and s2
? ^ ^
+ The length of longest common subsequence among the two given strings word1 and word2
? ... | false | false | algorithms/strings/min_distance.py | min_distance.py | algorithms | keon |
conan_tools_cmake_cmake.py | CMake.build | [
{
"version": "v71",
"docstring_lines": {
"start_line": 170,
"end_line": 182
},
"code_lines": {
"start_line": 182,
"end_line": 210
},
"commit_date_time": "2023-11-06 23:39:07",
"commit_sha": "23d96d6d1611cd4c3dfad9cb5c66896f6f6130c3",
"commit_message": "Add doc... | - def build(self, build_type=None, target=None, cli_args=None, build_tool_args=None):
? ^^
+ def build(self, build_type=None, target=None, cli_args=None, build_tool_args=None,
? ... | :param build_type: Use it only to override the value defined in the ``settings.build_type``
for a multi-configuration generator (e.g. Visual Studio, XCode).
This value will be ignored for single-configuration generators, they will
... | false | false | conan/tools/cmake/cmake.py | cmake.py | conan | conan-io |
freqtrade_freqtradebot.py | FreqtradeBot._refresh_whitelist | [
{
"version": "v15",
"docstring_lines": {
"start_line": 204,
"end_line": 211
},
"code_lines": {
"start_line": 211,
"end_line": 232
},
"commit_date_time": "2018-04-06 07:57:08",
"commit_sha": "1f75636e56132f09a08032d3ef71d319d711164e",
"commit_message": "[1/3] A... | def _refresh_whitelist(self, whitelist: List[str]) -> List[str]:
sanitized_whitelist = whitelist
- health = exchange.get_wallet_health()
+ markets = exchange.get_markets()
+
+ markets = [m for m in markets if m['quote'] == self.config['stake_currency... | - Check wallet health and remove pair from whitelist if necessary
? - ^^^^^^^
+ Check available markets and remove pair from whitelist if necessary
? +++ ++ ++++++ ^
:param whitelist: the sorted list (based on BaseVolume) of pairs the user might want to
trade
:return: t... | false | false | freqtrade/freqtradebot.py | freqtradebot.py | freqtrade | freqtrade |
freqtrade_freqtradebot.py | FreqtradeBot._gen_pair_whitelist | [
{
"version": "v25",
"docstring_lines": {
"start_line": 193,
"end_line": 199
},
"code_lines": {
"start_line": 199,
"end_line": 207
},
"commit_date_time": "2018-04-21 16:44:57",
"commit_sha": "954c6e8c15095e9935dafd7f3055414687136b01",
"commit_message": "Write l... | - def _gen_pair_whitelist(self, base_currency: str, key: str = 'BaseVolume') -> List[str]:
? ^^^
+ def _gen_pair_whitelist(self, base_currency: str, key: str = 'quoteVolume') -> List[str]:
? ^^^^... | Updates the whitelist with with a dynamically generated list
:param base_currency: base currency as str
- :param key: sort key (defaults to 'BaseVolume')
? ^^^
+ :param key: sort key (defaults to 'quoteVolume')
? ... | false | false | freqtrade/freqtradebot.py | freqtradebot.py | freqtrade | freqtrade |
freqtrade_freqtradebot.py | FreqtradeBot.get_real_amount | [
{
"version": "v527",
"docstring_lines": {
"start_line": 1137,
"end_line": 1142
},
"code_lines": {
"start_line": 1142,
"end_line": 1174
},
"commit_date_time": "2020-05-11 16:17:03",
"commit_sha": "9fbe1357902aa90243309781f164e7328fdc5b9a",
"commit_message": "at... | def get_real_amount(self, trade: Trade, order: Dict, order_amount: float = None) -> float:
+ # Init variables
if order_amount is None:
order_amount = order['amount']
# Only run for closed orders
- if trade.fee_open == 0 or order['statu... | - Get real amount for the trade
+ Detect and update trade fee.
+ Calls trade.update_fee() uppon correct detection.
+ Returns modified amount if the fee was taken from the destination currency.
Necessary for exchanges which charge fees in base currency (e.g. binance)
+ :return: identica... | false | false | freqtrade/freqtradebot.py | freqtradebot.py | freqtrade | freqtrade |
freqtrade_freqtradebot.py | FreqtradeBot._check_and_execute_exit | [
{
"version": "v985",
"docstring_lines": {
"start_line": 450,
"end_line": 455
},
"code_lines": {
"start_line": 455,
"end_line": 484
},
"commit_date_time": "2022-03-20 08:46:51",
"commit_sha": "fcec071a0804574dc9e03d8a45ebf8dcc8fa665b",
"commit_message": "Use or... | def _check_and_execute_exit(self, trade: Trade, exit_rate: float,
- buy: bool, sell: bool, exit_tag: Optional[str]) -> bool:
? ^^^ - ^^
+ enter: bool, exit_: bool, exit_tag: Optional[str]) -> bool:
? ... | - Check and execute exit
+ Check and execute trade exit
? ++++++
| false | false | freqtrade/freqtradebot.py | freqtradebot.py | freqtrade | freqtrade |
freqtrade_freqtradebot.py | FreqtradeBot.check_for_open_trades | [
{
"version": "v842",
"docstring_lines": {
"start_line": 221,
"end_line": 225
},
"code_lines": {
"start_line": 225,
"end_line": 237
},
"commit_date_time": "2021-11-18 18:58:44",
"commit_sha": "8638e6fe47dc847a95b31350401d59ccc078eb23",
"commit_message": "Simpli... | def check_for_open_trades(self):
open_trades = Trade.get_trades([Trade.is_open.is_(True)]).all()
- if len(open_trades) != 0:
+ if len(open_trades) != 0 and self.state != State.RELOAD_CONFIG:
msg = {
'type': RPCMessageType.WA... | - Notify the user when the bot is stopped
+ Notify the user when the bot is stopped (not reloaded)
? +++++++++++++++
and there are still open trades active. | false | false | freqtrade/freqtradebot.py | freqtradebot.py | freqtrade | freqtrade |
freqtrade_freqtradebot.py | FreqtradeBot._init_modules | [
{
"version": "v50",
"docstring_lines": {
"start_line": 63,
"end_line": 68
},
"code_lines": {
"start_line": 68,
"end_line": 80
},
"commit_date_time": "2018-06-05 21:14:28",
"commit_sha": "12d8a8b1a35b463fc90a0af0c9ca6d1d0560538e",
"commit_message": "Fix review ... | - def _init_modules(self, db_url: Optional[str] = None) -> None:
+ def _init_modules(self) -> None:
# Initialize all modules
- persistence.init(self.config, db_url)
? --------
+ persistence.init(self.config)
exc... | Initializes all modules and updates the config
- :param db_url: database connector string for sqlalchemy (Optional)
:return: None | false | false | freqtrade/freqtradebot.py | freqtradebot.py | freqtrade | freqtrade |
freqtrade_freqtradebot.py | FreqtradeBot.create_trade | [
{
"version": "v52",
"docstring_lines": {
"start_line": 275,
"end_line": 282
},
"code_lines": {
"start_line": 282,
"end_line": 355
},
"commit_date_time": "2018-06-07 21:54:46",
"commit_sha": "b1b87731b1a97de0fd8d2cd262c22c80fed87f30",
"commit_message": "Support... | def create_trade(self) -> bool:
+ stake_amount = self.config['stake_amount']
interval = self.analyze.get_ticker_interval()
- stake_amount = self._get_trade_stake_amount()
-
- if not stake_amount:
- return False
logger.info(
... | Checks the implemented trading indicator(s) for a randomly picked pair,
if one pair triggers the buy_signal a new trade record gets created
- :param stake_amount: amount of btc to spend
- :param interval: Ticker interval used for Analyze
:return: True if a trade object has been cre... | false | false | freqtrade/freqtradebot.py | freqtradebot.py | freqtrade | freqtrade |
freqtrade_freqtradebot.py | FreqtradeBot.execute_buy | [
{
"version": "v465",
"docstring_lines": {
"start_line": 951,
"end_line": 958
},
"code_lines": {
"start_line": 958,
"end_line": 1001
},
"commit_date_time": "2020-02-21 19:27:13",
"commit_sha": "6c01542fed34a71f44ae3b4aa75a0c8bce0b302f",
"commit_message": "Ad ch... | def execute_buy(self, pair: str, stake_amount: float, price: Optional[float] = None) -> bool:
time_in_force = self.strategy.order_time_in_force['buy']
if price:
buy_limit_requested = price
else:
# Calculate price
- ... | Executes a limit buy for the given pair
:param pair: pair for which we want to create a LIMIT_BUY
- :return: None
+ :return: True if a buy order is created, false if it fails. | false | false | freqtrade/freqtradebot.py | freqtradebot.py | freqtrade | freqtrade |
freqtrade_freqtradebot.py | FreqtradeBot.execute_sell | [
{
"version": "v87",
"docstring_lines": {
"start_line": 602,
"end_line": 608
},
"code_lines": {
"start_line": 608,
"end_line": 645
},
"commit_date_time": "2018-07-24 07:00:56",
"commit_sha": "1a9ead45ebb75f360789316e2cca7072ce790dcc",
"commit_message": "fix mis... | - def execute_sell(self, trade: Trade, limit: float) -> None:
+ def execute_sell(self, trade: Trade, limit: float, sell_reason: SellType) -> None:
? +++++++++++++++++++++++
# Execute sell and update trade record
order... | Executes a limit sell for the given trade and limit
:param trade: Trade instance
:param limit: limit rate for the sell order
+ :param sellreason: Reason the sell was triggered
:return: None | false | false | freqtrade/freqtradebot.py | freqtradebot.py | freqtrade | freqtrade |
freqtrade_freqtradebot.py | FreqtradeBot._process | [
{
"version": "v136",
"docstring_lines": {
"start_line": 167,
"end_line": 173
},
"code_lines": {
"start_line": 173,
"end_line": 218
},
"commit_date_time": "2018-10-28 12:15:49",
"commit_sha": "551dc79cf7692191b797351fb03ebf67a5771c2b",
"commit_message": "Don't ... | - def _process(self, nb_assets: Optional[int] = 0) -> bool:
+ def _process(self) -> bool:
state_changed = False
try:
+ nb_assets = self.config.get('dynamic_whitelist', None)
# Refresh whitelist based on wallet maintenance
sanit... | Queries the persistence layer for open trades and handles them,
otherwise a new trade is created.
- :param: nb_assets: the maximum number of pairs to be traded at the same time
:return: True if one or more trades has been created or closed, False otherwise | false | false | freqtrade/freqtradebot.py | freqtradebot.py | freqtrade | freqtrade |
freqtrade_freqtradebot.py | FreqtradeBot.handle_stoploss_on_exchange | [
{
"version": "v235",
"docstring_lines": {
"start_line": 614,
"end_line": 619
},
"code_lines": {
"start_line": 619,
"end_line": 653
},
"commit_date_time": "2019-01-16 19:03:34",
"commit_sha": "75cedfafb88d9db97a88e17add8ee958d04c0efc",
"commit_message": "unreac... | def handle_stoploss_on_exchange(self, trade: Trade) -> bool:
result = False
# If trade is open and the buy order is fulfilled but there is no stoploss,
# then we add a stoploss on exchange
if not trade.open_order_id and not trade.stoploss_... | Check if trade is fulfilled in which case the stoploss
- on exchange should be added immediately if stoploss on exchnage
? -
+ on exchange should be added immediately if stoploss on exchange
? ... | false | false | freqtrade/freqtradebot.py | freqtradebot.py | freqtrade | freqtrade |
freqtrade_freqtradebot.py | FreqtradeBot.enter_positions | [
{
"version": "v808",
"docstring_lines": {
"start_line": 745,
"end_line": 749
},
"code_lines": {
"start_line": 749,
"end_line": 775
},
"commit_date_time": "2021-10-12 17:10:38",
"commit_sha": "f290ff5c9aa68c06fc162a463097fc34b1fd8594",
"commit_message": "Re-add... | def enter_positions(self) -> int:
trades_created = 0
whitelist = copy.deepcopy(self.active_pair_whitelist)
if not whitelist:
logger.info("Active pair whitelist is empty.")
return trades_created
# Remove pairs for c... | - Tries to execute entry orders for new trades (positions)
? ^^^^
+ Tries to execute buy orders for new trades (positions)
? ^^
| false | false | freqtrade/freqtradebot.py | freqtradebot.py | freqtrade | freqtrade |
freqtrade_freqtradebot.py | FreqtradeBot.get_target_bid | [
{
"version": "v264",
"docstring_lines": {
"start_line": 215,
"end_line": 220
},
"code_lines": {
"start_line": 220,
"end_line": 248
},
"commit_date_time": "2019-02-17 13:42:55",
"commit_sha": "fe792882b5f7457f8c1a0e2f33c5976ea28149c0",
"commit_message": "load g... | - def get_target_bid(self, pair: str, ticker: Dict[str, float]) -> float:
? --------------------------
+ def get_target_bid(self, pair: str) -> float:
- if ticker['ask'] < ticker['last']:
- ticker_rate = ticker['ask']
- else... | Calculates bid target between current ask price and last price
- :param ticker: Ticker to use for getting Ask and Last Price
:return: float: Price | false | false | freqtrade/freqtradebot.py | freqtradebot.py | freqtrade | freqtrade |
freqtrade_freqtradebot.py | FreqtradeBot.get_sell_rate | [
{
"version": "v490",
"docstring_lines": {
"start_line": 632,
"end_line": 641
},
"code_lines": {
"start_line": 641,
"end_line": 658
},
"commit_date_time": "2020-03-20 04:48:53",
"commit_sha": "942792f1233f35eba31d51d96ecbc92163376af1",
"commit_message": "update... | def get_sell_rate(self, pair: str, refresh: bool) -> float:
if not refresh:
rate = self._sell_rate_cache.get(pair)
# Check if cache has been invalidated
if rate:
logger.info(f"Using cached sell rate for {pair}.")
... | - Get sell rate - either using get-ticker bid or first bid based on orderbook
? ----
+ Get sell rate - either using ticker bid or first bid based on orderbook
The orderbook portion is only used for rpc messaging, which would otherwise fail
for BitMex (has no bid/ask in ... | false | false | freqtrade/freqtradebot.py | freqtradebot.py | freqtrade | freqtrade |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.