Datasets:

function_name
stringlengths
1
63
docstring
stringlengths
50
5.89k
masked_code
stringlengths
50
882k
implementation
stringlengths
169
12.9k
start_line
int32
1
14.6k
end_line
int32
16
14.6k
file_content
stringlengths
274
882k
_iter_valid_files
Iterates on files with extension in `white_list_formats` contained in `directory`. # Arguments directory: Absolute path to the directory containing files to be counted white_list_formats: Set of strings containing allowed extensions for the files to be counted. follow_links: Boolean. # Yie...
"""Fairly basic set of tools for real-time data augmentation on image data. Can easily be extended to include new transformations, new preprocessing methods, etc... """ from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np import re from scipy ...
def _iter_valid_files(directory, white_list_formats, follow_links): """Iterates on files with extension in `white_list_formats` contained in `directory`. # Arguments directory: Absolute path to the directory containing files to be counted white_list_formats: Set of strings containin...
1,356
1,381
"""Fairly basic set of tools for real-time data augmentation on image data. Can easily be extended to include new transformations, new preprocessing methods, etc... """ from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np import re from scipy ...
_count_valid_files_in_directory
Counts files with extension in `white_list_formats` contained in `directory`. # Arguments directory: absolute path to the directory containing files to be counted white_list_formats: set of strings containing allowed extensions for the files to be counted. split: tuple of floats (e.g. `(0.2...
"""Fairly basic set of tools for real-time data augmentation on image data. Can easily be extended to include new transformations, new preprocessing methods, etc... """ from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np import re from scipy ...
def _count_valid_files_in_directory(directory, white_list_formats, split, follow_links): """Counts files with extension in `white_list_formats` contained in `directory`. # Arguments directory: ab...
1,384
1,411
"""Fairly basic set of tools for real-time data augmentation on image data. Can easily be extended to include new transformations, new preprocessing methods, etc... """ from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np import re from scipy ...
standardize
Applies the normalization configuration to a batch of inputs. # Arguments x: Batch of inputs to be normalized. # Returns The inputs, normalized.
"""Fairly basic set of tools for real-time data augmentation on image data. Can easily be extended to include new transformations, new preprocessing methods, etc... """ from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np import re from scipy ...
def standardize(self, x): """Applies the normalization configuration to a batch of inputs. # Arguments x: Batch of inputs to be normalized. # Returns The inputs, normalized. """ if self.preprocessing_function: x = self.preprocessing_funct...
876
921
"""Fairly basic set of tools for real-time data augmentation on image data. Can easily be extended to include new transformations, new preprocessing methods, etc... """ from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np import re from scipy ...
fit
Computes the internal data stats related to the data-dependent transformations, based on an array of sample data. Only required if `featurewise_center` or `featurewise_std_normalization` or `zca_whitening` are set to True. # Arguments x: Sample data. Should have rank 4. In case of grayscale data, the ch...
"""Fairly basic set of tools for real-time data augmentation on image data. Can easily be extended to include new transformations, new preprocessing methods, etc... """ from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np import re from scipy ...
def fit(self, x, augment=False, rounds=1, seed=None): """Computes the internal data stats related to the data-dependent transformations, based on an array of sample data. Only required if `featurewise_center` or `featurewise_std_normalization` or `zca_whi...
1,037
1,107
"""Fairly basic set of tools for real-time data augmentation on image data. Can easily be extended to include new transformations, new preprocessing methods, etc... """ from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np import re from scipy ...
reroot
Reroot to a new path, maintaining a input proto index. Similar to root.get_descendant_or_error(source_path): however, this method retains the ability to get a map to the original index. Args: root: the original root. source_path: the path to the new root. Returns: the new root.
# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
def reroot(root: expression.Expression, source_path: path.Path) -> expression.Expression: """Reroot to a new path, maintaining a input proto index. Similar to root.get_descendant_or_error(source_path): however, this method retains the ability to get a map to the original index. Args: root: the ...
31
49
# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
has_wildcard
Check if string or any element in list/tuple has a wildcard (? or *). Args: workflow_id_or_label: Workflow ID (str) or label (str). Or array (list, tuple) of them.
import fnmatch import io import logging from uuid import UUID import requests from requests.exceptions import ConnectionError, HTTPError from .cromwell_metadata import CromwellMetadata logger = logging.getLogger(__name__) def requests_error_handler(func): """Re-raise ConnectionError with help message. Cont...
def has_wildcard(workflow_id_or_label): """Check if string or any element in list/tuple has a wildcard (? or *). Args: workflow_id_or_label: Workflow ID (str) or label (str). Or array (list, tuple) of them. """ if workflow_id_or_label is None: return False ...
67
84
import fnmatch import io import logging from uuid import UUID import requests from requests.exceptions import ConnectionError, HTTPError from .cromwell_metadata import CromwellMetadata logger = logging.getLogger(__name__) def requests_error_handler(func): """Re-raise ConnectionError with help message. Cont...
get_metadata
Retrieve metadata for workflows matching workflow IDs or labels Args: workflow_ids: List of workflows IDs to find workflows matched. labels: List of Caper's string labels to find workflows matched. embed_subworkflow: Recursively embed subworkflow's metadata in main workflow'...
import fnmatch import io import logging from uuid import UUID import requests from requests.exceptions import ConnectionError, HTTPError from .cromwell_metadata import CromwellMetadata logger = logging.getLogger(__name__) def requests_error_handler(func): """Re-raise ConnectionError with help message. Cont...
def get_metadata(self, workflow_ids=None, labels=None, embed_subworkflow=False): """Retrieve metadata for workflows matching workflow IDs or labels Args: workflow_ids: List of workflows IDs to find workflows matched. labels: List of Caper's st...
227
261
import fnmatch import io import logging from uuid import UUID import requests from requests.exceptions import ConnectionError, HTTPError from .cromwell_metadata import CromwellMetadata logger = logging.getLogger(__name__) def requests_error_handler(func): """Re-raise ConnectionError with help message. Cont...
get_labels
Get labels JSON for a specified workflow Returns: Labels JSON for a workflow
import fnmatch import io import logging from uuid import UUID import requests from requests.exceptions import ConnectionError, HTTPError from .cromwell_metadata import CromwellMetadata logger = logging.getLogger(__name__) def requests_error_handler(func): """Re-raise ConnectionError with help message. Cont...
def get_labels(self, workflow_id): """Get labels JSON for a specified workflow Returns: Labels JSON for a workflow """ if workflow_id is None or not is_valid_uuid(workflow_id): return r = self.__request_get( CromwellRestAPI.ENDPOINT_LABEL...
263
277
import fnmatch import io import logging from uuid import UUID import requests from requests.exceptions import ConnectionError, HTTPError from .cromwell_metadata import CromwellMetadata logger = logging.getLogger(__name__) def requests_error_handler(func): """Re-raise ConnectionError with help message. Cont...
get_label
Get a label for a key in a specified workflow Returns: Value for a specified key in labels JSON for a workflow
import fnmatch import io import logging from uuid import UUID import requests from requests.exceptions import ConnectionError, HTTPError from .cromwell_metadata import CromwellMetadata logger = logging.getLogger(__name__) def requests_error_handler(func): """Re-raise ConnectionError with help message. Cont...
def get_label(self, workflow_id, key): """Get a label for a key in a specified workflow Returns: Value for a specified key in labels JSON for a workflow """ labels = self.get_labels(workflow_id) if labels is None: return if key in labels: ...
279
289
import fnmatch import io import logging from uuid import UUID import requests from requests.exceptions import ConnectionError, HTTPError from .cromwell_metadata import CromwellMetadata logger = logging.getLogger(__name__) def requests_error_handler(func): """Re-raise ConnectionError with help message. Cont...
find_by_workflow_ids
Finds workflows by exactly matching workflow IDs (UUIDs). Does OR search for a list of workflow IDs. Invalid UUID in `workflows_ids` will be ignored without warning. Wildcards (? and *) are not allowed. Args: workflow_ids: List of workflow ID (UUID) strings. Lower-case only (Cromwell uses lower-cas...
import fnmatch import io import logging from uuid import UUID import requests from requests.exceptions import ConnectionError, HTTPError from .cromwell_metadata import CromwellMetadata logger = logging.getLogger(__name__) def requests_error_handler(func): """Re-raise ConnectionError with help message. Cont...
def find_by_workflow_ids(self, workflow_ids=None, exclude_subworkflow=True): """Finds workflows by exactly matching workflow IDs (UUIDs). Does OR search for a list of workflow IDs. Invalid UUID in `workflows_ids` will be ignored without warning. Wildcards (? and *) are not allowed. ...
358
397
import fnmatch import io import logging from uuid import UUID import requests from requests.exceptions import ConnectionError, HTTPError from .cromwell_metadata import CromwellMetadata logger = logging.getLogger(__name__) def requests_error_handler(func): """Re-raise ConnectionError with help message. Cont...
find_by_labels
Finds workflows by exactly matching labels (key, value) tuples. Does OR search for a list of label key/value pairs. Wildcards (? and *) are not allowed. Args: labels: List of labels (key/value pairs). Returns: List of matched workflow JSONs.
import fnmatch import io import logging from uuid import UUID import requests from requests.exceptions import ConnectionError, HTTPError from .cromwell_metadata import CromwellMetadata logger = logging.getLogger(__name__) def requests_error_handler(func): """Re-raise ConnectionError with help message. Cont...
def find_by_labels(self, labels=None, exclude_subworkflow=True): """Finds workflows by exactly matching labels (key, value) tuples. Does OR search for a list of label key/value pairs. Wildcards (? and *) are not allowed. Args: labels: List of labels (key/...
399
439
import fnmatch import io import logging from uuid import UUID import requests from requests.exceptions import ConnectionError, HTTPError from .cromwell_metadata import CromwellMetadata logger = logging.getLogger(__name__) def requests_error_handler(func): """Re-raise ConnectionError with help message. Cont...
find
Wrapper for the following three find functions. - find_with_wildcard - find_by_workflow_ids - find_by_labels Find workflows by matching workflow IDs or label (key, value) tuples. Does OR search for both parameters. Wildcards (? and *) in both parameters are allowed but Caper will retrieve a list of all workflows, whic...
import fnmatch import io import logging from uuid import UUID import requests from requests.exceptions import ConnectionError, HTTPError from .cromwell_metadata import CromwellMetadata logger = logging.getLogger(__name__) def requests_error_handler(func): """Re-raise ConnectionError with help message. Cont...
def find(self, workflow_ids=None, labels=None, exclude_subworkflow=True): """Wrapper for the following three find functions. - find_with_wildcard - find_by_workflow_ids - find_by_labels Find workflows by matching workflow IDs or label (key, value) tuples. Does OR sea...
441
493
import fnmatch import io import logging from uuid import UUID import requests from requests.exceptions import ConnectionError, HTTPError from .cromwell_metadata import CromwellMetadata logger = logging.getLogger(__name__) def requests_error_handler(func): """Re-raise ConnectionError with help message. Cont...
__next__
This changes the inverse table by removing hits. Returns a (Whisker_Seg, index),(Whisker_Seg, index)... tuple or None, if done.
""" Author: Nathan Clack Date : 2009 Copyright (c) 2009 HHMI. Free downloads and distribution are allowed for any non-profit research and educational purposes as long as proper credit is given to the author. All other rights reserved. """ from .tests import plot_whiskers from ui.whiskerdata.trace import Whisker_Seg f...
def __next__(self): """ This changes the inverse table by removing hits. Returns a (Whisker_Seg, index),(Whisker_Seg, index)... tuple or None, if done. """ todelete = [] retval = None for px,s in self._map.items(): todelete.append(px) # get rid of references to visited pixe...
590
607
""" Author: Nathan Clack Date : 2009 Copyright (c) 2009 HHMI. Free downloads and distribution are allowed for any non-profit research and educational purposes as long as proper credit is given to the author. All other rights reserved. """ from .tests import plot_whiskers from ui.whiskerdata.trace import Whisker_Seg f...
_build_labels_query
Build Elasticsearch query for Timesketch labels. Args: sketch_id: Integer of sketch primary key. labels: List of label names. Returns: Elasticsearch query as a dictionary.
# Copyright 2015 Google Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
@staticmethod def _build_labels_query(sketch_id, labels): """Build Elasticsearch query for Timesketch labels. Args: sketch_id: Integer of sketch primary key. labels: List of label names. Returns: Elasticsearch query as a dictionary. """ ...
138
177
# Copyright 2015 Google Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
_build_events_query
Build Elasticsearch query for one or more document ids. Args: events: List of Elasticsearch document IDs. Returns: Elasticsearch query as a dictionary.
# Copyright 2015 Google Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
@staticmethod def _build_events_query(events): """Build Elasticsearch query for one or more document ids. Args: events: List of Elasticsearch document IDs. Returns: Elasticsearch query as a dictionary. """ events_list = [event['event_id'] for eve...
179
191
# Copyright 2015 Google Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
_build_query_dsl
Build Elastic Search DSL query by adding in timeline filtering. Args: query_dsl: A dict with the current query_dsl timeline_ids: Either a list of timeline IDs (int) or None. Returns: Elasticsearch query DSL as a dictionary.
# Copyright 2015 Google Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
@staticmethod def _build_query_dsl(query_dsl, timeline_ids): """Build Elastic Search DSL query by adding in timeline filtering. Args: query_dsl: A dict with the current query_dsl timeline_ids: Either a list of timeline IDs (int) or None. Returns: Ela...
193
255
# Copyright 2015 Google Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
_convert_to_time_range
Convert an interval timestamp into start and end dates. Args: interval: Time frame representation Returns: Start timestamp in string format. End timestamp in string format.
# Copyright 2015 Google Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
@staticmethod def _convert_to_time_range(interval): """Convert an interval timestamp into start and end dates. Args: interval: Time frame representation Returns: Start timestamp in string format. End timestamp in string format. """ # ...
257
299
# Copyright 2015 Google Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
get_filter_labels
Aggregate labels for a sketch. Args: sketch_id: The Sketch ID indices: List of indices to aggregate on Returns: List with label names.
# Copyright 2015 Google Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
def get_filter_labels(self, sketch_id, indices): """Aggregate labels for a sketch. Args: sketch_id: The Sketch ID indices: List of indices to aggregate on Returns: List with label names. """ # This is a workaround to return all labels by ...
651
717
# Copyright 2015 Google Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
count
Count number of documents. Args: indices: List of indices. Returns: Tuple containing number of documents and size on disk.
# Copyright 2015 Google Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
def count(self, indices): """Count number of documents. Args: indices: List of indices. Returns: Tuple containing number of documents and size on disk. """ if not indices: return 0, 0 try: es_stats = self.client.indic...
754
786
# Copyright 2015 Google Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
create_index
Create index with Timesketch settings. Args: index_name: Name of the index. Default is a generated UUID. doc_type: Name of the document type. Default id generic_event. mappings: Optional dict with the document mapping for Elastic. Returns: Index name in string format. Document type in string forma...
# Copyright 2015 Google Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
def create_index( self, index_name=uuid4().hex, doc_type='generic_event', mappings=None): """Create index with Timesketch settings. Args: index_name: Name of the index. Default is a generated UUID. doc_type: Name of the document type. Default id gener...
853
898
# Copyright 2015 Google Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
lpp_averageIndivTransit
Create the loop over individual transits and return array normalized lpp values, mean and std. Input TCE object and mapInfo object. It is unclear that this individual transit approach separates out several new false positives. It probably would require retuning for low SNR signals.
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Thu Aug 23 20:32:12 2018 Functions to correctly fold and bin a light curve. Calculate the lpp metric: transform to lower dimensions, knn Depends on class from reading in a previously created LPP metric Map Depends on reading in the light curve to data stru...
def lpp_averageIndivTransit(tcedata,mapInfo): """ Create the loop over individual transits and return array normalized lpp values, mean and std. Input TCE object and mapInfo object. It is unclear that this individual transit approach separates out several new false positives. It p...
259
287
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Thu Aug 23 20:32:12 2018 Functions to correctly fold and bin a light curve. Calculate the lpp metric: transform to lower dimensions, knn Depends on class from reading in a previously created LPP metric Map Depends on reading in the light curve to data stru...
__init__
Args: cfg (CfgNode): vis_highest_scoring (bool): If set to True visualizes only the highest scoring prediction
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import argparse import logging import multiprocessing as mp import numpy as np import os import torch from detectron2.config import get_cfg from detectron2.data import MetadataCatalog from detectron2.da...
def __init__(self, cfg, vis_highest_scoring=True, output_dir="./vis"): """ Args: cfg (CfgNode): vis_highest_scoring (bool): If set to True visualizes only the highest scoring prediction """ self.metadata = MetadataCatalo...
60
76
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import argparse import logging import multiprocessing as mp import numpy as np import os import torch from detectron2.config import get_cfg from detectron2.data import MetadataCatalog from detectron2.da...
_get_field_uniq_x_coef
This function outputs threshold to number of occurrences different variants of list of columns (fields) In short if coef for ex. is 0.9, then function outputs number of occurrences for all but least 10% of the least used If coef is more 1.0, then 'coef' itself is used as threshold
# AUTOGENERATED! DO NOT EDIT! File to edit: nbs/01_tabular.pd.ipynb (unless otherwise specified). __all__ = ['PartDep'] # Cell from fastai.tabular.all import * from .core import * # Cell from plotnine import * # Cell from IPython.display import clear_output # Cell class PartDep(Interpret): """ Calculate Pa...
def _get_field_uniq_x_coef(self, df: pd.DataFrame, fields: list, coef: float) -> list: ''' This function outputs threshold to number of occurrences different variants of list of columns (fields) In short if coef for ex. is 0.9, then function outputs number of occurrences for all but least 10...
123
139
# AUTOGENERATED! DO NOT EDIT! File to edit: nbs/01_tabular.pd.ipynb (unless otherwise specified). __all__ = ['PartDep'] # Cell from fastai.tabular.all import * from .core import * # Cell from plotnine import * # Cell from IPython.display import clear_output # Cell class PartDep(Interpret): """ Calculate Pa...
sigmoid_focal_loss
:alias_main: paddle.nn.functional.sigmoid_focal_loss :alias: paddle.nn.functional.sigmoid_focal_loss,paddle.nn.functional.loss.sigmoid_focal_loss :old_api: paddle.fluid.layers.sigmoid_focal_loss **Sigmoid Focal Loss Operator.** `Focal Loss <https://arxiv.org/abs/1708.02002>`_ is used to address the foregr...
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applic...
def sigmoid_focal_loss(x, label, fg_num, gamma=2.0, alpha=0.25): """ :alias_main: paddle.nn.functional.sigmoid_focal_loss :alias: paddle.nn.functional.sigmoid_focal_loss,paddle.nn.functional.loss.sigmoid_focal_loss :old_api: paddle.fluid.layers.sigmoid_focal_loss **Sigmoid Focal Loss Operator.** `Focal...
472
616
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applic...
iou_similarity
:alias_main: paddle.nn.functional.iou_similarity :alias: paddle.nn.functional.iou_similarity,paddle.nn.functional.loss.iou_similarity :old_api: paddle.fluid.layers.iou_similarity ${comment} Args: x (Variable): ${x_comment}.The data type is float32 or float64. y (Variable): ${y_comment}.The data ty...
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applic...
@templatedoc() def iou_similarity(x, y, box_normalized=True, name=None): """ :alias_main: paddle.nn.functional.iou_similarity :alias: paddle.nn.functional.iou_similarity,paddle.nn.functional.loss.iou_similarity :old_api: paddle.fluid.layers.iou_similarity ${comment} Args: x (Variable): ${x_comm...
761
812
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applic...
polygon_box_transform
${comment} Args: input(Variable): The input with shape [batch_size, geometry_channels, height, width]. A Tensor with type float32, float64. name(str, Optional): For details, please refer to :ref:`api_guide_Name`. Generally, no setting is required. Default: None. Return...
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applic...
@templatedoc() def polygon_box_transform(input, name=None): """ ${comment} Args: input(Variable): The input with shape [batch_size, geometry_channels, height, width]. A Tensor with type float32, float64. name(str, Optional): For details, please refer to :ref:`api_gu...
967
998
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applic...
yolo_box
:alias_main: paddle.nn.functional.yolo_box :alias: paddle.nn.functional.yolo_box,paddle.nn.functional.vision.yolo_box :old_api: paddle.fluid.layers.yolo_box ${comment} Args: x (Variable): ${x_comment} The data type is float32 or float64. img_size (Variable): ${img_size_comment} The data type is i...
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applic...
@templatedoc(op_type="yolo_box") def yolo_box(x, img_size, anchors, class_num, conf_thresh, downsample_ratio, clip_bbox=True, name=None, scale_x_y=1.): """ :alias_main: paddle.nn.functional.yolo_box :alias: pad...
1,131
1,219
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applic...
anchor_generator
:alias_main: paddle.nn.functional.anchor_generator :alias: paddle.nn.functional.anchor_generator,paddle.nn.functional.vision.anchor_generator :old_api: paddle.fluid.layers.anchor_generator **Anchor generator operator** Generate anchors for Faster RCNN algorithm. Each position of the input produce N anchor...
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applic...
def anchor_generator(input, anchor_sizes=None, aspect_ratios=None, variance=[0.1, 0.1, 0.2, 0.2], stride=None, offset=0.5, name=None): """ :alias_main: paddle.nn.functional.anchor_generator...
2,402
2,504
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applic...
generate_mask_labels
:alias_main: paddle.nn.functional.generate_mask_labels :alias: paddle.nn.functional.generate_mask_labels,paddle.nn.functional.vision.generate_mask_labels :old_api: paddle.fluid.layers.generate_mask_labels **Generate Mask Labels for Mask-RCNN** This operator can be, for given the RoIs and corresponding lab...
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applic...
def generate_mask_labels(im_info, gt_classes, is_crowd, gt_segms, rois, labels_int32, num_classes, resolution): """ :alias_main: paddle.nn.functional.generate_mask_labels :alias: paddle.nn.functional.generate_mask_labels,paddle.nn.functional.vision.generate_mask_labels :old_api: paddle.f...
2,737
2,883
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applic...
box_decoder_and_assign
:alias_main: paddle.nn.functional.box_decoder_and_assign :alias: paddle.nn.functional.box_decoder_and_assign,paddle.nn.functional.vision.box_decoder_and_assign :old_api: paddle.fluid.layers.box_decoder_and_assign ${comment} Args: prior_box(${prior_box_type}): ${prior_box_comment} prior_box_var(...
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applic...
@templatedoc() def box_decoder_and_assign(prior_box, prior_box_var, target_box, box_score, box_clip, name=None): """ :alias_main: paddle.nn.functional.box_decoder_and_assign :alia...
3,742
3,815
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applic...
get_node_list
This function returns all check constraints nodes within that collection as a list. Args: gid: Server Group ID sid: Server ID did: Database ID scid: Schema ID tid: Table ID cid: Cehck constraint ID Returns:
########################################################################## # # pgAdmin 4 - PostgreSQL Tools # # Copyright (C) 2013 - 2017, The pgAdmin Development Team # This software is released under the PostgreSQL Licence # ########################################################################## """Implements the...
def get_node_list(self, gid, sid, did, scid, tid, cid=None): """ This function returns all check constraints nodes within that collection as a list. Args: gid: Server Group ID sid: Server ID did: Database ID scid: Schema ID tid: Tabl...
267
305
########################################################################## # # pgAdmin 4 - PostgreSQL Tools # # Copyright (C) 2013 - 2017, The pgAdmin Development Team # This software is released under the PostgreSQL Licence # ########################################################################## """Implements the...
node
Returns all the Check Constraints. Args: gid: Server Group Id sid: Server Id did: Database Id scid: Schema Id tid: Table Id cid: Check constraint Id.
########################################################################## # # pgAdmin 4 - PostgreSQL Tools # # Copyright (C) 2013 - 2017, The pgAdmin Development Team # This software is released under the PostgreSQL Licence # ########################################################################## """Implements the...
@check_precondition def node(self, gid, sid, did, scid, tid, cid): """ Returns all the Check Constraints. Args: gid: Server Group Id sid: Server Id did: Database Id scid: Schema Id tid: Table Id cid: Check constrain...
307
344
########################################################################## # # pgAdmin 4 - PostgreSQL Tools # # Copyright (C) 2013 - 2017, The pgAdmin Development Team # This software is released under the PostgreSQL Licence # ########################################################################## """Implements the...
nodes
Returns all the Check Constraints. Args: gid: Server Group Id sid: Server Id did: Database Id scid: Schema Id tid: Table Id cid: Check constraint Id.
########################################################################## # # pgAdmin 4 - PostgreSQL Tools # # Copyright (C) 2013 - 2017, The pgAdmin Development Team # This software is released under the PostgreSQL Licence # ########################################################################## """Implements the...
@check_precondition def nodes(self, gid, sid, did, scid, tid): """ Returns all the Check Constraints. Args: gid: Server Group Id sid: Server Id did: Database Id scid: Schema Id tid: Table Id cid: Check constraint Id...
346
383
########################################################################## # # pgAdmin 4 - PostgreSQL Tools # # Copyright (C) 2013 - 2017, The pgAdmin Development Team # This software is released under the PostgreSQL Licence # ########################################################################## """Implements the...
get_nodes
This function returns all event check constraint as a list. Args: gid: Server Group ID sid: Server ID did: Database ID scid: Schema ID tid: Table ID cid: Check constraint ID Returns:
########################################################################## # # pgAdmin 4 - PostgreSQL Tools # # Copyright (C) 2013 - 2017, The pgAdmin Development Team # This software is released under the PostgreSQL Licence # ########################################################################## """Implements the...
def get_nodes(self, gid, sid, did, scid, tid, cid=None): """ This function returns all event check constraint as a list. Args: gid: Server Group ID sid: Server ID did: Database ID scid: Schema ID tid: Table ID cid: Check constraint...
385
439
########################################################################## # # pgAdmin 4 - PostgreSQL Tools # # Copyright (C) 2013 - 2017, The pgAdmin Development Team # This software is released under the PostgreSQL Licence # ########################################################################## """Implements the...
properties
Returns the Check Constraints property. Args: gid: Server Group Id sid: Server Id did: Database Id scid: Schema Id tid: Check Id cid: Check Constraint Id
########################################################################## # # pgAdmin 4 - PostgreSQL Tools # # Copyright (C) 2013 - 2017, The pgAdmin Development Team # This software is released under the PostgreSQL Licence # ########################################################################## """Implements the...
@check_precondition def properties(self, gid, sid, did, scid, tid, cid): """ Returns the Check Constraints property. Args: gid: Server Group Id sid: Server Id did: Database Id scid: Schema Id tid: Check Id cid: Chec...
441
470
########################################################################## # # pgAdmin 4 - PostgreSQL Tools # # Copyright (C) 2013 - 2017, The pgAdmin Development Team # This software is released under the PostgreSQL Licence # ########################################################################## """Implements the...
msql
Returns the modified SQL. Args: gid: Server Group Id sid: Server Id did: Database Id scid: Schema Id tid: Table Id cid: Check Constraint Id Returns: Check Constraint object in json format.
########################################################################## # # pgAdmin 4 - PostgreSQL Tools # # Copyright (C) 2013 - 2017, The pgAdmin Development Team # This software is released under the PostgreSQL Licence # ########################################################################## """Implements the...
@check_precondition def msql(self, gid, sid, did, scid, tid, cid=None): """ Returns the modified SQL. Args: gid: Server Group Id sid: Server Id did: Database Id scid: Schema Id tid: Table Id cid: Check Constraint Id...
738
776
########################################################################## # # pgAdmin 4 - PostgreSQL Tools # # Copyright (C) 2013 - 2017, The pgAdmin Development Team # This software is released under the PostgreSQL Licence # ########################################################################## """Implements the...
stack_load
This fixture is used to run `stack load` on the host during integration tests. There are 4 essentially equivalent ways of loading and running a dump.json. Using this test fixture ensures that all 4 are tested. I.E: stack load dump_file exec=True stack load document=dump_file exec=True stack load dump_file | bash -x s...
import json import subprocess import ipaddress import pytest @pytest.fixture def add_host(): def _inner(hostname, rack, rank, appliance): cmd = f'stack add host {hostname} rack={rack} rank={rank} appliance={appliance}' result = subprocess.run(cmd.split()) if result.returncode != 0: pytest.fail('unable to ad...
@pytest.fixture( params = ( ("", "exec=True"), ("", "| bash -x"), ("document=", "exec=True"), ("document=", "| bash -x"), ), ids = ("stack_load_exec", "stack_load_bash", "stack_load_document_exec", "stack_load_document_bash"), ) def stack_load(request, host): """This fixture is used to run `stack load` on t...
251
282
import json import subprocess import ipaddress import pytest @pytest.fixture def add_host(): def _inner(hostname, rack, rank, appliance): cmd = f'stack add host {hostname} rack={rack} rank={rank} appliance={appliance}' result = subprocess.run(cmd.split()) if result.returncode != 0: pytest.fail('unable to ad...
_is_token
Check for stopwords and actual words in word pieces Args: pieces (list): word pieces returned by sentencepiece model special_symbol (str): spm prefix special symbol for space Returns: List of decoded words
"""SentencePiece based word tokenizer module""" from pathlib import Path from typing import List import sentencepiece as spm from urduhack.stop_words import STOP_WORDS # MASKED: _is_token function (lines 10-30) def _load_model(model_path: str) -> spm.SentencePieceProcessor: """ Loads pre_trained keras mod...
def _is_token(pieces: list, special_symbol: str = "▁") -> List[str]: """ Check for stopwords and actual words in word pieces Args: pieces (list): word pieces returned by sentencepiece model special_symbol (str): spm prefix special symbol for space Returns: List of decoded word...
10
30
"""SentencePiece based word tokenizer module""" from pathlib import Path from typing import List import sentencepiece as spm from urduhack.stop_words import STOP_WORDS def _is_token(pieces: list, special_symbol: str = "▁") -> List[str]: """ Check for stopwords and actual words in word pieces Args: ...
_load_model
Loads pre_trained keras model and vocab file Args: model_path (str): Path to the spm model file Returns: spm model class instance
"""SentencePiece based word tokenizer module""" from pathlib import Path from typing import List import sentencepiece as spm from urduhack.stop_words import STOP_WORDS def _is_token(pieces: list, special_symbol: str = "▁") -> List[str]: """ Check for stopwords and actual words in word pieces Args: ...
def _load_model(model_path: str) -> spm.SentencePieceProcessor: """ Loads pre_trained keras model and vocab file Args: model_path (str): Path to the spm model file Returns: spm model class instance """ spm_model = spm.SentencePieceProcessor() spm_model.Load(model_file=model_...
33
44
"""SentencePiece based word tokenizer module""" from pathlib import Path from typing import List import sentencepiece as spm from urduhack.stop_words import STOP_WORDS def _is_token(pieces: list, special_symbol: str = "▁") -> List[str]: """ Check for stopwords and actual words in word pieces Args: ...
startup
Construct and show the Toga application. Usually, you would add your application to a main content box. We then create a main window (with a name matching the app), and show the main window.
""" My first application """ import toga from toga.style import Pack from toga.style.pack import COLUMN, ROW class HelloWorld(toga.App): # MASKED: startup function (lines 11-42) def say_hello(self, widget): if self.name_input.value: name = self.name_input.value else: name...
def startup(self): """ Construct and show the Toga application. Usually, you would add your application to a main content box. We then create a main window (with a name matching the app), and show the main window. """ main_box = toga.Box(style=Pack(direction=...
11
42
""" My first application """ import toga from toga.style import Pack from toga.style.pack import COLUMN, ROW class HelloWorld(toga.App): def startup(self): """ Construct and show the Toga application. Usually, you would add your application to a main content box. We then create a...
get
Get an existing ApiOperation resource's state with the given name, id, and optional extra properties used to qualify the lookup. :param str resource_name: The unique name of the resulting resource. :param pulumi.Input[str] id: The unique provider ID of the resource to lookup. :param pulumi.ResourceOptions opts: Option...
# coding=utf-8 # *** WARNING: this file was generated by the Pulumi SDK Generator. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import warnings import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union from ... import _utilities, _tables from...
@staticmethod def get(resource_name: str, id: pulumi.Input[str], opts: Optional[pulumi.ResourceOptions] = None) -> 'ApiOperation': """ Get an existing ApiOperation resource's state with the given name, id, and optional extra properties used to qualify the lookup. ...
104
120
# coding=utf-8 # *** WARNING: this file was generated by the Pulumi SDK Generator. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import warnings import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union from ... import _utilities, _tables from...
shortDescription
Returns the description of the current test. This changes the default behavior to replace all newlines with spaces, allowing a test description to span lines. It should still be kept short, though. Returns: unicode: The descriptive text for the current unit test.
"""Base test cases for RBTools unit tests.""" from __future__ import unicode_literals import os import re import shutil import sys import tempfile import unittest from contextlib import contextmanager import six from rbtools.utils.filesystem import cleanup_tempfiles, make_tempdir import kgb from rbtools.utils.file...
def shortDescription(self): """Returns the description of the current test. This changes the default behavior to replace all newlines with spaces, allowing a test description to span lines. It should still be kept short, though. Returns: unicode: The...
81
98
"""Base test cases for RBTools unit tests.""" from __future__ import unicode_literals import os import re import shutil import sys import tempfile import unittest from contextlib import contextmanager import six from rbtools.utils.filesystem import cleanup_tempfiles, make_tempdir import kgb from rbtools.utils.file...
precreate_tempfiles
Pre-create a specific number of temporary files. This will call :py:func:`~rbtools.utils.filesystem.make_tempfile` the specified number of times, returning the list of generated temp file paths, and will then spy that function to return those temp files. Once each pre-created temp file is used up, any further calls t...
"""Base test cases for RBTools unit tests.""" from __future__ import unicode_literals import os import re import shutil import sys import tempfile import unittest from contextlib import contextmanager import six from rbtools.utils.filesystem import cleanup_tempfiles, make_tempdir import kgb from rbtools.utils.file...
def precreate_tempfiles(self, count): """Pre-create a specific number of temporary files. This will call :py:func:`~rbtools.utils.filesystem.make_tempfile` the specified number of times, returning the list of generated temp file paths, and will then spy that function to return those...
143
181
"""Base test cases for RBTools unit tests.""" from __future__ import unicode_literals import os import re import shutil import sys import tempfile import unittest from contextlib import contextmanager import six from rbtools.utils.filesystem import cleanup_tempfiles, make_tempdir import kgb from rbtools.utils.file...
assertDiffEqual
Assert that two diffs are equal. Args: diff (bytes): The generated diff. expected_diff (bytes): The expected diff. Raises: AssertionError: The diffs aren't equal or of the right type.
"""Base test cases for RBTools unit tests.""" from __future__ import unicode_literals import os import re import shutil import sys import tempfile import unittest from contextlib import contextmanager import six from rbtools.utils.filesystem import cleanup_tempfiles, make_tempdir import kgb from rbtools.utils.file...
def assertDiffEqual(self, diff, expected_diff): """Assert that two diffs are equal. Args: diff (bytes): The generated diff. expected_diff (bytes): The expected diff. Raises: AssertionError: The diffs aren'...
183
200
"""Base test cases for RBTools unit tests.""" from __future__ import unicode_literals import os import re import shutil import sys import tempfile import unittest from contextlib import contextmanager import six from rbtools.utils.filesystem import cleanup_tempfiles, make_tempdir import kgb from rbtools.utils.file...
reviewboardrc
Populate a temporary .reviewboardrc file. This will create a :file:`.reviewboardrc` file, either in the current directory or in a new temporary directory (if ``use_temp_dir`` is set). The file will contain the provided configuration. Version Added: 3.0 Args: config (dict): A dictionary of key-value p...
"""Base test cases for RBTools unit tests.""" from __future__ import unicode_literals import os import re import shutil import sys import tempfile import unittest from contextlib import contextmanager import six from rbtools.utils.filesystem import cleanup_tempfiles, make_tempdir import kgb from rbtools.utils.file...
@contextmanager def reviewboardrc(self, config, use_temp_dir=False): """Populate a temporary .reviewboardrc file. This will create a :file:`.reviewboardrc` file, either in the current directory or in a new temporary directory (if ``use_temp_dir`` is set). The file will contain t...
220
263
"""Base test cases for RBTools unit tests.""" from __future__ import unicode_literals import os import re import shutil import sys import tempfile import unittest from contextlib import contextmanager import six from rbtools.utils.filesystem import cleanup_tempfiles, make_tempdir import kgb from rbtools.utils.file...
create
Create a symmetric key on a KMIP appliance. Args: algorithm (CryptographicAlgorithm): An enumeration defining the algorithm to use to generate the symmetric key. length (int): The length in bits for the symmetric key. operation_policy_name (string): The name of the operation policy to use f...
# Copyright (c) 2015 The Johns Hopkins University/Applied Physics Laboratory # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICEN...
@is_connected def create(self, algorithm, length, operation_policy_name=None, name=None, cryptographic_usage_mask=None): """ Create a symmetric key on a KMIP appliance. Args: algorithm (CryptographicAlgorithm): An enumeration defining the algor...
149
211
# Copyright (c) 2015 The Johns Hopkins University/Applied Physics Laboratory # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICEN...
locate
Search for managed objects, depending on the attributes specified in the request. Args: maximum_items (integer): Maximum number of object identifiers the server MAY return. storage_status_mask (integer): A bit mask that indicates whether on-line or archived objects are to be searched. objec...
# Copyright (c) 2015 The Johns Hopkins University/Applied Physics Laboratory # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICEN...
@is_connected def locate(self, maximum_items=None, storage_status_mask=None, object_group_member=None, attributes=None): """ Search for managed objects, depending on the attributes specified in the request. Args: maximum_items (integer): Maximum number...
503
559
# Copyright (c) 2015 The Johns Hopkins University/Applied Physics Laboratory # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICEN...
get_attributes
Get the attributes associated with a managed object. If the uid is not specified, the appliance will use the ID placeholder by default. If the attribute_names list is not specified, the appliance will return all viable attributes for the managed object. Args: uid (string): The unique ID of the managed object wit...
# Copyright (c) 2015 The Johns Hopkins University/Applied Physics Laboratory # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICEN...
@is_connected def get_attributes(self, uid=None, attribute_names=None): """ Get the attributes associated with a managed object. If the uid is not specified, the appliance will use the ID placeholder by default. If the attribute_names list is not specified, the applianc...
631
673
# Copyright (c) 2015 The Johns Hopkins University/Applied Physics Laboratory # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICEN...
get_attribute_list
Get the names of the attributes associated with a managed object. If the uid is not specified, the appliance will use the ID placeholder by default. Args: uid (string): The unique ID of the managed object with which the retrieved attribute names should be associated. Optional, defaults to None.
# Copyright (c) 2015 The Johns Hopkins University/Applied Physics Laboratory # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICEN...
@is_connected def get_attribute_list(self, uid=None): """ Get the names of the attributes associated with a managed object. If the uid is not specified, the appliance will use the ID placeholder by default. Args: uid (string): The unique ID of the managed ob...
675
703
# Copyright (c) 2015 The Johns Hopkins University/Applied Physics Laboratory # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICEN...
activate
Activate a managed object stored by a KMIP appliance. Args: uid (string): The unique ID of the managed object to activate. Optional, defaults to None. Returns: None Raises: ClientConnectionNotOpen: if the client connection is unusable KmipOperationFailure: if the operation result is a failure...
# Copyright (c) 2015 The Johns Hopkins University/Applied Physics Laboratory # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICEN...
@is_connected def activate(self, uid=None): """ Activate a managed object stored by a KMIP appliance. Args: uid (string): The unique ID of the managed object to activate. Optional, defaults to None. Returns: None Raises: ...
705
736
# Copyright (c) 2015 The Johns Hopkins University/Applied Physics Laboratory # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICEN...
revoke
Revoke a managed object stored by a KMIP appliance. Args: revocation_reason (RevocationReasonCode): An enumeration indicating the revocation reason. uid (string): The unique ID of the managed object to revoke. Optional, defaults to None. revocation_message (string): A message regarding the ...
# Copyright (c) 2015 The Johns Hopkins University/Applied Physics Laboratory # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICEN...
@is_connected def revoke(self, revocation_reason, uid=None, revocation_message=None, compromise_occurrence_date=None): """ Revoke a managed object stored by a KMIP appliance. Args: revocation_reason (RevocationReasonCode): An enumeration indicating ...
738
792
# Copyright (c) 2015 The Johns Hopkins University/Applied Physics Laboratory # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICEN...
destroy
Destroy a managed object stored by a KMIP appliance. Args: uid (string): The unique ID of the managed object to destroy. Returns: None Raises: ClientConnectionNotOpen: if the client connection is unusable KmipOperationFailure: if the operation result is a failure TypeError: if the input argument ...
# Copyright (c) 2015 The Johns Hopkins University/Applied Physics Laboratory # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICEN...
@is_connected def destroy(self, uid=None): """ Destroy a managed object stored by a KMIP appliance. Args: uid (string): The unique ID of the managed object to destroy. Returns: None Raises: ClientConnectionNotOpen: if the client conn...
794
824
# Copyright (c) 2015 The Johns Hopkins University/Applied Physics Laboratory # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICEN...
encrypt
Encrypt data using the specified encryption key and parameters. Args: data (bytes): The bytes to encrypt. Required. uid (string): The unique ID of the encryption key to use. Optional, defaults to None. cryptographic_parameters (dict): A dictionary containing various cryptographic settings t...
# Copyright (c) 2015 The Johns Hopkins University/Applied Physics Laboratory # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICEN...
@is_connected def encrypt(self, data, uid=None, cryptographic_parameters=None, iv_counter_nonce=None): """ Encrypt data using the specified encryption key and parameters. Args: data (bytes): The bytes to encrypt. Required. uid (string): The unique...
826
931
# Copyright (c) 2015 The Johns Hopkins University/Applied Physics Laboratory # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICEN...
decrypt
Decrypt data using the specified decryption key and parameters. Args: data (bytes): The bytes to decrypt. Required. uid (string): The unique ID of the decryption key to use. Optional, defaults to None. cryptographic_parameters (dict): A dictionary containing various cryptographic settings t...
# Copyright (c) 2015 The Johns Hopkins University/Applied Physics Laboratory # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICEN...
@is_connected def decrypt(self, data, uid=None, cryptographic_parameters=None, iv_counter_nonce=None): """ Decrypt data using the specified decryption key and parameters. Args: data (bytes): The bytes to decrypt. Required. uid (string): The unique...
933
1,036
# Copyright (c) 2015 The Johns Hopkins University/Applied Physics Laboratory # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICEN...
signature_verify
Verify a message signature using the specified signing key. Args: message (bytes): The bytes of the signed message. Required. signature (bytes): The bytes of the message signature. Required. uid (string): The unique ID of the signing key to use. Optional, defaults to None. cryptographic_paramet...
# Copyright (c) 2015 The Johns Hopkins University/Applied Physics Laboratory # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICEN...
@is_connected def signature_verify(self, message, signature, uid=None, cryptographic_parameters=None): """ Verify a message signature using the specified signing key. Args: message (bytes): The bytes of the signed message. Required. signa...
1,038
1,102
# Copyright (c) 2015 The Johns Hopkins University/Applied Physics Laboratory # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICEN...
sign
Create a digital signature for data using the specified signing key. Args: data (bytes): The bytes of the data to be signed. Required. uid (string): The unique ID of the signing key to use. Optional, defaults to None. cryptographic_parameters (dict): A dictionary containing various cryptogr...
# Copyright (c) 2015 The Johns Hopkins University/Applied Physics Laboratory # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICEN...
@is_connected def sign(self, data, uid=None, cryptographic_parameters=None): """ Create a digital signature for data using the specified signing key. Args: data (bytes): The bytes of the data to be signed. Required. uid (string): The unique ID of the signing key ...
1,104
1,157
# Copyright (c) 2015 The Johns Hopkins University/Applied Physics Laboratory # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICEN...
mac
Get the message authentication code for data. Args: data (string): The data to be MACed. uid (string): The unique ID of the managed object that is the key to use for the MAC operation. algorithm (CryptographicAlgorithm): An enumeration defining the algorithm to use to generate the MAC. Ret...
# Copyright (c) 2015 The Johns Hopkins University/Applied Physics Laboratory # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICEN...
@is_connected def mac(self, data, uid=None, algorithm=None): """ Get the message authentication code for data. Args: data (string): The data to be MACed. uid (string): The unique ID of the managed object that is the key to use for the MAC operatio...
1,159
1,207
# Copyright (c) 2015 The Johns Hopkins University/Applied Physics Laboratory # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICEN...
_make_api_call
This private method is here for two reasons: 1. It's faster to avoid using botocore's response parsing 2. It provides a place to monkey patch requests for unit testing
""" Lowest level connection """ from __future__ import division import logging import math import random import time import uuid import warnings from base64 import b64decode from threading import local import six from botocore.client import ClientError from botocore.exceptions import BotoCoreError from botocore.sessi...
def _make_api_call(self, operation_name, operation_kwargs): """ This private method is here for two reasons: 1. It's faster to avoid using botocore's response parsing 2. It provides a place to monkey patch requests for unit testing """ operation_model = self.client._s...
335
418
""" Lowest level connection """ from __future__ import division import logging import math import random import time import uuid import warnings from base64 import b64decode from threading import local import six from botocore.client import ClientError from botocore.exceptions import BotoCoreError from botocore.sessi...
__init__
Constructor for ChartService. Args: config_service (ConfigService): An instance of ConfigService.
# Copyright 2018 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file or at # https://developers.google.com/open-source/licenses/bsd """A service for querying data for charts. Functions for querying the IssueSnapshot table and ...
def __init__(self, config_service): """Constructor for ChartService. Args: config_service (ConfigService): An instance of ConfigService. """ self.config_service = config_service # Set up SQL table objects. self.issuesnapshot_tbl = sql.SQLTableManager(ISSUESNAPSHOT_TABLE_NAME) self....
44
59
# Copyright 2018 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file or at # https://developers.google.com/open-source/licenses/bsd """A service for querying data for charts. Functions for querying the IssueSnapshot table and ...
_minimal_polynomial_sq
Returns the minimal polynomial for the ``nth-root`` of a sum of surds or ``None`` if it fails. Parameters ========== p : sum of surds n : positive integer x : variable of the returned polynomial Examples ======== >>> q = 1 + sqrt(2) + sqrt(3) >>> _minimal_polynomial_sq(q, 3, x) x**12 - 4*x**9 - 4*x**6 + 16*x**3 - 8
"""Computational algebraic field theory.""" import functools import math import mpmath from ..config import query from ..core import (Add, Dummy, E, GoldenRatio, I, Integer, Mul, Rational, cacheit, pi) from ..core.exprtools import Factors from ..core.function import _mexpand, count_ops from ..cor...
def _minimal_polynomial_sq(p, n, x): """ Returns the minimal polynomial for the ``nth-root`` of a sum of surds or ``None`` if it fails. Parameters ========== p : sum of surds n : positive integer x : variable of the returned polynomial Examples ======== >>> q = 1 + sqrt(2...
137
175
"""Computational algebraic field theory.""" import functools import math import mpmath from ..config import query from ..core import (Add, Dummy, E, GoldenRatio, I, Integer, Mul, Rational, cacheit, pi) from ..core.exprtools import Factors from ..core.function import _mexpand, count_ops from ..cor...
_minpoly_op_algebraic_element
Return the minimal polynomial for ``op(ex1, ex2)``. Parameters ========== op : operation ``Add`` or ``Mul`` ex1, ex2 : expressions for the algebraic elements x : indeterminate of the polynomials dom: ground domain mp1, mp2 : minimal polynomials for ``ex1`` and ``ex2`` or None Examples ======== >>> p1 = sqrt(sqrt(2)...
"""Computational algebraic field theory.""" import functools import math import mpmath from ..config import query from ..core import (Add, Dummy, E, GoldenRatio, I, Integer, Mul, Rational, cacheit, pi) from ..core.exprtools import Factors from ..core.function import _mexpand, count_ops from ..cor...
def _minpoly_op_algebraic_element(op, ex1, ex2, x, dom, mp1=None, mp2=None): """ Return the minimal polynomial for ``op(ex1, ex2)``. Parameters ========== op : operation ``Add`` or ``Mul`` ex1, ex2 : expressions for the algebraic elements x : indeterminate of the polynomials dom: groun...
178
242
"""Computational algebraic field theory.""" import functools import math import mpmath from ..config import query from ..core import (Add, Dummy, E, GoldenRatio, I, Integer, Mul, Rational, cacheit, pi) from ..core.exprtools import Factors from ..core.function import _mexpand, count_ops from ..cor...
_minpoly_pow
Returns ``minimal_polynomial(ex**pw)`` Parameters ========== ex : algebraic element pw : rational number x : indeterminate of the polynomial dom: ground domain Examples ======== >>> p = sqrt(1 + sqrt(2)) >>> _minpoly_pow(p, 2, x, QQ) x**2 - 2*x - 1 >>> minimal_polynomial(p**2)(x) x**2 - 2*x - 1 >>> _minpoly_pow(y, ...
"""Computational algebraic field theory.""" import functools import math import mpmath from ..config import query from ..core import (Add, Dummy, E, GoldenRatio, I, Integer, Mul, Rational, cacheit, pi) from ..core.exprtools import Factors from ..core.function import _mexpand, count_ops from ..cor...
def _minpoly_pow(ex, pw, x, dom): """ Returns ``minimal_polynomial(ex**pw)`` Parameters ========== ex : algebraic element pw : rational number x : indeterminate of the polynomial dom: ground domain Examples ======== >>> p = sqrt(1 + sqrt(2)) >>> _minpoly_pow(p, 2, x, ...
263
308
"""Computational algebraic field theory.""" import functools import math import mpmath from ..config import query from ..core import (Add, Dummy, E, GoldenRatio, I, Integer, Mul, Rational, cacheit, pi) from ..core.exprtools import Factors from ..core.function import _mexpand, count_ops from ..cor...
_minpoly_compose
Computes the minimal polynomial of an algebraic element using operations on minimal polynomials Examples ======== >>> minimal_polynomial(sqrt(2) + 3*Rational(1, 3), method='compose')(x) x**2 - 2*x - 1 >>> minimal_polynomial(sqrt(y) + 1/y, method='compose')(x) x**2*y**2 - 2*x*y - y**3 + 1
"""Computational algebraic field theory.""" import functools import math import mpmath from ..config import query from ..core import (Add, Dummy, E, GoldenRatio, I, Integer, Mul, Rational, cacheit, pi) from ..core.exprtools import Factors from ..core.function import _mexpand, count_ops from ..cor...
def _minpoly_compose(ex, x, dom): """ Computes the minimal polynomial of an algebraic element using operations on minimal polynomials Examples ======== >>> minimal_polynomial(sqrt(2) + 3*Rational(1, 3), method='compose')(x) x**2 - 2*x - 1 >>> minimal_polynomial(sqrt(y) + 1/y, method='c...
456
536
"""Computational algebraic field theory.""" import functools import math import mpmath from ..config import query from ..core import (Add, Dummy, E, GoldenRatio, I, Integer, Mul, Rational, cacheit, pi) from ..core.exprtools import Factors from ..core.function import _mexpand, count_ops from ..cor...
minpoly_groebner
Computes the minimal polynomial of an algebraic number using Gröbner bases Examples ======== >>> minimal_polynomial(sqrt(2) + 1, method='groebner')(x) x**2 - 2*x - 1 References ========== * :cite:`Adams1994intro`
"""Computational algebraic field theory.""" import functools import math import mpmath from ..config import query from ..core import (Add, Dummy, E, GoldenRatio, I, Integer, Mul, Rational, cacheit, pi) from ..core.exprtools import Factors from ..core.function import _mexpand, count_ops from ..cor...
def minpoly_groebner(ex, x, domain): """ Computes the minimal polynomial of an algebraic number using Gröbner bases Examples ======== >>> minimal_polynomial(sqrt(2) + 1, method='groebner')(x) x**2 - 2*x - 1 References ========== * :cite:`Adams1994intro` """ generator...
599
681
"""Computational algebraic field theory.""" import functools import math import mpmath from ..config import query from ..core import (Add, Dummy, E, GoldenRatio, I, Integer, Mul, Rational, cacheit, pi) from ..core.exprtools import Factors from ..core.function import _mexpand, count_ops from ..cor...
add
increments counters for the sum of log probs of current word and next word (given context ending at current word). Since the next word might be at the end of the example, or it might be not counted because it is not an ending subword unit, also keeps track of how many of those we have seen
#!/usr/bin/env python3 -u # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ Evaluate the perplexity of a trained language model. """ import logging import math import os import torch fr...
def add(self, log_prob, next_word_prob): """ increments counters for the sum of log probs of current word and next word (given context ending at current word). Since the next word might be at the end of the example, or it might be not counted because it is not an ending subword unit,...
42
52
#!/usr/bin/env python3 -u # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ Evaluate the perplexity of a trained language model. """ import logging import math import os import torch fr...
__init__
Init function for the Importer. Args: source_uri: the URI of the resource that needs to be registered. artifact_type: the type of the artifact to import. reimport: whether or not to re-import as a new artifact if the URI has been imported in before. properties: Dictionary of properties for the imported Art...
# Copyright 2019 Google LLC. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
def __init__(self, source_uri: str, artifact_type: Type[types.Artifact], reimport: Optional[bool] = False, properties: Optional[Dict[str, Union[str, int]]] = None, custom_properties: Optional[Dict[str, Union[str, int]]] = None): """Init fu...
247
282
# Copyright 2019 Google LLC. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
__call__
Generates final detections. Args: raw_boxes: A `dict` with keys representing FPN levels and values representing box tenors of shape `[batch, feature_h, feature_w, num_anchors * 4]`. raw_scores: A `dict` with keys representing FPN levels and values representing logit tensors of shape `[batch, feature_h,...
# Copyright 2021 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
def __call__(self, raw_boxes: Mapping[str, tf.Tensor], raw_scores: Mapping[str, tf.Tensor], anchor_boxes: tf.Tensor, image_shape: tf.Tensor, raw_attributes: Optional[Mapping[str, tf.Tensor]] = None): """Generates final detections. Arg...
729
845
# Copyright 2021 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
locate_index
Locate the start time index and end time index in a calendar under certain frequency. Parameters ---------- start_time : str start of the time range end_time : str end of the time range freq : str time frequency, available: year/quarter/month/week/day future : bool whether including future trading day ...
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. from __future__ import division from __future__ import print_function import os import abc import six import time import queue import bisect import logging import importlib import traceback import numpy as np import pandas as pd from multiproce...
def locate_index(self, start_time, end_time, freq, future): """Locate the start time index and end time index in a calendar under certain frequency. Parameters ---------- start_time : str start of the time range end_time : str end of the time range ...
59
98
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. from __future__ import division from __future__ import print_function import os import abc import six import time import queue import bisect import logging import importlib import traceback import numpy as np import pandas as pd from multiproce...
instruments
Get the general config dictionary for a base market adding several dynamic filters. Parameters ---------- market : str market/industry/index shortname, e.g. all/sse/szse/sse50/csi300/csi500 filter_pipe : list the list of dynamic filters Returns ---------- dict dict of stockpool config {`market`=>base ...
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. from __future__ import division from __future__ import print_function import os import abc import six import time import queue import bisect import logging import importlib import traceback import numpy as np import pandas as pd from multiproce...
@staticmethod def instruments(market="all", filter_pipe=None): """Get the general config dictionary for a base market adding several dynamic filters. Parameters ---------- market : str market/industry/index shortname, e.g. all/sse/szse/sse50/csi300/csi500 fil...
138
174
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. from __future__ import division from __future__ import print_function import os import abc import six import time import queue import bisect import logging import importlib import traceback import numpy as np import pandas as pd from multiproce...
submit_observation
Upload a pairing of a configuration alongside an observed target variable. Parameters: config (dictionary): A dictionary mapping dimension names to values indicating the configuration of parameters. target (float): A number indicating the performance of this configuration of model parameters. ...
import requests import json from .config import auth_token, base_url from .recommendation_client import RecommendationClient from .json_parser import json_parser class ExperimentClient(object): """Experiment Client Class This object defines a Thor experiment within the Python environment. In particular, ...
def submit_observation(self, config, target): """Upload a pairing of a configuration alongside an observed target variable. Parameters: config (dictionary): A dictionary mapping dimension names to values indicating the configuration of parameters. tar...
47
81
import requests import json from .config import auth_token, base_url from .recommendation_client import RecommendationClient from .json_parser import json_parser class ExperimentClient(object): """Experiment Client Class This object defines a Thor experiment within the Python environment. In particular, ...
best_configuration
Get the configuration of parameters that produced the best value of the objective function. Returns: dictionary: A dictionary containing a detailed view of the configuration of model parameters that produced the maximal value of the metric. This includes the date the observation was created...
import requests import json from .config import auth_token, base_url from .recommendation_client import RecommendationClient from .json_parser import json_parser class ExperimentClient(object): """Experiment Client Class This object defines a Thor experiment within the Python environment. In particular, ...
def best_configuration(self): """Get the configuration of parameters that produced the best value of the objective function. Returns: dictionary: A dictionary containing a detailed view of the configuration of model parameters that produced the maximal ...
145
163
import requests import json from .config import auth_token, base_url from .recommendation_client import RecommendationClient from .json_parser import json_parser class ExperimentClient(object): """Experiment Client Class This object defines a Thor experiment within the Python environment. In particular, ...
write_frames
Add some data to the file. Parameters ---------- data : bytes-like object The user must ensure that the data's format matches the file's! Returns ------- int : the number of frames written
# Copyright (C) 2019 by Landmark Acoustics LLC r"""A class to write a WAV-formatted file.""" import wave class WaveFile: '''A wrapper for `Wave_write` from Python STL's `wave` module. Parameters ---------- name : str The name to save the file as. It should include path and extension. sa...
def write_frames(self, data) -> int: '''Add some data to the file. Parameters ---------- data : bytes-like object The user must ensure that the data's format matches the file's! Returns ------- int : the number of frames written ''' ...
63
79
# Copyright (C) 2019 by Landmark Acoustics LLC r"""A class to write a WAV-formatted file.""" import wave class WaveFile: '''A wrapper for `Wave_write` from Python STL's `wave` module. Parameters ---------- name : str The name to save the file as. It should include path and extension. sa...
tokenize
Function splits text into separate words and gets a word lowercased and removes whitespaces at the ends of a word. The funtions also cleans irrelevant stopwords. Input: 1. text: text message Output: 1. Clean_tokens : list of tokenized clean words
import pandas as pd import re import nltk from nltk.corpus import stopwords from nltk.stem.wordnet import WordNetLemmatizer from nltk.tokenize import word_tokenize from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.metrics.pairwise import cosine_similarity from sklearn.metrics.pairwise import line...
def tokenize(text): ''' Function splits text into separate words and gets a word lowercased and removes whitespaces at the ends of a word. The funtions also cleans irrelevant stopwords. Input: 1. text: text message Output: 1. Clean_tokens : list of tokenized ...
228
252
import pandas as pd import re import nltk from nltk.corpus import stopwords from nltk.stem.wordnet import WordNetLemmatizer from nltk.tokenize import word_tokenize from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.metrics.pairwise import cosine_similarity from sklearn.metrics.pairwise import line...
tokenize
Function splits text into separate words and gets a word lowercased and removes whitespaces at the ends of a word. The funtions also cleans irrelevant stopwords. Input: 1. text: text message Output: 1. Clean_tokens : list of tokenized clean words
import pandas as pd import re import nltk from nltk.corpus import stopwords from nltk.stem.wordnet import WordNetLemmatizer from nltk.tokenize import word_tokenize from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.metrics.pairwise import cosine_similarity from sklearn.metrics.pairwise import line...
def tokenize(text): ''' Function splits text into separate words and gets a word lowercased and removes whitespaces at the ends of a word. The funtions also cleans irrelevant stopwords. Input: 1. text: text message Output: 1. Clean_tokens : list of tokenized ...
279
303
import pandas as pd import re import nltk from nltk.corpus import stopwords from nltk.stem.wordnet import WordNetLemmatizer from nltk.tokenize import word_tokenize from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.metrics.pairwise import cosine_similarity from sklearn.metrics.pairwise import line...
__init__
__init__(self, parent, pagesize='A3', orientation='landscape', x=0.05, y=0.05, xl=None, xr=None, yt=None, yb=None, start=None, end=None, tracklines=0, track_size=0.75, circular=1) o parent Diagram object containing the data that the drawer draws o pagesize String describing ...
# Copyright 2003-2008 by Leighton Pritchard. All rights reserved. # Revisions copyright 2008-2009 by Peter Cock. # This code is part of the Biopython distribution and governed by its # license. Please see the LICENSE file that should have been included # as part of this package. # # Contact: Leighton Pritchard,...
def __init__(self, parent=None, pagesize='A3', orientation='landscape', x=0.05, y=0.05, xl=None, xr=None, yt=None, yb=None, start=None, end=None, tracklines=0, track_size=0.75, circular=1): """ __init__(self, parent, pagesize='A3', orientation='landscape', ...
168
230
# Copyright 2003-2008 by Leighton Pritchard. All rights reserved. # Revisions copyright 2008-2009 by Peter Cock. # This code is part of the Biopython distribution and governed by its # license. Please see the LICENSE file that should have been included # as part of this package. # # Contact: Leighton Pritchard,...
draw_track
draw_track(self, track) -> ([element, element,...], [element, element,...]) o track Track object Return tuple of (list of track elements, list of track labels)
# Copyright 2003-2008 by Leighton Pritchard. All rights reserved. # Revisions copyright 2008-2009 by Peter Cock. # This code is part of the Biopython distribution and governed by its # license. Please see the LICENSE file that should have been included # as part of this package. # # Contact: Leighton Pritchard,...
def draw_track(self, track): """ draw_track(self, track) -> ([element, element,...], [element, element,...]) o track Track object Return tuple of (list of track elements, list of track labels) """ track_elements = [] # Holds elements for features and ...
318
337
# Copyright 2003-2008 by Leighton Pritchard. All rights reserved. # Revisions copyright 2008-2009 by Peter Cock. # This code is part of the Biopython distribution and governed by its # license. Please see the LICENSE file that should have been included # as part of this package. # # Contact: Leighton Pritchard,...
draw_feature_set
draw_feature_set(self, set) -> ([element, element,...], [element, element,...]) o set FeatureSet object Returns a tuple (list of elements describing features, list of labels for elements)
# Copyright 2003-2008 by Leighton Pritchard. All rights reserved. # Revisions copyright 2008-2009 by Peter Cock. # This code is part of the Biopython distribution and governed by its # license. Please see the LICENSE file that should have been included # as part of this package. # # Contact: Leighton Pritchard,...
def draw_feature_set(self, set): """ draw_feature_set(self, set) -> ([element, element,...], [element, element,...]) o set FeatureSet object Returns a tuple (list of elements describing features, list of labels for elements) """ #print 'draw featur...
340
359
# Copyright 2003-2008 by Leighton Pritchard. All rights reserved. # Revisions copyright 2008-2009 by Peter Cock. # This code is part of the Biopython distribution and governed by its # license. Please see the LICENSE file that should have been included # as part of this package. # # Contact: Leighton Pritchard,...
draw_feature
draw_feature(self, feature, parent_feature=None) -> ([element, element,...], [element, element,...]) o feature Feature containing location info Returns tuple of (list of elements describing single feature, list of labels for those elements)
# Copyright 2003-2008 by Leighton Pritchard. All rights reserved. # Revisions copyright 2008-2009 by Peter Cock. # This code is part of the Biopython distribution and governed by its # license. Please see the LICENSE file that should have been included # as part of this package. # # Contact: Leighton Pritchard,...
def draw_feature(self, feature): """ draw_feature(self, feature, parent_feature=None) -> ([element, element,...], [element, element,...]) o feature Feature containing location info Returns tuple of (list of elements describing single feature, list of labels fo...
362
384
# Copyright 2003-2008 by Leighton Pritchard. All rights reserved. # Revisions copyright 2008-2009 by Peter Cock. # This code is part of the Biopython distribution and governed by its # license. Please see the LICENSE file that should have been included # as part of this package. # # Contact: Leighton Pritchard,...
draw_graph_set
draw_graph_set(self, set) -> ([element, element,...], [element, element,...]) o set GraphSet object Returns tuple (list of graph elements, list of graph labels)
# Copyright 2003-2008 by Leighton Pritchard. All rights reserved. # Revisions copyright 2008-2009 by Peter Cock. # This code is part of the Biopython distribution and governed by its # license. Please see the LICENSE file that should have been included # as part of this package. # # Contact: Leighton Pritchard,...
def draw_graph_set(self, set): """ draw_graph_set(self, set) -> ([element, element,...], [element, element,...]) o set GraphSet object Returns tuple (list of graph elements, list of graph labels) """ #print 'draw graph set' elements = [] # Ho...
479
499
# Copyright 2003-2008 by Leighton Pritchard. All rights reserved. # Revisions copyright 2008-2009 by Peter Cock. # This code is part of the Biopython distribution and governed by its # license. Please see the LICENSE file that should have been included # as part of this package. # # Contact: Leighton Pritchard,...
old_style
Pop the current parser style and revert to the previous one. See new_style(). ** experimental **
# # The Template-Python distribution is Copyright (C) Sean McAfee 2007-2008, # derived from the Perl Template Toolkit Copyright (C) 1996-2007 Andy # Wardley. All Rights Reserved. # # The file "LICENSE" at the top level of this source distribution describes # the terms under which this file may be distributed. # ...
def old_style(self): """Pop the current parser style and revert to the previous one. See new_style(). ** experimental ** """ if len(self.style) <= 1: raise Error("only 1 parser style remaining") self.style.pop() return self.style[-1]
703
711
# # The Template-Python distribution is Copyright (C) Sean McAfee 2007-2008, # derived from the Perl Template Toolkit Copyright (C) 1996-2007 Andy # Wardley. All Rights Reserved. # # The file "LICENSE" at the top level of this source distribution describes # the terms under which this file may be distributed. # ...
define_block
Called by the parser 'defblock' rule when a BLOCK definition is encountered in the template. The name of the block is passed in the first parameter and a reference to the compiled block is passed in the second. This method stores the block in the self.defblock dictionary which has been initialised by parse() and will...
# # The Template-Python distribution is Copyright (C) Sean McAfee 2007-2008, # derived from the Perl Template Toolkit Copyright (C) 1996-2007 Andy # Wardley. All Rights Reserved. # # The file "LICENSE" at the top level of this source distribution describes # the terms under which this file may be distributed. # ...
def define_block(self, name, block): """Called by the parser 'defblock' rule when a BLOCK definition is encountered in the template. The name of the block is passed in the first parameter and a reference to the compiled block is passed in the second. This method stores the ...
1,011
1,025
# # The Template-Python distribution is Copyright (C) Sean McAfee 2007-2008, # derived from the Perl Template Toolkit Copyright (C) 1996-2007 Andy # Wardley. All Rights Reserved. # # The file "LICENSE" at the top level of this source distribution describes # the terms under which this file may be distributed. # ...
mocked_today
Helper to make easily a python "with statement" mocking the "today" date. :param forced_today: The expected "today" date as a str or Date object. :return: An object to be used like 'with self.mocked_today(<today>):'.
# -*- coding: utf-8 -*- from odoo import fields from odoo.tests.common import Form, SavepointCase from odoo.tests import tagged from contextlib import contextmanager from unittest.mock import patch import datetime @tagged('post_install', '-at_install') class AccountTestInvoicingCommon(SavepointCase): @classmet...
@contextmanager def mocked_today(self, forced_today): ''' Helper to make easily a python "with statement" mocking the "today" date. :param forced_today: The expected "today" date as a str or Date object. :return: An object to be used like 'with self.mocked_today(<today>...
380
403
# -*- coding: utf-8 -*- from odoo import fields from odoo.tests.common import Form, SavepointCase from odoo.tests import tagged from contextlib import contextmanager from unittest.mock import patch import datetime @tagged('post_install', '-at_install') class AccountTestInvoicingCommon(SavepointCase): @classmet...
_prometheus_module_metric_decorator
A Prometheus decorator adding timing metrics to a function. This decorator will work on both asynchronous and synchronous functions. Note, however, that this function will turn synchronous functions into asynchronous ones when used as a decorator. :param f: The function for which to capture metrics
import asyncio import functools import logging from types import FunctionType, ModuleType from typing import Type from prometheus_client import Histogram, Counter logger = logging.getLogger(__name__) H = Histogram(f"management_layer_call_duration_seconds", "API call duration (s)", ["call"]) # MASKED:...
def _prometheus_module_metric_decorator(f: FunctionType): """ A Prometheus decorator adding timing metrics to a function. This decorator will work on both asynchronous and synchronous functions. Note, however, that this function will turn synchronous functions into asynchronous ones when used as a d...
15
34
import asyncio import functools import logging from types import FunctionType, ModuleType from typing import Type from prometheus_client import Histogram, Counter logger = logging.getLogger(__name__) H = Histogram(f"management_layer_call_duration_seconds", "API call duration (s)", ["call"]) def _prom...
seconds_to_timelimit
Convert seconds into a Slum-notation time limit for the ABINIT flag `--timelimit`. :param seconds: time limit in seconds :returns: Slurm-notation time limit (hours:minutes:seconds)
# -*- coding: utf-8 -*- """Utilities for calculation job resources.""" __all__ = ( 'get_default_options', 'seconds_to_timelimit', ) def get_default_options(max_num_machines: int = 1, max_wallclock_seconds: int = 1800, with_mpi: bool = False) -> dict: """Return an instance of the options dictionary with t...
def seconds_to_timelimit(seconds: int) -> str: """Convert seconds into a Slum-notation time limit for the ABINIT flag `--timelimit`. :param seconds: time limit in seconds :returns: Slurm-notation time limit (hours:minutes:seconds) """ days = seconds // 86400 seconds -= days * 86400 hours = ...
26
44
# -*- coding: utf-8 -*- """Utilities for calculation job resources.""" __all__ = ( 'get_default_options', 'seconds_to_timelimit', ) def get_default_options(max_num_machines: int = 1, max_wallclock_seconds: int = 1800, with_mpi: bool = False) -> dict: """Return an instance of the options dictionary with t...
__init__
Create the field. Arguments: name -- Set the name of the field (e.g. "database_server") title -- Set the human readable title (e.g. "Database server") description -- Set the human-readable description of the field (e.g. "The IP or domain name of the database server") required_on_create -- If "true", the...
import json import re class FieldValidationException(Exception): pass class Field(object): """ This is the base class that should be used to create field validators. Sub-class this and override to_python if you need custom validation. """ DATA_TYPE_STRING = 'string' DATA_TYPE_NUMBER = '...
def __init__(self, name, title, description, required_on_create=True, required_on_edit=False): """ Create the field. Arguments: name -- Set the name of the field (e.g. "database_server") title -- Set the human readable title (e.g. "Database server") description -- Se...
26
57
import json import re class FieldValidationException(Exception): pass class Field(object): """ This is the base class that should be used to create field validators. Sub-class this and override to_python if you need custom validation. """ DATA_TYPE_STRING = 'string' DATA_TYPE_NUMBER = '...
__init__
Parameters ---------- documents : iterable of iterable of str Iterable of documents, if given - use them to initialization. id_range : int, optional Number of hash-values in table, used as `id = myhash(key) % id_range`. myhash : function Hash function, should support interface myhash(str) -> int, used `zlib...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright (C) 2012 Homer Strong, Radim Rehurek # Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html """This module implements the "hashing trick" [1]_ -- a mapping between words and their integer ids using a fixed and static mapping. Notes -----...
def __init__(self, documents=None, id_range=32000, myhash=zlib.adler32, debug=True): """ Parameters ---------- documents : iterable of iterable of str Iterable of documents, if given - use them to initialization. id_range : int, optional Number of has...
70
102
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright (C) 2012 Homer Strong, Radim Rehurek # Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html """This module implements the "hashing trick" [1]_ -- a mapping between words and their integer ids using a fixed and static mapping. Notes -----...
restricted_hash
Calculate id of the given token. Also keep track of what words were mapped to what ids, for debugging reasons. Parameters ---------- token : str Input token. Return ------ int Hash value of `token`.
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright (C) 2012 Homer Strong, Radim Rehurek # Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html """This module implements the "hashing trick" [1]_ -- a mapping between words and their integer ids using a fixed and static mapping. Notes -----...
def restricted_hash(self, token): """Calculate id of the given token. Also keep track of what words were mapped to what ids, for debugging reasons. Parameters ---------- token : str Input token. Return ------ int Hash value of...
124
143
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright (C) 2012 Homer Strong, Radim Rehurek # Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html """This module implements the "hashing trick" [1]_ -- a mapping between words and their integer ids using a fixed and static mapping. Notes -----...
apply_at
Returns a function that takes an iterable and applies ``func`` to the values at the corresponding ``index``. ``args`` and ``kwargs`` are passed to ``func`` as additional arguments. Examples -------- >>> first_sqr = apply_at(0, np.square) >>> first_sqr([3, 2, 1]) >>> (9, 2, 1)
from typing import Callable, Iterable, Sequence import numpy as np from dpipe.im.axes import AxesLike, AxesParams from dpipe.itertools import lmap, squeeze_first from dpipe.im import pad_to_shape def pad_batch_equal(batch, padding_values: AxesParams = 0, ratio: AxesParams = 0.5): """ Pad each element of ``b...
def apply_at(index: AxesLike, func: Callable, *args, **kwargs): """ Returns a function that takes an iterable and applies ``func`` to the values at the corresponding ``index``. ``args`` and ``kwargs`` are passed to ``func`` as additional arguments. Examples -------- >>> first_sqr = apply_at(0,...
61
83
from typing import Callable, Iterable, Sequence import numpy as np from dpipe.im.axes import AxesLike, AxesParams from dpipe.itertools import lmap, squeeze_first from dpipe.im import pad_to_shape def pad_batch_equal(batch, padding_values: AxesParams = 0, ratio: AxesParams = 0.5): """ Pad each element of ``b...
get_valid_arguments
Return a list of all available plugins for the groups configured for this PluginParamType instance. If the entry point names are not unique, because there are multiple groups that contain an entry point that has an identical name, we need to prefix the names with the full group name :returns: list of valid entry point...
# -*- coding: utf-8 -*- ########################################################################### # Copyright (c), The AiiDA team. All rights reserved. # # This file is part of the AiiDA code. # # ...
def get_valid_arguments(self): """ Return a list of all available plugins for the groups configured for this PluginParamType instance. If the entry point names are not unique, because there are multiple groups that contain an entry point that has an identical name, we need to prefix ...
102
114
# -*- coding: utf-8 -*- ########################################################################### # Copyright (c), The AiiDA team. All rights reserved. # # This file is part of the AiiDA code. # # ...
get_entry_point_from_string
Validate a given entry point string, which means that it should have a valid entry point string format and that the entry point unambiguously corresponds to an entry point in the groups configured for this instance of PluginParameterType. :returns: the entry point if valid :raises: ValueError if the entry point string...
# -*- coding: utf-8 -*- ########################################################################### # Copyright (c), The AiiDA team. All rights reserved. # # This file is part of the AiiDA code. # # ...
def get_entry_point_from_string(self, entry_point_string): """ Validate a given entry point string, which means that it should have a valid entry point string format and that the entry point unambiguously corresponds to an entry point in the groups configured for this instance of Plu...
152
198
# -*- coding: utf-8 -*- ########################################################################### # Copyright (c), The AiiDA team. All rights reserved. # # This file is part of the AiiDA code. # # ...
convert
Convert the string value to an entry point instance, if the value can be successfully parsed into an actual entry point. Will raise click.BadParameter if validation fails.
# -*- coding: utf-8 -*- ########################################################################### # Copyright (c), The AiiDA team. All rights reserved. # # This file is part of the AiiDA code. # # ...
@decorators.with_dbenv() def convert(self, value, param, ctx): """ Convert the string value to an entry point instance, if the value can be successfully parsed into an actual entry point. Will raise click.BadParameter if validation fails. """ if not value: rai...
200
220
# -*- coding: utf-8 -*- ########################################################################### # Copyright (c), The AiiDA team. All rights reserved. # # This file is part of the AiiDA code. # # ...
__init__
Initializes the GaussianSumQuery. Args: l2_norm_clip: The clipping norm to apply to the global norm of each record. stddev: The stddev of the noise added to the sum.
# Copyright 2018, The TensorFlow Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed t...
def __init__(self, l2_norm_clip, stddev): """Initializes the GaussianSumQuery. Args: l2_norm_clip: The clipping norm to apply to the global norm of each record. stddev: The stddev of the noise added to the sum. """ self._l2_norm_clip = l2_norm_clip self._stddev = stddev se...
41
51
# Copyright 2018, The TensorFlow Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed t...
forward
Return generator or discriminator loss with dict format. Args: text (Tensor): Text index tensor (B, T_text). text_lengths (Tensor): Text length tensor (B,). speech (Tensor): Speech waveform tensor (B, T_wav). speech_lengths (Tensor): Speech length tensor (B,). spembs (Optional[Tensor]): Speaker emb...
# Copyright 2021 Tomoki Hayashi # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """GAN-based TTS ESPnet model.""" from contextlib import contextmanager from distutils.version import LooseVersion from typing import Any from typing import Dict from typing import Optional import torch from typeguard import...
def forward( self, text: torch.Tensor, text_lengths: torch.Tensor, speech: torch.Tensor, speech_lengths: torch.Tensor, spembs: Optional[torch.Tensor] = None, sids: Optional[torch.Tensor] = None, lids: Optional[torch.Tensor] = None, forward_gene...
53
111
# Copyright 2021 Tomoki Hayashi # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """GAN-based TTS ESPnet model.""" from contextlib import contextmanager from distutils.version import LooseVersion from typing import Any from typing import Dict from typing import Optional import torch from typeguard import...
collect_feats
Calculate features and return them as a dict. Args: text (Tensor): Text index tensor (B, T_text). text_lengths (Tensor): Text length tensor (B,). speech (Tensor): Speech waveform tensor (B, T_wav). speech_lengths (Tensor): Speech length tensor (B, 1). spembs (Optional[Tensor]): Speaker embedding te...
# Copyright 2021 Tomoki Hayashi # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """GAN-based TTS ESPnet model.""" from contextlib import contextmanager from distutils.version import LooseVersion from typing import Any from typing import Dict from typing import Optional import torch from typeguard import...
def collect_feats( self, text: torch.Tensor, text_lengths: torch.Tensor, speech: torch.Tensor, speech_lengths: torch.Tensor, spembs: Optional[torch.Tensor] = None, sids: Optional[torch.Tensor] = None, lids: Optional[torch.Tensor] = None, ) -> Dict[...
113
145
# Copyright 2021 Tomoki Hayashi # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """GAN-based TTS ESPnet model.""" from contextlib import contextmanager from distutils.version import LooseVersion from typing import Any from typing import Dict from typing import Optional import torch from typeguard import...
create_client
Create Cumulocity client and prompt for missing credentials if necessary. Args: ctx (click.Context): Click context opts (ProxyContext): Proxy options Returns: CumulocityClient: Configured Cumulocity client
# # Copyright (c) 2021 Software AG, Darmstadt, Germany and/or its licensors # # SPDX-License-Identifier: Apache-2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apach...
def create_client(ctx: click.Context, opts: ProxyContext) -> CumulocityClient: """Create Cumulocity client and prompt for missing credentials if necessary. Args: ctx (click.Context): Click context opts (ProxyContext): Proxy options Returns: CumulocityClient: Configured Cumuloci...
322
399
# # Copyright (c) 2021 Software AG, Darmstadt, Germany and/or its licensors # # SPDX-License-Identifier: Apache-2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apach...
run_proxy_in_background
Run the proxy in a background thread Args: ctx (click.Context): Click context opts (ProxyContext): Proxy options connection_data (RemoteAccessConnectionData): Remote access connection data
# # Copyright (c) 2021 Software AG, Darmstadt, Germany and/or its licensors # # SPDX-License-Identifier: Apache-2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apach...
def run_proxy_in_background( ctx: click.Context, opts: ProxyContext, connection_data: RemoteAccessConnectionData, ready_signal: threading.Event = None, ): """Run the proxy in a background thread Args: ctx (click.Context): Click context opts (ProxyContext): Proxy options ...
493
547
# # Copyright (c) 2021 Software AG, Darmstadt, Germany and/or its licensors # # SPDX-License-Identifier: Apache-2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apach...
start_proxy
Start the local proxy Args: ctx (click.Context): Click context opts (ProxyContext): Proxy options
# # Copyright (c) 2021 Software AG, Darmstadt, Germany and/or its licensors # # SPDX-License-Identifier: Apache-2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apach...
def start_proxy( ctx: click.Context, opts: ProxyContext, connection_data: RemoteAccessConnectionData, stop_signal: threading.Event = None, ready_signal: threading.Event = None, ) -> NoReturn: """Start the local proxy Args: ctx (click.Context): Click context opts (ProxyContex...
605
715
# # Copyright (c) 2021 Software AG, Darmstadt, Germany and/or its licensors # # SPDX-License-Identifier: Apache-2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apach...
start_background
Start the local proxy in the background Returns: ProxyContext: Reference to the proxy context so it can be chained with other commands or used after the initialization of the class.
# # Copyright (c) 2021 Software AG, Darmstadt, Germany and/or its licensors # # SPDX-License-Identifier: Apache-2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apach...
def start_background(self, ctx: click.Context = None) -> "ProxyContext": """Start the local proxy in the background Returns: ProxyContext: Reference to the proxy context so it can be chained with other commands or used after the initialization of the class. """ ...
152
167
# # Copyright (c) 2021 Software AG, Darmstadt, Germany and/or its licensors # # SPDX-License-Identifier: Apache-2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apach...
start
Start the local proxy in the background Returns: ProxyContext: Reference to the proxy context so it can be chained with other commands or used after the initialization of the class.
# # Copyright (c) 2021 Software AG, Darmstadt, Germany and/or its licensors # # SPDX-License-Identifier: Apache-2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apach...
def start(self, ctx: click.Context = None) -> None: """Start the local proxy in the background Returns: ProxyContext: Reference to the proxy context so it can be chained with other commands or used after the initialization of the class. """ cur_ctx = ctx ...
169
178
# # Copyright (c) 2021 Software AG, Darmstadt, Germany and/or its licensors # # SPDX-License-Identifier: Apache-2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apach...
show_error
Show an error to the user and log it Args: msg (str): User message to print on the console
# # Copyright (c) 2021 Software AG, Darmstadt, Germany and/or its licensors # # SPDX-License-Identifier: Apache-2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apach...
def show_error(self, msg: str, *args, **kwargs): """Show an error to the user and log it Args: msg (str): User message to print on the console """ if not self.verbose: click.secho(msg, fg="red") logging.warning(msg, *args, **kwargs)
190
199
# # Copyright (c) 2021 Software AG, Darmstadt, Germany and/or its licensors # # SPDX-License-Identifier: Apache-2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apach...