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_ray_data__internal_plan.py
ExecutionPlan.deep_copy
[ { "version": "v84", "docstring_lines": { "start_line": 327, "end_line": 337 }, "code_lines": { "start_line": 337, "end_line": 356 }, "commit_date_time": "2023-10-16 21:16:33", "commit_sha": "0c06bb9894687873d450598872b2c2767ebd703e", "commit_message": "[data] ...
- def deep_copy(self, preserve_uuid: bool = False) -> "ExecutionPlan": + def deep_copy(self) -> "ExecutionPlan": - dataset_uuid = None - if preserve_uuid: - dataset_uuid = self._dataset_uuid in_blocks = self._in_blocks if isinstance(in_blocks, BlockL...
Create a deep copy of this execution plan. This copy can be executed AND cleared without mutating the original. - Args: - preserve_uuid: Whether to preserve the original UUID in the copy. - Returns: A deep copy of this execution plan.
false
false
python/ray/data/_internal/plan.py
plan.py
ray
ray-project
glances_outputs_glances_bars.py
Bar.__str__
[ { "version": "v10", "docstring_lines": { "start_line": 76, "end_line": 78 }, "code_lines": { "start_line": 78, "end_line": 87 }, "commit_date_time": "2015-02-26 11:57:55", "commit_sha": "0f083d215a3c49c11adc213e5851e72eef55ef91", "commit_message": "Do not retu...
def __str__(self): - frac, whole = modf(self.get_size() * self.get_percent() / 100.0) ? ---- -- ---- -- + frac, whole = modf(self.size * self.percent / 100.0) ret = curses_bars[8] * int(whole) if frac > 0: re...
- Return the bars + Return the bars. ? +
false
false
glances/outputs/glances_bars.py
glances_bars.py
glances
nicolargo
jina_orchestrate_flow_base.py
Flow.to_docker_compose_yaml
[ { "version": "v363", "docstring_lines": { "start_line": 1808, "end_line": 1817 }, "code_lines": { "start_line": 1817, "end_line": 1821 }, "commit_date_time": "2022-04-11 13:24:14", "commit_sha": "f45a6e9cda3481851db6a7c37f702e41a9c10a28", "commit_message": "fe...
def to_docker_compose_yaml( self, output_path: Optional[str] = None, network_name: Optional[str] = None, + include_gateway: bool = True, ): import yaml if self._build_level.value < FlowBuildLevel.GRAPH.value: ...
Converts the Flow into a yaml file to run with `docker-compose up` :param output_path: The output path for the yaml file :param network_name: The name of the network that will be used by the deployment name + :param include_gateway: Defines if the gateway deployment should be included, def...
false
false
jina/orchestrate/flow/base.py
base.py
jina
jina-ai
jina_orchestrate_flow_base.py
Flow.build
[ { "version": "v481", "docstring_lines": { "start_line": 1663, "end_line": 1691 }, "code_lines": { "start_line": 1691, "end_line": 1771 }, "commit_date_time": "2023-07-13 18:54:18", "commit_sha": "871a5f2e2998e8127f8d5f6f567588a680f5598e", "commit_message": "fi...
+ def build(self, copy_flow: bool = False, **kwargs) -> 'Flow': - def build( - self, copy_flow: bool = False, disable_build_sandbox: bool = False - ) -> 'Flow': if multiprocessing.get_start_method().lower() == 'fork': os.environ['GRPC_ENABLE_FORK_SUPP...
Build the current Flow and make it ready to use .. note:: No need to manually call it since 0.0.8. When using Flow with the context manager, or using :meth:`start`, :meth:`build` will be invoked. :param copy_flow: when set to true, then always copy the current ...
false
false
jina/orchestrate/flow/base.py
base.py
jina
jina-ai
jina_orchestrate_flow_base.py
Flow.add
[ { "version": "v455", "docstring_lines": { "start_line": 357, "end_line": 507 }, "code_lines": { "start_line": 507, "end_line": 527 }, "commit_date_time": "2023-01-31 17:04:43", "commit_sha": "18b5b4123e4e04cc96b47dc615d41fd6862204e2", "commit_message": "Open r...
def add( self, **kwargs, ) -> Union['Flow', 'AsyncFlow']: # implementation_stub_inject_start_add # implementation_stub_inject_end_add needs = kwargs.pop('needs', None) copy_flow = kwargs.pop('copy_flow', True) depl...
Add a Deployment to the current Flow object and return the new modified Flow object. The attribute of the Deployment can be later changed with :py:meth:`set` or deleted with :py:meth:`remove` :param compression: The compression mechanism used when sending requests from the Head to the WorkerRun...
false
false
jina/orchestrate/flow/base.py
base.py
jina
jina-ai
skimage_filters_ridges.py
compute_hessian_eigenvalues
[ { "version": "v11", "docstring_lines": { "start_line": 53, "end_line": 72 }, "code_lines": { "start_line": 72, "end_line": 82 }, "commit_date_time": "2019-09-01 10:24:40", "commit_sha": "379f981ef28c23b7278facb899765250e5fea265", "commit_message": "Update skim...
- def compute_hessian_eigenvalues(image, sigma, sorting='none'): ? ^^ + def compute_hessian_eigenvalues(image, sigma, sorting='none', ? ^ + mode='constant', cval=0): ...
Compute Hessian eigenvalues of nD images. For 2D images, the computation uses a more efficient, skimage-based algorithm. Parameters ---------- image : (N, ..., M) ndarray Array with input image data. sigma : float Smoothing factor of image for detection of...
false
false
skimage/filters/ridges.py
ridges.py
scikit-image
scikit-image
skimage_filters_ridges.py
hessian
[ { "version": "v12", "docstring_lines": { "start_line": 144, "end_line": 186 }, "code_lines": { "start_line": 186, "end_line": 238 }, "commit_date_time": "2020-01-14 03:03:22", "commit_sha": "5e45b8f405915f0bf4a3e0213a0a5328a2190385", "commit_message": "Fix Fra...
def hessian(image, sigmas=range(1, 10, 2), scale_range=None, scale_step=None, beta1=None, beta2=None, alpha=0.5, beta=0.5, gamma=15, - black_ridges=True): + black_ridges=True, mode=None, cval=0): ? +++++++++++++++++++ + + if mode i...
Filter an image with the Hybrid Hessian filter. This filter can be used to detect continuous edges, e.g. vessels, wrinkles, rivers. It can be used to calculate the fraction of the whole image containing such objects. Defined only for 2-D and 3-D images. Almost equal to Frangi filter, but...
false
false
skimage/filters/ridges.py
ridges.py
scikit-image
scikit-image
skimage_filters_ridges.py
frangi
[ { "version": "v13", "docstring_lines": { "start_line": 509, "end_line": 569 }, "code_lines": { "start_line": 569, "end_line": 585 }, "commit_date_time": "2020-01-23 08:56:33", "commit_sha": "b46a4961157510eb395028cd9b6cf8739cedb7c2", "commit_message": "Add bor...
def frangi(image, sigmas=range(1, 10, 2), scale_range=None, - scale_step=None, beta1=None, beta2=None, alpha=0.5, + scale_step=None, alpha=0.5, beta=0.5, gamma=15, - beta=0.5, gamma=15, black_ridges=True, mode='reflect', ? -------------------- + black_ridges=True...
Filter an image with the Frangi vesselness filter. This filter can be used to detect continuous ridges, e.g. vessels, wrinkles, rivers. It can be used to calculate the fraction of the whole image containing such objects. Defined only for 2-D and 3-D images. Calculates the eigenvectors of...
false
false
skimage/filters/ridges.py
ridges.py
scikit-image
scikit-image
skimage_morphology_convex_hull.py
convex_hull_object
[ { "version": "v52", "docstring_lines": { "start_line": 97, "end_line": 134 }, "code_lines": { "start_line": 134, "end_line": 165 }, "commit_date_time": "2019-08-25 18:32:57", "commit_sha": "9ce31f7b61bd03877727ebf0ea94fd1505da61e7", "commit_message": "Deprecat...
- def convex_hull_object(image, neighbors=None, *, connectivity=None): ? ---------------- ^^^^ + def convex_hull_object(image, *, connectivity=2): ? ^ if image.ndim > 2: raise ValueError("Input mus...
r"""Compute the convex hull image of individual objects in a binary image. The convex hull is the set of pixels included in the smallest convex polygon that surround all white pixels in the input image. Parameters ---------- image : (M, N) ndarray Binary input image. - ...
false
false
skimage/morphology/convex_hull.py
convex_hull.py
scikit-image
scikit-image
skimage_morphology_convex_hull.py
convex_hull_image
[ { "version": "v56", "docstring_lines": { "start_line": 29, "end_line": 60 }, "code_lines": { "start_line": 60, "end_line": 79 }, "commit_date_time": "2021-11-11 00:21:41", "commit_sha": "fd500111da6842c1ffe7dd75259384ed4ac8bfee", "commit_message": "catch Qhull...
- def convex_hull_image(image, offset_coordinates=True, tolerance=1e-10): ? ^^ + def convex_hull_image(image, offset_coordinates=True, tolerance=1e-10, ? ^ + ...
Compute the convex hull image of a binary image. The convex hull is the set of pixels included in the smallest convex polygon that surround all white pixels in the input image. Parameters ---------- image : array Binary input image. This array is cast to bool before proce...
false
false
skimage/morphology/convex_hull.py
convex_hull.py
scikit-image
scikit-image
sklearn_cluster__bisect_k_means.py
BisectingKMeans._predict_recursive
[ { "version": "v5", "docstring_lines": { "start_line": 473, "end_line": 495 }, "code_lines": { "start_line": 495, "end_line": 526 }, "commit_date_time": "2022-08-30 09:01:10", "commit_sha": "02ebf9e68fe1fc7687d9e1047b9e465ae0fd945e", "commit_message": "MNT Adds...
- def _predict_recursive(self, X, x_squared_norms, sample_weight, cluster_node): ? ----------------- + def _predict_recursive(self, X, sample_weight, cluster_node): if cluster_node.left is None: # This cluster has no subcluster. Labels are ju...
Predict recursively by going down the hierarchical tree. Parameters ---------- X : {ndarray, csr_matrix} of shape (n_samples, n_features) The data points, currently assigned to `cluster_node`, to predict between the subclusters of this node. - - x_...
false
false
sklearn/cluster/_bisect_k_means.py
_bisect_k_means.py
scikit-learn
scikit-learn
sklearn_cluster__bisect_k_means.py
BisectingKMeans._inertia_per_cluster
[ { "version": "v11", "docstring_lines": { "start_line": 253, "end_line": 274 }, "code_lines": { "start_line": 274, "end_line": 283 }, "commit_date_time": "2023-06-21 15:50:07", "commit_sha": "42173fdb34b5aded79664e045cada719dfbe39dc", "commit_message": "MNT add...
def _inertia_per_cluster(self, X, centers, labels, sample_weight): + n_clusters = centers.shape[0] # = 2 since centers comes from a bisection _inertia = _inertia_sparse if sp.issparse(X) else _inertia_dense - inertia_per_cluster = np.empty(centers.shape[1]) ? ...
Calculate the sum of squared errors (inertia) per cluster. Parameters ---------- X : {ndarray, csr_matrix} of shape (n_samples, n_features) The input samples. - centers : ndarray of shape (n_clusters, n_features) + centers : ndarray of shape (n_cluster...
false
false
sklearn/cluster/_bisect_k_means.py
_bisect_k_means.py
scikit-learn
scikit-learn
django_core_handlers_base.py
BaseHandler.process_exception_by_middleware
[ { "version": "v143", "docstring_lines": { "start_line": 324, "end_line": 328 }, "code_lines": { "start_line": 328, "end_line": 334 }, "commit_date_time": "2020-05-13 07:12:18", "commit_sha": "7cd88b3fece1c17f5ee905c78222a28594fee215", "commit_message": "Update...
def process_exception_by_middleware(self, exception, request): for middleware_method in self._exception_middleware: response = middleware_method(request, exception) if response: return response - raise + return No...
Pass the exception to the exception middleware. If no middleware - return a response for this exception, raise it. ? --- -- + return a response for this exception, return None. ? ++++++++
false
false
django/core/handlers/base.py
base.py
django
django
homeassistant_components_blebox_light.py
BleBoxLightEntity.color_mode
[ { "version": "v7", "docstring_lines": { "start_line": 62, "end_line": 94 }, "code_lines": { "start_line": 94, "end_line": 95 }, "commit_date_time": "2022-04-23 05:49:39", "commit_sha": "643d04a7176858e36e4c899d03d825589d7ec793", "commit_message": "Use ColorMod...
def color_mode(self): - if self._feature.supports_white and self._feature.supports_color: - return ColorMode.RGBW - if self._feature.supports_brightness: - return ColorMode.BRIGHTNESS - return ColorMode.ONOFF + + color_mode_tmp = COLOR_MODE_M...
Return the color mode. + + Set values to _attr_ibutes if needed.
false
false
homeassistant/components/blebox/light.py
light.py
core
home-assistant
PathPlanning_RRT_rrt_with_pathsmoothing.py
RRT.Planning
[ { "version": "v3", "docstring_lines": { "start_line": 40, "end_line": 45 }, "code_lines": { "start_line": 45, "end_line": 93 }, "commit_date_time": "2017-06-02 17:12:26", "commit_sha": "f0ee5bd1d7218a8b2252b7a0306f8cf3908369c4", "commit_message": "clean up cod...
- def Planning(self,animation=True): + def Planning(self, animation=True): ? + + self.nodeList = [self.start] while True: # Random Sampling if random.randint(0, 100) > self.goalSampleRate: - rnd = [rando...
+ Pathplanning - u""" - Pathplanning animation: flag for animation on or off
false
false
PathPlanning/RRT/rrt_with_pathsmoothing.py
rrt_with_pathsmoothing.py
PythonRobotics
AtsushiSakai
spacy_pipeline_attributeruler.py
AttributeRuler.__call__
[ { "version": "v11", "docstring_lines": { "start_line": 243, "end_line": 251 }, "code_lines": { "start_line": 251, "end_line": 252 }, "commit_date_time": "2020-08-29 13:20:11", "commit_sha": "34146750d4284b542078255f1c8dfaf4c0652a23", "commit_message": "Use fro...
def __call__(self, doc: Doc) -> Doc: - matches = self.matcher(doc) + matches = sorted(self.matcher(doc)) ? +++++++ + for match_id, start, end in matches: span = Span(doc, start, end, label=match_id) attrs...
Apply the AttributeRuler to a Doc and set all attribute exceptions. doc (Doc): The document to process. RETURNS (Doc): The processed Doc. - DOCS: https://spacy.io/api/attributeruler#call + DOCS: https://nightly.spacy.io/api/attributeruler#call ? ++++++++...
false
false
spacy/pipeline/attributeruler.py
attributeruler.py
spaCy
explosion
spacy_pipeline_attributeruler.py
AttributeRuler.__init__
[ { "version": "v20", "docstring_lines": { "start_line": 324, "end_line": 324 }, "code_lines": { "start_line": 325, "end_line": 335 }, "commit_date_time": "2020-10-04 11:08:21", "commit_sha": "96b636c2d3f8e8f62bf53e0c5c30147c48bca537", "commit_message": "Update ...
def __init__( + self, vocab: Vocab, name: str = "attribute_ruler", *, validate: bool = False - self, - vocab: Vocab, - name: str = "attribute_ruler", - *, - pattern_dicts: Optional[Iterable[AttributeRulerPatternType]] = None, - validate: bool = False, ) ->...
Create the AttributeRuler. After creation, you can add patterns with the `.initialize()` or `.add_patterns()` methods, or load patterns with `.from_bytes()` or `.from_disk()`. Loading patterns will remove any patterns you've added previously. vocab (Vocab): The vocab. ...
false
false
spacy/pipeline/attributeruler.py
attributeruler.py
spaCy
explosion
libs_langchain_langchain_hub.py
push
[ { "version": "v1", "docstring_lines": { "start_line": 55, "end_line": 58 }, "code_lines": { "start_line": 58, "end_line": 61 }, "commit_date_time": "2023-08-15 21:11:43", "commit_sha": "76d09b4ed0f749935ead328edbe18d5d84f37060", "commit_message": "hub push/pul...
def push( repo_full_name: str, object: Any, *, api_url: Optional[str] = None, api_key: Optional[str] = None, parent_commit_hash: Optional[str] = "latest", + new_repo_is_public: bool = False, + new_repo_description: str = "", ) -> str: client = _...
- Pushes an object to the hub and returns the URL. ? ^^^ + Pushes an object to the hub and returns the new commit hash. ? ^^^^^^^^^^^^^^^ + + :param repo_full_name: The full name of the repo to push to in the format of + ...
false
false
libs/langchain/langchain/hub.py
hub.py
langchain
langchain-ai
robot_Conversation.py
Conversation.say
[ { "version": "v63", "docstring_lines": { "start_line": 224, "end_line": 233 }, "code_lines": { "start_line": 233, "end_line": 295 }, "commit_date_time": "2023-03-13 14:58:16", "commit_sha": "dcb52cc699fb47a2377d78f7df958d2849c4322f", "commit_message": "style: ...
def say( self, msg, cache=False, plugin="", onCompleted=None, - wait=False, append_history=True, ): append_history and self.appendHistory(1, msg, plugin=plugin) is_too_long = False ...
说一句话 :param msg: 内容 :param cache: 是否缓存这句话的音频 :param plugin: 来自哪个插件的消息(将带上插件的说明) :param onCompleted: 完成的回调 - :param wait: 是否要等待说完(为True将阻塞主线程直至说完这句话) :param append_history: 是否要追加到聊天记录
false
false
robot/Conversation.py
Conversation.py
wukong-robot
wzpan
robot_Conversation.py
Conversation.doResponse
[ { "version": "v72", "docstring_lines": { "start_line": 122, "end_line": 129 }, "code_lines": { "start_line": 129, "end_line": 162 }, "commit_date_time": "2023-04-08 07:52:08", "commit_sha": "c071590827833e9e1c967e07100d82d6e9370abb", "commit_message": "feat: 增...
- def doResponse(self, query, UUID="", onSay=None): + def doResponse(self, query, UUID="", onSay=None, onStream=None): ? +++++++++++++++ statistic.report(1) self.interrupt() self.appendHistory(0, query, UUID) ...
响应指令 :param query: 指令 :UUID: 指令的UUID :onSay: 朗读时的回调 + :onStream: 流式输出时的回调
false
false
robot/Conversation.py
Conversation.py
wukong-robot
wzpan
robot_Conversation.py
Conversation.activeListen
[ { "version": "v64", "docstring_lines": { "start_line": 292, "end_line": 296 }, "code_lines": { "start_line": 296, "end_line": 317 }, "commit_date_time": "2023-03-18 09:50:04", "commit_sha": "c59ce14918519bf69e98e5c4a32b7761141504f1", "commit_message": "feat: 为...
def activeListen(self, silent=False): - logger.debug("activeListen") + if self.immersiveMode: + self.player.stop() + elif self.player.is_playing(): + self.player.join() # 确保所有音频都播完 + logger.info("进入主动聆听...") try: ...
主动问一个问题(适用于多轮对话) :param silent: 是否不触发唤醒表现(主要用于极客模式) + :param
false
false
robot/Conversation.py
Conversation.py
wukong-robot
wzpan
faker_providers_ssn_nl_BE___init__.py
Provider.vat_id
[ { "version": "v18", "docstring_lines": { "start_line": 60, "end_line": 64 }, "code_lines": { "start_line": 64, "end_line": 65 }, "commit_date_time": "2023-02-09 19:49:47", "commit_sha": "dc48bb5eafbb1fb3f422b07e06eedc1c61a72153", "commit_message": "Format code...
def vat_id(self) -> str: + + vat_id_random_section = ( + '#######' + ) + + vat_id_possible_initial_numbers = ( + '0', + '1' + ) - return self.bothify(self.random_element(self.vat_id_formats)) + gener...
http://ec.europa.eu/taxation_customs/vies/faq.html#item_11 - :return: A random Belgian VAT ID + https://en.wikipedia.org/wiki/VAT_identification_number + :return: A random Belgian VAT ID starting with 0 or 1 and has a correct checksum with a modulo 97 check
false
false
faker/providers/ssn/nl_BE/__init__.py
__init__.py
faker
joke2k
src_lightning_fabric_accelerators_cuda.py
_device_count_nvml
[ { "version": "v17", "docstring_lines": { "start_line": 229, "end_line": 229 }, "code_lines": { "start_line": 230, "end_line": 241 }, "commit_date_time": "2023-02-06 14:26:51", "commit_sha": "770b7929255389503e907350e2380ff449229816", "commit_message": "copyrig...
def _device_count_nvml() -> int: + + visible_devices = _parse_visible_devices() + if not visible_devices: + return 0 try: + if type(visible_devices[0]) is str: + # Skip MIG parsing + if visible_devices[0].startswith("MIG-"): + return -1...
- Implementation copied from upstream: https://github.com/pytorch/pytorch/pull/84879. + Return number of devices as reported by NVML taking CUDA_VISIBLE_DEVICES into account. + + Negative value is returned if NVML discovery or initialization has failed.
false
false
src/lightning/fabric/accelerators/cuda.py
cuda.py
pytorch-lightning
Lightning-AI
src_lightning_fabric_accelerators_cuda.py
is_cuda_available
[ { "version": "v34", "docstring_lines": { "start_line": 166, "end_line": 172 }, "code_lines": { "start_line": 172, "end_line": 180 }, "commit_date_time": "2023-12-21 15:28:16", "commit_sha": "c3e2ba52ca80e21308667f6b39ed629a3f4438d5", "commit_message": "`set_de...
def is_cuda_available() -> bool: - - # We set `PYTORCH_NVML_BASED_CUDA_CHECK=1` in lightning.fabric.__init__.py - return torch.cuda.is_available() if _TORCH_GREATER_EQUAL_2_0 else num_cuda_devices() > 0 + return torch.cuda.is_available()
Returns a bool indicating if CUDA is currently available. - - Unlike :func:`torch.cuda.is_available`, this function does its best not to create a CUDA context for fork support, - if the platform allows it.
false
false
src/lightning/fabric/accelerators/cuda.py
cuda.py
pytorch-lightning
Lightning-AI
saleor_graphql_core_connection.py
prepare_filter
[ { "version": "v15", "docstring_lines": { "start_line": 51, "end_line": 64 }, "code_lines": { "start_line": 64, "end_line": 75 }, "commit_date_time": "2020-03-12 10:14:54", "commit_sha": "aebc86b3cdff4d7eac1bdbe54ae475173366c6b7", "commit_message": "Refactor cu...
def prepare_filter(cursor, sorting_fields, sorting_direction): - filter_kwargs = Q() - for field_id in range(len(sorting_fields)): + for index, field_name in enumerate(sorting_fields): field_expression = {} - for val_id in range(len(cursor[:field_id])): + for...
+ Create filter arguments based on sorting fields. + - :param cursor: list of values that are passed from page_info, used for filtering. + :param cursor: list of values that are passed from page_info, used for filtering. ? ++++ :param sorting_fields: list of fields that were used for sorting. :param s...
false
false
saleor/graphql/core/connection.py
connection.py
saleor
saleor
skrf_calibration_calibration.py
Calibration.__init__
[ { "version": "v286", "docstring_lines": { "start_line": 4618, "end_line": 4618 }, "code_lines": { "start_line": 4619, "end_line": 4653 }, "commit_date_time": "2021-10-31 16:42:49", "commit_sha": "3715bebfcafa03dbb11b15db8bdf1d3258899618", "commit_message": "Mu...
def __init__(self, measured, ideals, sloppy_input=False, is_reciprocal=True,name=None, self_calibration=False,*args, **kwargs): - ''' - ''' ? --- + # allow them to pass di # lets make an ideal flush thru for them : if hasatt...
+ r""" - Calibration initializer. + Calibration initializer. ? ++++++++ Notes ------- About the order of supplied standards, If the measured and ideals parameters are lists of Networks and `sloppy_input=False`, then their elements must align. However, ...
false
false
skrf/calibration/calibration.py
calibration.py
scikit-rf
scikit-rf
skrf_calibration_calibration.py
Calibration.coefs_8term
[ { "version": "v295", "docstring_lines": { "start_line": 4607, "end_line": 4610 }, "code_lines": { "start_line": 4610, "end_line": 4626 }, "commit_date_time": "2022-01-22 09:05:18", "commit_sha": "cd15aed3560eaf55df922c801a307b41b8028607", "commit_message": "mi...
def coefs_8term(self): d = self.coefs + if all([k in d.keys() for k in coefs_list_3term]): + raise ValueError("Can't convert one port error terms to two port error terms") - for k in coefs_list_8term: - if k not in d and k ...
Dictionary of error coefficients for 8-term (Error-box) Model. Contains the keys: * forward directivity * forward source match * forward reflection tracking * reverse directivity - * reverse load match ? ^ ^^ + ...
false
false
skrf/calibration/calibration.py
calibration.py
scikit-rf
scikit-rf
skrf_calibration_calibration.py
convert_12term_2_8term
[ { "version": "v332", "docstring_lines": { "start_line": 5739, "end_line": 5769 }, "code_lines": { "start_line": 5769, "end_line": 5837 }, "commit_date_time": "2023-04-19 17:08:30", "commit_sha": "7fbe75036e0409cbf643c34ce56fe70ea4e8b5c7", "commit_message": "Cl...
def convert_12term_2_8term(coefs_12term, redundant_k = False): + # Nomenclature taken from Roger Marks Edf = coefs_12term['forward directivity'] Esf = coefs_12term['forward source match'] Erf = coefs_12term['forward reflection tracking'] Etf = coefs_12term['forwa...
Convert the 12-term and 8-term error coefficients. Derivation of this conversion can be found in [#]_ . References ---------- - .. [#] Marks, Roger B.; , "Formulations of the Basic Vector Network Analyzer Error Model including Switch-Terms," ARFTG Conference Digest-Fall, 50th , vol.3...
false
false
skrf/calibration/calibration.py
calibration.py
scikit-rf
scikit-rf
skrf_calibration_calibration.py
Calibration.apply_cal_to_list
[ { "version": "v303", "docstring_lines": { "start_line": 321, "end_line": 324 }, "code_lines": { "start_line": 324, "end_line": 328 }, "commit_date_time": "2023-01-25 12:57:47", "commit_sha": "d034801b87d0b39155c981f6bfe1afa2d553af7e", "commit_message": "improv...
- def apply_cal_to_list(self,ntwk_list): + def apply_cal_to_list(self, ntwk_list): ? + if hasattr(ntwk_list, 'keys'): - return {k: self.apply_cal(ntwk_list[k]) for k in ntwk_list} ? - --------- + ...
- Apply correction to list of dict of Networks. ? ^ + Apply correction to list or dict of Networks. ? ^
false
false
skrf/calibration/calibration.py
calibration.py
scikit-rf
scikit-rf
skrf_calibration_calibration.py
Calibration.remove_and_cal
[ { "version": "v312", "docstring_lines": { "start_line": 5718, "end_line": 5748 }, "code_lines": { "start_line": 5748, "end_line": 5816 }, "commit_date_time": "2023-03-29 20:49:25", "commit_sha": "d72df4951871dcfea40bdb2b02039d832b716e38", "commit_message": "ad...
def remove_and_cal(self, std): - + measured, ideals = copy(self.measured), copy(self.ideals) i,m = self.pop(std) self.run() c = self.apply_cal(m) self.measured = measured self.ideals = ideals self.run...
Remove a cal standard and correct it, returning correct and ideal. - + - This requires requires overdetermination. Useful in ? - + This requires requires overdetermination. Useful in - troubleshooting a calibration in which...
false
false
skrf/calibration/calibration.py
calibration.py
scikit-rf
scikit-rf
skrf_calibration_calibration.py
LRRM.__init__
[ { "version": "v296", "docstring_lines": { "start_line": 3772, "end_line": 3806 }, "code_lines": { "start_line": 3806, "end_line": 3822 }, "commit_date_time": "2022-04-07 17:28:55", "commit_sha": "58b881b64f92b588ae998337a403357577dcb533", "commit_message": "Fi...
def __init__(self, measured, ideals, switch_terms=None, isolation=None, z0=50, match_fit='l', *args, **kwargs): self.z0 = z0 # TODO: Second port not implemented. self.match_port = 0 + # Maximum frequency to assume that open behave...
LRRM Initializer. - + Parameters ---------- measured : list of :class:`~skrf.network.Network` objects Raw measurements of the calibration standards. The order must be line, reflect, reflect, match and must align with the `ideals` parame...
false
false
skrf/calibration/calibration.py
calibration.py
scikit-rf
scikit-rf
spacy_scorer.py
Scorer.score
[ { "version": "v65", "docstring_lines": { "start_line": 74, "end_line": 78 }, "code_lines": { "start_line": 78, "end_line": 91 }, "commit_date_time": "2020-07-29 09:36:42", "commit_sha": "e0ffe36e79fc26384900f11dd331460f765d586c", "commit_message": "Update docs...
- def score(self, examples): + def score(self, examples: Iterable[Example]) -> Dict[str, Any]: scores = {} - if hasattr(self.nlp.tokenizer, "score"): scores.update(self.nlp.tokenizer.score(examples, **self.cfg)) for name, component in self.nlp.pipeline:...
Evaluate a list of Examples. examples (Iterable[Example]): The predicted annotations + correct annotations. RETURNS (Dict): A dictionary of scores. + DOCS: https://spacy.io/api/scorer#score
false
false
spacy/scorer.py
scorer.py
spaCy
explosion
spacy_scorer.py
Scorer.score_deps
[ { "version": "v68", "docstring_lines": { "start_line": 451, "end_line": 470 }, "code_lines": { "start_line": 470, "end_line": 571 }, "commit_date_time": "2020-08-09 20:36:23", "commit_sha": "3eaeb733427331b98f76412f43676fc1742d4d12", "commit_message": "Tidy up...
def score_deps( examples: Iterable[Example], attr: str, *, getter: Callable[[Token, str], Any] = getattr, head_attr: str = "head", - head_getter: Callable[[Token, str], Any] = getattr, ? ^ - + head_getter: C...
Returns the UAS, LAS, and LAS per type scores for dependency parses. examples (Iterable[Example]): Examples to score attr (str): The attribute containing the dependency label. getter (Callable[[Token, str], Any]): Defaults to getattr. If provided, getter(token,...
false
false
spacy/scorer.py
scorer.py
spaCy
explosion
spacy_scorer.py
Scorer.score_token_attr
[ { "version": "v86", "docstring_lines": { "start_line": 631, "end_line": 635 }, "code_lines": { "start_line": 635, "end_line": 699 }, "commit_date_time": "2020-10-26 09:37:25", "commit_sha": "080066ae74c10d5ef2a61eb123ad608b354a1103", "commit_message": "remove ...
def score_token_attr( examples: Iterable[Example], attr: str, *, getter: Callable[[Token, str], Any] = getattr, + missing_values: Set[Any] = MISSING_VALUES, **cfg, - ) -> Dict[str, float]: ? ^^^^^ + ) -> Dict[str, Any]: ? ...
Returns an accuracy score for a token-level attribute. examples (Iterable[Example]): Examples to score attr (str): The attribute to score. getter (Callable[[Token, str], Any]): Defaults to getattr. If provided, getter(token, attr) should return the value of the attribute...
false
false
spacy/scorer.py
scorer.py
spaCy
explosion
spacy_scorer.py
Scorer.scores
[ { "version": "v55", "docstring_lines": { "start_line": 248, "end_line": 251 }, "code_lines": { "start_line": 251, "end_line": 270 }, "commit_date_time": "2020-04-02 12:46:32", "commit_sha": "b71a11ff6dd7b47582fbffd45121c05ff3b89977", "commit_message": "Update ...
def scores(self): return { "uas": self.uas, "las": self.las, "las_per_type": self.las_per_type, "ents_p": self.ents_p, "ents_r": self.ents_r, "ents_f": self.ents_f, "ents_per_type": self.e...
+ RETURNS (dict): All scores mapped by key. - RETURNS (dict): All scores with keys `uas`, `las`, `ents_p`, - `ents_r`, `ents_f`, `tags_acc`, `token_acc`, and `textcat_score`.
false
false
spacy/scorer.py
scorer.py
spaCy
explosion
research_delf_delf_python_pooling_layers_pooling.py
GeM.call
[ { "version": "v1", "docstring_lines": { "start_line": 130, "end_line": 141 }, "code_lines": { "start_line": 141, "end_line": 144 }, "commit_date_time": "2021-02-12 16:47:56", "commit_sha": "2a370fe09ff18800e2530cdd5a7bc25b5dcf7114", "commit_message": "Ranking ...
- def call(self, x, axis=[1, 2]): ? ^^^^^^ + def call(self, x, axis=None): ? ^^^^ + if axis is None: + axis = [1, 2] return gem(x, power=self.power, eps=self.eps, axis=axis)
Invokes the GeM instance. Args: x: [B, H, W, D] A float32 Tensor. - axis: Dimensions to reduce. + axis: Dimensions to reduce. By default, dimensions [1, 2] are reduced. Returns: output: [B, D] A float32 Tensor.
false
false
research/delf/delf/python/pooling_layers/pooling.py
pooling.py
models
tensorflow
research_object_detection_dataset_tools_context_rcnn_generate_detection_data.py
main
[ { "version": "v1", "docstring_lines": { "start_line": 238, "end_line": 243 }, "code_lines": { "start_line": 243, "end_line": 263 }, "commit_date_time": "2020-06-17 07:59:17", "commit_sha": "420a7253e034a12ae2208e6ec94d3e4936177a53", "commit_message": "Refactor...
- def main(_): + def main(argv=None, save_main_session=True): - # must create before flags are used - runner = runners.DirectRunner() + args, pipeline_args = parse_args(argv) + + pipeline_options = beam.options.pipeline_options.PipelineOptions( + pipeline_args) + pipeline_options.vie...
Runs the Beam pipeline that performs inference. Args: - _: unused + argv: Command line arguments. + save_main_session: Whether to save the main session.
false
false
research/object_detection/dataset_tools/context_rcnn/generate_detection_data.py
generate_detection_data.py
models
tensorflow
openbb_platform_providers_sec_openbb_sec_models_company_filings.py
SecCompanyFilingsFetcher.extract_data
[ { "version": "v8", "docstring_lines": { "start_line": 138, "end_line": 240 }, "code_lines": { "start_line": 240, "end_line": 241 }, "commit_date_time": "2024-03-12 12:37:10", "commit_sha": "cc7908fe54095d1139f01a991b289f8f688a590e", "commit_message": "[Release...
def extract_data( query: SecCompanyFilingsQueryParams, # pylint: disable=unused-argument credentials: Optional[Dict[str, str]], **kwargs: Any, ) -> List[Dict]: filings = pd.DataFrame() if query.symbol and not query.cik: query.cik = s...
- Extracts the data from the SEC endpoint. ? - + Extract the data from the SEC endpoint.
false
false
openbb_platform/providers/sec/openbb_sec/models/company_filings.py
company_filings.py
OpenBBTerminal
OpenBB-finance
samcli_lib_sync_infra_sync_executor.py
InfraSyncExecutor.__init__
[ { "version": "v3", "docstring_lines": { "start_line": 102, "end_line": 110 }, "code_lines": { "start_line": 110, "end_line": 119 }, "commit_date_time": "2023-03-10 17:32:03", "commit_sha": "709009e0aa99d196943166717d90a76bbef0b91f", "commit_message": "feat: Ad...
- def __init__(self, build_context: BuildContext, package_context: PackageContext, deploy_context: DeployContext): + def __init__( + self, + build_context: BuildContext, + package_context: PackageContext, + deploy_context: DeployContext, + sync_context: SyncContext, + ): ...
Constructs the sync for infra executor. Parameters ---------- build_context : BuildContext package_context : PackageContext deploy_context : DeployContext + sync_context : SyncContext
false
false
samcli/lib/sync/infra_sync_executor.py
infra_sync_executor.py
aws-sam-cli
aws
samcli_lib_sync_infra_sync_executor.py
InfraSyncExecutor._remove_resource_field
[ { "version": "v5", "docstring_lines": { "start_line": 405, "end_line": 426 }, "code_lines": { "start_line": 426, "end_line": 462 }, "commit_date_time": "2023-03-21 00:16:00", "commit_sha": "18c936a7e91061c178106acfeaaa4437be26a3c6", "commit_message": "feat: Ad...
def _remove_resource_field( self, resource_logical_id: str, resource_type: str, resource_dict: Dict, - linked_resources: Set[str] = set(), ? ^ --- + linked_resources: Optional[Set[str]] = None, ? ++...
Helper method to process resource dict Parameters ---------- resource_logical_id: str Logical ID of the resource resource_type: str Resource type resource_dict: Dict The resource level dict containing Properties field - ...
false
false
samcli/lib/sync/infra_sync_executor.py
infra_sync_executor.py
aws-sam-cli
aws
skrf_tlineFunctions.py
distributed_circuit_2_propagation_impedance
[ { "version": "v30", "docstring_lines": { "start_line": 447, "end_line": 447 }, "code_lines": { "start_line": 448, "end_line": 480 }, "commit_date_time": "2019-07-06 05:54:15", "commit_sha": "d5e1bd498096dc9aa990ebbdf0294a17ca7f0c4c", "commit_message": "typo", ...
- def distributed_circuit_2_propagation_impedance( distributed_admittance,\ ? - - + def distributed_circuit_2_propagation_impedance(distributed_admittance, distributed_impedance): - ''' - ''' + propagation_constan...
+ r""" - Converts distributed circuit values to wave quantities. ? - ^ + Convert distrubuted circuit values to wave quantities. ? ++++ ^ This converts complex distributed impedance and admittance to propagation constant and characteristic impedance. The relation is ...
false
false
skrf/tlineFunctions.py
tlineFunctions.py
scikit-rf
scikit-rf
skrf_tlineFunctions.py
Gamma0_2_swr
[ { "version": "v36", "docstring_lines": { "start_line": 585, "end_line": 608 }, "code_lines": { "start_line": 608, "end_line": 611 }, "commit_date_time": "2021-07-31 17:19:57", "commit_sha": "5538960dc84563d37d977840ad2a3ed92039043b", "commit_message": "removed...
- def Gamma0_2_swr(Gamma0): + def Gamma0_2_swr(Gamma0: NumberLike): ? ++++++++++++ + return (1 + npy.abs(Gamma0)) / (1 - npy.abs(Gamma0))
- r""" - Return Standing Wave Ratio (SWR) for a given reflection coefficient. ? ----------- + Standing Wave Ratio (SWR) for a given reflection coefficient. Standing Wave Ratio value is defined by: - .. math:: ? ---- + .. math:: - VSWR = \\frac{1 + |\\Gamma_0|}{1 - |\Gamma_0|} ?...
false
false
skrf/tlineFunctions.py
tlineFunctions.py
scikit-rf
scikit-rf
skrf_tlineFunctions.py
voltage_current_propagation
[ { "version": "v32", "docstring_lines": { "start_line": 613, "end_line": 653 }, "code_lines": { "start_line": 653, "end_line": 687 }, "commit_date_time": "2019-07-21 12:07:26", "commit_sha": "49c95fd0ee2400fbc1f41c1cd3825d37e3d23262", "commit_message": "Added v...
- def voltage_current_propagation(v1, i1, z0, gamma, d): ? ^ ------ + def voltage_current_propagation(v1, i1, z0, theta): ? ^^^^ # outer product by broadcasting of the electrical length - theta = gam...
- Propagate voltage and current on length d of a transmissio line. ? ^ + Propagate voltage and current on electrical length theta of a transmission line. ? +++++++++++ ^^^^^ + - Give voltage v2 and current i1 at z=-L...
false
false
skrf/tlineFunctions.py
tlineFunctions.py
scikit-rf
scikit-rf
research_object_detection_models_faster_rcnn_resnet_v1_feature_extractor.py
FasterRCNNResnet101FeatureExtractor.__init__
[ { "version": "v8", "docstring_lines": { "start_line": 242, "end_line": 255 }, "code_lines": { "start_line": 255, "end_line": 259 }, "commit_date_time": "2018-11-02 15:48:34", "commit_sha": "31ae57eb8555e51493a4721f6efbea68d98a3d69", "commit_message": "Minor fi...
def __init__(self, is_training, first_stage_features_stride, batch_norm_trainable=False, reuse_weights=None, - weight_decay=0.0): ? ^^ + weight_decay=0.0, ? ...
Constructor. Args: is_training: See base class. first_stage_features_stride: See base class. batch_norm_trainable: See base class. reuse_weights: See base class. weight_decay: See base class. + activation_fn: See base class. Raises: ValueError: I...
false
false
research/object_detection/models/faster_rcnn_resnet_v1_feature_extractor.py
faster_rcnn_resnet_v1_feature_extractor.py
models
tensorflow
research_object_detection_models_faster_rcnn_resnet_v1_feature_extractor.py
FasterRCNNResnetV1FeatureExtractor.preprocess
[ { "version": "v7", "docstring_lines": { "start_line": 71, "end_line": 85 }, "code_lines": { "start_line": 85, "end_line": 87 }, "commit_date_time": "2018-03-22 17:14:28", "commit_sha": "001a2a61285e378fef5f45386f638cb5e9f153c7", "commit_message": "Internal cha...
def preprocess(self, resized_inputs): + if resized_inputs.shape.as_list()[3] == 3: - channel_means = [123.68, 116.779, 103.939] + channel_means = [123.68, 116.779, 103.939] ? ++ - return resized_inputs - [[channel_means]] + return resized_inputs - [[channel_means]] ? ++ + ...
Faster R-CNN Resnet V1 preprocessing. VGG style channel mean subtraction as described here: https://gist.github.com/ksimonyan/211839e770f7b538e2d8#file-readme-md + Note that if the number of channels is not equal to 3, the mean subtraction + will be skipped and the original resized_inputs will ...
false
false
research/object_detection/models/faster_rcnn_resnet_v1_feature_extractor.py
faster_rcnn_resnet_v1_feature_extractor.py
models
tensorflow
Lib_hashlib.py
__hash_new
[ { "version": "v29", "docstring_lines": { "start_line": 114, "end_line": 117 }, "code_lines": { "start_line": 117, "end_line": 147 }, "commit_date_time": "2012-07-22 04:22:16", "commit_sha": "b9e9e0d5a8be470ade2bb497019a5cf737138182", "commit_message": "Consist...
- def __hash_new(name, string=''): ? ^ ^^^^ + def __hash_new(name, data=b''): ? ^^ ^ + try: - return _hashlib.new(name, string) ? ^ ^^^^ + return _hashlib.new(name, data) ? ...
- new(name, string='') - Return a new hashing object using the named algorithm; ? ^ ^^^^ + new(name, data=b'') - Return a new hashing object using the named algorithm; ? ^^ ^ + - optionally initialized with a string. + optionally initialized with data (which must be bytes).
false
false
Lib/hashlib.py
hashlib.py
cpython
python
Lib_hashlib.py
__py_new
[ { "version": "v38", "docstring_lines": { "start_line": 111, "end_line": 114 }, "code_lines": { "start_line": 114, "end_line": 116 }, "commit_date_time": "2016-09-06 18:22:28", "commit_sha": "39093e9e6836b98dc67979e4e888e4bc639caa07", "commit_message": "Issue #...
- def __py_new(name, data=b''): + def __py_new(name, data=b'', **kwargs): ? ++++++++++ - return __get_builtin_constructor(name)(data) + return __get_builtin_constructor(name)(data, **kwargs) ? ++++++++++
- new(name, data=b'') - Return a new hashing object using the named algorithm; ? ----------------- + new(name, data=b'', **kwargs) - Return a new hashing object using the ? ++++++++++ - optionally initialized with data (which must be byt...
false
false
Lib/hashlib.py
hashlib.py
cpython
python
ciphers_atbash.py
benchmark
[ { "version": "v9", "docstring_lines": { "start_line": 40, "end_line": 42 }, "code_lines": { "start_line": 42, "end_line": 67 }, "commit_date_time": "2021-03-22 06:59:51", "commit_sha": "14bcb580d55ee90614ad258ea31ef8fe4e4b5c40", "commit_message": "fix(mypy): F...
def benchmark() -> None: from timeit import timeit print("Running performance benchmarks...") - print( - "> atbash_slow()", - timeit( - "atbash_slow(printable)", - setup="from string import printable ; from __main__ import atbash_slow", ? -------- ...
- Let's benchmark them side-by-side... ? ^^^ + Let's benchmark our functions side-by-side... ? ++++++++ ^^^^
false
false
ciphers/atbash.py
atbash.py
Python
TheAlgorithms
src_promptflow-core_promptflow_executor_flow_executor.py
execute_flow
[ { "version": "v108", "docstring_lines": { "start_line": 1340, "end_line": 1361 }, "code_lines": { "start_line": 1361, "end_line": 1391 }, "commit_date_time": "2024-04-11 08:55:30", "commit_sha": "7b3e48e8d37d707fc511c70a4bb5c2ae3ef89796", "commit_message": "[E...
def execute_flow( flow_file: Path, working_dir: Path, output_dir: Path, connections: dict, inputs: Mapping[str, Any], *, run_id: str = None, run_aggregation: bool = True, enable_stream_output: bool = False, allow_generator_output: bool = False, # TODO: remo...
Execute the flow, including aggregation nodes. :param flow_file: The path to the flow file. :type flow_file: Path :param working_dir: The working directory of the flow. :type working_dir: Path :param output_dir: Relative path relative to working_dir. :type output_dir: Path ...
false
false
src/promptflow-core/promptflow/executor/flow_executor.py
flow_executor.py
promptflow
microsoft
research_object_detection_models_faster_rcnn_resnet_v1_fpn_keras_feature_extractor.py
FasterRCNNResnet101FpnKerasFeatureExtractor.__init__
[ { "version": "v22", "docstring_lines": { "start_line": 369, "end_line": 382 }, "code_lines": { "start_line": 382, "end_line": 394 }, "commit_date_time": "2020-07-17 04:47:09", "commit_sha": "938f102d54bd74cadc2e17df630773b6795037be", "commit_message": "reshape...
def __init__(self, is_training, first_stage_features_stride=16, + batch_norm_trainable=False, conv_hyperparams=None, - batch_norm_trainable=False, weight_decay=0.0, fpn_min_level=2, fpn_...
Constructor. Args: is_training: See base class. first_stage_features_stride: See base class. + batch_norm_trainable: See base class. conv_hyperparams: See base class. - batch_norm_trainable: See base class. weight_decay: See base class. fpn_min_level: See b...
false
false
research/object_detection/models/faster_rcnn_resnet_v1_fpn_keras_feature_extractor.py
faster_rcnn_resnet_v1_fpn_keras_feature_extractor.py
models
tensorflow
tests_test_utils.py
test_should_bypass_proxies
[ { "version": "v25", "docstring_lines": { "start_line": 292, "end_line": 345 }, "code_lines": { "start_line": 345, "end_line": 352 }, "commit_date_time": "2016-07-20 16:30:08", "commit_sha": "2d4a89f5dc561dbf062ec5c85d6f6ca32a511042", "commit_message": "adding ...
def test_should_bypass_proxies(url, expected, monkeypatch): - monkeypatch.setenv('no_proxy', '192.168.0.0/24,127.0.0.1,localhost.localdomain,172.16.1.1') monkeypatch.setenv('NO_PROXY', '192.168.0.0/24,127.0.0.1,localhost.localdomain,172.16.1.1') assert should_bypass_proxies(url) =...
- Tests for function should_bypass_proxies to check if proxy can be bypassed or not ? ----------------------- + Tests for function should_bypass_proxies to check if proxy + can be bypassed or not
false
false
tests/test_utils.py
test_utils.py
requests
psf
localstack_services_cloudformation_engine_parameters.py
map_to_legacy_structure
[ { "version": "v1", "docstring_lines": { "start_line": 155, "end_line": 162 }, "code_lines": { "start_line": 162, "end_line": 172 }, "commit_date_time": "2023-06-06 12:58:00", "commit_sha": "fdf2f2ceaae0c070a2244b6ff23fce84ad2243a4", "commit_message": "Improve ...
- def map_to_legacy_structure(parameter_type: str, new_parameter: Parameter) -> LegacyParameter: ? ^^^ + def map_to_legacy_structure(parameter_name: str, new_parameter: StackParameter) -> LegacyParameter: ? ^^^ +++++ ...
Helper util to convert a normal (resolved) stack parameter to a legacy parameter structure that can then be merged with stack resources. - :param parameter_type: the stack parameter type (e.g. "String", "AWS::SSM::Parameter::Value<String>", ...) :param new_parameter: a resolved stack parameter :ret...
false
false
localstack/services/cloudformation/engine/parameters.py
parameters.py
localstack
localstack
timm_data_tf_preprocessing.py
preprocess_for_eval
[ { "version": "v2", "docstring_lines": { "start_line": 177, "end_line": 188 }, "code_lines": { "start_line": 188, "end_line": 195 }, "commit_date_time": "2019-06-20 00:20:51", "commit_sha": "aa4354f4668ee7cf349f24de60e3a23dee43a6ef", "commit_message": "Big re-o...
- def preprocess_for_eval(image_bytes, use_bfloat16, image_size=IMAGE_SIZE): + def preprocess_for_eval(image_bytes, use_bfloat16, image_size=IMAGE_SIZE, interpolation='bicubic'): ? +++++++++++++++++++++++++ + resize_method = tf.i...
Preprocesses the given image for evaluation. Args: image_bytes: `Tensor` representing an image binary of arbitrary size. use_bfloat16: `bool` for whether to use bfloat16. image_size: image size. + interpolation: image interpolation method Returns: A preprocessed...
false
false
timm/data/tf_preprocessing.py
tf_preprocessing.py
pytorch-image-models
huggingface
python_ray_autoscaler__private_cli_logger.py
_format_msg
[ { "version": "v34", "docstring_lines": { "start_line": 166, "end_line": 206 }, "code_lines": { "start_line": 206, "end_line": 249 }, "commit_date_time": "2022-02-09 06:07:44", "commit_sha": "d7cead7519bd0c3c62e548d51b959721c272305e", "commit_message": "[Core] ...
def _format_msg( msg: str, *args: Any, + no_format: bool = None, _tags: Dict[str, Any] = None, _numbered: Tuple[str, int, int] = None, - _no_format: bool = None, **kwargs: Any ): if isinstance(msg, str) or isinstance(msg, ColorfulString): tags_s...
Formats a message for printing. Renders `msg` using the built-in `str.format` and the passed-in `*args` and `**kwargs`. Args: *args (Any): `.format` arguments for `msg`. + no_format (bool): + If `no_format` is `True`, + `.format` will not be called on ...
false
false
python/ray/autoscaler/_private/cli_logger.py
cli_logger.py
ray
ray-project
st2common_st2common_services_datastore.py
DatastoreService.delete_value
[ { "version": "v14", "docstring_lines": { "start_line": 132, "end_line": 147 }, "code_lines": { "start_line": 147, "end_line": 163 }, "commit_date_time": "2016-05-23 08:16:12", "commit_sha": "1d8f6d61b937686686387abe64a086a0ec933040", "commit_message": "Add dat...
- def delete_value(self, name, local=True): + def delete_value(self, name, local=True, scope=SYSTEM_SCOPE): ? ++++++++++++++++++++ name = self._get_full_key_name(name=name, local=local) client = self._get_api_client() ...
Delete the provided key. By default, value is deleted from a namespace local to the pack/class. If you want to delete a global value, pass local=False to this method. :param name: Name of the key to delete. :type name: ``str`` :param local: Delete a value in ...
false
false
st2common/st2common/services/datastore.py
datastore.py
st2
StackStorm
st2common_st2common_services_datastore.py
BaseDatastoreService.list_values
[ { "version": "v37", "docstring_lines": { "start_line": 76, "end_line": 93 }, "code_lines": { "start_line": 93, "end_line": 99 }, "commit_date_time": "2021-03-03 10:10:50", "commit_sha": "356df24c14746e1fa629d1bc207b01a25f73857e", "commit_message": "Add support...
- def list_values(self, local=True, prefix=None, limit=100, offset=0): ? ^^^ + def list_values(self, local=True, prefix=None, limit=None, offset=0): ? ^^^^ client = self...
Retrieve all the datastores items. :param local: List values from a namespace local to this pack/class. Defaults to True. :type: local: ``bool`` :param prefix: Optional key name prefix / startswith filter. :type prefix: ``str`` - :param limit: Number of keys to...
false
false
st2common/st2common/services/datastore.py
datastore.py
st2
StackStorm
skimage_draw_draw.py
set_color
[ { "version": "v28", "docstring_lines": { "start_line": 129, "end_line": 166 }, "code_lines": { "start_line": 166, "end_line": 170 }, "commit_date_time": "2015-07-12 17:42:11", "commit_sha": "1b31af72b00b22fe6bece0a51677fd4d0ac9db46", "commit_message": "Fixed v...
- def set_color(img, coords, color): + def set_color(img, coords, color, alpha=None): ? ++++++++++++ + rr, cc = coords - rr, cc = coords + if alpha is None: - rr, cc = _coords_inside_image(rr, cc, img.shape) + rr, cc = _coords_inside_image(rr,...
Set pixel color in the image at the given coordinates. Coordinates that exceed the shape of the image will be ignored. Parameters ---------- img : (M, N, D) ndarray Image - coords : ((P,) ndarray, (P,) ndarray) + coords : tuple of ((P,) ndarray, (P,) ndarray) ? ...
false
false
skimage/draw/draw.py
draw.py
scikit-image
scikit-image
skimage_draw_draw.py
ellipse
[ { "version": "v48", "docstring_lines": { "start_line": 12, "end_line": 21 }, "code_lines": { "start_line": 21, "end_line": 30 }, "commit_date_time": "2016-11-04 18:01:47", "commit_sha": "a2da948d84f5951ad30560254c46ca66bdfdbf97", "commit_message": "extending t...
def ellipse(r, c, yradius, xradius, shape=None, orientation=0.): center = np.array([r, c]) radiuses = np.array([yradius, xradius]) + # allow just rotation with in range 90 degree + orientation = orientation % (np.pi / 2.) - # The upper_left and lower_right corners of the...
Generate coordinates of pixels within ellipse. The ellipse equation: ``((x * cos(alpha) + y * sin(alpha)) / xradius) ** 2 + ((x * sin(alpha) + y * cos(alpha)) / yradius) ** 2 = 1`` Parameters ---------- r, c : double Centre coordinate of ellipse. y...
false
false
skimage/draw/draw.py
draw.py
scikit-image
scikit-image
skimage_draw_draw.py
circle
[ { "version": "v68", "docstring_lines": { "start_line": 146, "end_line": 186 }, "code_lines": { "start_line": 186, "end_line": 188 }, "commit_date_time": "2019-09-13 07:50:22", "commit_sha": "3fc59aad048af56a060883ac9730566ab55df991", "commit_message": "back-ti...
def circle(r, c, radius, shape=None): + warnings.warn("circle is deprecated in favor of " + "disk." + "circle will be removed in version 0.19", + FutureWarning, stacklevel=2) - return ellipse(r, c, radius, radius, shape) ? ^^^ - ^ ...
Generate coordinates of pixels within circle. Parameters ---------- r, c : double - Centre coordinate of circle. ? - ^ ^^^^ + Center coordinate of disk. ? + ^ ^^ radius : double - Radius of circle. ? ...
false
false
skimage/draw/draw.py
draw.py
scikit-image
scikit-image
skimage_draw_draw.py
bezier_curve
[ { "version": "v49", "docstring_lines": { "start_line": 12, "end_line": 21 }, "code_lines": { "start_line": 21, "end_line": 31 }, "commit_date_time": "2016-11-06 08:08:53", "commit_sha": "3ffdf7650179919a15906115d3d104070f3e071f", "commit_message": "add compute...
- def bezier_curve(y0, x0, y1, x1, y2, x2, weight, shape=None): ? ^ ^ ^ ^ ^ ^ + def bezier_curve(r0, c0, r1, c1, r2, c2, weight, shape=None): ? ^ ^ ^ ^ ^ ^ - return _bezier_curve(y0, x0, y1, x1, y2, x2, weight, shape) ? ^...
Generate Bezier curve coordinates. Parameters ---------- - y0, x0 : int ? ^ ^ + r0, c0 : int ? ^ ^ Coordinates of the first control point. - y1, x1 : int ? ^ ^ + r1, c1 : int ? ^ ^ Coordinates of the middle control point. - y2, x2 : in...
false
false
skimage/draw/draw.py
draw.py
scikit-image
scikit-image
skimage_draw_draw.py
polygon_perimeter
[ { "version": "v37", "docstring_lines": { "start_line": 133, "end_line": 178 }, "code_lines": { "start_line": 178, "end_line": 208 }, "commit_date_time": "2016-02-02 16:25:41", "commit_sha": "bf7e885064e545496a55ccbbdc9f56eebb7ac0a4", "commit_message": "Polygon...
- def polygon_perimeter(cy, cx, shape=None, clip=False): ? ^ ^ + def polygon_perimeter(cr, cc, shape=None, clip=False): ? ^ ^ if clip: if shape is None: raise ValueError("Must specify clipping shape") clip_box =...
Generate polygon perimeter coordinates. Parameters ---------- - cy : (N,) ndarray ? ^ + cr : (N,) ndarray ? ^ - Y-coordinates of vertices of polygon. ? ^ + Row (Y) coordinates of vertices of polygon. ? +++++ ^^ - cx : (N,) ndarray ? ^ + ...
false
false
skimage/draw/draw.py
draw.py
scikit-image
scikit-image
skimage_draw_draw.py
line
[ { "version": "v43", "docstring_lines": { "start_line": 405, "end_line": 463 }, "code_lines": { "start_line": 463, "end_line": 465 }, "commit_date_time": "2016-09-26 18:20:02", "commit_sha": "f679d70125b47fe7c3e3d91ea42e9e506fdaed69", "commit_message": "Fix imp...
- def line(y1, x1, y2, x2): + def line(y0, x0, y1, x1): - return _line(y1, x1, y2, x2) ? -------- + return _line(y0, x0, y1, x1) ? ++++++++
Generate line pixel coordinates. Parameters ---------- + y0, x0 : int + Starting position (row, column). y1, x1 : int - Starting position (row, column). - y2, x2 : int End position (row, column). Returns ------- rr, cc : (N,) ndarray of int ...
false
false
skimage/draw/draw.py
draw.py
scikit-image
scikit-image
skimage_draw_draw.py
rectangle
[ { "version": "v63", "docstring_lines": { "start_line": 694, "end_line": 752 }, "code_lines": { "start_line": 752, "end_line": 766 }, "commit_date_time": "2018-06-26 06:18:09", "commit_sha": "94168408d9fadc6d3cd1548a2e8b9e6d3cea1c9f", "commit_message": "MAINT: ...
def rectangle(start, end=None, extent=None, shape=None): + tl, br = _rectangle_slice(start=start, end=end, extent=extent) + - if extent is not None: - end = np.array(start) + np.array(extent) - elif end is None: - raise ValueError("Either `end` or `extent` must be given")...
Generate coordinates of pixels within a rectangle. Parameters ---------- start : tuple Origin point of the rectangle, e.g., ``([plane,] row, column)``. end : tuple End point of the rectangle ``([plane,] row, column)``. + For a 2D matrix, the slice defined by the ...
false
false
skimage/draw/draw.py
draw.py
scikit-image
scikit-image
freqtrade_configuration_config_validation.py
_validate_unlimited_amount
[ { "version": "v69", "docstring_lines": { "start_line": 99, "end_line": 103 }, "code_lines": { "start_line": 103, "end_line": 108 }, "commit_date_time": "2023-12-11 19:35:49", "commit_sha": "c5c2c8c1856a3b08ab4027352c9734e65aec1e4d", "commit_message": "Enforce ...
def _validate_unlimited_amount(conf: Dict[str, Any]) -> None: if (not conf.get('edge', {}).get('enabled') and conf.get('max_open_trades') == float('inf') and conf.get('stake_amount') == constants.UNLIMITED_STAKE_AMOUNT): - raise OperationalException("`max_ope...
If edge is disabled, either max_open_trades or stake_amount need to be set. - :raise: OperationalException if config validation failed ? ^^^ -- ^^^^^^ ^ + :raise: ConfigurationError if config validation failed ? ^^^^^^^ ^^ ^
false
false
freqtrade/configuration/config_validation.py
config_validation.py
freqtrade
freqtrade
speechbrain_lobes_models_transformer_TransformerST.py
TransformerST.decode_asr
[ { "version": "v9", "docstring_lines": { "start_line": 347, "end_line": 356 }, "code_lines": { "start_line": 356, "end_line": 372 }, "commit_date_time": "2024-03-14 18:06:30", "commit_sha": "3d2cb42957290a75c9206c5ac1b00d64d4aa4c59", "commit_message": "Typo fix...
def decode_asr(self, tgt, encoder_out): tgt_mask = get_lookahead_mask(tgt) tgt = self.custom_tgt_module(tgt) if self.attention_type == "RelPosMHAXL": # we use fixed positional encodings in the decoder tgt = tgt + self.positional_encoding_...
This method implements a decoding step for the transformer model. Arguments --------- tgt : torch.Tensor The sequence to the decoder. encoder_out : torch.Tensor Hidden output of the encoder. + + Returns + ------- + predict...
false
false
speechbrain/lobes/models/transformer/TransformerST.py
TransformerST.py
speechbrain
speechbrain
conan_cli_commands_create.py
_get_test_conanfile_path
[ { "version": "v39", "docstring_lines": { "start_line": 155, "end_line": 157 }, "code_lines": { "start_line": 157, "end_line": 173 }, "commit_date_time": "2022-12-15 07:16:03", "commit_sha": "4c96f2b1fba98a8c768ec789b88c1533f25c6acc", "commit_message": "[develo...
def _get_test_conanfile_path(tf, conanfile_path): + if tf is False: # Look up for testing conanfile can be disabled if tf (test folder) is False return None - test_folders = [tf] if tf else ["test_package", "test"] base_folder = os.path.dirname(conanfile_path) - ...
- Searches in the declared test_folder or in the standard locations ? ^^ ^^^^^ + Searches in the declared test_folder or in the standard "test_package" ? ^^^^^^^^ + ^^^
false
false
conan/cli/commands/create.py
create.py
conan
conan-io
sklearn_linear_model_tests_test_logistic.py
test_inconsistent_input
[ { "version": "v36", "docstring_lines": { "start_line": 57, "end_line": 59 }, "code_lines": { "start_line": 59, "end_line": 66 }, "commit_date_time": "2011-09-21 09:04:45", "commit_sha": "aed53bfac423a80a787fdadd2f56a311dbf780f9", "commit_message": "FIX: assign...
def test_inconsistent_input(): X_ = np.random.random((5, 10)) y_ = np.ones(X_.shape[0]) + + clf = logistic.LogisticRegression() + + # Wrong dimensions for training data + y_wrong = y_[:-1] + assert_raises(ValueError, clf.fit, X, y_wrong) + + # Wrong dimensions for test data ...
- Test that an exception is raised on inconsistent input to predict ? ----------- + Test that an exception is raised on inconsistent input
false
false
sklearn/linear_model/tests/test_logistic.py
test_logistic.py
scikit-learn
scikit-learn
deepspeed_utils_zero_to_fp32.py
convert_zero_checkpoint_to_fp32_state_dict
[ { "version": "v27", "docstring_lines": { "start_line": 518, "end_line": 527 }, "code_lines": { "start_line": 527, "end_line": 532 }, "commit_date_time": "2024-01-03 19:45:06", "commit_sha": "691458f8b6e6a58ceae7e41776e55c0410303009", "commit_message": "zero_to...
- def convert_zero_checkpoint_to_fp32_state_dict(checkpoint_dir, output_file, tag=None): + def convert_zero_checkpoint_to_fp32_state_dict(checkpoint_dir, output_file, tag=None, exclude_frozen_parameters=False): ? +++++++++++++++++++++++...
Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated ``state_dict`` file that can be loaded with ``torch.load(file)`` + ``load_state_dict()`` and used for training without DeepSpeed. Args: - ``checkpoint_dir``: path to the desired checkpoint folder. (one that contains the tag-folder...
false
false
deepspeed/utils/zero_to_fp32.py
zero_to_fp32.py
DeepSpeed
microsoft
Lib_idlelib_replace.py
ReplaceDialog.open
[ { "version": "v37", "docstring_lines": { "start_line": 55, "end_line": 63 }, "code_lines": { "start_line": 63, "end_line": 77 }, "commit_date_time": "2023-12-11 20:45:08", "commit_sha": "a01022af23b27a9bfb4fadbcdb60b1ddf24a7220", "commit_message": "GH-83162: R...
- def open(self, text, insert_tags=None): + def open(self, text, searchphrase=None, *, insert_tags=None): ? ++++++++++++++++++++++ - SearchDialogBase.open(self, text) + SearchDialogBase.open(self, text, searchphrase) ? ++...
Make dialog visible on top of others and ready to use. - Also, highlight the currently selected text and set the - search to include the current selection (self.ok). ? ----------- + Also, set the search to include the current selection ? ...
false
false
Lib/idlelib/replace.py
replace.py
cpython
python
gensim_models_poincare.py
PoincareBatch.__init__
[ { "version": "v2", "docstring_lines": { "start_line": 247, "end_line": 264 }, "code_lines": { "start_line": 264, "end_line": 280 }, "commit_date_time": "2017-12-04 12:08:17", "commit_sha": "1ac5a26896cbcfad97076d763ad291d57d99a674", "commit_message": "[MRG] Ad...
- def __init__(self, vectors_u, vectors_v, indices_u, indices_v): + def __init__(self, vectors_u, vectors_v, indices_u, indices_v, regularization_coeff=1.0): ? ++++++++++++++++++++++++++ self.vectors_u = vectors_...
Initialize instance with sets of vectors for which distances are to be computed. Parameters ---------- vectors_u : numpy.array Vectors of all nodes `u` in the batch. Expected shape (batch_size, dim). vectors_v : numpy.array Vectors o...
false
false
gensim/models/poincare.py
poincare.py
gensim
piskvorky
gensim_models_poincare.py
LexicalEntailmentEvaluation.evaluate_spearman
[ { "version": "v9", "docstring_lines": { "start_line": 1693, "end_line": 1706 }, "code_lines": { "start_line": 1706, "end_line": 1723 }, "commit_date_time": "2018-03-14 13:27:08", "commit_sha": "e8264bd693408a487735bfb9dd12e46bdd3e8973", "commit_message": "Fix ...
def evaluate_spearman(self, embedding): predicted_scores = [] expected_scores = [] skipped = 0 count = 0 vocab_trie = self.create_vocab_trie(embedding) for (word_1, word_2), expected_score in self.scores.items(): try: ...
Evaluate spearman scores for lexical entailment for given embedding. Parameters ---------- - embedding : PoincareKeyedVectors instance + embedding : :class:`~gensim.models.poincare.PoincareKeyedVectors` Embedding for which evaluation is to be done. Ret...
false
false
gensim/models/poincare.py
poincare.py
gensim
piskvorky
gensim_models_poincare.py
PoincareKeyedVectors.most_similar
[ { "version": "v15", "docstring_lines": { "start_line": 1185, "end_line": 1219 }, "code_lines": { "start_line": 1219, "end_line": 1240 }, "commit_date_time": "2019-01-28 15:31:48", "commit_sha": "c9c8b1f4e869a7794d42a20c869c8a9fc462bc4b", "commit_message": "Upd...
def most_similar(self, node_or_vector, topn=10, restrict_vocab=None): + if isinstance(topn, Integral) and topn < 1: + return [] + if not restrict_vocab: all_distances = self.distances(node_or_vector) else: nodes_to_use = sel...
Find the top-N most similar nodes to the given node or vector, sorted in increasing order of distance. Parameters ---------- node_or_vector : {str, int, numpy.array} node key or vector for which similar nodes are to be found. topn : int or None, optional - ...
false
false
gensim/models/poincare.py
poincare.py
gensim
piskvorky
spacy_util.py
_wrap
[ { "version": "v112", "docstring_lines": { "start_line": 138, "end_line": 138 }, "code_lines": { "start_line": 139, "end_line": 156 }, "commit_date_time": "2017-05-13 19:22:25", "commit_sha": "ee7dcf65c9c1a110cc563ed7391643def002bfcf", "commit_message": "Fix ex...
def _wrap(text, wrap_max=80, indent=4): - indent = indent * ' ' wrap_width = wrap_max - len(indent) if isinstance(text, Path): text = path2str(text) return textwrap.fill(text, width=wrap_width, initial_indent=indent, subsequent_indent=ind...
- Wrap text at given width using textwrap module. Indent should consist of ? ------------------------- + Wrap text at given width using textwrap module. - spaces. Its length is deducted from wrap width to ensure exact wrapping. + + Args: + text (unicode):...
false
false
spacy/util.py
util.py
spaCy
explosion
spacy_util.py
compile_infix_regex
[ { "version": "v403", "docstring_lines": { "start_line": 706, "end_line": 712 }, "code_lines": { "start_line": 712, "end_line": 718 }, "commit_date_time": "2021-01-17 11:48:43", "commit_sha": "28256522c8a6311e6a20d66927ef2bd230755464", "commit_message": "Fix `s...
- def compile_infix_regex(entries): + def compile_infix_regex(entries: Iterable[Union[str, Pattern]]) -> Pattern: expression = "|".join([piece for piece in entries if piece.strip()]) return re.compile(expression)
Compile a sequence of infix rules into a regex object. - entries (tuple): The infix rules, e.g. spacy.lang.punctuation.TOKENIZER_INFIXES. + entries (Iterable[Union[str, Pattern]]): The infix rules, e.g. + spacy.lang.punctuation.TOKENIZER_INFIXES. RETURNS (regex object): The regex object. to b...
false
false
spacy/util.py
util.py
spaCy
explosion
spacy_util.py
load_model
[ { "version": "v267", "docstring_lines": { "start_line": 577, "end_line": 580 }, "code_lines": { "start_line": 580, "end_line": 613 }, "commit_date_time": "2020-05-20 10:27:31", "commit_sha": "24efd54a42e7e5f22b040018f222d24867e83a87", "commit_message": "Merge ...
def load_model(name, **overrides): - if isinstance(name, str): # name or string path + data_path = get_data_path() + if not data_path or not data_path.exists(): + raise IOError(Errors.E049.format(path=path2str(data_path))) + if isinstance(name, basestring_): # in data dir / sho...
- Load a model from a package or data path. + Load a model from a shortcut link, package or data path. ? +++++++++++++++ - name (unicode): Package name or model path. ? ^ + name (unicode): Package name, shortcut link or model path. ? ...
false
false
spacy/util.py
util.py
spaCy
explosion
spacy_util.py
minibatch_by_words
[ { "version": "v278", "docstring_lines": { "start_line": 660, "end_line": 663 }, "code_lines": { "start_line": 663, "end_line": 699 }, "commit_date_time": "2020-06-02 11:21:55", "commit_sha": "ec52e7f886ad3839bb509c38707a8ae4e955b7d4", "commit_message": "add ov...
- def minibatch_by_words(examples, size, tuples=True, count_words=len, tolerance=0.2): ? ------------- + def minibatch_by_words(examples, size, count_words=len, tolerance=0.2, discard_oversize=False): ? +++++++++...
Create minibatches of roughly a given number of words. If any examples are longer than the specified batch length, they will appear in a batch by - themselves. + themselves, or be discarded if discard_oversize=True.
false
false
spacy/util.py
util.py
spaCy
explosion
spacy_util.py
validate_json
[ { "version": "v214", "docstring_lines": { "start_line": 630, "end_line": 630 }, "code_lines": { "start_line": 631, "end_line": 635 }, "commit_date_time": "2019-02-07 20:00:04", "commit_sha": "77efee029529653f77630a7bcd5cebb8e7d0862b", "commit_message": "Auto-f...
- def validate_json(data, schema): ? ^^^^^ + def validate_json(data, validator): ? ^ +++++++ - # TODO: replace with (stable) Draft6Validator, if available - validator = Draft4Validator(schema) errors = [] for err in sorted(validator.ite...
Validate data against a given JSON schema (see https://json-schema.org). data: JSON-serializable data to validate. - schema (dict): The JSON schema. + validator (jsonschema.DraftXValidator): The validator. RETURNS (list): A list of error messages, if available.
false
false
spacy/util.py
util.py
spaCy
explosion
spacy_util.py
load_language_data
[ { "version": "v227", "docstring_lines": { "start_line": 121, "end_line": 126 }, "code_lines": { "start_line": 126, "end_line": 132 }, "commit_date_time": "2019-08-20 12:54:11", "commit_sha": "756b66b7c088e9c9e2fac03d822a64730f68d20c", "commit_message": "Reduce...
def load_language_data(path): - - try: + path = ensure_path(path) + if path.exists(): return srsly.read_json(path) - except FileNotFoundError: + path = path.with_suffix(path.suffix + ".gz") + if path.exists(): - return srsly.read_gzip_json(path + ".gz") ? ...
- Load JSON language data using the given path as a base. + Load JSON language data using the given path as a base. If the provided ? ++++++++++++++++ + path isn't present, will attempt to load a gzipped version before giving up. - If the provided path ...
false
false
spacy/util.py
util.py
spaCy
explosion
spacy_util.py
run_command
[ { "version": "v359", "docstring_lines": { "start_line": 665, "end_line": 674 }, "code_lines": { "start_line": 674, "end_line": 702 }, "commit_date_time": "2020-09-18 17:43:19", "commit_sha": "47080fba98bf7efd7432a0ac831d5715fad91a59", "commit_message": "Minor ...
def run_command( command: Union[str, List[str]], *, - capture: bool = False, stdin: Optional[Any] = None, + capture: bool=False, ) -> Optional[subprocess.CompletedProcess]: if isinstance(command, str): - command = split_command(command) ? - --- + ...
Run a command on the command line as a subprocess. If the subprocess returns a non-zero exit code, a system exit is performed. command (str / List[str]): The command. If provided as a string, the string will be split using shlex.split. stdin (Optional[Any]): stdin to read from or None. ...
false
false
spacy/util.py
util.py
spaCy
explosion
spacy_util.py
working_dir
[ { "version": "v300", "docstring_lines": { "start_line": 462, "end_line": 466 }, "code_lines": { "start_line": 466, "end_line": 474 }, "commit_date_time": "2020-06-30 11:17:00", "commit_sha": "3aca404735eab7be48fffcc19dc905ee6db753a5", "commit_message": "Make r...
def working_dir(path: Union[str, Path]) -> None: prev_cwd = Path.cwd() os.chdir(str(path)) try: - yield + yield Path(path).resolve() finally: os.chdir(prev_cwd)
Change current working directory and returns to previous on exit. path (str / Path): The directory to navigate to. + YIELDS (Path): The absolute path to the current working directory. This + should be used if the block needs to perform actions within the working + directory, to prevent mi...
false
false
spacy/util.py
util.py
spaCy
explosion
spacy_util.py
load_config
[ { "version": "v310", "docstring_lines": { "start_line": 339, "end_line": 350 }, "code_lines": { "start_line": 350, "end_line": 360 }, "commit_date_time": "2020-07-12 10:32:24", "commit_sha": "8a67ddd6f12c6870245c0ed7263e30ebe81ede33", "commit_message": "Remove...
+ def load_config(path, create_objects=False): - def load_config( - path: Union[Path, str], - *, - create_objects: bool = False, - schema: Type[BaseModel] = EmptySchema, - overrides: Dict[str, Any] = {}, - validate: bool = True, - ) -> Dict[str, Any]: config = thinc.config.Co...
Load a Thinc-formatted config file, optionally filling in objects where the config references registry entries. See "Thinc config files" for details. path (str / Path): Path to the config file create_objects (bool): Whether to automatically create objects when the config references regi...
false
false
spacy/util.py
util.py
spaCy
explosion
spacy_util.py
resolve_dot_names
[ { "version": "v371", "docstring_lines": { "start_line": 407, "end_line": 418 }, "code_lines": { "start_line": 418, "end_line": 424 }, "commit_date_time": "2020-09-28 01:42:58", "commit_sha": "65448b2e34ab55291a52caaa950e9c427f85902c", "commit_message": "Remove...
- def resolve_dot_names(config: Config, dot_names: List[Optional[str]]) -> List[Optional[Callable]]: + def resolve_dot_names( + config: Config, dot_names: List[Optional[str]] + ) -> List[Optional[Callable]]: resolved = {} output = [] for name in dot_names: if name is None: ...
- Resolve one or more "dot notation" names, e.g. corpora.train. ? - + Resolve one or more "dot notation" names, e.g. corpora.train. The paths could point anywhere into the config, so we don't know which top-level section we'll be looking within....
false
false
spacy/util.py
util.py
spaCy
explosion
spacy_util.py
load_model_from_path
[ { "version": "v428", "docstring_lines": { "start_line": 466, "end_line": 470 }, "code_lines": { "start_line": 470, "end_line": 476 }, "commit_date_time": "2021-10-11 09:38:45", "commit_sha": "fd759a881b02a7bc3488b1d9c005d5849cfc05f9", "commit_message": "Fix in...
def load_model_from_path( - model_path: Union[str, Path], ? ----------- - + model_path: Path, *, meta: Optional[Dict[str, Any]] = None, vocab: Union["Vocab", bool] = True, disable: Iterable[str] = SimpleFrozenList(), exclude: Iterable[str] = SimpleFrozenList()...
Load a model from a data directory path. Creates Language class with pipeline from config.cfg and then calls from_disk() with path. - name (str): Package name or model path. + model_path (Path): Mmodel path. meta (Dict[str, Any]): Optional model meta. vocab (Vocab / True): Optional vocab ...
false
false
spacy/util.py
util.py
spaCy
explosion
spacy_util.py
combine_score_weights
[ { "version": "v363", "docstring_lines": { "start_line": 1206, "end_line": 1212 }, "code_lines": { "start_line": 1212, "end_line": 1237 }, "commit_date_time": "2020-09-24 08:27:33", "commit_sha": "ae51f580c1cd8a4168253d326fd9c1356fc88844", "commit_message": "Fi...
- def combine_score_weights(weights: List[Dict[str, float]]) -> Dict[str, float]: + def combine_score_weights( + weights: List[Dict[str, float]], + overrides: Dict[str, Optional[Union[float, int]]] = SimpleFrozenDict(), + ) -> Dict[str, float]: # We first need to extract all None/null values...
Combine and normalize score weights defined by components, e.g. {"ents_r": 0.2, "ents_p": 0.3, "ents_f": 0.5} and {"some_other_score": 1.0}. weights (List[dict]): The weights defined by the components. + overrides (Dict[str, Optional[Union[float, int]]]): Existing scores that + should be pr...
false
false
spacy/util.py
util.py
spaCy
explosion
spacy_util.py
dict_to_dot
[ { "version": "v448", "docstring_lines": { "start_line": 1535, "end_line": 1557 }, "code_lines": { "start_line": 1557, "end_line": 1564 }, "commit_date_time": "2023-06-14 15:48:41", "commit_sha": "e2b70df01294edee6d1627890f034ac7591d1575", "commit_message": "Co...
- def dict_to_dot(obj: Dict[str, dict]) -> Dict[str, Any]: + def dict_to_dot(obj: Dict[str, dict], *, for_overrides: bool = False) -> Dict[str, Any]: ? ++++++++++++++++++++++++++++++++ - return {".".join(key): value for key, value in walk_dict(obj)} + return { ...
Convert dot notation to a dict. For example: {"token": {"pos": True, "_": {"xyz": True }}} becomes {"token.pos": True, "token._.xyz": True}. - values (Dict[str, dict]): The dict to convert. ? ^^^^^^ + obj (Dict[str, dict]): The dict to convert. ? ^^^ + for_overrides (bool): Whether to e...
false
false
spacy/util.py
util.py
spaCy
explosion
speechbrain_nnet_losses.py
compute_cost.forward
[ { "version": "v22", "docstring_lines": { "start_line": 97, "end_line": 113 }, "code_lines": { "start_line": 113, "end_line": 283 }, "commit_date_time": "2020-05-02 19:26:52", "commit_sha": "eeb1855d7250871b08c6ba2f772af9dcb96d2a82", "commit_message": "Add mini...
def forward(self, prediction, target, lengths): - + # Check on input and label shapes if "ctc" not in self.cost_type: # Shapes cannot be too different (max 3 time steps) diff = abs(prediction.shape[1] - target.shape[1]) i...
+ Returns the cost function given predictions and targets. - Input: - prediction (type: torch.Tensor, mandatory) - the output of the neural network, + Arguments + --------- + prediction : torch.Tensor + tensor containing the posterior probabilities + tar...
false
false
speechbrain/nnet/losses.py
losses.py
speechbrain
speechbrain
speechbrain_nnet_losses.py
compute_masked_loss
[ { "version": "v65", "docstring_lines": { "start_line": 490, "end_line": 512 }, "code_lines": { "start_line": 512, "end_line": 535 }, "commit_date_time": "2020-08-10 22:48:29", "commit_sha": "e3d4eee7f563a8cc5130b487af9956f70f2d4956", "commit_message": "First p...
def compute_masked_loss( loss_fn, predictions, targets, length=None, label_smoothing=0.0, reduction="mean", ): + mask = torch.ones_like(targets) if length is not None: mask = length_to_mask( length * targets.shape[1], max...
Compute the true average loss of a set of waveforms of unequal length. Arguments --------- loss_fn : function A function for computing the loss taking just predictions and targets. Should return all the losses, not a reduction (e.g. reduction="none") predictions : torch....
false
false
speechbrain/nnet/losses.py
losses.py
speechbrain
speechbrain
speechbrain_nnet_losses.py
PitWrapper.forward
[ { "version": "v109", "docstring_lines": { "start_line": 1218, "end_line": 1230 }, "code_lines": { "start_line": 1230, "end_line": 1252 }, "commit_date_time": "2022-08-28 15:54:33", "commit_sha": "8386c170577508fe976422a6ce9e2a936363ab53", "commit_message": "En...
def forward(self, preds, targets): - ? ---- + losses = [] perms = [] for pred, label in zip(preds, targets): loss, p = self._opt_perm_loss(pred, label) perms.append(p) losses.append(loss) ...
Arguments - --------- ? ---- + --------- - preds : torch.Tensor ? ---- + preds : torch.Tensor - Network predictions tensor, of shape ? ---- + Network predictions tensor, of shape - [batch, channels, ..., sources]. ? ---- + ...
false
false
speechbrain/nnet/losses.py
losses.py
speechbrain
speechbrain
speechbrain_nnet_losses.py
LaplacianVarianceLoss.forward
[ { "version": "v115", "docstring_lines": { "start_line": 663, "end_line": 663 }, "code_lines": { "start_line": 664, "end_line": 677 }, "commit_date_time": "2022-11-13 02:43:41", "commit_sha": "b475815f8836da123bec1565fe766ac30d3bed9d", "commit_message": "Diffus...
def forward(self, predictions, length=None, reduction=None): laplacian = self.laplacian(predictions) laplacian = laplacian.moveaxis(self.len_dim, 1) mask = compute_length_mask(laplacian, length).bool() if reduction == "batch": # TODO: Vectori...
Computes the Laplacian loss - + Arguments --------- predictions: torch.Tensor a (B x C x W x H) or (B x C x H x W) tensor Returns ------- loss: torch.Tensor the loss value
false
false
speechbrain/nnet/losses.py
losses.py
speechbrain
speechbrain
speechbrain_nnet_losses.py
VariationalAutoencoderLoss.details
[ { "version": "v117", "docstring_lines": { "start_line": 1345, "end_line": 1378 }, "code_lines": { "start_line": 1378, "end_line": 1389 }, "commit_date_time": "2022-12-08 04:35:15", "commit_sha": "0550948a929c44e0de663badb0895bac3088523a", "commit_message": "Di...
def details(self, predictions, targets, length=None, reduction="batchmean"): if length is None: length = torch.ones(targets.size(0)) rec_loss, dist_loss = self._compute_components(predictions, targets) - rec_loss = self._reduce_loss(rec_loss, length, ...
Gets detailed information about the loss (useful for plotting, logs, etc.) Arguments --------- predictions: speechbrain.nnet.autoencoder.VariationalAutoencoderOutput the variational autoencoder output (or a tuple of rec, mean, log_var) targets: tor...
false
false
speechbrain/nnet/losses.py
losses.py
speechbrain
speechbrain
speechbrain_nnet_losses.py
AutoencoderLoss.forward
[ { "version": "v131", "docstring_lines": { "start_line": 1395, "end_line": 1421 }, "code_lines": { "start_line": 1421, "end_line": 1446 }, "commit_date_time": "2024-03-14 18:12:26", "commit_sha": "01c8a112f34bb61f26102a584268ec2d65f4a60e", "commit_message": "Fi...
def forward(self, predictions, targets, length=None, reduction="batchmean"): - rec_loss = self._align_length_axis( self.rec_loss(targets, predictions.rec, reduction=None) ) return _reduce_autoencoder_loss(rec_loss, length, reduction)
Computes the autoencoder loss Arguments --------- predictions: speechbrain.nnet.autoencoders.AutoencoderOutput the autoencoder output - targets: torch.Tensor targets for the reconstruction loss - length: torch.Tensor Leng...
false
false
speechbrain/nnet/losses.py
losses.py
speechbrain
speechbrain
spacy_pipe_analysis.py
analyze_all_pipes
[ { "version": "v8", "docstring_lines": { "start_line": 179, "end_line": 182 }, "code_lines": { "start_line": 182, "end_line": 195 }, "commit_date_time": "2020-05-24 15:20:58", "commit_sha": "5d3806e059178c9516fb6cf57064cb10cfbf0f29", "commit_message": "unicode ...
- def analyze_all_pipes(pipeline, warn=True): + def analyze_all_pipes(nlp: "Language", warn: bool = True) -> Dict[str, List[str]]: problems = {} - for i, (name, pipe) in enumerate(pipeline): ? - ------- ^^ + for i, name in enumerate(nlp.pipe_names): ? ...
Analyze all pipes in the pipeline in order. - pipeline (list): A list of (name, pipe) tuples e.g. nlp.pipeline. + nlp (Language): The current nlp object. warn (bool): Show user warning if problem is found. - RETURNS (dict): The problems found, keyed by component name. ? ^ + RETU...
false
false
spacy/pipe_analysis.py
pipe_analysis.py
spaCy
explosion
spacy_pipe_analysis.py
print_summary
[ { "version": "v9", "docstring_lines": { "start_line": 138, "end_line": 147 }, "code_lines": { "start_line": 147, "end_line": 168 }, "commit_date_time": "2020-07-22 11:42:59", "commit_sha": "43b960c01b0c64e56859ad5eb304a5422af46516", "commit_message": "Refactor...
def print_summary( - nlp: "Language", pretty: bool = True, no_print: bool = False + nlp: "Language", + *, + keys: List[str] = ["requires", "assigns", "scores", "retokenizes"], + pretty: bool = True, + no_print: bool = False, ) -> Optional[Dict[str, Union[List[str], Dict[str, List[str]]]]]: ...
Print a formatted summary for the current nlp object's pipeline. Shows a table with the pipeline components and why they assign and require, as well as any problems if available. nlp (Language): The nlp object. + keys (List[str]): The meta keys to show in the table. pretty (bool): Prett...
false
false
spacy/pipe_analysis.py
pipe_analysis.py
spaCy
explosion
scripts_ws_client.py
readable_timedelta
[ { "version": "v5", "docstring_lines": { "start_line": 77, "end_line": 83 }, "code_lines": { "start_line": 83, "end_line": 91 }, "commit_date_time": "2022-10-11 06:10:57", "commit_sha": "16c0fef72edf529f34744552d155ff15642ad64f", "commit_message": "update times...
def readable_timedelta(delta): + seconds, milliseconds = divmod(delta, 1000) + minutes, seconds = divmod(seconds, 60) + + return f"{int(minutes)}:{int(seconds)}.{int(milliseconds)}" - attrs = ['years', 'months', 'days', 'hours', 'minutes', 'seconds', 'microseconds'] - return ...
- Convert a dateutil.relativedelta to a readable format ? ^^^^^^ ^^ ^^^^^^ + Convert a millisecond delta to a readable format ? ^ ^^^ ^^^^^ - :param delta: A dateutil.relativedelta + :param delta: A delta between two timestamps in milliseconds :returns: The readable time differe...
false
false
scripts/ws_client.py
ws_client.py
freqtrade
freqtrade
apps_ops_ansible_runner.py
AdHocRunner.run
[ { "version": "v16", "docstring_lines": { "start_line": 181, "end_line": 189 }, "code_lines": { "start_line": 189, "end_line": 227 }, "commit_date_time": "2018-03-30 14:03:43", "commit_sha": "09fc2776df4dfda5aee42b6ffb86f709397bdbd7", "commit_message": "[Update...
- def run(self, tasks, pattern, play_name='Ansible Ad-hoc', gather_facts='no', file_obj=None): ? --------------- + def run(self, tasks, pattern, play_name='Ansible Ad-hoc', gather_facts='no'): self.che...
:param tasks: [{'action': {'module': 'shell', 'args': 'ls'}, ...}, ] :param pattern: all, *, or others :param play_name: The play name :param gather_facts: - :param file_obj: logging to file_obj :return:
false
false
apps/ops/ansible/runner.py
runner.py
jumpserver
jumpserver
homeassistant_config_entries.py
ConfigFlow._async_current_entries
[ { "version": "v163", "docstring_lines": { "start_line": 959, "end_line": 961 }, "code_lines": { "start_line": 961, "end_line": 964 }, "commit_date_time": "2021-01-26 21:19:10", "commit_sha": "74a44e03fa2e917e07bbe7e5fd3eb6f9d77dc8fc", "commit_message": "Extend...
- def _async_current_entries(self) -> List[ConfigEntry]: + def _async_current_entries(self, include_ignore: bool = False) -> List[ConfigEntry]: ? ++++++++++++++++++++++++++++++ + assert self.hass is not None - return self.hass.config_entries.async_en...
Return current entries. + + If the flow is user initiated, filter out ignored entries unless include_ignore is True.
false
false
homeassistant/config_entries.py
config_entries.py
core
home-assistant
samcli_lib_remote_invoke_remote_invoke_executors.py
RemoteInvokeExecutor.execute
[ { "version": "v1", "docstring_lines": { "start_line": 178, "end_line": 183 }, "code_lines": { "start_line": 183, "end_line": 191 }, "commit_date_time": "2023-05-10 00:53:10", "commit_sha": "e6dff76892b22c2f06b95622b3f53dfbaec2f8e7", "commit_message": "feat: ad...
def execute(self, remote_invoke_input: RemoteInvokeExecutionInfo) -> RemoteInvokeExecutionInfo: remote_invoke_input = self._map_input(remote_invoke_input) + self._boto_action_executor.validate_action_parameters(remote_invoke_input.parameters) remote_invoke_...
First runs all mappers for request object to get the final version of it. - Then invokes the BotoActionExecutor to get the result + Then validates all the input boto parameters and invokes the BotoActionExecutor to get the result And finally, runs all mappers for the response object to get t...
false
false
samcli/lib/remote_invoke/remote_invoke_executors.py
remote_invoke_executors.py
aws-sam-cli
aws
samcli_lib_remote_invoke_remote_invoke_executors.py
BotoActionExecutor.execute
[ { "version": "v3", "docstring_lines": { "start_line": 241, "end_line": 253 }, "code_lines": { "start_line": 253, "end_line": 256 }, "commit_date_time": "2023-06-05 18:20:50", "commit_sha": "dd1adb15ab4036a809f4f4cf976ded09139f5a4e", "commit_message": "feat: Ad...
- def execute(self, remote_invoke_input: RemoteInvokeExecutionInfo) -> RemoteInvokeExecutionInfo: ? ^^ ^^^^ ^^^^ + def execute(self, remote_invoke_input: RemoteInvokeExecutionInfo) -> RemoteInvokeIterableResponseType: ? ...
Executes boto3 API and updates response or exception object depending on the result Parameters ---------- remote_invoke_input : RemoteInvokeExecutionInfo - RemoteInvokeExecutionInfo details which contains payload or payload file information ? ^^^^^ - ...
false
false
samcli/lib/remote_invoke/remote_invoke_executors.py
remote_invoke_executors.py
aws-sam-cli
aws
skimage_metrics_simple_metrics.py
mean_squared_error
[ { "version": "v22", "docstring_lines": { "start_line": 22, "end_line": 42 }, "code_lines": { "start_line": 42, "end_line": 46 }, "commit_date_time": "2019-08-15 14:44:25", "commit_sha": "24b2917b98ad5787f71b57f5771c4d884362759f", "commit_message": "Critical: a...
- def mean_squared_error(im1, im2): ? ^ ^ + def mean_squared_error(image0, image1): ? ^^^^ ^^^^ - check_shape_equality(im1, im2) ? ^ ^ + check_shape_equality(image0, image1) ? ...
Compute the mean-squared error between two images. Parameters ---------- - im1, im2 : ndarray ? ^ ^ + image0, image1 : ndarray ? ^^^^ ^^^^ Images. Any dimensionality, must have same shape. Returns ------- mse : float The mean-squared...
false
false
skimage/metrics/simple_metrics.py
simple_metrics.py
scikit-image
scikit-image
skimage_metrics_simple_metrics.py
peak_signal_noise_ratio
[ { "version": "v21", "docstring_lines": { "start_line": 97, "end_line": 121 }, "code_lines": { "start_line": 121, "end_line": 143 }, "commit_date_time": "2019-07-27 03:18:37", "commit_sha": "7875d332f63e1e69b45d8efc2ade97f7a9d14767", "commit_message": "Rename i...
def peak_signal_noise_ratio(im_true, im_test, data_range=None): check_shape_equality(im_true, im_test) if data_range is None: if im_true.dtype != im_test.dtype: warn("Inputs have mismatched dtype. Setting data_range based on " - "im_true...
Compute the peak signal to noise ratio (PSNR) for an image. Parameters ---------- im_true : ndarray Ground-truth image, same shape as im_test. im_test : ndarray Test image. data_range : int, optional The data range of the input image (distance between min...
false
false
skimage/metrics/simple_metrics.py
simple_metrics.py
scikit-image
scikit-image