body stringlengths 26 98.2k | body_hash int64 -9,222,864,604,528,158,000 9,221,803,474B | docstring stringlengths 1 16.8k | path stringlengths 5 230 | name stringlengths 1 96 | repository_name stringlengths 7 89 | lang stringclasses 1
value | body_without_docstring stringlengths 20 98.2k |
|---|---|---|---|---|---|---|---|
def create_scraper_configuration(self, instance=None):
'\n Creates a scraper configuration.\n\n If instance does not specify a value for a configuration option, the value will default to the `init_config`.\n Otherwise, the `default_instance` value will be used.\n\n A default mixin config... | 7,534,735,580,054,286,000 | Creates a scraper configuration.
If instance does not specify a value for a configuration option, the value will default to the `init_config`.
Otherwise, the `default_instance` value will be used.
A default mixin configuration will be returned if there is no instance. | datadog_checks_base/datadog_checks/base/checks/openmetrics/mixins.py | create_scraper_configuration | DingGGu/integrations-core | python | def create_scraper_configuration(self, instance=None):
'\n Creates a scraper configuration.\n\n If instance does not specify a value for a configuration option, the value will default to the `init_config`.\n Otherwise, the `default_instance` value will be used.\n\n A default mixin config... |
def get_http_handler(self, scraper_config):
'\n Get http handler for a specific scraper config.\n The http handler is cached using `prometheus_url` as key.\n '
prometheus_url = scraper_config['prometheus_url']
if (prometheus_url in self._http_handlers):
return self._http_handler... | 1,936,616,197,089,814,800 | Get http handler for a specific scraper config.
The http handler is cached using `prometheus_url` as key. | datadog_checks_base/datadog_checks/base/checks/openmetrics/mixins.py | get_http_handler | DingGGu/integrations-core | python | def get_http_handler(self, scraper_config):
'\n Get http handler for a specific scraper config.\n The http handler is cached using `prometheus_url` as key.\n '
prometheus_url = scraper_config['prometheus_url']
if (prometheus_url in self._http_handlers):
return self._http_handler... |
def reset_http_config(self):
'\n You may need to use this when configuration is determined dynamically during every\n check run, such as when polling an external resource like the Kubelet.\n '
self._http_handlers.clear() | 9,124,018,060,828,578,000 | You may need to use this when configuration is determined dynamically during every
check run, such as when polling an external resource like the Kubelet. | datadog_checks_base/datadog_checks/base/checks/openmetrics/mixins.py | reset_http_config | DingGGu/integrations-core | python | def reset_http_config(self):
'\n You may need to use this when configuration is determined dynamically during every\n check run, such as when polling an external resource like the Kubelet.\n '
self._http_handlers.clear() |
def parse_metric_family(self, response, scraper_config):
'\n Parse the MetricFamily from a valid `requests.Response` object to provide a MetricFamily object.\n The text format uses iter_lines() generator.\n '
if (response.encoding is None):
response.encoding = 'utf-8'
input_gen ... | 1,450,872,603,286,986,000 | Parse the MetricFamily from a valid `requests.Response` object to provide a MetricFamily object.
The text format uses iter_lines() generator. | datadog_checks_base/datadog_checks/base/checks/openmetrics/mixins.py | parse_metric_family | DingGGu/integrations-core | python | def parse_metric_family(self, response, scraper_config):
'\n Parse the MetricFamily from a valid `requests.Response` object to provide a MetricFamily object.\n The text format uses iter_lines() generator.\n '
if (response.encoding is None):
response.encoding = 'utf-8'
input_gen ... |
def _text_filter_input(self, input_gen, scraper_config):
"\n Filters out the text input line by line to avoid parsing and processing\n metrics we know we don't want to process. This only works on `text/plain`\n payloads, and is an INTERNAL FEATURE implemented for the kubelet check\n :par... | -6,281,635,910,394,082,000 | Filters out the text input line by line to avoid parsing and processing
metrics we know we don't want to process. This only works on `text/plain`
payloads, and is an INTERNAL FEATURE implemented for the kubelet check
:param input_get: line generator
:output: generator of filtered lines | datadog_checks_base/datadog_checks/base/checks/openmetrics/mixins.py | _text_filter_input | DingGGu/integrations-core | python | def _text_filter_input(self, input_gen, scraper_config):
"\n Filters out the text input line by line to avoid parsing and processing\n metrics we know we don't want to process. This only works on `text/plain`\n payloads, and is an INTERNAL FEATURE implemented for the kubelet check\n :par... |
def scrape_metrics(self, scraper_config):
'\n Poll the data from Prometheus and return the metrics as a generator.\n '
response = self.poll(scraper_config)
if scraper_config['telemetry']:
if ('content-length' in response.headers):
content_len = int(response.headers['content... | -5,311,989,745,671,305,000 | Poll the data from Prometheus and return the metrics as a generator. | datadog_checks_base/datadog_checks/base/checks/openmetrics/mixins.py | scrape_metrics | DingGGu/integrations-core | python | def scrape_metrics(self, scraper_config):
'\n \n '
response = self.poll(scraper_config)
if scraper_config['telemetry']:
if ('content-length' in response.headers):
content_len = int(response.headers['content-length'])
else:
content_len = len(response.cont... |
def process(self, scraper_config, metric_transformers=None):
'\n Polls the data from Prometheus and submits them as Datadog metrics.\n `endpoint` is the metrics endpoint to use to poll metrics from Prometheus\n\n Note that if the instance has a `tags` attribute, it will be pushed\n autom... | 4,262,099,596,921,157,000 | Polls the data from Prometheus and submits them as Datadog metrics.
`endpoint` is the metrics endpoint to use to poll metrics from Prometheus
Note that if the instance has a `tags` attribute, it will be pushed
automatically as additional custom tags and added to the metrics | datadog_checks_base/datadog_checks/base/checks/openmetrics/mixins.py | process | DingGGu/integrations-core | python | def process(self, scraper_config, metric_transformers=None):
'\n Polls the data from Prometheus and submits them as Datadog metrics.\n `endpoint` is the metrics endpoint to use to poll metrics from Prometheus\n\n Note that if the instance has a `tags` attribute, it will be pushed\n autom... |
def process_metric(self, metric, scraper_config, metric_transformers=None):
"\n Handle a Prometheus metric according to the following flow:\n - search `scraper_config['metrics_mapper']` for a prometheus.metric to datadog.metric mapping\n - call check method with the same name as the metric\n ... | -3,420,036,718,522,466,300 | Handle a Prometheus metric according to the following flow:
- search `scraper_config['metrics_mapper']` for a prometheus.metric to datadog.metric mapping
- call check method with the same name as the metric
- log info if none of the above worked
`metric_transformers` is a dict of `<metric name>:<function to run when t... | datadog_checks_base/datadog_checks/base/checks/openmetrics/mixins.py | process_metric | DingGGu/integrations-core | python | def process_metric(self, metric, scraper_config, metric_transformers=None):
"\n Handle a Prometheus metric according to the following flow:\n - search `scraper_config['metrics_mapper']` for a prometheus.metric to datadog.metric mapping\n - call check method with the same name as the metric\n ... |
def poll(self, scraper_config, headers=None):
"\n Returns a valid `requests.Response`, otherwise raise requests.HTTPError if the status code of the\n response isn't valid - see `response.raise_for_status()`\n\n The caller needs to close the requests.Response.\n\n Custom headers can be ad... | 2,956,356,092,003,690,500 | Returns a valid `requests.Response`, otherwise raise requests.HTTPError if the status code of the
response isn't valid - see `response.raise_for_status()`
The caller needs to close the requests.Response.
Custom headers can be added to the default headers. | datadog_checks_base/datadog_checks/base/checks/openmetrics/mixins.py | poll | DingGGu/integrations-core | python | def poll(self, scraper_config, headers=None):
"\n Returns a valid `requests.Response`, otherwise raise requests.HTTPError if the status code of the\n response isn't valid - see `response.raise_for_status()`\n\n The caller needs to close the requests.Response.\n\n Custom headers can be ad... |
def get_hostname_for_sample(self, sample, scraper_config):
'\n Expose the label_to_hostname mapping logic to custom handler methods\n '
return self._get_hostname(None, sample, scraper_config) | -893,631,662,106,031,400 | Expose the label_to_hostname mapping logic to custom handler methods | datadog_checks_base/datadog_checks/base/checks/openmetrics/mixins.py | get_hostname_for_sample | DingGGu/integrations-core | python | def get_hostname_for_sample(self, sample, scraper_config):
'\n \n '
return self._get_hostname(None, sample, scraper_config) |
def submit_openmetric(self, metric_name, metric, scraper_config, hostname=None):
"\n For each sample in the metric, report it as a gauge with all labels as tags\n except if a labels `dict` is passed, in which case keys are label names we'll extract\n and corresponding values are tag names we'll... | -6,410,313,078,005,258,000 | For each sample in the metric, report it as a gauge with all labels as tags
except if a labels `dict` is passed, in which case keys are label names we'll extract
and corresponding values are tag names we'll use (eg: {'node': 'node'}).
Histograms generate a set of values instead of a unique metric.
`send_histograms_buc... | datadog_checks_base/datadog_checks/base/checks/openmetrics/mixins.py | submit_openmetric | DingGGu/integrations-core | python | def submit_openmetric(self, metric_name, metric, scraper_config, hostname=None):
"\n For each sample in the metric, report it as a gauge with all labels as tags\n except if a labels `dict` is passed, in which case keys are label names we'll extract\n and corresponding values are tag names we'll... |
def _get_hostname(self, hostname, sample, scraper_config):
'\n If hostname is None, look at label_to_hostname setting\n '
if ((hostname is None) and (scraper_config['label_to_hostname'] is not None) and sample[self.SAMPLE_LABELS].get(scraper_config['label_to_hostname'])):
hostname = sample... | -251,633,848,672,179,940 | If hostname is None, look at label_to_hostname setting | datadog_checks_base/datadog_checks/base/checks/openmetrics/mixins.py | _get_hostname | DingGGu/integrations-core | python | def _get_hostname(self, hostname, sample, scraper_config):
'\n \n '
if ((hostname is None) and (scraper_config['label_to_hostname'] is not None) and sample[self.SAMPLE_LABELS].get(scraper_config['label_to_hostname'])):
hostname = sample[self.SAMPLE_LABELS][scraper_config['label_to_hostname... |
def _submit_gauges_from_summary(self, metric_name, metric, scraper_config, hostname=None):
'\n Extracts metrics from a prometheus summary metric and sends them as gauges\n '
for sample in metric.samples:
val = sample[self.SAMPLE_VALUE]
if (not self._is_value_valid(val)):
... | -5,473,741,916,677,806,000 | Extracts metrics from a prometheus summary metric and sends them as gauges | datadog_checks_base/datadog_checks/base/checks/openmetrics/mixins.py | _submit_gauges_from_summary | DingGGu/integrations-core | python | def _submit_gauges_from_summary(self, metric_name, metric, scraper_config, hostname=None):
'\n \n '
for sample in metric.samples:
val = sample[self.SAMPLE_VALUE]
if (not self._is_value_valid(val)):
self.log.debug('Metric value is not supported for metric %s', sample[sel... |
def _submit_gauges_from_histogram(self, metric_name, metric, scraper_config, hostname=None):
'\n Extracts metrics from a prometheus histogram and sends them as gauges\n '
if scraper_config['non_cumulative_buckets']:
self._decumulate_histogram_buckets(metric)
for sample in metric.sample... | -6,556,666,123,089,748,000 | Extracts metrics from a prometheus histogram and sends them as gauges | datadog_checks_base/datadog_checks/base/checks/openmetrics/mixins.py | _submit_gauges_from_histogram | DingGGu/integrations-core | python | def _submit_gauges_from_histogram(self, metric_name, metric, scraper_config, hostname=None):
'\n \n '
if scraper_config['non_cumulative_buckets']:
self._decumulate_histogram_buckets(metric)
for sample in metric.samples:
val = sample[self.SAMPLE_VALUE]
if (not self._is_v... |
def _decumulate_histogram_buckets(self, metric):
'\n Decumulate buckets in a given histogram metric and adds the lower_bound label (le being upper_bound)\n '
bucket_values_by_context_upper_bound = {}
for sample in metric.samples:
if sample[self.SAMPLE_NAME].endswith('_bucket'):
... | 4,912,369,996,977,096,000 | Decumulate buckets in a given histogram metric and adds the lower_bound label (le being upper_bound) | datadog_checks_base/datadog_checks/base/checks/openmetrics/mixins.py | _decumulate_histogram_buckets | DingGGu/integrations-core | python | def _decumulate_histogram_buckets(self, metric):
'\n \n '
bucket_values_by_context_upper_bound = {}
for sample in metric.samples:
if sample[self.SAMPLE_NAME].endswith('_bucket'):
context_key = self._compute_bucket_hash(sample[self.SAMPLE_LABELS])
if (context_key... |
def CreateNewSimulator(device_type=None, os_version=None, name_prefix=None):
'Creates a new simulator according to arguments.\n\n If neither device_type nor os_version is given, will use the latest iOS\n version and latest iPhone type.\n If os_version is given but device_type is not, will use latest iPhone type\... | -5,960,860,370,713,791,000 | Creates a new simulator according to arguments.
If neither device_type nor os_version is given, will use the latest iOS
version and latest iPhone type.
If os_version is given but device_type is not, will use latest iPhone type
according to the OS version limitation. E.g., if the given os_version is 9.3,
the latest sim... | simulator_control/simulator_util.py | CreateNewSimulator | ios-bazel-users/xctestrunner | python | def CreateNewSimulator(device_type=None, os_version=None, name_prefix=None):
'Creates a new simulator according to arguments.\n\n If neither device_type nor os_version is given, will use the latest iOS\n version and latest iPhone type.\n If os_version is given but device_type is not, will use latest iPhone type\... |
def GetSupportedSimDeviceTypes(os_type=None):
'Gets the name list of supported simulator device types of given OS type.\n\n If os_type is not provided, it will return all supported simulator device\n types. The names are got from command result of `xcrun simctl list devices`.\n So some simulator device types\' n... | 1,543,619,953,991,501,300 | Gets the name list of supported simulator device types of given OS type.
If os_type is not provided, it will return all supported simulator device
types. The names are got from command result of `xcrun simctl list devices`.
So some simulator device types' names may be different in different Xcode.
E.g., the name of iP... | simulator_control/simulator_util.py | GetSupportedSimDeviceTypes | ios-bazel-users/xctestrunner | python | def GetSupportedSimDeviceTypes(os_type=None):
'Gets the name list of supported simulator device types of given OS type.\n\n If os_type is not provided, it will return all supported simulator device\n types. The names are got from command result of `xcrun simctl list devices`.\n So some simulator device types\' n... |
def GetLastSupportedIphoneSimType(os_version):
'"Gets the last supported iPhone simulator type of the given OS version.\n\n Currently, the last supported iPhone simulator type is the last iPhone from\n the output of `xcrun simctl list devicetypes`.\n\n Args:\n os_version: string, OS version of the new simulat... | 6,094,569,838,771,017,000 | "Gets the last supported iPhone simulator type of the given OS version.
Currently, the last supported iPhone simulator type is the last iPhone from
the output of `xcrun simctl list devicetypes`.
Args:
os_version: string, OS version of the new simulator. The format is
{major}.{minor}, such as 9.3, 10.2.
Returns... | simulator_control/simulator_util.py | GetLastSupportedIphoneSimType | ios-bazel-users/xctestrunner | python | def GetLastSupportedIphoneSimType(os_version):
'"Gets the last supported iPhone simulator type of the given OS version.\n\n Currently, the last supported iPhone simulator type is the last iPhone from\n the output of `xcrun simctl list devicetypes`.\n\n Args:\n os_version: string, OS version of the new simulat... |
def GetSupportedSimOsVersions(os_type=ios_constants.OS.IOS):
'Gets the supported version of given simulator OS type.\n\n Args:\n os_type: shared.ios_constants.OS, OS type of simulator, such as iOS,\n watchOS, tvOS.\n\n Returns:\n a list of string, each item is an OS version number. E.g., ["10.1", "11.0... | 2,632,829,651,962,133,500 | Gets the supported version of given simulator OS type.
Args:
os_type: shared.ios_constants.OS, OS type of simulator, such as iOS,
watchOS, tvOS.
Returns:
a list of string, each item is an OS version number. E.g., ["10.1", "11.0"] | simulator_control/simulator_util.py | GetSupportedSimOsVersions | ios-bazel-users/xctestrunner | python | def GetSupportedSimOsVersions(os_type=ios_constants.OS.IOS):
'Gets the supported version of given simulator OS type.\n\n Args:\n os_type: shared.ios_constants.OS, OS type of simulator, such as iOS,\n watchOS, tvOS.\n\n Returns:\n a list of string, each item is an OS version number. E.g., ["10.1", "11.0... |
def GetLastSupportedSimOsVersion(os_type=ios_constants.OS.IOS, device_type=None):
'Gets the last supported version of given arguments.\n\n If device_type is given, will return the last supported OS version of the\n device type. Otherwise, will return the last supported OS version of the\n OS type.\n\n Args:\n ... | 6,682,635,599,485,531,000 | Gets the last supported version of given arguments.
If device_type is given, will return the last supported OS version of the
device type. Otherwise, will return the last supported OS version of the
OS type.
Args:
os_type: shared.ios_constants.OS, OS type of simulator, such as iOS,
watchOS, tvOS.
device_type:... | simulator_control/simulator_util.py | GetLastSupportedSimOsVersion | ios-bazel-users/xctestrunner | python | def GetLastSupportedSimOsVersion(os_type=ios_constants.OS.IOS, device_type=None):
'Gets the last supported version of given arguments.\n\n If device_type is given, will return the last supported OS version of the\n device type. Otherwise, will return the last supported OS version of the\n OS type.\n\n Args:\n ... |
def GetOsType(device_type):
'Gets the OS type of the given simulator.\n\n This method can not work fine if the device_type is invalid. Please calls\n simulator_util.ValidateSimulatorType(device_type, os_version) to validate\n it first.\n\n Args:\n device_type: string, device type of the new simulator. The va... | 6,833,521,821,800,253,000 | Gets the OS type of the given simulator.
This method can not work fine if the device_type is invalid. Please calls
simulator_util.ValidateSimulatorType(device_type, os_version) to validate
it first.
Args:
device_type: string, device type of the new simulator. The value corresponds
to the output of `xcrun simctl... | simulator_control/simulator_util.py | GetOsType | ios-bazel-users/xctestrunner | python | def GetOsType(device_type):
'Gets the OS type of the given simulator.\n\n This method can not work fine if the device_type is invalid. Please calls\n simulator_util.ValidateSimulatorType(device_type, os_version) to validate\n it first.\n\n Args:\n device_type: string, device type of the new simulator. The va... |
def _ValidateSimulatorType(device_type):
'Checks if the simulator type is valid.\n\n Args:\n device_type: string, device type of the new simulator. The value corresponds\n to the output of `xcrun simctl list devicetypes`. E.g., iPhone 6, iPad\n Air, etc.\n\n Raises:\n ios_errors.IllegalArgumentErr... | -6,484,406,973,542,943,000 | Checks if the simulator type is valid.
Args:
device_type: string, device type of the new simulator. The value corresponds
to the output of `xcrun simctl list devicetypes`. E.g., iPhone 6, iPad
Air, etc.
Raises:
ios_errors.IllegalArgumentError: when the given simulator device type is
invalid. | simulator_control/simulator_util.py | _ValidateSimulatorType | ios-bazel-users/xctestrunner | python | def _ValidateSimulatorType(device_type):
'Checks if the simulator type is valid.\n\n Args:\n device_type: string, device type of the new simulator. The value corresponds\n to the output of `xcrun simctl list devicetypes`. E.g., iPhone 6, iPad\n Air, etc.\n\n Raises:\n ios_errors.IllegalArgumentErr... |
def _ValidateSimulatorTypeWithOsVersion(device_type, os_version):
'Checks if the simulator type with the given os version is valid.\n\n Args:\n device_type: string, device type of the new simulator. The value corresponds\n to the output of `xcrun simctl list devicetypes`. E.g., iPhone 6, iPad\n Air, e... | -4,512,402,697,419,481,600 | Checks if the simulator type with the given os version is valid.
Args:
device_type: string, device type of the new simulator. The value corresponds
to the output of `xcrun simctl list devicetypes`. E.g., iPhone 6, iPad
Air, etc.
os_version: string, OS version of the new simulator. The format is
{major}... | simulator_control/simulator_util.py | _ValidateSimulatorTypeWithOsVersion | ios-bazel-users/xctestrunner | python | def _ValidateSimulatorTypeWithOsVersion(device_type, os_version):
'Checks if the simulator type with the given os version is valid.\n\n Args:\n device_type: string, device type of the new simulator. The value corresponds\n to the output of `xcrun simctl list devicetypes`. E.g., iPhone 6, iPad\n Air, e... |
def QuitSimulatorApp():
'Quits the Simulator.app.'
if (xcode_info_util.GetXcodeVersionNumber() >= 700):
simulator_name = 'Simulator'
else:
simulator_name = 'iOS Simulator'
subprocess.Popen(['killall', simulator_name], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) | 1,200,886,455,530,469,000 | Quits the Simulator.app. | simulator_control/simulator_util.py | QuitSimulatorApp | ios-bazel-users/xctestrunner | python | def QuitSimulatorApp():
if (xcode_info_util.GetXcodeVersionNumber() >= 700):
simulator_name = 'Simulator'
else:
simulator_name = 'iOS Simulator'
subprocess.Popen(['killall', simulator_name], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) |
def IsAppFailedToLaunchOnSim(sim_sys_log, app_bundle_id=''):
"Checks if the app failed to launch on simulator.\n\n If app_bundle_id is not provided, will check if any UIKitApplication failed\n to launch on simulator.\n\n Args:\n sim_sys_log: string, the content of the simulator's system.log.\n app_bundle_i... | -2,801,166,854,162,089,000 | Checks if the app failed to launch on simulator.
If app_bundle_id is not provided, will check if any UIKitApplication failed
to launch on simulator.
Args:
sim_sys_log: string, the content of the simulator's system.log.
app_bundle_id: string, the bundle id of the app.
Returns:
True if the app failed to launch o... | simulator_control/simulator_util.py | IsAppFailedToLaunchOnSim | ios-bazel-users/xctestrunner | python | def IsAppFailedToLaunchOnSim(sim_sys_log, app_bundle_id=):
"Checks if the app failed to launch on simulator.\n\n If app_bundle_id is not provided, will check if any UIKitApplication failed\n to launch on simulator.\n\n Args:\n sim_sys_log: string, the content of the simulator's system.log.\n app_bundle_id:... |
def IsXctestFailedToLaunchOnSim(sim_sys_log):
"Checks if the xctest process failed to launch on simulator.\n\n Args:\n sim_sys_log: string, the content of the simulator's system.log.\n\n Returns:\n True if the xctest process failed to launch on simulator.\n "
pattern = re.compile(_PATTERN_XCTEST_PROCES... | -1,712,033,317,035,671,000 | Checks if the xctest process failed to launch on simulator.
Args:
sim_sys_log: string, the content of the simulator's system.log.
Returns:
True if the xctest process failed to launch on simulator. | simulator_control/simulator_util.py | IsXctestFailedToLaunchOnSim | ios-bazel-users/xctestrunner | python | def IsXctestFailedToLaunchOnSim(sim_sys_log):
"Checks if the xctest process failed to launch on simulator.\n\n Args:\n sim_sys_log: string, the content of the simulator's system.log.\n\n Returns:\n True if the xctest process failed to launch on simulator.\n "
pattern = re.compile(_PATTERN_XCTEST_PROCES... |
def IsCoreSimulatorCrash(sim_sys_log):
"Checks if CoreSimulator crashes.\n\n Args:\n sim_sys_log: string, the content of the simulator's system.log.\n\n Returns:\n True if the CoreSimulator crashes.\n "
pattern = re.compile(_PATTERN_CORESIMULATOR_CRASH)
return (pattern.search(sim_sys_log) is not No... | 7,590,567,797,334,453,000 | Checks if CoreSimulator crashes.
Args:
sim_sys_log: string, the content of the simulator's system.log.
Returns:
True if the CoreSimulator crashes. | simulator_control/simulator_util.py | IsCoreSimulatorCrash | ios-bazel-users/xctestrunner | python | def IsCoreSimulatorCrash(sim_sys_log):
"Checks if CoreSimulator crashes.\n\n Args:\n sim_sys_log: string, the content of the simulator's system.log.\n\n Returns:\n True if the CoreSimulator crashes.\n "
pattern = re.compile(_PATTERN_CORESIMULATOR_CRASH)
return (pattern.search(sim_sys_log) is not No... |
def RunSimctlCommand(command):
'Runs simctl command.'
for i in range(_SIMCTL_MAX_ATTEMPTS):
process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
(stdout, stderr) = process.communicate()
if (ios_constants.CORESIMULATOR_CHANGE_ERROR in stderr):
ou... | -4,057,334,053,992,785,400 | Runs simctl command. | simulator_control/simulator_util.py | RunSimctlCommand | ios-bazel-users/xctestrunner | python | def RunSimctlCommand(command):
for i in range(_SIMCTL_MAX_ATTEMPTS):
process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
(stdout, stderr) = process.communicate()
if (ios_constants.CORESIMULATOR_CHANGE_ERROR in stderr):
output = stdout
... |
def __init__(self, simulator_id):
'Constructor of Simulator object.\n\n Args:\n simulator_id: string, the identity of the simulator.\n '
self._simulator_id = simulator_id
self._simulator_root_dir = None
self._simulator_log_root_dir = None
self._device_plist_object = None | -7,640,569,958,608,737,000 | Constructor of Simulator object.
Args:
simulator_id: string, the identity of the simulator. | simulator_control/simulator_util.py | __init__ | ios-bazel-users/xctestrunner | python | def __init__(self, simulator_id):
'Constructor of Simulator object.\n\n Args:\n simulator_id: string, the identity of the simulator.\n '
self._simulator_id = simulator_id
self._simulator_root_dir = None
self._simulator_log_root_dir = None
self._device_plist_object = None |
@property
def simulator_root_dir(self):
"Gets the simulator's root directory."
if (not self._simulator_root_dir):
home_dir = pwd.getpwuid(os.geteuid()).pw_dir
self._simulator_root_dir = os.path.join(('%s/Library/Developer/CoreSimulator/Devices/%s' % (home_dir, self.simulator_id)))
return sel... | -8,339,548,879,086,290,000 | Gets the simulator's root directory. | simulator_control/simulator_util.py | simulator_root_dir | ios-bazel-users/xctestrunner | python | @property
def simulator_root_dir(self):
if (not self._simulator_root_dir):
home_dir = pwd.getpwuid(os.geteuid()).pw_dir
self._simulator_root_dir = os.path.join(('%s/Library/Developer/CoreSimulator/Devices/%s' % (home_dir, self.simulator_id)))
return self._simulator_root_dir |
@property
def simulator_log_root_dir(self):
"Gets the root directory of the simulator's logs."
if (not self._simulator_log_root_dir):
home_dir = pwd.getpwuid(os.geteuid()).pw_dir
self._simulator_log_root_dir = os.path.join(('%s/Library/Logs/CoreSimulator/%s' % (home_dir, self.simulator_id)))
... | -2,731,196,311,688,810,500 | Gets the root directory of the simulator's logs. | simulator_control/simulator_util.py | simulator_log_root_dir | ios-bazel-users/xctestrunner | python | @property
def simulator_log_root_dir(self):
if (not self._simulator_log_root_dir):
home_dir = pwd.getpwuid(os.geteuid()).pw_dir
self._simulator_log_root_dir = os.path.join(('%s/Library/Logs/CoreSimulator/%s' % (home_dir, self.simulator_id)))
return self._simulator_log_root_dir |
@property
def device_plist_object(self):
'Gets the plist_util.Plist object of device.plist of the simulator.\n\n Returns:\n a plist_util.Plist object of device.plist of the simulator or None when\n the simulator does not exist or is being created.\n '
if (not self._device_plist_object):
... | -7,964,115,949,617,574,000 | Gets the plist_util.Plist object of device.plist of the simulator.
Returns:
a plist_util.Plist object of device.plist of the simulator or None when
the simulator does not exist or is being created. | simulator_control/simulator_util.py | device_plist_object | ios-bazel-users/xctestrunner | python | @property
def device_plist_object(self):
'Gets the plist_util.Plist object of device.plist of the simulator.\n\n Returns:\n a plist_util.Plist object of device.plist of the simulator or None when\n the simulator does not exist or is being created.\n '
if (not self._device_plist_object):
... |
def Shutdown(self):
'Shuts down the simulator.'
sim_state = self.GetSimulatorState()
if (sim_state == ios_constants.SimState.SHUTDOWN):
logging.info('Simulator %s has already shut down.', self.simulator_id)
return
if (sim_state == ios_constants.SimState.CREATING):
raise ios_error... | -2,268,752,979,446,568,400 | Shuts down the simulator. | simulator_control/simulator_util.py | Shutdown | ios-bazel-users/xctestrunner | python | def Shutdown(self):
sim_state = self.GetSimulatorState()
if (sim_state == ios_constants.SimState.SHUTDOWN):
logging.info('Simulator %s has already shut down.', self.simulator_id)
return
if (sim_state == ios_constants.SimState.CREATING):
raise ios_errors.SimError('Can not shut do... |
def Delete(self):
"Deletes the simulator asynchronously.\n\n The simulator state should be SHUTDOWN when deleting it. Otherwise, it will\n raise exception.\n\n Raises:\n ios_errors.SimError: The simulator's state is not SHUTDOWN.\n "
if (xcode_info_util.GetXcodeVersionNumber() < 900):
s... | 4,910,870,316,368,934,000 | Deletes the simulator asynchronously.
The simulator state should be SHUTDOWN when deleting it. Otherwise, it will
raise exception.
Raises:
ios_errors.SimError: The simulator's state is not SHUTDOWN. | simulator_control/simulator_util.py | Delete | ios-bazel-users/xctestrunner | python | def Delete(self):
"Deletes the simulator asynchronously.\n\n The simulator state should be SHUTDOWN when deleting it. Otherwise, it will\n raise exception.\n\n Raises:\n ios_errors.SimError: The simulator's state is not SHUTDOWN.\n "
if (xcode_info_util.GetXcodeVersionNumber() < 900):
s... |
def FetchLogToFile(self, output_file_path, start_time=None, end_time=None):
'Gets simulator log via running `log` tool on simulator.\n\n Args:\n output_file_path: string, the path of the stdout file.\n start_time: datetime, the start time of the simulatro log.\n end_time: datetime, the end time of... | -3,275,341,676,593,996,000 | Gets simulator log via running `log` tool on simulator.
Args:
output_file_path: string, the path of the stdout file.
start_time: datetime, the start time of the simulatro log.
end_time: datetime, the end time of the simulatro log. | simulator_control/simulator_util.py | FetchLogToFile | ios-bazel-users/xctestrunner | python | def FetchLogToFile(self, output_file_path, start_time=None, end_time=None):
'Gets simulator log via running `log` tool on simulator.\n\n Args:\n output_file_path: string, the path of the stdout file.\n start_time: datetime, the start time of the simulatro log.\n end_time: datetime, the end time of... |
def GetAppDocumentsPath(self, app_bundle_id):
"Gets the path of the app's Documents directory."
if (xcode_info_util.GetXcodeVersionNumber() >= 830):
try:
app_data_container = RunSimctlCommand(['xcrun', 'simctl', 'get_app_container', self._simulator_id, app_bundle_id, 'data'])
ret... | -5,155,790,081,601,089,000 | Gets the path of the app's Documents directory. | simulator_control/simulator_util.py | GetAppDocumentsPath | ios-bazel-users/xctestrunner | python | def GetAppDocumentsPath(self, app_bundle_id):
if (xcode_info_util.GetXcodeVersionNumber() >= 830):
try:
app_data_container = RunSimctlCommand(['xcrun', 'simctl', 'get_app_container', self._simulator_id, app_bundle_id, 'data'])
return os.path.join(app_data_container, 'Documents')... |
def IsAppInstalled(self, app_bundle_id):
'Checks if the simulator has installed the app with given bundle id.'
try:
RunSimctlCommand(['xcrun', 'simctl', 'get_app_container', self._simulator_id, app_bundle_id])
return True
except ios_errors.SimError:
return False | 3,805,973,177,728,198,700 | Checks if the simulator has installed the app with given bundle id. | simulator_control/simulator_util.py | IsAppInstalled | ios-bazel-users/xctestrunner | python | def IsAppInstalled(self, app_bundle_id):
try:
RunSimctlCommand(['xcrun', 'simctl', 'get_app_container', self._simulator_id, app_bundle_id])
return True
except ios_errors.SimError:
return False |
def WaitUntilStateShutdown(self, timeout_sec=_SIMULATOR_SHUTDOWN_TIMEOUT_SEC):
'Waits until the simulator state becomes SHUTDOWN.\n\n Args:\n timeout_sec: int, timeout of waiting simulator state for becoming SHUTDOWN\n in seconds.\n\n Raises:\n ios_errors.SimError: when it is timeout to wait ... | -6,328,015,680,993,274,000 | Waits until the simulator state becomes SHUTDOWN.
Args:
timeout_sec: int, timeout of waiting simulator state for becoming SHUTDOWN
in seconds.
Raises:
ios_errors.SimError: when it is timeout to wait the simulator state
becomes SHUTDOWN. | simulator_control/simulator_util.py | WaitUntilStateShutdown | ios-bazel-users/xctestrunner | python | def WaitUntilStateShutdown(self, timeout_sec=_SIMULATOR_SHUTDOWN_TIMEOUT_SEC):
'Waits until the simulator state becomes SHUTDOWN.\n\n Args:\n timeout_sec: int, timeout of waiting simulator state for becoming SHUTDOWN\n in seconds.\n\n Raises:\n ios_errors.SimError: when it is timeout to wait ... |
def GetSimulatorState(self):
'Gets the state of the simulator in real time.\n\n Returns:\n shared.ios_constants.SimState, the state of the simulator.\n\n Raises:\n ios_errors.SimError: The state can not be recognized.\n '
if (self.device_plist_object is None):
return ios_constants.Sim... | 3,246,234,434,032,654,000 | Gets the state of the simulator in real time.
Returns:
shared.ios_constants.SimState, the state of the simulator.
Raises:
ios_errors.SimError: The state can not be recognized. | simulator_control/simulator_util.py | GetSimulatorState | ios-bazel-users/xctestrunner | python | def GetSimulatorState(self):
'Gets the state of the simulator in real time.\n\n Returns:\n shared.ios_constants.SimState, the state of the simulator.\n\n Raises:\n ios_errors.SimError: The state can not be recognized.\n '
if (self.device_plist_object is None):
return ios_constants.Sim... |
def __init__(self, i2c, device_address):
'\n Try to read a byte from an address,\n if you get an OSError it means the device is not there\n '
while (not i2c.try_lock()):
pass
try:
i2c.writeto(device_address, b'')
except OSError:
try:
result = byte... | -5,941,914,171,103,282,000 | Try to read a byte from an address,
if you get an OSError it means the device is not there | adafruit_bus_device/i2c_device.py | __init__ | rhthomas/Adafruit_CircuitPython_NRF24L01 | python | def __init__(self, i2c, device_address):
'\n Try to read a byte from an address,\n if you get an OSError it means the device is not there\n '
while (not i2c.try_lock()):
pass
try:
i2c.writeto(device_address, b)
except OSError:
try:
result = bytear... |
def readinto(self, buf, **kwargs):
'\n Read into ``buf`` from the device. The number of bytes read will be the\n length of ``buf``.\n\n If ``start`` or ``end`` is provided, then the buffer will be sliced\n as if ``buf[start:end]``. This will not cause an allocation like\n ``buf[st... | -1,874,825,497,476,106,500 | Read into ``buf`` from the device. The number of bytes read will be the
length of ``buf``.
If ``start`` or ``end`` is provided, then the buffer will be sliced
as if ``buf[start:end]``. This will not cause an allocation like
``buf[start:end]`` will so it saves memory.
:param bytearray buffer: buffer to write into
:par... | adafruit_bus_device/i2c_device.py | readinto | rhthomas/Adafruit_CircuitPython_NRF24L01 | python | def readinto(self, buf, **kwargs):
'\n Read into ``buf`` from the device. The number of bytes read will be the\n length of ``buf``.\n\n If ``start`` or ``end`` is provided, then the buffer will be sliced\n as if ``buf[start:end]``. This will not cause an allocation like\n ``buf[st... |
def write(self, buf, **kwargs):
'\n Write the bytes from ``buffer`` to the device. Transmits a stop bit if\n ``stop`` is set.\n\n If ``start`` or ``end`` is provided, then the buffer will be sliced\n as if ``buffer[start:end]``. This will not cause an allocation like\n ``buffer[st... | 8,320,486,125,263,830,000 | Write the bytes from ``buffer`` to the device. Transmits a stop bit if
``stop`` is set.
If ``start`` or ``end`` is provided, then the buffer will be sliced
as if ``buffer[start:end]``. This will not cause an allocation like
``buffer[start:end]`` will so it saves memory.
:param bytearray buffer: buffer containing the ... | adafruit_bus_device/i2c_device.py | write | rhthomas/Adafruit_CircuitPython_NRF24L01 | python | def write(self, buf, **kwargs):
'\n Write the bytes from ``buffer`` to the device. Transmits a stop bit if\n ``stop`` is set.\n\n If ``start`` or ``end`` is provided, then the buffer will be sliced\n as if ``buffer[start:end]``. This will not cause an allocation like\n ``buffer[st... |
def write_then_readinto(self, out_buffer, in_buffer, *, out_start=0, out_end=None, in_start=0, in_end=None, stop=True):
'\n Write the bytes from ``out_buffer`` to the device, then immediately\n reads into ``in_buffer`` from the device. The number of bytes read\n will be the length of ``in_buffe... | 3,956,235,842,555,875,300 | Write the bytes from ``out_buffer`` to the device, then immediately
reads into ``in_buffer`` from the device. The number of bytes read
will be the length of ``in_buffer``.
Transmits a stop bit after the write, if ``stop`` is set.
If ``out_start`` or ``out_end`` is provided, then the output buffer
will be sliced as if ... | adafruit_bus_device/i2c_device.py | write_then_readinto | rhthomas/Adafruit_CircuitPython_NRF24L01 | python | def write_then_readinto(self, out_buffer, in_buffer, *, out_start=0, out_end=None, in_start=0, in_end=None, stop=True):
'\n Write the bytes from ``out_buffer`` to the device, then immediately\n reads into ``in_buffer`` from the device. The number of bytes read\n will be the length of ``in_buffe... |
@property
def exists(self):
'\n Does this key correspond to an object in S3?\n '
return (self._size is not None) | -5,765,735,506,469,143,000 | Does this key correspond to an object in S3? | metaflow/datatools/s3.py | exists | anthonypreza/metaflow | python | @property
def exists(self):
'\n \n '
return (self._size is not None) |
@property
def downloaded(self):
'\n Has this object been downloaded?\n '
return bool(self._path) | 4,760,805,548,842,401,000 | Has this object been downloaded? | metaflow/datatools/s3.py | downloaded | anthonypreza/metaflow | python | @property
def downloaded(self):
'\n \n '
return bool(self._path) |
@property
def url(self):
'\n S3 location of the object\n '
return self._url | 5,366,792,614,045,977,000 | S3 location of the object | metaflow/datatools/s3.py | url | anthonypreza/metaflow | python | @property
def url(self):
'\n \n '
return self._url |
@property
def prefix(self):
'\n Prefix requested that matches the object.\n '
return self._prefix | 8,917,826,216,431,051,000 | Prefix requested that matches the object. | metaflow/datatools/s3.py | prefix | anthonypreza/metaflow | python | @property
def prefix(self):
'\n \n '
return self._prefix |
@property
def key(self):
'\n Key corresponds to the key given to the get call that produced\n this object. This may be a full S3 URL or a suffix based on what\n was requested.\n '
return self._key | -3,277,946,264,028,065,000 | Key corresponds to the key given to the get call that produced
this object. This may be a full S3 URL or a suffix based on what
was requested. | metaflow/datatools/s3.py | key | anthonypreza/metaflow | python | @property
def key(self):
'\n Key corresponds to the key given to the get call that produced\n this object. This may be a full S3 URL or a suffix based on what\n was requested.\n '
return self._key |
@property
def path(self):
'\n Path to the local file corresponding to the object downloaded.\n This file gets deleted automatically when a S3 scope exits.\n\n Returns None if this S3Object has not been downloaded.\n '
return self._path | -1,224,402,731,662,786,000 | Path to the local file corresponding to the object downloaded.
This file gets deleted automatically when a S3 scope exits.
Returns None if this S3Object has not been downloaded. | metaflow/datatools/s3.py | path | anthonypreza/metaflow | python | @property
def path(self):
'\n Path to the local file corresponding to the object downloaded.\n This file gets deleted automatically when a S3 scope exits.\n\n Returns None if this S3Object has not been downloaded.\n '
return self._path |
@property
def blob(self):
'\n Contents of the object as a byte string.\n\n Returns None if this S3Object has not been downloaded.\n '
if self._path:
with open(self._path, 'rb') as f:
return f.read() | 4,473,451,728,646,713,300 | Contents of the object as a byte string.
Returns None if this S3Object has not been downloaded. | metaflow/datatools/s3.py | blob | anthonypreza/metaflow | python | @property
def blob(self):
'\n Contents of the object as a byte string.\n\n Returns None if this S3Object has not been downloaded.\n '
if self._path:
with open(self._path, 'rb') as f:
return f.read() |
@property
def text(self):
'\n Contents of the object as a Unicode string.\n\n Returns None if this S3Object has not been downloaded.\n '
if self._path:
return self.blob.decode('utf-8', errors='replace') | -540,721,315,459,532,160 | Contents of the object as a Unicode string.
Returns None if this S3Object has not been downloaded. | metaflow/datatools/s3.py | text | anthonypreza/metaflow | python | @property
def text(self):
'\n Contents of the object as a Unicode string.\n\n Returns None if this S3Object has not been downloaded.\n '
if self._path:
return self.blob.decode('utf-8', errors='replace') |
@property
def size(self):
'\n Size of the object in bytes.\n\n Returns None if the key does not correspond to an object in S3.\n '
return self._size | -8,567,336,051,561,795,000 | Size of the object in bytes.
Returns None if the key does not correspond to an object in S3. | metaflow/datatools/s3.py | size | anthonypreza/metaflow | python | @property
def size(self):
'\n Size of the object in bytes.\n\n Returns None if the key does not correspond to an object in S3.\n '
return self._size |
def __init__(self, tmproot='.', bucket=None, prefix=None, run=None, s3root=None):
"\n Initialize a new context for S3 operations. This object is based used as\n a context manager for a with statement.\n\n There are two ways to initialize this object depending whether you want\n to bind p... | -1,208,082,141,560,803,000 | Initialize a new context for S3 operations. This object is based used as
a context manager for a with statement.
There are two ways to initialize this object depending whether you want
to bind paths to a Metaflow run or not.
1. With a run object:
run: (required) Either a FlowSpec object (typically 'self') or a
... | metaflow/datatools/s3.py | __init__ | anthonypreza/metaflow | python | def __init__(self, tmproot='.', bucket=None, prefix=None, run=None, s3root=None):
"\n Initialize a new context for S3 operations. This object is based used as\n a context manager for a with statement.\n\n There are two ways to initialize this object depending whether you want\n to bind p... |
def close(self):
'\n Delete all temporary files downloaded in this context.\n '
try:
if (not debug.s3client):
shutil.rmtree(self._tmpdir)
except:
pass | -6,482,489,124,144,749,000 | Delete all temporary files downloaded in this context. | metaflow/datatools/s3.py | close | anthonypreza/metaflow | python | def close(self):
'\n \n '
try:
if (not debug.s3client):
shutil.rmtree(self._tmpdir)
except:
pass |
def list_paths(self, keys=None):
"\n List the next level of paths in S3. If multiple keys are\n specified, listings are done in parallel. The returned\n S3Objects have .exists == False if the url refers to a\n prefix, not an existing S3 object.\n\n Args:\n keys: (requir... | -2,845,874,272,869,705,700 | List the next level of paths in S3. If multiple keys are
specified, listings are done in parallel. The returned
S3Objects have .exists == False if the url refers to a
prefix, not an existing S3 object.
Args:
keys: (required) a list of suffixes for paths to list.
Returns:
a list of S3Objects (not downloaded)
... | metaflow/datatools/s3.py | list_paths | anthonypreza/metaflow | python | def list_paths(self, keys=None):
"\n List the next level of paths in S3. If multiple keys are\n specified, listings are done in parallel. The returned\n S3Objects have .exists == False if the url refers to a\n prefix, not an existing S3 object.\n\n Args:\n keys: (requir... |
def list_recursive(self, keys=None):
"\n List objects in S3 recursively. If multiple keys are\n specified, listings are done in parallel. The returned\n S3Objects have always .exists == True, since they refer\n to existing objects in S3.\n\n Args:\n keys: (required) a l... | -8,079,390,429,491,253,000 | List objects in S3 recursively. If multiple keys are
specified, listings are done in parallel. The returned
S3Objects have always .exists == True, since they refer
to existing objects in S3.
Args:
keys: (required) a list of suffixes for paths to list.
Returns:
a list of S3Objects (not downloaded)
Example:
C... | metaflow/datatools/s3.py | list_recursive | anthonypreza/metaflow | python | def list_recursive(self, keys=None):
"\n List objects in S3 recursively. If multiple keys are\n specified, listings are done in parallel. The returned\n S3Objects have always .exists == True, since they refer\n to existing objects in S3.\n\n Args:\n keys: (required) a l... |
def get(self, key=None, return_missing=False):
'\n Get a single object from S3.\n\n Args:\n key: (optional) a suffix identifying the object.\n return_missing: (optional, default False) if set to True, do\n not raise an exception for a missing key but\n ... | -1,205,389,529,836,959,500 | Get a single object from S3.
Args:
key: (optional) a suffix identifying the object.
return_missing: (optional, default False) if set to True, do
not raise an exception for a missing key but
return it as an S3Object with .exists == False.
Returns:
an S3Object corresp... | metaflow/datatools/s3.py | get | anthonypreza/metaflow | python | def get(self, key=None, return_missing=False):
'\n Get a single object from S3.\n\n Args:\n key: (optional) a suffix identifying the object.\n return_missing: (optional, default False) if set to True, do\n not raise an exception for a missing key but\n ... |
def get_many(self, keys, return_missing=False):
'\n Get many objects from S3 in parallel.\n\n Args:\n keys: (required) a list of suffixes identifying the objects.\n return_missing: (optional, default False) if set to True, do\n not raise an exception fo... | -445,562,500,342,118,500 | Get many objects from S3 in parallel.
Args:
keys: (required) a list of suffixes identifying the objects.
return_missing: (optional, default False) if set to True, do
not raise an exception for a missing key but
return it as an S3Object with .exists == False.
Returns:
... | metaflow/datatools/s3.py | get_many | anthonypreza/metaflow | python | def get_many(self, keys, return_missing=False):
'\n Get many objects from S3 in parallel.\n\n Args:\n keys: (required) a list of suffixes identifying the objects.\n return_missing: (optional, default False) if set to True, do\n not raise an exception fo... |
def get_recursive(self, keys):
'\n Get many objects from S3 recursively in parallel.\n\n Args:\n keys: (required) a list of suffixes for paths to download\n recursively.\n\n Returns:\n a list of S3Objects corresponding to the objects requested.\n '
... | 346,994,368,772,277,500 | Get many objects from S3 recursively in parallel.
Args:
keys: (required) a list of suffixes for paths to download
recursively.
Returns:
a list of S3Objects corresponding to the objects requested. | metaflow/datatools/s3.py | get_recursive | anthonypreza/metaflow | python | def get_recursive(self, keys):
'\n Get many objects from S3 recursively in parallel.\n\n Args:\n keys: (required) a list of suffixes for paths to download\n recursively.\n\n Returns:\n a list of S3Objects corresponding to the objects requested.\n '
... |
def get_all(self):
'\n Get all objects from S3 recursively (in parallel). This request\n only works if S3 is initialized with a run or a s3root prefix.\n\n Returns:\n a list of S3Objects corresponding to the objects requested.\n '
if (self._s3root is None):
raise M... | 995,553,267,817,929,200 | Get all objects from S3 recursively (in parallel). This request
only works if S3 is initialized with a run or a s3root prefix.
Returns:
a list of S3Objects corresponding to the objects requested. | metaflow/datatools/s3.py | get_all | anthonypreza/metaflow | python | def get_all(self):
'\n Get all objects from S3 recursively (in parallel). This request\n only works if S3 is initialized with a run or a s3root prefix.\n\n Returns:\n a list of S3Objects corresponding to the objects requested.\n '
if (self._s3root is None):
raise M... |
def put(self, key, obj, overwrite=True):
'\n Put an object to S3.\n\n Args:\n key: (required) suffix for the object.\n obj: (required) a bytes, string, or a unicode object to \n be stored in S3.\n overwrite: (optional) overwrites the k... | 6,599,148,957,707,137,000 | Put an object to S3.
Args:
key: (required) suffix for the object.
obj: (required) a bytes, string, or a unicode object to
be stored in S3.
overwrite: (optional) overwrites the key with obj, if it exists
Returns:
an S3 URL corresponding to the object stored. | metaflow/datatools/s3.py | put | anthonypreza/metaflow | python | def put(self, key, obj, overwrite=True):
'\n Put an object to S3.\n\n Args:\n key: (required) suffix for the object.\n obj: (required) a bytes, string, or a unicode object to \n be stored in S3.\n overwrite: (optional) overwrites the k... |
def put_many(self, key_objs, overwrite=True):
'\n Put objects to S3 in parallel.\n\n Args:\n key_objs: (required) an iterator of (key, value) tuples. Value must\n be a string, bytes, or a unicode object.\n overwrite: (optional) overwrites the key with obj, ... | -338,204,776,939,149,250 | Put objects to S3 in parallel.
Args:
key_objs: (required) an iterator of (key, value) tuples. Value must
be a string, bytes, or a unicode object.
overwrite: (optional) overwrites the key with obj, if it exists
Returns:
a list of (key, S3 URL) tuples corresponding to the files sent. | metaflow/datatools/s3.py | put_many | anthonypreza/metaflow | python | def put_many(self, key_objs, overwrite=True):
'\n Put objects to S3 in parallel.\n\n Args:\n key_objs: (required) an iterator of (key, value) tuples. Value must\n be a string, bytes, or a unicode object.\n overwrite: (optional) overwrites the key with obj, ... |
def put_files(self, key_paths, overwrite=True):
'\n Put files to S3 in parallel.\n\n Args:\n key_paths: (required) an iterator of (key, path) tuples.\n overwrite: (optional) overwrites the key with obj, if it exists\n\n Returns:\n a list of (key, S3 URL) tuples ... | 7,870,756,319,350,997,000 | Put files to S3 in parallel.
Args:
key_paths: (required) an iterator of (key, path) tuples.
overwrite: (optional) overwrites the key with obj, if it exists
Returns:
a list of (key, S3 URL) tuples corresponding to the files sent. | metaflow/datatools/s3.py | put_files | anthonypreza/metaflow | python | def put_files(self, key_paths, overwrite=True):
'\n Put files to S3 in parallel.\n\n Args:\n key_paths: (required) an iterator of (key, path) tuples.\n overwrite: (optional) overwrites the key with obj, if it exists\n\n Returns:\n a list of (key, S3 URL) tuples ... |
def _mount_config_map_op(config_map_name: Text) -> OpFunc:
'Mounts all key-value pairs found in the named Kubernetes ConfigMap.\n\n All key-value pairs in the ConfigMap are mounted as environment variables.\n\n Args:\n config_map_name: The name of the ConfigMap resource.\n\n Returns:\n An OpFunc for mounti... | 411,682,323,971,103,200 | Mounts all key-value pairs found in the named Kubernetes ConfigMap.
All key-value pairs in the ConfigMap are mounted as environment variables.
Args:
config_map_name: The name of the ConfigMap resource.
Returns:
An OpFunc for mounting the ConfigMap. | tfx/orchestration/kubeflow/kubeflow_dag_runner.py | _mount_config_map_op | TimoKerr/tfx | python | def _mount_config_map_op(config_map_name: Text) -> OpFunc:
'Mounts all key-value pairs found in the named Kubernetes ConfigMap.\n\n All key-value pairs in the ConfigMap are mounted as environment variables.\n\n Args:\n config_map_name: The name of the ConfigMap resource.\n\n Returns:\n An OpFunc for mounti... |
def _mount_secret_op(secret_name: Text) -> OpFunc:
'Mounts all key-value pairs found in the named Kubernetes Secret.\n\n All key-value pairs in the Secret are mounted as environment variables.\n\n Args:\n secret_name: The name of the Secret resource.\n\n Returns:\n An OpFunc for mounting the Secret.\n '
... | 2,268,967,825,270,047,500 | Mounts all key-value pairs found in the named Kubernetes Secret.
All key-value pairs in the Secret are mounted as environment variables.
Args:
secret_name: The name of the Secret resource.
Returns:
An OpFunc for mounting the Secret. | tfx/orchestration/kubeflow/kubeflow_dag_runner.py | _mount_secret_op | TimoKerr/tfx | python | def _mount_secret_op(secret_name: Text) -> OpFunc:
'Mounts all key-value pairs found in the named Kubernetes Secret.\n\n All key-value pairs in the Secret are mounted as environment variables.\n\n Args:\n secret_name: The name of the Secret resource.\n\n Returns:\n An OpFunc for mounting the Secret.\n '
... |
def get_default_pipeline_operator_funcs(use_gcp_sa: bool=False) -> List[OpFunc]:
'Returns a default list of pipeline operator functions.\n\n Args:\n use_gcp_sa: If true, mount a GCP service account secret to each pod, with\n the name _KUBEFLOW_GCP_SECRET_NAME.\n\n Returns:\n A list of functions with ty... | -5,693,614,598,524,444,000 | Returns a default list of pipeline operator functions.
Args:
use_gcp_sa: If true, mount a GCP service account secret to each pod, with
the name _KUBEFLOW_GCP_SECRET_NAME.
Returns:
A list of functions with type OpFunc. | tfx/orchestration/kubeflow/kubeflow_dag_runner.py | get_default_pipeline_operator_funcs | TimoKerr/tfx | python | def get_default_pipeline_operator_funcs(use_gcp_sa: bool=False) -> List[OpFunc]:
'Returns a default list of pipeline operator functions.\n\n Args:\n use_gcp_sa: If true, mount a GCP service account secret to each pod, with\n the name _KUBEFLOW_GCP_SECRET_NAME.\n\n Returns:\n A list of functions with ty... |
def get_default_kubeflow_metadata_config() -> kubeflow_pb2.KubeflowMetadataConfig:
'Returns the default metadata connection config for Kubeflow.\n\n Returns:\n A config proto that will be serialized as JSON and passed to the running\n container so the TFX component driver is able to communicate with MLMD in\... | -3,431,900,069,264,442,000 | Returns the default metadata connection config for Kubeflow.
Returns:
A config proto that will be serialized as JSON and passed to the running
container so the TFX component driver is able to communicate with MLMD in
a Kubeflow cluster. | tfx/orchestration/kubeflow/kubeflow_dag_runner.py | get_default_kubeflow_metadata_config | TimoKerr/tfx | python | def get_default_kubeflow_metadata_config() -> kubeflow_pb2.KubeflowMetadataConfig:
'Returns the default metadata connection config for Kubeflow.\n\n Returns:\n A config proto that will be serialized as JSON and passed to the running\n container so the TFX component driver is able to communicate with MLMD in\... |
def get_default_pod_labels() -> Dict[(Text, Text)]:
'Returns the default pod label dict for Kubeflow.'
result = {'add-pod-env': 'true', telemetry_utils.LABEL_KFP_SDK_ENV: 'tfx'}
return result | -1,403,425,279,285,681,400 | Returns the default pod label dict for Kubeflow. | tfx/orchestration/kubeflow/kubeflow_dag_runner.py | get_default_pod_labels | TimoKerr/tfx | python | def get_default_pod_labels() -> Dict[(Text, Text)]:
result = {'add-pod-env': 'true', telemetry_utils.LABEL_KFP_SDK_ENV: 'tfx'}
return result |
def __init__(self, pipeline_operator_funcs: Optional[List[OpFunc]]=None, tfx_image: Optional[Text]=None, kubeflow_metadata_config: Optional[kubeflow_pb2.KubeflowMetadataConfig]=None, supported_launcher_classes: List[Type[base_component_launcher.BaseComponentLauncher]]=None, **kwargs):
'Creates a KubeflowDagRunnerCo... | -5,085,960,655,409,913,000 | Creates a KubeflowDagRunnerConfig object.
The user can use pipeline_operator_funcs to apply modifications to
ContainerOps used in the pipeline. For example, to ensure the pipeline
steps mount a GCP secret, and a Persistent Volume, one can create config
object like so:
from kfp import gcp, onprem
mount_secret_op =... | tfx/orchestration/kubeflow/kubeflow_dag_runner.py | __init__ | TimoKerr/tfx | python | def __init__(self, pipeline_operator_funcs: Optional[List[OpFunc]]=None, tfx_image: Optional[Text]=None, kubeflow_metadata_config: Optional[kubeflow_pb2.KubeflowMetadataConfig]=None, supported_launcher_classes: List[Type[base_component_launcher.BaseComponentLauncher]]=None, **kwargs):
'Creates a KubeflowDagRunnerCo... |
def __init__(self, output_dir: Optional[Text]=None, output_filename: Optional[Text]=None, config: Optional[KubeflowDagRunnerConfig]=None, pod_labels_to_attach: Optional[Dict[(Text, Text)]]=None):
'Initializes KubeflowDagRunner for compiling a Kubeflow Pipeline.\n\n Args:\n output_dir: An optional output dir... | 3,617,570,464,397,079,000 | Initializes KubeflowDagRunner for compiling a Kubeflow Pipeline.
Args:
output_dir: An optional output directory into which to output the pipeline
definition files. Defaults to the current working directory.
output_filename: An optional output file name for the pipeline definition
file. Defaults to pipeline... | tfx/orchestration/kubeflow/kubeflow_dag_runner.py | __init__ | TimoKerr/tfx | python | def __init__(self, output_dir: Optional[Text]=None, output_filename: Optional[Text]=None, config: Optional[KubeflowDagRunnerConfig]=None, pod_labels_to_attach: Optional[Dict[(Text, Text)]]=None):
'Initializes KubeflowDagRunner for compiling a Kubeflow Pipeline.\n\n Args:\n output_dir: An optional output dir... |
def _parse_parameter_from_component(self, component: base_component.BaseComponent) -> None:
'Extract embedded RuntimeParameter placeholders from a component.\n\n Extract embedded RuntimeParameter placeholders from a component, then append\n the corresponding dsl.PipelineParam to KubeflowDagRunner.\n\n Args... | 5,823,248,919,543,096,000 | Extract embedded RuntimeParameter placeholders from a component.
Extract embedded RuntimeParameter placeholders from a component, then append
the corresponding dsl.PipelineParam to KubeflowDagRunner.
Args:
component: a TFX component. | tfx/orchestration/kubeflow/kubeflow_dag_runner.py | _parse_parameter_from_component | TimoKerr/tfx | python | def _parse_parameter_from_component(self, component: base_component.BaseComponent) -> None:
'Extract embedded RuntimeParameter placeholders from a component.\n\n Extract embedded RuntimeParameter placeholders from a component, then append\n the corresponding dsl.PipelineParam to KubeflowDagRunner.\n\n Args... |
def _parse_parameter_from_pipeline(self, pipeline: tfx_pipeline.Pipeline) -> None:
'Extract all the RuntimeParameter placeholders from the pipeline.'
for component in pipeline.components:
self._parse_parameter_from_component(component) | -1,081,928,389,239,006,700 | Extract all the RuntimeParameter placeholders from the pipeline. | tfx/orchestration/kubeflow/kubeflow_dag_runner.py | _parse_parameter_from_pipeline | TimoKerr/tfx | python | def _parse_parameter_from_pipeline(self, pipeline: tfx_pipeline.Pipeline) -> None:
for component in pipeline.components:
self._parse_parameter_from_component(component) |
def _construct_pipeline_graph(self, pipeline: tfx_pipeline.Pipeline, pipeline_root: dsl.PipelineParam):
'Constructs a Kubeflow Pipeline graph.\n\n Args:\n pipeline: The logical TFX pipeline to base the construction on.\n pipeline_root: dsl.PipelineParam representing the pipeline root.\n '
compon... | -9,222,476,127,377,449,000 | Constructs a Kubeflow Pipeline graph.
Args:
pipeline: The logical TFX pipeline to base the construction on.
pipeline_root: dsl.PipelineParam representing the pipeline root. | tfx/orchestration/kubeflow/kubeflow_dag_runner.py | _construct_pipeline_graph | TimoKerr/tfx | python | def _construct_pipeline_graph(self, pipeline: tfx_pipeline.Pipeline, pipeline_root: dsl.PipelineParam):
'Constructs a Kubeflow Pipeline graph.\n\n Args:\n pipeline: The logical TFX pipeline to base the construction on.\n pipeline_root: dsl.PipelineParam representing the pipeline root.\n '
compon... |
def run(self, pipeline: tfx_pipeline.Pipeline):
'Compiles and outputs a Kubeflow Pipeline YAML definition file.\n\n Args:\n pipeline: The logical TFX pipeline to use when building the Kubeflow\n pipeline.\n '
for component in pipeline.components:
if isinstance(component, tfx_base_compo... | 8,106,389,141,127,631,000 | Compiles and outputs a Kubeflow Pipeline YAML definition file.
Args:
pipeline: The logical TFX pipeline to use when building the Kubeflow
pipeline. | tfx/orchestration/kubeflow/kubeflow_dag_runner.py | run | TimoKerr/tfx | python | def run(self, pipeline: tfx_pipeline.Pipeline):
'Compiles and outputs a Kubeflow Pipeline YAML definition file.\n\n Args:\n pipeline: The logical TFX pipeline to use when building the Kubeflow\n pipeline.\n '
for component in pipeline.components:
if isinstance(component, tfx_base_compo... |
def _construct_pipeline():
'Constructs a Kubeflow pipeline.\n\n Creates Kubeflow ContainerOps for each TFX component encountered in the\n logical pipeline definition.\n '
self._construct_pipeline_graph(pipeline, dsl_pipeline_root) | 7,665,502,271,515,047,000 | Constructs a Kubeflow pipeline.
Creates Kubeflow ContainerOps for each TFX component encountered in the
logical pipeline definition. | tfx/orchestration/kubeflow/kubeflow_dag_runner.py | _construct_pipeline | TimoKerr/tfx | python | def _construct_pipeline():
'Constructs a Kubeflow pipeline.\n\n Creates Kubeflow ContainerOps for each TFX component encountered in the\n logical pipeline definition.\n '
self._construct_pipeline_graph(pipeline, dsl_pipeline_root) |
def is_zh(in_str):
'\n SJISに変換して文字数が減れば簡体字があるので中国語\n '
return ((set(in_str) - set(in_str.encode('sjis', 'ignore').decode('sjis'))) != set([])) | -7,672,488,910,888,925,000 | SJISに変換して文字数が減れば簡体字があるので中国語 | code/exp/v18.py | is_zh | okotaku/pet_finder | python | def is_zh(in_str):
'\n \n '
return ((set(in_str) - set(in_str.encode('sjis', 'ignore').decode('sjis'))) != set([])) |
def fit(self, X):
'\n Parameters\n ----------\n X : sparse matrix, [n_samples, n_features] document-term matrix\n '
if (not sp.sparse.issparse(X)):
X = sp.sparse.csc_matrix(X)
if self.use_idf:
(n_samples, n_features) = X.shape
df = _document_frequency(X)
... | 1,019,888,090,101,431,300 | Parameters
----------
X : sparse matrix, [n_samples, n_features] document-term matrix | code/exp/v18.py | fit | okotaku/pet_finder | python | def fit(self, X):
'\n Parameters\n ----------\n X : sparse matrix, [n_samples, n_features] document-term matrix\n '
if (not sp.sparse.issparse(X)):
X = sp.sparse.csc_matrix(X)
if self.use_idf:
(n_samples, n_features) = X.shape
df = _document_frequency(X)
... |
def transform(self, X, copy=True):
'\n Parameters\n ----------\n X : sparse matrix, [n_samples, n_features] document-term matrix\n copy : boolean, optional (default=True)\n '
if (hasattr(X, 'dtype') and np.issubdtype(X.dtype, np.float)):
X = sp.sparse.csr_matrix(X, cop... | -7,544,926,766,733,184,000 | Parameters
----------
X : sparse matrix, [n_samples, n_features] document-term matrix
copy : boolean, optional (default=True) | code/exp/v18.py | transform | okotaku/pet_finder | python | def transform(self, X, copy=True):
'\n Parameters\n ----------\n X : sparse matrix, [n_samples, n_features] document-term matrix\n copy : boolean, optional (default=True)\n '
if (hasattr(X, 'dtype') and np.issubdtype(X.dtype, np.float)):
X = sp.sparse.csr_matrix(X, cop... |
def train(self, examples):
'\n This function trains the neural network with examples obtained from\n self-play.\n Input:\n examples: a list of training examples, where each example is of form\n (board, pi, v). pi is the MCTS informed policy vector for\n ... | -4,471,661,638,472,599,000 | This function trains the neural network with examples obtained from
self-play.
Input:
examples: a list of training examples, where each example is of form
(board, pi, v). pi is the MCTS informed policy vector for
the given board, and v is its value. The examples has
board i... | pommerman/NN/neural_net.py | train | MaxU11/playground | python | def train(self, examples):
'\n This function trains the neural network with examples obtained from\n self-play.\n Input:\n examples: a list of training examples, where each example is of form\n (board, pi, v). pi is the MCTS informed policy vector for\n ... |
def predict(self, board):
'\n Input:\n board: current board in its canonical form.\n Returns:\n pi: a policy vector for the current board- a numpy array of length\n game.getActionSize\n v: a float in [-1,1] that gives the value of the current board\n ... | -8,479,434,058,017,637,000 | Input:
board: current board in its canonical form.
Returns:
pi: a policy vector for the current board- a numpy array of length
game.getActionSize
v: a float in [-1,1] that gives the value of the current board | pommerman/NN/neural_net.py | predict | MaxU11/playground | python | def predict(self, board):
'\n Input:\n board: current board in its canonical form.\n Returns:\n pi: a policy vector for the current board- a numpy array of length\n game.getActionSize\n v: a float in [-1,1] that gives the value of the current board\n ... |
def save_checkpoint(self, folder, filename):
'\n Saves the current neural network (with its parameters) in\n folder/filename\n '
pass | -7,472,453,376,441,475,000 | Saves the current neural network (with its parameters) in
folder/filename | pommerman/NN/neural_net.py | save_checkpoint | MaxU11/playground | python | def save_checkpoint(self, folder, filename):
'\n Saves the current neural network (with its parameters) in\n folder/filename\n '
pass |
def load_checkpoint(self, folder, filename):
'\n Loads parameters of the neural network from folder/filename\n '
pass | -7,363,140,946,181,195,000 | Loads parameters of the neural network from folder/filename | pommerman/NN/neural_net.py | load_checkpoint | MaxU11/playground | python | def load_checkpoint(self, folder, filename):
'\n \n '
pass |
def load_image(filename, flags=None):
'\n This will call cv2.imread() with the given arguments and convert\n the resulting numpy array to a darknet image\n\n :param filename: Image file name\n :param flags: imread flags\n :return: Given image file as a darknet image\n :rtype: IMAGE\n '
imag... | -8,928,047,387,716,222,000 | This will call cv2.imread() with the given arguments and convert
the resulting numpy array to a darknet image
:param filename: Image file name
:param flags: imread flags
:return: Given image file as a darknet image
:rtype: IMAGE | pyyolo/utils.py | load_image | isarandi/pyyolo | python | def load_image(filename, flags=None):
'\n This will call cv2.imread() with the given arguments and convert\n the resulting numpy array to a darknet image\n\n :param filename: Image file name\n :param flags: imread flags\n :return: Given image file as a darknet image\n :rtype: IMAGE\n '
imag... |
def array_to_image(arr):
'\n Given image with numpy array will be converted to\n darkent image\n Remember to call free_image(im) function after using this image\n\n :rtype: IMAGE\n :param arr: numpy array\n :return: darknet image\n '
data = arr.ctypes.data_as(POINTER(c_ubyte))
im = ndar... | 4,073,591,681,017,779,000 | Given image with numpy array will be converted to
darkent image
Remember to call free_image(im) function after using this image
:rtype: IMAGE
:param arr: numpy array
:return: darknet image | pyyolo/utils.py | array_to_image | isarandi/pyyolo | python | def array_to_image(arr):
'\n Given image with numpy array will be converted to\n darkent image\n Remember to call free_image(im) function after using this image\n\n :rtype: IMAGE\n :param arr: numpy array\n :return: darknet image\n '
data = arr.ctypes.data_as(POINTER(c_ubyte))
im = ndar... |
def detect(net, meta, im, thresh=0.2, hier_thresh=0, nms=0.4):
'\n Detect the objects in the given image. free_image function is called inside this function.\n Therefore the input darkent image is not usable after calling this function.\n :param net:\n :param meta:\n :param im:\n :param thresh:\n ... | -3,912,271,757,855,231,000 | Detect the objects in the given image. free_image function is called inside this function.
Therefore the input darkent image is not usable after calling this function.
:param net:
:param meta:
:param im:
:param thresh:
:param hier_thresh:
:param nms:
:return: | pyyolo/utils.py | detect | isarandi/pyyolo | python | def detect(net, meta, im, thresh=0.2, hier_thresh=0, nms=0.4):
'\n Detect the objects in the given image. free_image function is called inside this function.\n Therefore the input darkent image is not usable after calling this function.\n :param net:\n :param meta:\n :param im:\n :param thresh:\n ... |
def load_net(cfg_filepath, weights_filepath, clear):
'\n\n :param cfg_filepath: cfg file name\n :param weights_filepath: weights file name\n :param clear: True if you want to clear the weights otherwise False\n :return: darknet network object\n '
return pyyolo.darknet.load_net(cfg_filepath, weigh... | 8,169,648,081,730,823,000 | :param cfg_filepath: cfg file name
:param weights_filepath: weights file name
:param clear: True if you want to clear the weights otherwise False
:return: darknet network object | pyyolo/utils.py | load_net | isarandi/pyyolo | python | def load_net(cfg_filepath, weights_filepath, clear):
'\n\n :param cfg_filepath: cfg file name\n :param weights_filepath: weights file name\n :param clear: True if you want to clear the weights otherwise False\n :return: darknet network object\n '
return pyyolo.darknet.load_net(cfg_filepath, weigh... |
def load_meta(meta_filepath):
'\n Recommend using load_names(str) function instead.\n :param meta_filepath: metadata file path\n :return: darknet metadata object\n '
return pyyolo.darknet.load_meta(meta_filepath) | 725,308,637,335,651,100 | Recommend using load_names(str) function instead.
:param meta_filepath: metadata file path
:return: darknet metadata object | pyyolo/utils.py | load_meta | isarandi/pyyolo | python | def load_meta(meta_filepath):
'\n Recommend using load_names(str) function instead.\n :param meta_filepath: metadata file path\n :return: darknet metadata object\n '
return pyyolo.darknet.load_meta(meta_filepath) |
def load_names(names_filepath):
'\n Loading metadata from data file (eg: coco.data) is a mess as you need to edit that file also by pointing it to the names file.\n Using this function you can directly load the names file as METADATA object.\n\n Older function is still available if you need.\n\n :param ... | 339,022,950,776,337,660 | Loading metadata from data file (eg: coco.data) is a mess as you need to edit that file also by pointing it to the names file.
Using this function you can directly load the names file as METADATA object.
Older function is still available if you need.
:param names_filepath: Filepath of the names file. Eg: coco.names
:... | pyyolo/utils.py | load_names | isarandi/pyyolo | python | def load_names(names_filepath):
'\n Loading metadata from data file (eg: coco.data) is a mess as you need to edit that file also by pointing it to the names file.\n Using this function you can directly load the names file as METADATA object.\n\n Older function is still available if you need.\n\n :param ... |
def test_rates_limits_list(self):
'\n Test case for rates_limits_list\n\n Endpoint to check rate limits for current user.\n '
pass | -983,380,903,900,645,100 | Test case for rates_limits_list
Endpoint to check rate limits for current user. | bindings/python/src/test/test_rates_api.py | test_rates_limits_list | cloudsmith-io/cloudsmith-api | python | def test_rates_limits_list(self):
'\n Test case for rates_limits_list\n\n Endpoint to check rate limits for current user.\n '
pass |
def setUp(self):
'\n Initialises common tests attributes.\n '
self._cmfs = reshape_msds(MSDS_CMFS['CIE 1931 2 Degree Standard Observer'], SpectralShape(360, 780, 10))
self._sd_D65 = reshape_sd(SDS_ILLUMINANTS['D65'], self._cmfs.shape) | 4,722,955,684,539,319 | Initialises common tests attributes. | colour/recovery/tests/test__init__.py | setUp | JGoldstone/colour | python | def setUp(self):
'\n \n '
self._cmfs = reshape_msds(MSDS_CMFS['CIE 1931 2 Degree Standard Observer'], SpectralShape(360, 780, 10))
self._sd_D65 = reshape_sd(SDS_ILLUMINANTS['D65'], self._cmfs.shape) |
def test_domain_range_scale_XYZ_to_sd(self):
'\n Tests :func:`colour.recovery.XYZ_to_sd` definition domain\n and range scale support.\n '
XYZ = np.array([0.20654008, 0.12197225, 0.05136952])
m = ('Jakob 2019', 'Mallett 2019', 'Meng 2015', 'Otsu 2018', 'Smits 1999')
v = [sd_to_XYZ_in... | 1,553,417,427,829,978,600 | Tests :func:`colour.recovery.XYZ_to_sd` definition domain
and range scale support. | colour/recovery/tests/test__init__.py | test_domain_range_scale_XYZ_to_sd | JGoldstone/colour | python | def test_domain_range_scale_XYZ_to_sd(self):
'\n Tests :func:`colour.recovery.XYZ_to_sd` definition domain\n and range scale support.\n '
XYZ = np.array([0.20654008, 0.12197225, 0.05136952])
m = ('Jakob 2019', 'Mallett 2019', 'Meng 2015', 'Otsu 2018', 'Smits 1999')
v = [sd_to_XYZ_in... |
async def test_flow_works(hass, aioclient_mock, mock_discovery):
'Test config flow.'
mock_discovery.return_value = '1'
result = (await hass.config_entries.flow.async_init(UNIFI_DOMAIN, context={'source': 'user'}))
assert (result['type'] == data_entry_flow.RESULT_TYPE_FORM)
assert (result['step_id'] ... | 1,996,485,359,439,664,400 | Test config flow. | tests/components/unifi/test_config_flow.py | test_flow_works | Nixon506E/home-assistant | python | async def test_flow_works(hass, aioclient_mock, mock_discovery):
mock_discovery.return_value = '1'
result = (await hass.config_entries.flow.async_init(UNIFI_DOMAIN, context={'source': 'user'}))
assert (result['type'] == data_entry_flow.RESULT_TYPE_FORM)
assert (result['step_id'] == 'user')
asse... |
async def test_flow_works_multiple_sites(hass, aioclient_mock):
'Test config flow works when finding multiple sites.'
result = (await hass.config_entries.flow.async_init(UNIFI_DOMAIN, context={'source': 'user'}))
assert (result['type'] == data_entry_flow.RESULT_TYPE_FORM)
assert (result['step_id'] == 'u... | -1,844,292,938,368,761,900 | Test config flow works when finding multiple sites. | tests/components/unifi/test_config_flow.py | test_flow_works_multiple_sites | Nixon506E/home-assistant | python | async def test_flow_works_multiple_sites(hass, aioclient_mock):
result = (await hass.config_entries.flow.async_init(UNIFI_DOMAIN, context={'source': 'user'}))
assert (result['type'] == data_entry_flow.RESULT_TYPE_FORM)
assert (result['step_id'] == 'user')
aioclient_mock.get('https://1.2.3.4:1234', ... |
async def test_flow_raise_already_configured(hass, aioclient_mock):
'Test config flow aborts since a connected config entry already exists.'
(await setup_unifi_integration(hass))
result = (await hass.config_entries.flow.async_init(UNIFI_DOMAIN, context={'source': 'user'}))
assert (result['type'] == data... | 7,033,402,708,946,387,000 | Test config flow aborts since a connected config entry already exists. | tests/components/unifi/test_config_flow.py | test_flow_raise_already_configured | Nixon506E/home-assistant | python | async def test_flow_raise_already_configured(hass, aioclient_mock):
(await setup_unifi_integration(hass))
result = (await hass.config_entries.flow.async_init(UNIFI_DOMAIN, context={'source': 'user'}))
assert (result['type'] == data_entry_flow.RESULT_TYPE_FORM)
assert (result['step_id'] == 'user')
... |
async def test_flow_aborts_configuration_updated(hass, aioclient_mock):
'Test config flow aborts since a connected config entry already exists.'
entry = MockConfigEntry(domain=UNIFI_DOMAIN, data={'controller': {'host': '1.2.3.4', 'site': 'office'}})
entry.add_to_hass(hass)
entry = MockConfigEntry(domain... | 3,056,866,012,301,531,000 | Test config flow aborts since a connected config entry already exists. | tests/components/unifi/test_config_flow.py | test_flow_aborts_configuration_updated | Nixon506E/home-assistant | python | async def test_flow_aborts_configuration_updated(hass, aioclient_mock):
entry = MockConfigEntry(domain=UNIFI_DOMAIN, data={'controller': {'host': '1.2.3.4', 'site': 'office'}})
entry.add_to_hass(hass)
entry = MockConfigEntry(domain=UNIFI_DOMAIN, data={'controller': {'host': '1.2.3.4', 'site': 'site_id'... |
async def test_flow_fails_user_credentials_faulty(hass, aioclient_mock):
'Test config flow.'
result = (await hass.config_entries.flow.async_init(UNIFI_DOMAIN, context={'source': 'user'}))
assert (result['type'] == data_entry_flow.RESULT_TYPE_FORM)
assert (result['step_id'] == 'user')
aioclient_mock.... | 5,485,508,945,404,993,000 | Test config flow. | tests/components/unifi/test_config_flow.py | test_flow_fails_user_credentials_faulty | Nixon506E/home-assistant | python | async def test_flow_fails_user_credentials_faulty(hass, aioclient_mock):
result = (await hass.config_entries.flow.async_init(UNIFI_DOMAIN, context={'source': 'user'}))
assert (result['type'] == data_entry_flow.RESULT_TYPE_FORM)
assert (result['step_id'] == 'user')
aioclient_mock.get('https://1.2.3.... |
async def test_flow_fails_controller_unavailable(hass, aioclient_mock):
'Test config flow.'
result = (await hass.config_entries.flow.async_init(UNIFI_DOMAIN, context={'source': 'user'}))
assert (result['type'] == data_entry_flow.RESULT_TYPE_FORM)
assert (result['step_id'] == 'user')
aioclient_mock.g... | -5,741,835,985,947,900,000 | Test config flow. | tests/components/unifi/test_config_flow.py | test_flow_fails_controller_unavailable | Nixon506E/home-assistant | python | async def test_flow_fails_controller_unavailable(hass, aioclient_mock):
result = (await hass.config_entries.flow.async_init(UNIFI_DOMAIN, context={'source': 'user'}))
assert (result['type'] == data_entry_flow.RESULT_TYPE_FORM)
assert (result['step_id'] == 'user')
aioclient_mock.get('https://1.2.3.4... |
async def test_reauth_flow_update_configuration(hass, aioclient_mock):
'Verify reauth flow can update controller configuration.'
controller = (await setup_unifi_integration(hass))
result = (await hass.config_entries.flow.async_init(UNIFI_DOMAIN, context={'source': SOURCE_REAUTH}, data=controller.config_entr... | -7,351,216,011,015,675,000 | Verify reauth flow can update controller configuration. | tests/components/unifi/test_config_flow.py | test_reauth_flow_update_configuration | Nixon506E/home-assistant | python | async def test_reauth_flow_update_configuration(hass, aioclient_mock):
controller = (await setup_unifi_integration(hass))
result = (await hass.config_entries.flow.async_init(UNIFI_DOMAIN, context={'source': SOURCE_REAUTH}, data=controller.config_entry))
assert (result['type'] == data_entry_flow.RESULT_... |
async def test_advanced_option_flow(hass):
'Test advanced config flow options.'
controller = (await setup_unifi_integration(hass, clients_response=CLIENTS, devices_response=DEVICES, wlans_response=WLANS, dpigroup_response=DPI_GROUPS, dpiapp_response=[]))
result = (await hass.config_entries.options.async_ini... | -4,160,935,200,820,935,700 | Test advanced config flow options. | tests/components/unifi/test_config_flow.py | test_advanced_option_flow | Nixon506E/home-assistant | python | async def test_advanced_option_flow(hass):
controller = (await setup_unifi_integration(hass, clients_response=CLIENTS, devices_response=DEVICES, wlans_response=WLANS, dpigroup_response=DPI_GROUPS, dpiapp_response=[]))
result = (await hass.config_entries.options.async_init(controller.config_entry.entry_id, ... |
async def test_simple_option_flow(hass):
'Test simple config flow options.'
controller = (await setup_unifi_integration(hass, clients_response=CLIENTS, wlans_response=WLANS, dpigroup_response=DPI_GROUPS, dpiapp_response=[]))
result = (await hass.config_entries.options.async_init(controller.config_entry.entr... | -7,815,050,608,609,491,000 | Test simple config flow options. | tests/components/unifi/test_config_flow.py | test_simple_option_flow | Nixon506E/home-assistant | python | async def test_simple_option_flow(hass):
controller = (await setup_unifi_integration(hass, clients_response=CLIENTS, wlans_response=WLANS, dpigroup_response=DPI_GROUPS, dpiapp_response=[]))
result = (await hass.config_entries.options.async_init(controller.config_entry.entry_id, context={'show_advanced_opti... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.