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_oceanex.py
oceanex.fetch_orders
[ { "version": "v124", "docstring_lines": { "start_line": 679, "end_line": 688 }, "code_lines": { "start_line": 688, "end_line": 709 }, "commit_date_time": "2023-11-16 12:46:12", "commit_sha": "8d2f99100013351c73cf0629d66e28e7a2e45c0a", "commit_message": "Merge ...
def fetch_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]: - self.check_required_symbol('fetchOrders', symbol) + if symbol is None: + raise ArgumentsRequired(self.id + ' fetchOrders() requires a symbol argume...
fetches information on multiple orders made by the user :see: https://api.oceanex.pro/doc/v1/#order-status-with-filters-post :param str symbol: unified market symbol of the market orders were made in :param int [since]: the earliest time in ms to fetch orders for :param int [li...
false
false
python/ccxt/oceanex.py
oceanex.py
ccxt
ccxt
tests_tests_pytorch_models_test_tpu.py
test_accelerator_set_when_using_tpu
[ { "version": "v85", "docstring_lines": { "start_line": 266, "end_line": 268 }, "code_lines": { "start_line": 268, "end_line": 276 }, "commit_date_time": "2022-10-04 22:54:14", "commit_sha": "7ef87464ddd740f8af8388bd95130066c65874da", "commit_message": "Refacto...
- def test_accelerator_set_when_using_tpu(tpu_cores): ? ^^^^ -- + def test_accelerator_set_when_using_tpu(devices): ? ^^^^ - assert isinstance(Trainer(accelerator="tpu", devices=tpu_cores).accelerator, TPUAccelerator) ? ...
- Test if the accelerator is set to `tpu` when tpu_cores is not None. ? ^^^^ -- + Test if the accelerator is set to `tpu` when devices is not None. ? ^^^^
false
false
tests/tests_pytorch/models/test_tpu.py
test_tpu.py
pytorch-lightning
Lightning-AI
homeassistant_components_feedreader___init__.py
StoredData.__init__
[ { "version": "v35", "docstring_lines": { "start_line": 224, "end_line": 226 }, "code_lines": { "start_line": 226, "end_line": 231 }, "commit_date_time": "2023-04-28 19:16:08", "commit_sha": "c303487c1bf234bad2901882476dceefec2243a9", "commit_message": "Fix lin...
- def __init__(self, data_file: str) -> None: + def __init__(self, hass: HomeAssistant, legacy_data_file: str) -> None: ? ++++++++++++++++++++++++++++ - self._data_file = data_file + self._legacy_data_file = legacy_data_file ? +++++++ +++++++ - ...
- Initialize pickle data storage. ? ------- + Initialize data storage.
false
false
homeassistant/components/feedreader/__init__.py
__init__.py
core
home-assistant
python_ccxt_bitmex.py
bitmex.fetch_funding_rate_history
[ { "version": "v255", "docstring_lines": { "start_line": 2369, "end_line": 2382 }, "code_lines": { "start_line": 2382, "end_line": 2420 }, "commit_date_time": "2022-06-15 02:49:29", "commit_sha": "9fb56f853b7e4893488e3bc55d0c2c324d7cfef5", "commit_message": "1....
def fetch_funding_rate_history(self, symbol=None, since=None, limit=None, params={}): self.load_markets() request = {} market = None if symbol in self.currencies: code = self.currency(symbol) request['symbol'] = code[...
Fetches the history of funding rates :param str|None symbol: unified symbol of the market to fetch the funding rate history for :param int|None since: timestamp in ms of the earliest funding rate to fetch :param int|None limit: the maximum amount of `funding rate structures <https://docs...
false
false
python/ccxt/bitmex.py
bitmex.py
ccxt
ccxt
python_ccxt_bitmex.py
bitmex.fetch_my_trades
[ { "version": "v325", "docstring_lines": { "start_line": 1630, "end_line": 1638 }, "code_lines": { "start_line": 1638, "end_line": 1680 }, "commit_date_time": "2023-09-14 23:49:35", "commit_sha": "2e126035c9575c4748f136085bded8c4660286b1", "commit_message": "Me...
def fetch_my_trades(self, symbol: Optional[str] = None, since: Optional[int] = None, limit: Optional[int] = None, params={}): self.load_markets() + paginate = False + paginate, params = self.handle_option_and_params(params, 'fetchMyTrades', 'paginate') + ...
+ see https://www.bitmex.com/api/explorer/#not /Execution/Execution_getTradeHistory - fetch all trades made by the user + fetch all trades made by the user ? ++++++++ :param str symbol: unified market symbol :param int [since]: the earliest time in ms to fetch trades for :param in...
false
false
python/ccxt/bitmex.py
bitmex.py
ccxt
ccxt
python_ccxt_bitmex.py
bitmex.create_order
[ { "version": "v353", "docstring_lines": { "start_line": 1725, "end_line": 1738 }, "code_lines": { "start_line": 1738, "end_line": 1789 }, "commit_date_time": "2023-12-23 12:50:45", "commit_sha": "f279fec2e79975ff33dc107d275902286fffef96", "commit_message": "4....
def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount, price=None, params={}): self.load_markets() market = self.market(symbol) orderType = self.capitalize(type) reduceOnly = self.safe_value(params, 'reduceOnly') ...
create a trade order :see: https://www.bitmex.com/api/explorer/#not /Order/Order_new :param str symbol: unified symbol of the market to create an order in :param str type: 'market' or 'limit' :param str side: 'buy' or 'sell' :param float amount: how much of currency y...
false
false
python/ccxt/bitmex.py
bitmex.py
ccxt
ccxt
python_ray_serve_context.py
_connect
[ { "version": "v8", "docstring_lines": { "start_line": 89, "end_line": 106 }, "code_lines": { "start_line": 106, "end_line": 142 }, "commit_date_time": "2022-06-01 18:27:54", "commit_sha": "905258dbc19753c81039f993477e7ab027960729", "commit_message": "Clean up ...
- def _connect( - _override_controller_namespace: Optional[str] = None, - ) -> ServeControllerClient: + def _connect() -> ServeControllerClient: ? +++++++++++++ - # Initialize ray if needed. ? ^ + # Initialize Ray if needed. ? ^ ray.worker.global_w...
- Connect to an existing Serve instance on this Ray cluster. ? ^^ ^^^^^ + Connect to an existing Serve application on this Ray cluster. ? ++++ ^^ ^ +++ - If calling from the driver program, the Serve instance on this Ray cluster ? ...
false
false
python/ray/serve/context.py
context.py
ray
ray-project
homeassistant_components_goalzero_binary_sensor.py
YetiBinarySensor.is_on
[ { "version": "v8", "docstring_lines": { "start_line": 84, "end_line": 86 }, "code_lines": { "start_line": 86, "end_line": 87 }, "commit_date_time": "2021-10-14 22:20:08", "commit_sha": "abf6720cd3d12d5bed3194754481aa39933c349e", "commit_message": "Add strict t...
def is_on(self) -> bool: - return cast(bool, self.api.data.get(self.entity_description.key) == 1) ? ^^^^^ ^ + return cast(bool, self.api.data[self.entity_description.key] == 1) ? ^ ...
- Return if the service is on. + Return True if the service is on. ? +++++
false
false
homeassistant/components/goalzero/binary_sensor.py
binary_sensor.py
core
home-assistant
plugins_convert_writer__base.py
Output.cache_frame
[ { "version": "v5", "docstring_lines": { "start_line": 67, "end_line": 69 }, "code_lines": { "start_line": 69, "end_line": 70 }, "commit_date_time": "2019-07-30 16:59:50", "commit_sha": "1d0d7214525205caf841c8d8e7789862a600b2a4", "commit_message": "bugfix: Fram...
- def cache_frame(self, filename, image): + def cache_frame(self, filename, image) -> None: ? ++++++++ - ? - + + frame_no = int(re.search(self.re_search, filename).group()) self.cache[frame_no] = image logger.tr...
- Add the incoming frame to the cache + Add the incoming converted frame to the cache ready for writing out. + + Used for ffmpeg and gif writers to ensure that the frames are written out in the correct + order. + + Parameters + ---------- + filename: str + The filen...
false
false
plugins/convert/writer/_base.py
_base.py
faceswap
deepfakes
plugins_convert_writer__base.py
Output.output_filename
[ { "version": "v7", "docstring_lines": { "start_line": 121, "end_line": 139 }, "code_lines": { "start_line": 139, "end_line": 140 }, "commit_date_time": "2022-05-14 11:15:50", "commit_sha": "e0e2779bd3ab59b7bab2ee7ebaaa567d543173c2", "commit_message": "gif writ...
- def output_filename(self, filename: str) -> str: + def output_filename(self, filename: str, separate_mask: bool = False) -> List[str]: filename = os.path.splitext(os.path.basename(filename))[0] out_filename = f"{filename}.{self.config['format']}" - out_filename = os....
Obtain the full path for the output file, including the correct extension, for the given input filename. NB: The plugin must have a config item 'format' that contains the file extension to use this method. Parameters ---------- filename: str ...
false
false
plugins/convert/writer/_base.py
_base.py
faceswap
deepfakes
timm_models_registry.py
list_models
[ { "version": "v2", "docstring_lines": { "start_line": 46, "end_line": 56 }, "code_lines": { "start_line": 56, "end_line": 66 }, "commit_date_time": "2019-06-29 22:50:33", "commit_sha": "b8762cc67d79464ae3105fecf6e6f35ebe8ae230", "commit_message": "Model update...
- def list_models(filter='', module='', pretrained=False): + def list_models(filter='', module='', pretrained=False, exclude_filters=''): ? ++++++++++++++++++++ if module: models = list(_module_to_models[module]) else: ...
Return list of available model names, sorted alphabetically Args: filter (str) - Wildcard filter string that works with fnmatch module (str) - Limit model selection to a specific sub-module (ie 'gen_efficientnet') + pretrained (bool) - Include only models with pretrained weights i...
false
false
timm/models/registry.py
registry.py
pytorch-image-models
huggingface
timm_models_registry.py
get_pretrained_cfg_value
[ { "version": "v8", "docstring_lines": { "start_line": 155, "end_line": 157 }, "code_lines": { "start_line": 157, "end_line": 159 }, "commit_date_time": "2022-01-26 05:54:13", "commit_sha": "abc9ba254430ef971ea3dbd12f2b4f1969da55be", "commit_message": "Transiti...
def get_pretrained_cfg_value(model_name, cfg_key): if model_name in _model_pretrained_cfgs: - return _model_pretrained_cfgs[model_name].get(cfg_key, None) ? ^^^^^ + return getattr(_model_pretrained_cfgs[model_name], cfg_key, None) ...
- Get a specific model default_cfg value by key. None if it doesn't exist. ? ^^ + Get a specific model default_cfg value by key. None if key doesn't exist. ? ^^^
false
false
timm/models/registry.py
registry.py
pytorch-image-models
huggingface
bin_proxy.py
translate
[ { "version": "v22", "docstring_lines": { "start_line": 128, "end_line": 131 }, "code_lines": { "start_line": 131, "end_line": 135 }, "commit_date_time": "2021-01-02 21:43:18", "commit_sha": "0b8ead03e60bf248112d0834ffd064b5ce8ef875", "commit_message": "Use cas...
def translate(text, lang): + + if "," in text: + terms = text.split(",") + translated_terms = [translate(term.strip(), lang) for term in terms] + return ", ".join(translated_terms) + translated = TRANSLATIONS.get(lang, {}).get(text.lower(), text) - if text ...
- Translate `text` into `lang` + Translate `text` into `lang`. ? + + If `text` is comma-separated, translate each term independently. + If no translation found, leave it untouched.
false
false
bin/proxy.py
proxy.py
wttr.in
chubin
third_party_acados_acados_template_acados_sim_solver.py
AcadosSimSolver.get
[ { "version": "v5", "docstring_lines": { "start_line": 384, "end_line": 390 }, "code_lines": { "start_line": 390, "end_line": 439 }, "commit_date_time": "2023-01-01 05:00:50", "commit_sha": "cd8e03d53ed210aec46a2ff728cb4a830314a21a", "commit_message": "move all...
def get(self, field_): - field = field_ - field = field.encode('utf-8') + field = field_.encode('utf-8') ? + - if field_ in self.gettable.keys(): ? ^^ ^ -- + if field_ in self.gettable_...
Get the last solution of the solver. - :param str field: string in ['x', 'u', 'z', 'S_forw', 'Sx', 'Su', 'S_adj', 'S_hess', 'S_algebraic'] + :param str field: string in ['x', 'u', 'z', 'S_forw', 'Sx', 'Su', 'S_adj', 'S_hess', 'S_algebraic', 'CPUtime', 'time_tot', 'ADtime', 'time_ad', 'LAtim...
false
false
third_party/acados/acados_template/acados_sim_solver.py
acados_sim_solver.py
openpilot
commaai
deepspeed_inference_v2_ragged_ragged_manager.py
DSStateManager.get_cache
[ { "version": "v1", "docstring_lines": { "start_line": 100, "end_line": 111 }, "code_lines": { "start_line": 111, "end_line": 117 }, "commit_date_time": "2023-11-03 22:07:35", "commit_sha": "38b41dffa1d593ad8a8ab3ee2795dc203800f08c", "commit_message": "DeepSpee...
- def get_cache(self, cache_id: int) -> torch.Tensor: + def get_cache(self, cache_id: int, cache_group: int = 0) -> torch.Tensor: ? ++++++++++++++++++++++ - return self._kv_cache.get_cache(cache_id) + return self._kv_cache.get_cache(cach...
- Return the Tensor associated with the given cache id. + Return the Tensor associated with the given cache id in the specified cache group. ? +++++++++++++++++++++++++++++ + + Arguments: + cache_group (str): The KV cache group. + cac...
false
false
deepspeed/inference/v2/ragged/ragged_manager.py
ragged_manager.py
DeepSpeed
microsoft
samcli_lib_providers_sam_stack_provider.py
SamLocalStackProvider.get_stacks
[ { "version": "v18", "docstring_lines": { "start_line": 202, "end_line": 229 }, "code_lines": { "start_line": 229, "end_line": 261 }, "commit_date_time": "2022-05-02 15:57:05", "commit_sha": "17d9abbe6e74a3f45bd65dcf61649440d89c15f1", "commit_message": "#3826: ...
def get_stacks( - template_file: str, + template_file: Optional[str] = None, ? +++++++++ ++++++++ stack_path: str = "", name: str = "", parameter_overrides: Optional[Dict] = None, global_parameter_overrides: Optional[Dict] = None, ...
Recursively extract stacks from a template file. Parameters ---------- template_file: str - the file path of the template to extract stacks from + the file path of the template to extract stacks from. Only one of either template_dict or template_file + ...
false
false
samcli/lib/providers/sam_stack_provider.py
sam_stack_provider.py
aws-sam-cli
aws
samcli_lib_providers_sam_stack_provider.py
SamLocalStackProvider.__init__
[ { "version": "v21", "docstring_lines": { "start_line": 202, "end_line": 232 }, "code_lines": { "start_line": 232, "end_line": 274 }, "commit_date_time": "2023-03-03 15:54:21", "commit_sha": "e3b382df18d8e80b1c3d06eecc34c5ee0977efa6", "commit_message": "bug: Al...
def __init__( self, template_file: str, stack_path: str, template_dict: Dict, parameter_overrides: Optional[Dict] = None, global_parameter_overrides: Optional[Dict] = None, + use_sam_transform: bool = True, ): ...
Initialize the class with SAM template data. The SAM template passed to this provider is assumed to be valid and a dictionary. This class will perform template normalization to remove structures like ``Globals``, resolve intrinsic functions etc. This class does not perform any syntactic ...
false
false
samcli/lib/providers/sam_stack_provider.py
sam_stack_provider.py
aws-sam-cli
aws
samcli_lib_providers_sam_stack_provider.py
SamLocalStackProvider._extract_stacks
[ { "version": "v6", "docstring_lines": { "start_line": 206, "end_line": 229 }, "code_lines": { "start_line": 229, "end_line": 255 }, "commit_date_time": "2021-03-03 03:28:38", "commit_sha": "af19bdbcb26a0950ab7a21a181ac0d9e0bf5083f", "commit_message": "feat: En...
- def _extract_stacks(self) -> Dict[str, Stack]: ? ^^^^^^^^^^^^^^^^ + def _extract_stacks(self) -> None: ? ^^^^ - - result: Dict[str, Stack] = {} for name, resource in self._resources.items(): ...
Extracts and returns nested application information from the given dictionary of SAM/CloudFormation resources. This method supports applications defined with AWS::Serverless::Application - :return dict(string : application): Dictionary of application LogicalId to the - Application object...
false
false
samcli/lib/providers/sam_stack_provider.py
sam_stack_provider.py
aws-sam-cli
aws
samcli_lib_providers_sam_stack_provider.py
SamLocalStackProvider.normalize_resource_path
[ { "version": "v8", "docstring_lines": { "start_line": 289, "end_line": 311 }, "code_lines": { "start_line": 311, "end_line": 314 }, "commit_date_time": "2021-03-09 00:30:43", "commit_sha": "ab3dcfae17f971cfbfea3f459ed872ba14cead83", "commit_message": "fix: Cod...
def normalize_resource_path(stack_file_path: str, path: str) -> str: if os.path.isabs(path): return path + + if os.path.islink(stack_file_path): + # os.path.realpath() always returns an absolute path while + # the return valu...
Convert resource paths found in nested stack to ones resolvable from root stack. For example, root stack -> template.yaml child stack -> folder/template.yaml a resource in child stack -> folder/resource the resource path is "re...
false
false
samcli/lib/providers/sam_stack_provider.py
sam_stack_provider.py
aws-sam-cli
aws
libs_core_langchain_core_runnables_branch.py
RunnableBranch.get_lc_namespace
[ { "version": "v10", "docstring_lines": { "start_line": 134, "end_line": 136 }, "code_lines": { "start_line": 136, "end_line": 153 }, "commit_date_time": "2023-12-06 23:02:29", "commit_sha": "77c38df36cf96f1a2050b56875690ac7088dd12d", "commit_message": "[core/m...
def get_lc_namespace(cls) -> List[str]: - return cls.__module__.split(".")[:-1] + return ["langchain", "schema", "runnable"]
- The namespace of a RunnableBranch is the namespace of its default branch. + Get the namespace of the langchain object.
false
false
libs/core/langchain_core/runnables/branch.py
branch.py
langchain
langchain-ai
data_structures_linked_list_print_reverse.py
print_reverse
[ { "version": "v2", "docstring_lines": { "start_line": 38, "end_line": 40 }, "code_lines": { "start_line": 40, "end_line": 56 }, "commit_date_time": "2019-11-14 18:59:43", "commit_sha": "5df8aec66cdd87b893a0ee17b97ca8684262f7f7", "commit_message": "GitHub Actio...
- def print_reverse(head_node): + def print_reverse(head_node: Node) -> None: ? ++++++ ++++++++ + + if head_node is not None and isinstance(head_node, Node): - - # If reached end of the List - if head_node is None: - return None - else: - # Recurs...
Prints the elements of the given Linked List in reverse order + >>> print_reverse([]) + >>> linked_list = make_linked_list([69, 88, 73]) + >>> print_reverse(linked_list) + 73 + 88 + 69
false
false
data_structures/linked_list/print_reverse.py
print_reverse.py
Python
TheAlgorithms
freqtrade_rpc_rpc.py
RPC.__rpc_analysed_dataframe_raw
[ { "version": "v449", "docstring_lines": { "start_line": 947, "end_line": 1082 }, "code_lines": { "start_line": 1082, "end_line": 1093 }, "commit_date_time": "2022-12-15 06:05:07", "commit_sha": "7a0eadbdf5013c967d45c185da510c231e11dbe9", "commit_message": "Don...
- def __rpc_analysed_dataframe_raw(self, pair: str, timeframe: str, - limit: Optional[int]) -> Tuple[DataFrame, datetime]: + def __rpc_analysed_dataframe_raw( + self, + pair: str, + timeframe: str, + limit: Optional[int] + ) -> Tuple[DataFrame, da...
Get the dataframe and last analyze from the dataprovider + + :param pair: The pair to get + :param timeframe: The timeframe of data to get + :param limit: The amount of candles in the dataframe
false
false
freqtrade/rpc/rpc.py
rpc.py
freqtrade
freqtrade
data_structures_linked_list_circular_linked_list.py
CircularLinkedList.delete_front
[ { "version": "v1", "docstring_lines": { "start_line": 151, "end_line": 166 }, "code_lines": { "start_line": 166, "end_line": 187 }, "commit_date_time": "2019-11-19 09:53:44", "commit_sha": "c57c4ca1a126871a2153cec6425cf19ed6ed1e49", "commit_message": "Adds ope...
def delete_front(self) -> None: if not self.head: raise IndexError("Deleting from an empty list") current_node = self.head if current_node.next_ptr == current_node: - self.head, self.length = None, 0 ? ...
Removes the 1st node from the CircularLinkedList >>> cll = CircularLinkedList() >>> cll.delete_front() Traceback (most recent call last): ... IndexError: Deleting from an empty list >>> cll.append(1) >>> cll.append(2) >>> print(f"{len(cll...
false
false
data_structures/linked_list/circular_linked_list.py
circular_linked_list.py
Python
TheAlgorithms
homeassistant_components_sia_sia_entity_base.py
SIABaseEntity.async_handle_event
[ { "version": "v8", "docstring_lines": { "start_line": 101, "end_line": 103 }, "code_lines": { "start_line": 103, "end_line": 112 }, "commit_date_time": "2022-02-03 23:06:30", "commit_sha": "faa8ac692e98c389b3cd96d8a4ff41a3e8b2d926", "commit_message": "Fix SIA ...
def async_handle_event(self, sia_event: SIAEvent) -> None: + _LOGGER.debug("Received event: %s", sia_event) if int(sia_event.ri) not in (self.zone, SIA_HUB_ZONE): return + + relevant_event = self.update_state(sia_event) + + if relevant_event: - ...
Listen to dispatcher events for this port and account and update state and attributes. + + If the event is for either the zone or the 0 zone (hub zone), then handle it further. + If the event had a code that was relevant for the entity, then update the attributes. + If the event had a code th...
false
false
homeassistant/components/sia/sia_entity_base.py
sia_entity_base.py
core
home-assistant
gym_wrappers_normalize.py
NormalizeObservation.__init__
[ { "version": "v13", "docstring_lines": { "start_line": 59, "end_line": 66 }, "code_lines": { "start_line": 66, "end_line": 74 }, "commit_date_time": "2022-08-23 15:09:54", "commit_sha": "3a8daafce113c6161190c0252c6a3a340cc38fd4", "commit_message": "Removing re...
- def __init__(self, env: gym.Env, epsilon: float = 1e-8, new_step_api: bool = False): ? ---------------------------- + def __init__(self, env: gym.Env, epsilon: float = 1e-8): - super().__init__(env, new_step_api) ? ...
This wrapper will normalize observations s.t. each coordinate is centered with unit variance. Args: env (Env): The environment to apply the wrapper epsilon: A stability parameter that is used when scaling the observations. - new_step_api (bool): Whether the wrapper...
false
false
gym/wrappers/normalize.py
normalize.py
gym
openai
homeassistant_components_withings_sensor.py
WithingsHealthSensor.state
[ { "version": "v13", "docstring_lines": { "start_line": 283, "end_line": 293 }, "code_lines": { "start_line": 293, "end_line": 300 }, "commit_date_time": "2020-04-08 18:57:42", "commit_sha": "ea709d06303ec98ccd68d324ed8ecf75aa634bac", "commit_message": "Remove ...
- def state(self) -> Union[str, int, float, None]: ? ------ + def state(self) -> Union[None, str, int, float]: ? ++++++ - return self._state + return self._state_data ? +++++
- Return the state of the sensor. ? - ^^^ + Return the state of the entity. ? ^^^^
false
false
homeassistant/components/withings/sensor.py
sensor.py
core
home-assistant
python_ray_serve_handle.py
_DeploymentResponseBase.cancel
[ { "version": "v91", "docstring_lines": { "start_line": 593, "end_line": 595 }, "code_lines": { "start_line": 595, "end_line": 598 }, "commit_date_time": "2023-08-30 13:17:42", "commit_sha": "1cb46faa9dc7da352e544b8c75f812e70c920af5", "commit_message": "[serve]...
def cancel(self): + if not self._assign_request_task.done(): - # TODO(edoakes): when actor task cancellation is supported, we should cancel - # the scheduled actor task here if the assign request task is done. - self._assign_request_task.cancel() + sel...
Attempt to cancel the `DeploymentHandle` call. - This is best effort and will only successfully cancel the call if it has not yet - been assigned to a replica actor. If the call is successfully cancelled, - subsequent operations on the ref will raise an `asyncio.CancelledError` (or a - ...
false
false
python/ray/serve/handle.py
handle.py
ray
ray-project
chainer_links_model_vision_googlenet.py
GoogLeNet.__call__
[ { "version": "v47", "docstring_lines": { "start_line": 225, "end_line": 259 }, "code_lines": { "start_line": 259, "end_line": 263 }, "commit_date_time": "2017-05-16 02:28:16", "commit_sha": "fbf91dd9a715282061cc9a91da6cace44d088f1e", "commit_message": "Remove ...
- def __call__(self, x, layers=['prob'], train=False): ? ^ ^^^^^^^ - + def __call__(self, x, layers=['prob'], **kwargs): ? ^^^^^ ^ + + argument.check_unexpected_kwargs( + kwargs, train='train ar...
+ __call__(self, x, layers=['prob']) + - Computes all the feature maps specified by ``layers``. + Computes all the feature maps specified by ``layers``. ? ++++++++ + + .. warning:: + + ``train`` argument is not supported anymore since v2. + Instead, use ``chainer.using_config('...
false
false
chainer/links/model/vision/googlenet.py
googlenet.py
chainer
chainer
chainer_links_model_vision_googlenet.py
GoogLeNet.extract
[ { "version": "v44", "docstring_lines": { "start_line": 221, "end_line": 244 }, "code_lines": { "start_line": 244, "end_line": 248 }, "commit_date_time": "2017-05-15 02:15:31", "commit_sha": "6a650c8793eaa5e81928a81fdb7a6571ec188ee5", "commit_message": "Remove ...
- def extract(self, images, layers=['pool5'], size=(224, 224), ? ^ + def extract(self, images, layers=['pool5'], size=(224, 224)): ? ^^ - volatile=flag.OFF): ...
Extracts all the feature maps of given images. The difference of directly executing ``__call__`` is that it directly accepts images as an input and automatically transforms them to a proper variable. That is, it is also interpreted as a shortcut method that implicitly calls ...
false
false
chainer/links/model/vision/googlenet.py
googlenet.py
chainer
chainer
research_object_detection_utils_learning_schedules.py
cosine_decay_with_warmup
[ { "version": "v6", "docstring_lines": { "start_line": 111, "end_line": 135 }, "code_lines": { "start_line": 135, "end_line": 158 }, "commit_date_time": "2018-02-27 23:39:34", "commit_sha": "78d5f8f89cd2f29d8f5cce6e4da34272298362d7", "commit_message": "Merged c...
def cosine_decay_with_warmup(global_step, learning_rate_base, total_steps, warmup_learning_rate=0.0, - warmup_steps=0): ? ^^ + ...
Cosine decay schedule with warm up period. Cosine annealing learning rate as described in: Loshchilov and Hutter, SGDR: Stochastic Gradient Descent with Warm Restarts. ICLR 2017. https://arxiv.org/abs/1608.03983 In this schedule, the learning rate grows linearly from warmup_learning_rate to...
false
false
research/object_detection/utils/learning_schedules.py
learning_schedules.py
models
tensorflow
tests_constraints_tests.py
UniqueConstraintTests.test_model_validation_with_condition
[ { "version": "v26", "docstring_lines": { "start_line": 421, "end_line": 423 }, "code_lines": { "start_line": 423, "end_line": 427 }, "commit_date_time": "2022-05-05 04:44:34", "commit_sha": "27b07a3246bc033cd9ded01238c6dc64731cce35", "commit_message": "Refs #3...
def test_model_validation_with_condition(self): + + obj1 = UniqueConstraintConditionProduct.objects.create(name="p1", color="red") obj2 = UniqueConstraintConditionProduct.objects.create(name="p2") - UniqueConstraintConditionProduct(name=obj1.name, color="blue")...
- Partial unique constraints are ignored by Model.validate_unique(). + Partial unique constraints are not ignored by + Model.validate_constraints().
false
false
tests/constraints/tests.py
tests.py
django
django
orbit_controller_test.py
summaries_with_matching_keyword
[ { "version": "v4", "docstring_lines": { "start_line": 35, "end_line": 37 }, "code_lines": { "start_line": 37, "end_line": 45 }, "commit_date_time": "2020-07-18 00:09:33", "commit_sha": "1759f3e01bb9ddeab496dae02cfbedb4fa1406e0", "commit_message": "Internal cha...
def summaries_with_matching_keyword(keyword, summary_dir): + matches = [] event_paths = tf.io.gfile.glob(os.path.join(summary_dir, "events*")) for event in tf.compat.v1.train.summary_iterator(event_paths[-1]): if event.summary is not None: for value in event.summary.value: if ke...
- Yields summary protos matching given keyword from event file. ? ^^ ^^ + Returns summary protos matching given keyword from event file. ? ^ ^^^^
false
false
orbit/controller_test.py
controller_test.py
models
tensorflow
cli_openbb_cli_models_settings.py
Settings.from_env
[ { "version": "v2", "docstring_lines": { "start_line": 65, "end_line": 72 }, "code_lines": { "start_line": 72, "end_line": 79 }, "commit_date_time": "2024-04-30 12:42:31", "commit_sha": "cc15a770daa013f61cf8cf42218d877513ad64be", "commit_message": "[Feature] - ...
def from_env(cls, values: dict) -> dict: - settings = {} - settings.update(dotenv_values(ENV_FILE_REPOSITORY)) - settings.update(dotenv_values(ENV_FILE_PROJECT)) settings.update(dotenv_values(ENV_FILE_SETTINGS)) settings.update(values) filter...
+ Load settings from .env. - Load .env files. - - Loads the dotenv files in the following order: - 1. Repository .env file - 2. Package .env file - 3. User .env file
false
false
cli/openbb_cli/models/settings.py
settings.py
OpenBBTerminal
OpenBB-finance
skimage_feature_tests_test_corner.py
test_num_peaks
[ { "version": "v34", "docstring_lines": { "start_line": 236, "end_line": 239 }, "code_lines": { "start_line": 239, "end_line": 247 }, "commit_date_time": "2014-05-10 14:12:41", "commit_sha": "7b86728498cbda478e393f1fb3b63d87ec4c10dc", "commit_message": "Add ful...
def test_num_peaks(): - lena_corners = corner_harris(rgb2gray(data.lena())) ? ^^^^ ^^ + img_corners = corner_harris(rgb2gray(data.astronaut())) ? ^^^ ^^^^^ ++ for i in range(20): n = np.random.r...
For a bunch of different values of num_peaks, check that peak_local_max returns exactly the right amount of peaks. Test - is run on Lena in order to produce a sufficient number of corners ? ^ + is run on the astronaut image in order to produce a sufficient number of corners ? ...
false
false
skimage/feature/tests/test_corner.py
test_corner.py
scikit-image
scikit-image
test_lib_ansible_test__internal_delegation.py
filter_options
[ { "version": "v79", "docstring_lines": { "start_line": 191, "end_line": 240 }, "code_lines": { "start_line": 240, "end_line": 293 }, "commit_date_time": "2021-09-21 01:39:07", "commit_sha": "4ea8d9a7824827cf3d4a206599ffd7fe3a09eafd", "commit_message": "ansible...
- def filter_options(args, argv, options, exclude, require): - - + def filter_options( + args, # type: EnvironmentConfig + argv, # type: t.List[str] + options, # type: t.Dict[str, int] + exclude, # type: t.List[str] + require, # type: t.List[str] + ): # type: (......
+ Return an iterable that filters out unwanted CLI options and injects new ones as requested. - :type args: EnvironmentConfig - :type argv: list[str] - :type options: dict[str, int] - :type exclude: list[str] - :type require: list[str] - :rtype: collections.Iterable[str]
false
false
test/lib/ansible_test/_internal/delegation.py
delegation.py
ansible
ansible
localstack_utils_aws_aws_responses.py
MessageConversion._reset_account_id
[ { "version": "v33", "docstring_lines": { "start_line": 75, "end_line": 82 }, "code_lines": { "start_line": 82, "end_line": 112 }, "commit_date_time": "2021-06-19 12:00:49", "commit_sha": "8ab607c4bfced4bd04b327467a55923d39aa5342", "commit_message": "add suppor...
def _reset_account_id(data): - ? -- + return aws_stack.fix_account_id_in_arns( - data, colon_delimiter='%3A', existing=TEST_AWS_ACCOUNT_ID, replace=MOTO_ACCOUNT_ID) + data, + colon_delimiter="%3A", + existing=TEST_AWS_ACCOUNT_ID, +...
Fix account ID in request payload. All external-facing responses contain our - predefined account ID (defaults to 000000000000), whereas the backend endpoint ? ---- + predefined account ID (defaults to 000000000000), whereas the backend endpoint - from moto expects a different hardcod...
false
false
localstack/utils/aws/aws_responses.py
aws_responses.py
localstack
localstack
official_vision_dataloaders_tfexample_utils.py
create_segmentation_test_example
[ { "version": "v11", "docstring_lines": { "start_line": 290, "end_line": 302 }, "code_lines": { "start_line": 302, "end_line": 313 }, "commit_date_time": "2022-12-07 05:59:47", "commit_sha": "e070f0dee48f77850059a2eaf1e14a27fc899e78", "commit_message": "Interna...
def create_segmentation_test_example( image_height: int, image_width: int, image_channel: int, - output_serialized_example: bool = False) -> tf.train.Example: ? ^^^^^^^^^^^^^^^^^^^^^^ + output_serialized_example: bool = False, ? ...
Creates and returns a test example containing mask annotations. Args: image_height: The height of test image. image_width: The width of test image. image_channel: The channel of test image. output_serialized_example: A boolean flag represents whether to return a serialized examp...
false
false
official/vision/dataloaders/tfexample_utils.py
tfexample_utils.py
models
tensorflow
mmdet_models_losses_smooth_l1_loss.py
l1_loss
[ { "version": "v14", "docstring_lines": { "start_line": 106, "end_line": 113 }, "code_lines": { "start_line": 113, "end_line": 113 }, "commit_date_time": "2022-08-24 06:26:06", "commit_sha": "73a12e6508d4ba0331b84b1313027a511ba26fe3", "commit_message": "[Fix] F...
- def l1_loss(pred, target): + def l1_loss(pred: Tensor, target: Tensor) -> Tensor: if target.numel() == 0: return pred.sum() * 0 assert pred.size() == target.size() loss = torch.abs(pred - target) return loss
L1 loss. Args: - pred (torch.Tensor): The prediction. ? ------ + pred (Tensor): The prediction. - target (torch.Tensor): The learning target of the prediction. ? ------ + target (Tensor): The learning target of the prediction. Returns: ...
false
false
mmdet/models/losses/smooth_l1_loss.py
smooth_l1_loss.py
mmdetection
open-mmlab
python_ray_tune_tests_test_multi_tenancy.py
test_registry_conflict
[ { "version": "v1", "docstring_lines": { "start_line": 21, "end_line": 65 }, "code_lines": { "start_line": 65, "end_line": 144 }, "commit_date_time": "2023-02-16 21:12:41", "commit_sha": "61d0590f6d403103243d340697293b0a70a3f20b", "commit_message": "[tune] Add ...
- def test_registry_conflict(ray_start_4_cpus, tmpdir, use_workaround, exit_same): ? ---------------- + def test_registry_conflict(ray_start_4_cpus, tmpdir, exit_same): # Create file markers run_1_running = tmpdir / "run_1_running" run...
Two concurrent Tune runs can conflict with each other when they use a trainable with the same name. - This test starts two runs in parallel and asserts that a workaround used ? -------- ------ + This test starts two runs in parallel and as...
false
false
python/ray/tune/tests/test_multi_tenancy.py
test_multi_tenancy.py
ray
ray-project
speechbrain_utils_data_pipeline.py
DataPipeline.compute_outputs
[ { "version": "v6", "docstring_lines": { "start_line": 113, "end_line": 124 }, "code_lines": { "start_line": 124, "end_line": 126 }, "commit_date_time": "2020-12-10 16:00:31", "commit_sha": "1629247a1ad98a55761a1d6053eb1feb3f488540", "commit_message": "Filtered...
def compute_outputs(self, data): if self._exec_order is None: self._prepare_run(data) intermediate = {} for compute_key, edges, conf in self._exec_order: if compute_key in data: continue # It is ...
Arguments --------- data : dict Dictionary with data entries by key. Returns ------- dict - With keys as in self.output_keys + With the keys that were set.
false
false
speechbrain/utils/data_pipeline.py
data_pipeline.py
speechbrain
speechbrain
speechbrain_utils_data_pipeline.py
DataPipeline.set_output_keys
[ { "version": "v4", "docstring_lines": { "start_line": 113, "end_line": 124 }, "code_lines": { "start_line": 124, "end_line": 126 }, "commit_date_time": "2020-12-08 15:58:25", "commit_sha": "07384b9c74fb08d95108ca01ca404cbbc46ae4ae", "commit_message": "Working ...
- def set_output_keys(self, *keys): ? - + def set_output_keys(self, keys): self.output_keys = keys self._exec_order = None
Use this to change the output keys Also re-evaluates execution order. So if you request different outputs, some parts of the data pipeline may be skipped. Arguments --------- - *keys : str ? - - + keys : list ? ++ ...
false
false
speechbrain/utils/data_pipeline.py
data_pipeline.py
speechbrain
speechbrain
speechbrain_utils_data_pipeline.py
DataPipeline.add_dynamic_item
[ { "version": "v8", "docstring_lines": { "start_line": 92, "end_line": 106 }, "code_lines": { "start_line": 106, "end_line": 117 }, "commit_date_time": "2020-12-19 23:34:36", "commit_sha": "0babad8ce500e5ebf2900a32e308651b1d268f06", "commit_message": "Fixing re...
- def add_dynamic_item(self, key, func, argkeys): + def add_dynamic_item(self, func, takes=None, provides=None): - - if key in self._dynamic_item_keys: - raise ValueError(f"Duplicate function key {key}") + if isinstance(func, DynamicItem): + if take...
- Arguments + Adds a dynamic item to the Pipeline. + + Two calling conventions. For DynamicItem objects, just use: + add_dynamic_item(dynamic_item) + But otherwise, should use: + add_dynamic_item(func, takes, provides) + + Arguments --------- - key : str - ...
false
false
speechbrain/utils/data_pipeline.py
data_pipeline.py
speechbrain
speechbrain
official_projects_yt8m_modeling_nn_layers.py
MoeModel.create_model
[ { "version": "v6", "docstring_lines": { "start_line": 61, "end_line": 87 }, "code_lines": { "start_line": 87, "end_line": 134 }, "commit_date_time": "2023-02-10 22:37:18", "commit_sha": "1c99aadd7b0cd97407b80f83b6b760a2d9fb0b73", "commit_message": "Add a flag ...
def create_model(self, model_input, vocab_size, num_mixtures: int = 2, use_input_context_gate: bool = False, use_output_context_gate: bool = False, normalizer_fn=None, nor...
Creates a Mixture of (Logistic) Experts model. The model consists of a per-class softmax distribution over a configurable number of logistic classifiers. One of the classifiers in the mixture is not trained, and always predicts 0. Args: model_input: 'batch_size' x 'num_features' ...
false
false
official/projects/yt8m/modeling/nn_layers.py
nn_layers.py
models
tensorflow
python_ccxt_hitbtc3.py
hitbtc3.cancel_all_orders
[ { "version": "v125", "docstring_lines": { "start_line": 2321, "end_line": 2327 }, "code_lines": { "start_line": 2327, "end_line": 2369 }, "commit_date_time": "2022-09-29 17:19:03", "commit_sha": "73a0d584c596d7d721e72c94ce908bf279f879fa", "commit_message": "mo...
def cancel_all_orders(self, symbol=None, params={}): self.load_markets() market = None request = {} if symbol is not None: market = self.market(symbol) request['symbol'] = market['id'] + marketType = None - ...
cancel all open orders :param str|None 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 hitbtc3 api endpoint + :param str|None params['marginMode']: 'cross' or 'isolated' only ...
false
false
python/ccxt/hitbtc3.py
hitbtc3.py
ccxt
ccxt
readthedocs_core_utils_filesystem.py
safe_open
[ { "version": "v1", "docstring_lines": { "start_line": 24, "end_line": 24 }, "code_lines": { "start_line": 25, "end_line": 34 }, "commit_date_time": "2022-12-08 20:49:46", "commit_sha": "71037608bef971b73c5fb99e138b2cc6a9c979cd", "commit_message": "Merge pull r...
- def safe_open(path, *args, allow_symlinks=False, base_path=None, **kwargs): + def safe_open( + path, + *args, + allow_symlinks=False, + base_path=None, + max_size_bytes=MAX_FILE_SIZE_BYTES, + **kwargs + ): if allow_symlinks and not base_path: - raise ValueErr...
Wrapper around path.open() to check for symlinks. - Checks for symlinks to avoid symlink following vulnerabilities like GHSA-368m-86q9-m99w. - Checks that files aren't out of the DOCROOT directory. + - Checks that files aren't too large. :param allow_symlinks: If `False` and the p...
false
false
readthedocs/core/utils/filesystem.py
filesystem.py
readthedocs.org
readthedocs
python_ccxt_currencycom.py
currencycom.cancel_order
[ { "version": "v160", "docstring_lines": { "start_line": 1427, "end_line": 1435 }, "code_lines": { "start_line": 1435, "end_line": 1463 }, "commit_date_time": "2023-11-16 12:46:12", "commit_sha": "8d2f99100013351c73cf0629d66e28e7a2e45c0a", "commit_message": "Me...
def cancel_order(self, id: str, symbol: Str = None, params={}): - self.check_required_symbol('cancelOrder', symbol) + if symbol is None: + raise ArgumentsRequired(self.id + ' cancelOrder() requires a symbol argument') self.load_markets() ...
cancels an open order :param str id: order id :param str symbol: unified symbol of the market the order was made in :param dict [params]: extra parameters specific to the currencycom api endpoint - :returns dict: An `order structure <https://github.com/ccxt/ccxt/wiki/Manual#order...
false
false
python/ccxt/currencycom.py
currencycom.py
ccxt
ccxt
binance_depthcache.py
DepthCacheManager._depth_event
[ { "version": "v12", "docstring_lines": { "start_line": 166, "end_line": 172 }, "code_lines": { "start_line": 172, "end_line": 179 }, "commit_date_time": "2017-12-26 21:03:57", "commit_sha": "24be774a4e81ea5ca2a3033a349839c0b70a9b4d", "commit_message": "Buffer ...
def _depth_event(self, msg): - - if self._first_update_id is None: # Initial depth snapshot fetch not yet performed, buffer messages self._depth_message_buffer.append(msg) + else: - return - - self._process_depth_...
- :param msg: + Handle a depth event + + :param msg: :return:
false
false
binance/depthcache.py
depthcache.py
python-binance
sammchardy
binance_depthcache.py
DepthCache.get_asks
[ { "version": "v37", "docstring_lines": { "start_line": 82, "end_line": 112 }, "code_lines": { "start_line": 112, "end_line": 114 }, "commit_date_time": "2021-03-07 09:06:41", "commit_sha": "546a207fcced4b6bd0524ee99608a815c551214e", "commit_message": "Add supp...
def get_asks(self): - return DepthCache.sort_depth(self._asks, reverse=False, conv_type=self.conv_type) ? -------------------------- + return DepthCache.sort_depth(self._asks, reverse=False)
Get the current asks - :return: list of asks with price and quantity as conv_type. ? ^ ^^^ ^^^^ + :return: list of asks with price and quantity as floats ? ^^ ^ ^ .. code...
false
false
binance/depthcache.py
depthcache.py
python-binance
sammchardy
binance_depthcache.py
DepthCacheManager.__init__
[ { "version": "v49", "docstring_lines": { "start_line": 277, "end_line": 277 }, "code_lines": { "start_line": 278, "end_line": 278 }, "commit_date_time": "2021-05-09 09:24:40", "commit_sha": "a47cfabccdd6d5780b35fd67933044c6a1d1d316", "commit_message": "Handle ...
+ def __init__( - def __init__(self, client, symbol, loop=None, refresh_interval=None, bm=None, limit=500, ws_interval=None): ? ^^^^^^^^^^^^^ -- + self, client, symbol, loop=None, refresh_interval=None, bm=None, limit=50...
Initialise the DepthCacheManager :param client: Binance API client :type client: binance.Client :param loop: asyncio loop :param symbol: Symbol to create depth cache for :type symbol: string :param refresh_interval: Optional number of seconds between cach...
false
false
binance/depthcache.py
depthcache.py
python-binance
sammchardy
binance_depthcache.py
BaseDepthCacheManager.__init__
[ { "version": "v46", "docstring_lines": { "start_line": 79, "end_line": 109 }, "code_lines": { "start_line": 109, "end_line": 111 }, "commit_date_time": "2021-04-26 12:52:18", "commit_sha": "af67077c9d29b8080f434d987d5b04ef770f7038", "commit_message": "Update r...
- def __init__(self, client, loop, symbol, refresh_interval=None, bm=None, limit=10): + def __init__(self, client, loop, symbol, refresh_interval=None, bm=None, limit=10, conv_type=float): ? +++++++++++++++++ ...
Create a DepthCacheManager instance :param client: Binance API client :type client: binance.Client :param loop: :type loop: :param symbol: Symbol to create depth cache for :type symbol: string :param refresh_interval: Optional number of seconds ...
false
false
binance/depthcache.py
depthcache.py
python-binance
sammchardy
build_tools_github_vendor.py
main
[ { "version": "v5", "docstring_lines": { "start_line": 76, "end_line": 78 }, "code_lines": { "start_line": 78, "end_line": 131 }, "commit_date_time": "2022-10-20 14:20:45", "commit_sha": "7c2a58d51f4528827e9bfe9c43d06c5c1716bfb8", "commit_message": "CI Remove r...
def main(wheel_dirname): if not op.exists(VCOMP140_SRC_PATH): raise ValueError(f"Could not find {VCOMP140_SRC_PATH}.") - - if not op.exists(VCRUNTIME140_SRC_PATH): - raise ValueError(f"Could not find {VCRUNTIME140_SRC_PATH}.") - - if not op.exists(VCRUNTIME140_1_SRC_PATH): - ...
- Embed vcomp140.dll, vcruntime140.dll and vcruntime140_1.dll. + Embed vcomp140.dll and msvcp140.dll.
false
false
build_tools/github/vendor.py
vendor.py
scikit-learn
scikit-learn
localstack_services_sqs_query_api.py
register
[ { "version": "v13", "docstring_lines": { "start_line": 82, "end_line": 87 }, "code_lines": { "start_line": 87, "end_line": 91 }, "commit_date_time": "2023-06-21 08:58:53", "commit_sha": "495d5d32c2e6066451c59a0682d40c0eab50e8df", "commit_message": "SQS: Cross-...
def register(router: Router[Handler]): + router.add(standard_strategy_handler) router.add(path_strategy_handler) router.add(domain_strategy_handler) router.add(legacy_handler)
- Registers the query API handlers into the given router. There are three routes, one for each SQS_ENDPOINT_STRATEGY. ? ^^ -- + Registers the query API handlers into the given router. There are four routes, one for each SQS_ENDPOINT_STRATEGY. ? ...
false
false
localstack/services/sqs/query_api.py
query_api.py
localstack
localstack
src_datasets_download_streaming_download_manager.py
xPath.name
[ { "version": "v59", "docstring_lines": { "start_line": 650, "end_line": 658 }, "code_lines": { "start_line": 658, "end_line": 659 }, "commit_date_time": "2022-09-05 17:25:27", "commit_sha": "139d210b05f0ca9e9bbe29fdd628a3339d1fa813", "commit_message": "Downloa...
- def name(self) -> PurePosixPath: + def name(self) -> str: return PurePosixPath(_as_posix(self).split("::")[0]).name
Name function for argument of type :obj:`~pathlib.Path` that supports both local paths end remote URLs. - Args: - path (:obj:`~pathlib.Path`): Calling Path instance. - Returns: - :obj:`str` ? ----- + `str`
false
false
src/datasets/download/streaming_download_manager.py
streaming_download_manager.py
datasets
huggingface
src_datasets_download_streaming_download_manager.py
StreamingDownloadManager.extract
[ { "version": "v66", "docstring_lines": { "start_line": 912, "end_line": 927 }, "code_lines": { "start_line": 927, "end_line": 929 }, "commit_date_time": "2022-11-30 11:57:16", "commit_sha": "617d15b2edb74485f8cd7aef249ab9dc49797bca", "commit_message": "Support...
- def extract(self, path_or_paths): ? ^^^^ ^^^^ + def extract(self, url_or_urls): ? ^^^ ^^^ - urlpaths = map_nested(self._extract, path_or_paths, map_tuple=True) ? ^^^^ ^^^^ + urlpaths = ma...
- Extract given path(s). + Add extraction protocol for given url(s) for streaming. + + This is the lazy version of `DownloadManager.extract` for streaming. Args: - path_or_paths (`str` or `list` or `dict`): Path or paths of file to extract. Each path is a `str`. ? ^^^^ ^...
false
false
src/datasets/download/streaming_download_manager.py
streaming_download_manager.py
datasets
huggingface
src_datasets_download_streaming_download_manager.py
xwalk
[ { "version": "v68", "docstring_lines": { "start_line": 539, "end_line": 549 }, "code_lines": { "start_line": 549, "end_line": 571 }, "commit_date_time": "2022-12-09 01:41:44", "commit_sha": "6338ded243ccb495b53b1996cba0847bdc250aba", "commit_message": "Clean u...
- def xwalk(urlpath, use_auth_token: Optional[Union[str, bool]] = None): + def xwalk(urlpath, use_auth_token: Optional[Union[str, bool]] = None, **kwargs): ? ++++++++++ main_hop, *rest_hops = _as_str(urlpath).split("::") if i...
Extend `os.walk` function to support remote files. Args: urlpath (`str`): URL root path. use_auth_token (`bool` or `str`, *optional*): Whether to use token or token to authenticate on the Hugging Face Hub for private remote files. + **kwargs: Additional keyword argum...
false
false
src/datasets/download/streaming_download_manager.py
streaming_download_manager.py
datasets
huggingface
src_datasets_download_streaming_download_manager.py
xPath.exists
[ { "version": "v79", "docstring_lines": { "start_line": 446, "end_line": 451 }, "code_lines": { "start_line": 451, "end_line": 471 }, "commit_date_time": "2023-07-03 16:03:33", "commit_sha": "819bb4346434912eb405ce3f3e9f21dc25a2fe85", "commit_message": "Depreca...
- def exists(self, token: Optional[Union[str, bool]] = None): + def exists(self, download_config: Optional[DownloadConfig] = None): - return xexists(str(self), token=token) + return xexists(str(self), download_config=download_config)
Extend `pathlib.Path.exists` method to support both local and remote files. Args: + download_config : mainly use token or storage_options to support different platforms and auth types. - token (`bool` or `str`, *optional*): Whether to use token or token to authenticate on the - ...
false
false
src/datasets/download/streaming_download_manager.py
streaming_download_manager.py
datasets
huggingface
src_datasets_download_streaming_download_manager.py
_prepare_single_hop_path_and_storage_options
[ { "version": "v80", "docstring_lines": { "start_line": 417, "end_line": 423 }, "code_lines": { "start_line": 423, "end_line": 456 }, "commit_date_time": "2023-07-17 17:00:59", "commit_sha": "14f6edd9222e577dccb962ed5338b79b73502fa5", "commit_message": "Use new...
def _prepare_single_hop_path_and_storage_options( urlpath: str, download_config: Optional[DownloadConfig] = None ) -> Tuple[str, Dict[str, Dict[str, Any]]]: token = None if download_config is None else download_config.token protocol = urlpath.split("://")[0] if "://" in urlpat...
Prepare the URL and the kwargs that must be passed to the HttpFileSystem or to requests.get/head In particular it resolves google drive URLs It also adds the authentication headers for the Hugging Face Hub, for both https:// and hf:// paths. + + Storage options are formatted in the form {protocol:...
false
false
src/datasets/download/streaming_download_manager.py
streaming_download_manager.py
datasets
huggingface
st2client_st2client_commands_resource.py
ResourceViewCommand._get_include_attributes
[ { "version": "v75", "docstring_lines": { "start_line": 246, "end_line": 252 }, "code_lines": { "start_line": 252, "end_line": 276 }, "commit_date_time": "2019-03-14 17:34:15", "commit_sha": "971b4ddd01a61137b0b66e2e5cfa60d1fb2c4346", "commit_message": "Update ...
- def _get_include_attributes(cls, args): + def _get_include_attributes(cls, args, extra_attributes=None): ? +++++++++++++++++++++++ + extra_attributes = extra_attributes or [] + include_attributes = [] + + if extra_attri...
Return a list of attributes to send to the API using ?include_attributes filter. If None / empty list is returned it's assumed no filtering is to be performed and all attributes are to be retrieved. + + :param extra_attributes: Additional include attributes which should always be inclu...
false
false
st2client/st2client/commands/resource.py
resource.py
st2
StackStorm
python_ray_job_config.py
JobConfig.set_runtime_env
[ { "version": "v34", "docstring_lines": { "start_line": 46, "end_line": 48 }, "code_lines": { "start_line": 48, "end_line": 49 }, "commit_date_time": "2021-11-24 17:01:01", "commit_sha": "53630ee03b8d0fbdcd76f037203085f4565a0ad1", "commit_message": "Revert \"Re...
- def set_runtime_env(self, runtime_env: Optional[Dict[str, Any]]) -> None: + def set_runtime_env(self, + runtime_env: Optional[Dict[str, Any]], + validate: bool = False) -> None: self.runtime_env = runtime_env if runtime_env is not None el...
Modify the runtime_env of the JobConfig. - We don't validate the runtime_env here because it may go through some ? ------------- + We don't validate the runtime_env by default here because it may go ? ...
false
false
python/ray/job_config.py
job_config.py
ray
ray-project
python_ray_job_config.py
JobConfig.get_proto_job_config
[ { "version": "v29", "docstring_lines": { "start_line": 72, "end_line": 74 }, "code_lines": { "start_line": 74, "end_line": 92 }, "commit_date_time": "2021-10-19 03:31:14", "commit_sha": "46b4c7464d58d663092dd4504e3c944628ee4090", "commit_message": "runtime env...
def get_proto_job_config(self): if self._cached_pb is None: - self._cached_pb = gcs_utils.JobConfig() ? ------------- + pb = gcs_utils.JobConfig() if self.ray_namespace is None: - self._cached_pb.ray_namespace = str(uuid.uuid4()) ...
- Return the prototype structure of JobConfig ? ^^^^ + Return the protobuf structure of JobConfig. ? ^^^ +
false
false
python/ray/job_config.py
job_config.py
ray
ray-project
readthedocs_rtd_tests_tests_test_core_utils.py
CoreUtilTests.test_slugify
[ { "version": "v13", "docstring_lines": { "start_line": 141, "end_line": 143 }, "code_lines": { "start_line": 143, "end_line": 154 }, "commit_date_time": "2019-01-21 18:33:51", "commit_sha": "fd32096652b11fc8ea295de58df141f37e3e0195", "commit_message": "add cus...
def test_slugify(self): + self.assertEqual( - self.assertEqual(slugify('This is a test'), ? ^^^^^^^^^^^^^^^^^ + slugify('This is a test'), ? ^^^^ - 'this-is-a-test') ? ------------- ^ + 'this-is-a...
- Test additional slugify + Test additional slugify. ? +
false
false
readthedocs/rtd_tests/tests/test_core_utils.py
test_core_utils.py
readthedocs.org
readthedocs
graphs_minimum_spanning_tree_kruskal2.py
GraphUndirectedWeighted.kruskal
[ { "version": "v1", "docstring_lines": { "start_line": 62, "end_line": 77 }, "code_lines": { "start_line": 77, "end_line": 110 }, "commit_date_time": "2020-08-12 10:16:17", "commit_sha": "aa46639cbc7a147527bbaafb4c9b2590cc29f40c", "commit_message": "Added Krusk...
- def kruskal(self) -> GraphUndirectedWeighted: + def kruskal(self) -> GraphUndirectedWeighted[T]: ? +++ # Kruskal's Algorithm to generate a Minimum Spanning Tree (MST) of a graph # getting the edges in ascending order ...
Details: https://en.wikipedia.org/wiki/Kruskal%27s_algorithm Example: + >>> g1 = GraphUndirectedWeighted[int]() + >>> g1.add_edge(1, 2, 1) + >>> g1.add_edge(2, 3, 2) + >>> g1.add_edge(3, 4, 1) + >>> g1.add_edge(3, 5, 100) # Removed in MST + >>> g1.add_edge(...
false
false
graphs/minimum_spanning_tree_kruskal2.py
minimum_spanning_tree_kruskal2.py
Python
TheAlgorithms
homeassistant_components_vicare_sensor.py
ViCareSensor.unique_id
[ { "version": "v11", "docstring_lines": { "start_line": 388, "end_line": 390 }, "code_lines": { "start_line": 390, "end_line": 392 }, "commit_date_time": "2021-09-14 20:06:06", "commit_sha": "2b51896d7a433427165ec2486470dfb145591805", "commit_message": "Use Ent...
def unique_id(self): - return f"{self._api.service.id}-{self.entity_description.key}" + tmp_id = ( + f"{self._device_config.getConfig().serial}-{self.entity_description.key}" + ) + if hasattr(self._api, "id"): + return f"{tmp_id}-{self._api.id}" + ...
- Return a unique ID. + Return unique ID for this device.
false
false
homeassistant/components/vicare/sensor.py
sensor.py
core
home-assistant
samcli_lib_utils_resource_trigger.py
ResourceTrigger.get_dir_path_handler
[ { "version": "v1", "docstring_lines": { "start_line": 68, "end_line": 80 }, "code_lines": { "start_line": 80, "end_line": 86 }, "commit_date_time": "2021-10-26 03:35:50", "commit_sha": "ec9f5d89971b823fa01071c96b7de90ea5e5303a", "commit_message": "feat: Accele...
- def get_dir_path_handler(dir_path_str: str) -> PathHandler: + def get_dir_path_handler(dir_path_str: str, ignore_regexes: Optional[List[str]] = None) -> PathHandler: dir_path = Path(dir_path_str).resolve() + + case_sensitive = platform.system().lower() != "windows" + - ...
Get PathHandler for watching a single directory Parameters ---------- dir_path_str : str Folder path in string + ignore_regexes : List[str], Optional + List of regexes that should be ignored Returns ------- PathHandler...
false
false
samcli/lib/utils/resource_trigger.py
resource_trigger.py
aws-sam-cli
aws
samcli_lib_utils_resource_trigger.py
CodeResourceTrigger.__init__
[ { "version": "v2", "docstring_lines": { "start_line": 302, "end_line": 314 }, "code_lines": { "start_line": 314, "end_line": 318 }, "commit_date_time": "2021-11-23 01:00:57", "commit_sha": "06a3218cd061e1206dfd9dda81a58a78119cacde", "commit_message": "fix: Ski...
- def __init__(self, resource_identifier: ResourceIdentifier, stacks: List[Stack], on_code_change: OnChangeCallback): + def __init__( + self, + resource_identifier: ResourceIdentifier, + stacks: List[Stack], + base_dir: Path, + on_code_change: OnChangeCallback, + ): ...
Parameters ---------- resource_identifier : ResourceIdentifier ResourceIdentifier stacks : List[Stack] List of stacks + base_dir: Path + Base directory for the resource. This should be the path to template file in most cases. on_c...
false
false
samcli/lib/utils/resource_trigger.py
resource_trigger.py
aws-sam-cli
aws
samcli_lib_utils_resource_trigger.py
TemplateTrigger.__init__
[ { "version": "v4", "docstring_lines": { "start_line": 110, "end_line": 118 }, "code_lines": { "start_line": 118, "end_line": 122 }, "commit_date_time": "2022-03-17 20:53:42", "commit_sha": "f74698cbd360679940faff03eaf52679419c996d", "commit_message": "feat: Wa...
- def __init__(self, template_file: str, on_template_change: OnChangeCallback) -> None: + def __init__(self, template_file: str, stack_name: str, on_template_change: OnChangeCallback) -> None: ? +++++++++++++++++ super().__init__() ...
Parameters ---------- template_file : str Template file to be watched + stack_name: str + Stack name of the template on_template_change : OnChangeCallback Callback when template changes
false
false
samcli/lib/utils/resource_trigger.py
resource_trigger.py
aws-sam-cli
aws
Lib_textwrap.py
TextWrapper._handle_long_word
[ { "version": "v8", "docstring_lines": { "start_line": 153, "end_line": 165 }, "code_lines": { "start_line": 165, "end_line": 206 }, "commit_date_time": "2002-06-09 00:22:07", "commit_sha": "47df99d57527a9b1a940e87fd4e0164caaf5d029", "commit_message": "Make all...
- def _handle_long_word(self, chunks, cur_line, cur_len, width): ? ------- + def _handle_long_word(self, chunks, cur_line, cur_len): - space_left = width - cur_len + space_left = self.width - cur_len ? +++++...
_handle_long_word(chunks : [string], cur_line : [string], - cur_len : int, width : int) ? ------------- + cur_len : int) Handle a chunk of text (most likely a word, not whitespa...
false
false
Lib/textwrap.py
textwrap.py
cpython
python
Lib_textwrap.py
dedent
[ { "version": "v38", "docstring_lines": { "start_line": 321, "end_line": 341 }, "code_lines": { "start_line": 341, "end_line": 358 }, "commit_date_time": "2005-07-15 06:53:35", "commit_sha": "8bfa8935ea2fc645e5f166f180c2ba18cf11ade3", "commit_message": "textwra...
def dedent(text): - lines = text.expandtabs().split('\n') + # Look for the longest leading string of spaces and tabs common to + # all lines. margin = None + text = _whitespace_only_re.sub('', text) + indents = _leading_whitespace_re.findall(text) - for line in lines: ? ...
- dedent(text : string) -> string + Remove any common leading whitespace from every line in `text`. - Remove any whitespace than can be uniformly removed from the left - of every line in `text`. + This can be used to make triple-quoted strings line up with the left + edge of the display, while still ...
false
false
Lib/textwrap.py
textwrap.py
cpython
python
Lib_textwrap.py
TextWrapper._split
[ { "version": "v54", "docstring_lines": { "start_line": 122, "end_line": 132 }, "code_lines": { "start_line": 132, "end_line": 135 }, "commit_date_time": "2008-05-04 22:42:01", "commit_sha": "81ee3efededdaba0a7c0b1a3aac07727cebb6fc1", "commit_message": "Merged ...
def _split(self, text): + if self.break_on_hyphens is True: - chunks = self.wordsep_re.split(text) + chunks = self.wordsep_re.split(text) ? ++++ - chunks = [c for c in chunks if c] + else: + chunks = self.wordsep_simple_re.split(text) + ...
_split(text : string) -> [string] Split the text to wrap into indivisible chunks. Chunks are not quite the same as words; see wrap_chunks() for full details. As an example, the text Look, goof-ball -- use the -b option! breaks into the following chunks: ...
false
false
Lib/textwrap.py
textwrap.py
cpython
python
Lib_numbers.py
Complex.__truediv__
[ { "version": "v32", "docstring_lines": { "start_line": 305, "end_line": 307 }, "code_lines": { "start_line": 307, "end_line": 309 }, "commit_date_time": "2010-12-23 22:22:48", "commit_sha": "5b859950d178fd8a900764be8c8087b25cfd6bad", "commit_message": "Merged ...
def __truediv__(self, other): - raise NotImplementedError
- self / other with __future__ division. - - Should promote to float when necessary. ? ^^^^^^^ + self / other: Should promote to float when necessary. ? ^^^^^^^^^^^^^
false
false
Lib/numbers.py
numbers.py
cpython
python
Lib_numbers.py
Integral.__float__
[ { "version": "v6", "docstring_lines": { "start_line": 378, "end_line": 380 }, "code_lines": { "start_line": 380, "end_line": 382 }, "commit_date_time": "2008-01-15 07:46:24", "commit_sha": "d7b00334f3cbf7a802e875238b9f2bd95e190436", "commit_message": "Add rati...
def __float__(self): - return float(long(self)) ? ^^ ^ + return float(int(self)) ? ^ ^
- float(self) == float(long(self)) ? ^^ ^ + float(self) == float(int(self)) ? ^ ^
false
false
Lib/numbers.py
numbers.py
cpython
python
research_object_detection_models_keras_models_hourglass_network.py
HourglassNetwork.__init__
[ { "version": "v3", "docstring_lines": { "start_line": 289, "end_line": 304 }, "code_lines": { "start_line": 304, "end_line": 343 }, "commit_date_time": "2020-09-10 19:30:06", "commit_sha": "9d2a72427abd58c599f8ee58791c887ea9f8ca84", "commit_message": "Support ...
def __init__(self, num_stages, channel_dims, blocks_per_stage, - num_hourglasses): + num_hourglasses, downsample=True): ? +++++++++++++++++ super(HourglassNetwork, self).__init__() self.num_hourglasses = num_hourglasses + ...
Intializes the feature extractor. Args: num_stages: int, Number of stages in the network. At each stage we have 2 encoder and 1 decoder blocks. The second encoder block downsamples the input. channel_dims: int list, the output channel dimensions of stages in the ...
false
false
research/object_detection/models/keras_models/hourglass_network.py
hourglass_network.py
models
tensorflow
research_object_detection_models_keras_models_hourglass_network.py
EncoderDecoderBlock.__init__
[ { "version": "v5", "docstring_lines": { "start_line": 267, "end_line": 269 }, "code_lines": { "start_line": 269, "end_line": 269 }, "commit_date_time": "2020-09-11 16:53:31", "commit_sha": "3bac1426bf9319d8b44a1df79f7890c6a591b95b", "commit_message": "Fixes an...
- def __init__(self, num_stages, channel_dims, blocks_per_stage): ? ^^ + def __init__(self, num_stages, channel_dims, blocks_per_stage, ? ^ + stagewise_downsample=True, encoder_deco...
Initializes the encoder-decoder block. Args: num_stages: int, Number of stages in the network. At each stage we have 2 encoder and 1 decoder blocks. The second encoder block downsamples the input. channel_dims: int list, the output channels dimensions of stages in ...
false
false
research/object_detection/models/keras_models/hourglass_network.py
hourglass_network.py
models
tensorflow
chainer_training_extensions_value_observation.py
observe_lr
[ { "version": "v3", "docstring_lines": { "start_line": 37, "end_line": 46 }, "code_lines": { "start_line": 46, "end_line": 47 }, "commit_date_time": "2016-08-24 15:53:53", "commit_sha": "ce380319562eb94e252c74de7b6b1ac18a357466", "commit_message": "Add links fo...
- def observe_lr(optimizer, key='lr'): + def observe_lr(optimizer_name='main', observation_key='lr'): ? ++++++++++++ ++++++++++++ - return observe_value(key, lambda _: optimizer.lr) + return observe_value( + observation_key, + lambda trainer: trainer.updat...
Returns a trainer extension to record the learning rate. Args: - optimizer (~chainer.Optimizer): Optimizer object whose learning rate is recorded. - key (str): Key of observation to record. + optimizer_name (str): Name of optimizer whose learning rate is + recorded. + ...
false
false
chainer/training/extensions/value_observation.py
value_observation.py
chainer
chainer
speechbrain_processing_multi_mic.py
Mvdr._mvdr
[ { "version": "v54", "docstring_lines": { "start_line": 442, "end_line": 458 }, "code_lines": { "start_line": 458, "end_line": 504 }, "commit_date_time": "2021-10-27 14:07:33", "commit_sha": "64fe76a74a48362907ed0c451ab86b34d02a4c00", "commit_message": "updates...
- def _mvdr(Xs, XXs, As, eps=1e-20): ? ^^ + def _mvdr(Xs, NNs, As, eps=1e-20): ? ^^ # Get unique covariance values to reduce the number of computations - XXs_val, XXs_idx = torch.unique(XXs, return_inverse=True, dim=1) ? ^^ ^^ ...
Perform minimum variance distortionless response beamforming. Arguments --------- Xs : tensor A batch of audio signals in the frequency domain. The tensor must have the following format: (batch, time_step, n_fft/2 + 1, 2, n_mics). - XX...
false
false
speechbrain/processing/multi_mic.py
multi_mic.py
speechbrain
speechbrain
python_ray__private_runtime_env_packaging.py
delete_package
[ { "version": "v14", "docstring_lines": { "start_line": 574, "end_line": 581 }, "code_lines": { "start_line": 581, "end_line": 605 }, "commit_date_time": "2022-02-01 20:33:53", "commit_sha": "8d43a6bac741073abe762387040c22388f4fd794", "commit_message": "[Serve]...
- def delete_package(pkg_uri: str, base_directory: str) -> bool: + def delete_package(pkg_uri: str, base_directory: str) -> Tuple[bool, int]: ? ++++++ ++++++ deleted = False path = Path(_get_local_path(base_directory, pkg_uri)) ...
Deletes a specific URI from the local filesystem. Args: pkg_uri (str): URI to delete. Returns: - True if the URI was successfully deleted, else False. + bool: True if the URI was successfully deleted, else False. ? ++++++
false
false
python/ray/_private/runtime_env/packaging.py
packaging.py
ray
ray-project
python_ray__private_runtime_env_packaging.py
parse_uri
[ { "version": "v46", "docstring_lines": { "start_line": 865, "end_line": 873 }, "code_lines": { "start_line": 873, "end_line": 886 }, "commit_date_time": "2023-05-26 02:02:26", "commit_sha": "f526d0c5db5c9b80848ac2f8ea3367ba3caf7cad", "commit_message": "[Core] ...
def parse_uri(pkg_uri: str) -> Tuple[Protocol, str]: + uri = urlparse(pkg_uri) try: protocol = Protocol(uri.scheme) except ValueError as e: raise ValueError( f'Invalid protocol for runtime_env URI "{pkg_uri}". ' f"Supported protoc...
Parse package uri into protocol and package name based on its format. Note that the output of this function is not for handling actual IO, it's only for setting up local directory folders by using package name as path. >>> parse_uri("https://test.com/file.zip") (<Protocol.HTTPS: 'https'>, '...
false
false
python/ray/_private/runtime_env/packaging.py
packaging.py
ray
ray-project
tools_sort_sort.py
Sort.estimate_blur
[ { "version": "v47", "docstring_lines": { "start_line": 679, "end_line": 683 }, "code_lines": { "start_line": 683, "end_line": 689 }, "commit_date_time": "2021-03-23 16:50:37", "commit_sha": "2bcb7d572ac8fdacceb56d5cbd5b05fad8c71e5e", "commit_message": "tools.s...
- def estimate_blur(image): + def estimate_blur(cls, image, metadata=None): + - - + if metadata is not None: + alignments = metadata["alignments"] + det_face = DetectedFace() + det_face.from_png_meta(alignments) + aln_face = ...
Estimate the amount of blur an image has with the variance of the Laplacian. - Normalize by pixel number to offset the effect of image size on pixel gradients & variance + Normalize by pixel number to offset the effect of image size on pixel gradients & variance. ? ...
false
false
tools/sort/sort.py
sort.py
faceswap
deepfakes
cura_API_Account.py
Account.setSyncState
[ { "version": "v44", "docstring_lines": { "start_line": 34, "end_line": 36 }, "code_lines": { "start_line": 36, "end_line": 48 }, "commit_date_time": "2020-05-06 14:08:47", "commit_sha": "8937c63219dd61ec4ae16e77f4610bdaa761cfa3", "commit_message": "Finish merg...
def setSyncState(self, service_name: str, state: SyncState) -> None: prev_state = self._sync_state self._sync_services[service_name] = state - if any(val == self.SyncState.SYNCING for val in self._sync_services.values()): ? ----- + ...
Can be used to register sync services and update account sync states - Example: `setSyncState("PluginSyncService", Account.SyncState.SYNCING)` ? -------- + Example: `setSyncState("PluginSyncService", SyncState.SYNCING)` :param service_n...
false
false
cura/API/Account.py
Account.py
Cura
Ultimaker
cura_API_Account.py
Account.sync
[ { "version": "v47", "docstring_lines": { "start_line": 194, "end_line": 196 }, "code_lines": { "start_line": 196, "end_line": 199 }, "commit_date_time": "2020-05-12 09:23:14", "commit_sha": "8e75da552dd0b0cb32962f0dac1a37506d5dc4ea", "commit_message": "Do not ...
def sync(self) -> None: + + if self._update_timer.isActive(): + self._update_timer.stop() self.syncRequested.emit()
- Checks for new cloud printers + Signals all sync services to start syncing + + This can be considered a forced sync: even when a + sync is currently running, a sync will be requested.
false
false
cura/API/Account.py
Account.py
Cura
Ultimaker
mrcnn_model.py
MaskRCNN.find_last
[ { "version": "v74", "docstring_lines": { "start_line": 2062, "end_line": 2068 }, "code_lines": { "start_line": 2068, "end_line": 2085 }, "commit_date_time": "2018-06-05 09:20:28", "commit_sha": "398b86de9e6aa43bf1c91cc1c816ba0c416d4eab", "commit_message": "All...
def find_last(self): # Get directory names. Each directory corresponds to a model dir_names = next(os.walk(self.model_dir))[1] key = self.config.NAME.lower() dir_names = filter(lambda f: f.startswith(key), dir_names) dir_names = sorted(dir_names)...
Finds the last checkpoint file of the last trained model in the model directory. Returns: + The path of the last checkpoint file - log_dir: The directory where events and weights are saved - checkpoint_path: the path to the last checkpoint file
false
false
mrcnn/model.py
model.py
Mask_RCNN
matterport
samcli_commands__utils_table_print.py
pprint_columns
[ { "version": "v3", "docstring_lines": { "start_line": 79, "end_line": 88 }, "code_lines": { "start_line": 88, "end_line": 91 }, "commit_date_time": "2019-11-23 01:06:50", "commit_sha": "8af88172853c064f40e89534e5a929d3fbf0baba", "commit_message": "fix: usabili...
- def pprint_columns(columns, width, margin, format_string, format_args, columns_dict, color="yellow"): + def pprint_columns(columns, width, margin, format_string, format_args, columns_dict, color="yellow", **textwrap_kwargs): ? ...
Print columns based on list of columnar text, associated formatting string and associated format arguments. :param columns: list of columnnar text that go into columns as specified by the format_string :param width: width of the text to be wrapped :param margin: margin to be reduced from width fo...
false
false
samcli/commands/_utils/table_print.py
table_print.py
aws-sam-cli
aws
lib_image.py
count_frames_and_secs
[ { "version": "v5", "docstring_lines": { "start_line": 27, "end_line": 55 }, "code_lines": { "start_line": 55, "end_line": 84 }, "commit_date_time": "2019-10-23 18:34:27", "commit_sha": "86dda1212c5089ae1af8191a93266bddc884243f", "commit_message": "Revert lib.i...
def count_frames_and_secs(filename, timeout=90): # https://stackoverflow.com/questions/2017843/fetch-frame-count-with-ffmpeg assert isinstance(filename, str), "Video path must be a string" exe = im_ffm.get_ffmpeg_exe() iswin = sys.platform.startswith("win") logger.debug...
Count the number of frames and seconds in a video file. Adapted From :mod:`ffmpeg_imageio` to handle the issue of ffmpeg occasionally hanging - inside a subprocess. + inside a sub-process. ? + If the operation times out then the process will try to read the data again, up to...
false
false
lib/image.py
image.py
faceswap
deepfakes
lib_image.py
FacesLoader._from_folder
[ { "version": "v27", "docstring_lines": { "start_line": 1024, "end_line": 1037 }, "code_lines": { "start_line": 1037, "end_line": 1049 }, "commit_date_time": "2020-12-15 12:11:26", "commit_sha": "d392dfbdf7df617a26e64b6f57b440654608ba1f", "commit_message": "Bug...
def _from_folder(self): logger.debug("Loading images from folder: '%s'", self.location) for idx, filename in enumerate(self.file_list): if idx in self._skip_list: logger.trace("Skipping face %s due to skip list") continue - ...
Generator for loading images from a folder Faces will only ever be loaded from a folder, so this is the only function requiring an override Yields ------ filename: str The filename of the loaded image. image: numpy.ndarray The ...
false
false
lib/image.py
image.py
faceswap
deepfakes
lib_image.py
count_frames
[ { "version": "v7", "docstring_lines": { "start_line": 266, "end_line": 282 }, "code_lines": { "start_line": 282, "end_line": 325 }, "commit_date_time": "2019-10-31 01:45:27", "commit_sha": "b1dd0dbdc5c9a517cb6e89e50cce749e86927d2c", "commit_message": "bugfix: ...
- def count_frames(filename): + def count_frames(filename, fast=False): ? ++++++++++++ assert isinstance(filename, str), "Video path must be a string" - cmd = [im_ffm.get_ffmpeg_exe(), "-i", filename, "-map", "0:v:0", "-f", "null", "-"] ? ...
Count the number of frames in a video file - Unfortunately there is no guaranteed accurate way to get a count of video frames ? ^^^^^^^^^^^^^^^ + There is no guaranteed accurate way to get a count of video frames without iterating through ? ^ ...
false
false
lib/image.py
image.py
faceswap
deepfakes
lib_image.py
ImagesLoader._from_folder
[ { "version": "v19", "docstring_lines": { "start_line": 644, "end_line": 657 }, "code_lines": { "start_line": 657, "end_line": 672 }, "commit_date_time": "2020-01-25 19:33:50", "commit_sha": "ca4060f45fee4811919ccd31cd2b09e9e4324ec4", "commit_message": "lib.ima...
def _from_folder(self): - with_hash = self._args[0] - logger.debug("Loading images from folder: '%s'. with_hash: %s", self.location, with_hash) ? ^ -- --------------- ----------- + logger.debug("Loading fra...
Generator for loading images from a folder Yields ------ filename: str The filename of the loaded image. image: numpy.ndarray The loaded image. - sha1_hash: str, optional - The sha1 hash of the loaded image. Only yielded if :cl...
false
false
lib/image.py
image.py
faceswap
deepfakes
lib_image.py
ImagesSaver._save
[ { "version": "v46", "docstring_lines": { "start_line": 1409, "end_line": 1416 }, "code_lines": { "start_line": 1416, "end_line": 1425 }, "commit_date_time": "2022-09-18 23:13:41", "commit_sha": "f5fa5b43370f6641481928b378f079e2a0119249", "commit_message": "Ext...
- def _save(self, filename: str, image: bytes, sub_folder: Optional[str]) -> None: + def _save(self, + filename: str, + image: Union[bytes, np.ndarray], + sub_folder: Optional[str]) -> None: location = os.path.join(self.location, sub_folder) if ...
Save a single image inside a ThreadPoolExecutor Parameters ---------- filename: str The filename of the image to be saved. NB: Any folders passed in with the filename will be stripped and replaced with :attr:`location`. - image: bytes + imag...
false
false
lib/image.py
image.py
faceswap
deepfakes
lib_image.py
read_image_batch
[ { "version": "v17", "docstring_lines": { "start_line": 152, "end_line": 179 }, "code_lines": { "start_line": 179, "end_line": 189 }, "commit_date_time": "2019-12-08 10:54:26", "commit_sha": "ac1cf8fbe9c1e09f014bbceadb9c9d52814f0e94", "commit_message": "lib.ali...
def read_image_batch(filenames): logger.trace("Requested batch: '%s'", filenames) executor = futures.ThreadPoolExecutor() with executor: - images = [executor.submit(read_image, filename, raise_error=True) ? ^ + images = {executor.submit(read_image, fi...
Load a batch of images from the given file locations. Leverages multi-threading to load multiple images from disk at the same time leading to vastly reduced image read times. + + Notes + ----- + Images are loaded concurrently, so the order of the returned batch will likely not be the same ...
false
false
lib/image.py
image.py
faceswap
deepfakes
lib_image.py
ImagesLoader._dummy_video_framename
[ { "version": "v59", "docstring_lines": { "start_line": 1256, "end_line": 1271 }, "code_lines": { "start_line": 1271, "end_line": 1273 }, "commit_date_time": "2024-04-03 14:14:32", "commit_sha": "70c064ca7d7f592eb94f3ff0cb17cab4d0a9de70", "commit_message": "Min...
def _dummy_video_framename(self, index): - vidname = os.path.splitext(os.path.basename(self.location))[0] ? --- + vidname, ext = os.path.splitext(os.path.basename(self.location)) ? +++++ - return "...
- Return a dummy filename for video files + Return a dummy filename for video files. The file name is made up of: + <video_filename>_<frame_number>.<video_extension> Parameters ---------- index: int The index number for the frame in the video file Note...
false
false
lib/image.py
image.py
faceswap
deepfakes
lib_image.py
read_image_hash
[ { "version": "v26", "docstring_lines": { "start_line": 343, "end_line": 359 }, "code_lines": { "start_line": 359, "end_line": 364 }, "commit_date_time": "2020-12-08 01:31:56", "commit_sha": "05018f6119b4f90b91d18203e6bcd39868b0b662", "commit_message": "Extract...
- def read_image_hash(filename): + def read_image_hash(filename, output_shape=False): ? ++++++++++++++++++++ img = read_image(filename, raise_error=True) - image_hash = sha1(img).hexdigest() ? ^^ ^^^^^^^ + retval = sha1(img).hexdigest() ? ^^^^ ^ + ...
Return the `sha1` hash of an image saved on disk. Parameters ---------- filename: str Full path to the image to be loaded. + output_shape: bool + If ``True`` then a tuple is returned with the shape tuple of the image as the final value. + Default: ``False`` ...
false
false
lib/image.py
image.py
faceswap
deepfakes
lib_image.py
encode_image
[ { "version": "v54", "docstring_lines": { "start_line": 620, "end_line": 638 }, "code_lines": { "start_line": 638, "end_line": 655 }, "commit_date_time": "2023-09-01 21:36:31", "commit_sha": "8388241db9bff56b5dcb19d643916402ba200a84", "commit_message": "bugfix:...
def encode_image(image: np.ndarray, extension: str, + encoding_args: tuple[int, ...] | None = None, - metadata: PNGHeaderDict | None = None) -> bytes: + metadata: PNGHeaderDict | dict[str, T.Any] | bytes | None = None) -> bytes: ? ...
Encode an image. Parameters ---------- image: numpy.ndarray The image to be encoded in `BGR` channel order. extension: str A compatible `cv2` image file extension that the final image is to be saved to. + encoding_args: tuple[int, ...], optional + Any encodin...
false
false
lib/image.py
image.py
faceswap
deepfakes
speechbrain_processing_NMF.py
NMF_separate_spectra
[ { "version": "v20", "docstring_lines": { "start_line": 12, "end_line": 25 }, "code_lines": { "start_line": 25, "end_line": 30 }, "commit_date_time": "2021-10-27 14:07:33", "commit_sha": "64fe76a74a48362907ed0c451ab86b34d02a4c00", "commit_message": "updates", ...
def NMF_separate_spectra(Whats, Xmix): - W1, W2 = Whats nmixtures = Xmix.shape[0] Xmix = Xmix.permute(0, 2, 1).reshape(-1, Xmix.size(-1)).t() n = Xmix.shape[1] eps = 1e-20 # Normalize input g = Xmix.sum(dim=0) + eps z = Xmix / g # initializ...
This function separates the mixture signals, given NMF template matrices. Arguments --------- Whats : list This list contains the list [W1, W2], where W1 W2 are respectively the NMF template matrices that correspond to source1 and source2. W1, W2 are of size [nfft/2 ...
false
false
speechbrain/processing/NMF.py
NMF.py
speechbrain
speechbrain
speechbrain_processing_NMF.py
reconstruct_results
[ { "version": "v13", "docstring_lines": { "start_line": 106, "end_line": 150 }, "code_lines": { "start_line": 150, "end_line": 190 }, "commit_date_time": "2020-08-12 20:47:14", "commit_sha": "ecd72f6e9d8f9b9331f0716ef3b33004ebb4a52a", "commit_message": "Modify ...
def reconstruct_results( X1hat, X2hat, X_stft, sample_rate, win_length, hop_length, ): - ISTFT = spf.ISTFT( sample_rate=sample_rate, win_length=win_length, hop_length=hop_length ) phase_mix = spectral_phase(X_stft) mag_mix = spectral_magnitude(X_stft, ...
This function reconstructs the separated spectra into waveforms. Arguments --------- Xhat1 : torch.tensor The separated spectrum for source 1 of size [BS, nfft/2 + 1, T], where, BS = batch size, nfft = fft size, T = length of the spectra. Xhat2 : torch.tensor ...
false
false
speechbrain/processing/NMF.py
NMF.py
speechbrain
speechbrain
lib_gui_custom_widgets.py
StatusBar._status
[ { "version": "v1", "docstring_lines": { "start_line": 392, "end_line": 394 }, "code_lines": { "start_line": 394, "end_line": 405 }, "commit_date_time": "2019-11-22 19:20:23", "commit_sha": "9c588045aaac0efbdcf29ec11a8005c5e98ec650", "commit_message": "GUI Upda...
- def _status(self): + def _status(self, hide_status): - ? - + + + if hide_status: + return + statusframe = ttk.Frame(self) statusframe.pack(side=tk.LEFT, anchor=tk.W, fill=tk.X, expand=False) lbltitle = ttk.Label(statusframe,...
Place Status label into left of the status bar. + + Parameters + ---------- + hide_status: bool, optional + ``True`` to hide the status message that appears at the far left hand side of the + status frame otherwise ``False``
false
false
lib/gui/custom_widgets.py
custom_widgets.py
faceswap
deepfakes
lib_gui_custom_widgets.py
StatusBar._progress_bar
[ { "version": "v20", "docstring_lines": { "start_line": 510, "end_line": 512 }, "code_lines": { "start_line": 512, "end_line": 519 }, "commit_date_time": "2022-10-17 17:14:04", "commit_sha": "dab823a3eb7a5257cb1e0818ee10ed234d3de97f", "commit_message": "Typing ...
- def _progress_bar(self): + def _progress_bar(self) -> ttk.Progressbar: - ? - + + progressframe = ttk.Frame(self._frame) progressframe.pack(side=tk.RIGHT, anchor=tk.E, fill=tk.X) lblmessage = ttk.Label(progressframe, textvariable=self._pbar_messa...
Place progress bar into right of the status bar. + + Returns + ------- + :class:`tkinter.ttk.Progressbar` + The progress bar object
false
false
lib/gui/custom_widgets.py
custom_widgets.py
faceswap
deepfakes
mycroft_skills_intent_service.py
IntentService.get_skill_name
[ { "version": "v38", "docstring_lines": { "start_line": 261, "end_line": 264 }, "code_lines": { "start_line": 264, "end_line": 295 }, "commit_date_time": "2018-01-09 00:01:03", "commit_sha": "f88acdb60fea86f453d0663fce29b4c013e5a237", "commit_message": "Fix con...
def get_skill_name(self, skill_id): - ? ---- + return self.skill_names.get(int(skill_id), skill_id)
Get skill name from skill ID. - Args ? ---- + Args: ? + - skill_id: a skill id as encoded in Intent handlers. ? ---- + skill_id: a skill id as encoded in Intent handlers. - Returns: (str) Skill name or the skill id if the skill ? ---- +...
false
false
mycroft/skills/intent_service.py
intent_service.py
mycroft-core
MycroftAI
mycroft_skills_intent_service.py
IntentService.handle_utterance
[ { "version": "v54", "docstring_lines": { "start_line": 296, "end_line": 311 }, "code_lines": { "start_line": 311, "end_line": 349 }, "commit_date_time": "2019-03-14 09:57:31", "commit_sha": "44f60ec6f3e869f425b2c505e7ba4e3362ca2d42", "commit_message": "Change ...
def handle_utterance(self, message): try: # Get language of the utterance lang = message.data.get('lang', "en-us") - set_active_lang(lang) utterances = message.data.get('utterances', '') stopwatch = Stopwatch() ...
Main entrypoint for handling user utterances with Mycroft skills Monitor the messagebus for 'recognizer_loop:utterance', typically generated by a spoken interaction but potentially also from a CLI or other method of injecting a 'user utterance' into the system. Utterances...
false
false
mycroft/skills/intent_service.py
intent_service.py
mycroft-core
MycroftAI
mycroft_skills_intent_service.py
IntentService._converse
[ { "version": "v82", "docstring_lines": { "start_line": 157, "end_line": 161 }, "code_lines": { "start_line": 161, "end_line": 173 }, "commit_date_time": "2020-08-13 06:12:53", "commit_sha": "4c87bc23d4e7bf38179ed562dec0fc73d13bc332", "commit_message": "Move pa...
def _converse(self, utterances, lang, message): - # check for conversation time-out self.active_skills = [skill for skill in self.active_skills if time.time() - skill[ 1] <= self.converse_timeout * 60] ...
Give active skills a chance at the utterance - Args: + Arguments: ? +++++ utterances (list): list of utterances lang (string): 4 letter ISO language code message (Message): message to use to generate reply Returns: - ...
false
false
mycroft/skills/intent_service.py
intent_service.py
mycroft-core
MycroftAI
mycroft_skills_intent_service.py
IntentService.parse_utterances
[ { "version": "v37", "docstring_lines": { "start_line": 288, "end_line": 302 }, "code_lines": { "start_line": 302, "end_line": 339 }, "commit_date_time": "2018-01-09 00:01:03", "commit_sha": "936bd54180273d08b34f24b5b106c74a6a740547", "commit_message": "Add a f...
def parse_utterances(self, utterances, lang): - # check for conversation time-out - self.active_skills = [skill for skill in self.active_skills - if time.time() - skill[ - 1] <= self.converse_timeout *...
+ Parse the utteracne using adapt to find a matching intent. - Parse the utteracne using adapt. The process has two stages - - Stage 1: Converse, check if a recently invoked skill wants to - handle the utterance and override normal adapt handling. - - Stage 2: Parse the s...
false
false
mycroft/skills/intent_service.py
intent_service.py
mycroft-core
MycroftAI
mycroft_audio_audioservice.py
AudioService.track_start
[ { "version": "v54", "docstring_lines": { "start_line": 196, "end_line": 200 }, "code_lines": { "start_line": 200, "end_line": 202 }, "commit_date_time": "2020-01-15 08:06:50", "commit_sha": "e74b0e3900b8391dd9b075a7fa098b37e74e31ba", "commit_message": "Add aud...
def track_start(self, track): - + if track: + # Inform about the track about to start. + LOG.debug('New track coming up!') - self.bus.emit(Message('mycroft.audio.playing_track', + self.bus.emit(Message('mycroft.audio.playing_track'...
Callback method called from the services to indicate start of - playback of a track. + playback of a track or end of playlist.
false
false
mycroft/audio/audioservice.py
audioservice.py
mycroft-core
MycroftAI