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 get_all(self):
'\n Retrieve all Products\n\n :rtype: iter[datacube.model.DatasetType]\n '
return (self._make(record) for record in self._db.get_all_dataset_types()) | -7,092,304,018,140,173,000 | Retrieve all Products
:rtype: iter[datacube.model.DatasetType] | datacube/index/_datasets.py | get_all | cronosnull/agdc-v2 | python | def get_all(self):
'\n Retrieve all Products\n\n :rtype: iter[datacube.model.DatasetType]\n '
return (self._make(record) for record in self._db.get_all_dataset_types()) |
def _make(self, query_row):
'\n :rtype datacube.model.DatasetType\n '
return DatasetType(definition=query_row['definition'], metadata_type=self.metadata_type_resource.get(query_row['metadata_type_ref']), id_=query_row['id']) | -5,606,596,896,980,163,000 | :rtype datacube.model.DatasetType | datacube/index/_datasets.py | _make | cronosnull/agdc-v2 | python | def _make(self, query_row):
'\n \n '
return DatasetType(definition=query_row['definition'], metadata_type=self.metadata_type_resource.get(query_row['metadata_type_ref']), id_=query_row['id']) |
def __init__(self, db, dataset_type_resource):
'\n :type db: datacube.index.postgres._api.PostgresDb\n :type dataset_type_resource: datacube.index._datasets.DatasetTypeResource\n '
self._db = db
self.types = dataset_type_resource | 5,608,404,397,755,472,000 | :type db: datacube.index.postgres._api.PostgresDb
:type dataset_type_resource: datacube.index._datasets.DatasetTypeResource | datacube/index/_datasets.py | __init__ | cronosnull/agdc-v2 | python | def __init__(self, db, dataset_type_resource):
'\n :type db: datacube.index.postgres._api.PostgresDb\n :type dataset_type_resource: datacube.index._datasets.DatasetTypeResource\n '
self._db = db
self.types = dataset_type_resource |
def get(self, id_, include_sources=False):
'\n Get dataset by id\n\n :param uuid id_: id of the dataset to retrieve\n :param bool include_sources: get the full provenance graph?\n :rtype: datacube.model.Dataset\n '
if (not include_sources):
return self._make(self._db.g... | 6,263,144,244,050,827,000 | Get dataset by id
:param uuid id_: id of the dataset to retrieve
:param bool include_sources: get the full provenance graph?
:rtype: datacube.model.Dataset | datacube/index/_datasets.py | get | cronosnull/agdc-v2 | python | def get(self, id_, include_sources=False):
'\n Get dataset by id\n\n :param uuid id_: id of the dataset to retrieve\n :param bool include_sources: get the full provenance graph?\n :rtype: datacube.model.Dataset\n '
if (not include_sources):
return self._make(self._db.g... |
def get_derived(self, id_):
'\n Get drived datasets\n\n :param uuid id_: dataset id\n :rtype: list[datacube.model.Dataset]\n '
return [self._make(result) for result in self._db.get_derived_datasets(id_)] | -7,787,538,984,594,398,000 | Get drived datasets
:param uuid id_: dataset id
:rtype: list[datacube.model.Dataset] | datacube/index/_datasets.py | get_derived | cronosnull/agdc-v2 | python | def get_derived(self, id_):
'\n Get drived datasets\n\n :param uuid id_: dataset id\n :rtype: list[datacube.model.Dataset]\n '
return [self._make(result) for result in self._db.get_derived_datasets(id_)] |
def has(self, dataset):
'\n Have we already indexed this dataset?\n\n :param datacube.model.Dataset dataset: dataset to check\n :rtype: bool\n '
return self._db.contains_dataset(dataset.id) | 7,644,583,408,200,586,000 | Have we already indexed this dataset?
:param datacube.model.Dataset dataset: dataset to check
:rtype: bool | datacube/index/_datasets.py | has | cronosnull/agdc-v2 | python | def has(self, dataset):
'\n Have we already indexed this dataset?\n\n :param datacube.model.Dataset dataset: dataset to check\n :rtype: bool\n '
return self._db.contains_dataset(dataset.id) |
def add(self, dataset, skip_sources=False):
"\n Ensure a dataset is in the index. Add it if not present.\n\n :param datacube.model.Dataset dataset: dataset to add\n :param bool skip_sources: don't attempt to index source (use when sources are already indexed)\n :rtype: datacube.model.Dat... | 5,261,391,490,470,212,000 | Ensure a dataset is in the index. Add it if not present.
:param datacube.model.Dataset dataset: dataset to add
:param bool skip_sources: don't attempt to index source (use when sources are already indexed)
:rtype: datacube.model.Dataset | datacube/index/_datasets.py | add | cronosnull/agdc-v2 | python | def add(self, dataset, skip_sources=False):
"\n Ensure a dataset is in the index. Add it if not present.\n\n :param datacube.model.Dataset dataset: dataset to add\n :param bool skip_sources: don't attempt to index source (use when sources are already indexed)\n :rtype: datacube.model.Dat... |
def archive(self, ids):
'\n Mark datasets as archived\n\n :param list[uuid] ids: list of dataset ids to archive\n '
with self._db.begin() as transaction:
for id_ in ids:
transaction.archive_dataset(id_) | 3,311,493,167,582,657,500 | Mark datasets as archived
:param list[uuid] ids: list of dataset ids to archive | datacube/index/_datasets.py | archive | cronosnull/agdc-v2 | python | def archive(self, ids):
'\n Mark datasets as archived\n\n :param list[uuid] ids: list of dataset ids to archive\n '
with self._db.begin() as transaction:
for id_ in ids:
transaction.archive_dataset(id_) |
def restore(self, ids):
'\n Mark datasets as not archived\n\n :param list[uuid] ids: list of dataset ids to restore\n '
with self._db.begin() as transaction:
for id_ in ids:
transaction.restore_dataset(id_) | 7,723,542,168,741,103,000 | Mark datasets as not archived
:param list[uuid] ids: list of dataset ids to restore | datacube/index/_datasets.py | restore | cronosnull/agdc-v2 | python | def restore(self, ids):
'\n Mark datasets as not archived\n\n :param list[uuid] ids: list of dataset ids to restore\n '
with self._db.begin() as transaction:
for id_ in ids:
transaction.restore_dataset(id_) |
def get_field_names(self, type_name=None):
'\n :param str type_name:\n :rtype: __generator[str]\n '
if (type_name is None):
types = self.types.get_all()
else:
types = [self.types.get_by_name(type_name)]
for type_ in types:
for name in type_.metadata_type.data... | -9,014,035,561,054,024,000 | :param str type_name:
:rtype: __generator[str] | datacube/index/_datasets.py | get_field_names | cronosnull/agdc-v2 | python | def get_field_names(self, type_name=None):
'\n :param str type_name:\n :rtype: __generator[str]\n '
if (type_name is None):
types = self.types.get_all()
else:
types = [self.types.get_by_name(type_name)]
for type_ in types:
for name in type_.metadata_type.data... |
def get_locations(self, dataset):
'\n :param datacube.model.Dataset dataset: dataset\n :rtype: list[str]\n '
return self._db.get_locations(dataset.id) | -8,915,735,042,510,128,000 | :param datacube.model.Dataset dataset: dataset
:rtype: list[str] | datacube/index/_datasets.py | get_locations | cronosnull/agdc-v2 | python | def get_locations(self, dataset):
'\n :param datacube.model.Dataset dataset: dataset\n :rtype: list[str]\n '
return self._db.get_locations(dataset.id) |
def _make(self, dataset_res, full_info=False):
'\n :rtype datacube.model.Dataset\n\n :param bool full_info: Include all available fields\n '
return Dataset(self.types.get(dataset_res.dataset_type_ref), dataset_res.metadata, dataset_res.local_uri, indexed_by=(dataset_res.added_by if full_inf... | -5,285,444,197,718,200,000 | :rtype datacube.model.Dataset
:param bool full_info: Include all available fields | datacube/index/_datasets.py | _make | cronosnull/agdc-v2 | python | def _make(self, dataset_res, full_info=False):
'\n :rtype datacube.model.Dataset\n\n :param bool full_info: Include all available fields\n '
return Dataset(self.types.get(dataset_res.dataset_type_ref), dataset_res.metadata, dataset_res.local_uri, indexed_by=(dataset_res.added_by if full_inf... |
def _make_many(self, query_result):
'\n :rtype list[datacube.model.Dataset]\n '
return (self._make(dataset) for dataset in query_result) | -1,847,021,940,425,939,000 | :rtype list[datacube.model.Dataset] | datacube/index/_datasets.py | _make_many | cronosnull/agdc-v2 | python | def _make_many(self, query_result):
'\n \n '
return (self._make(dataset) for dataset in query_result) |
def search_by_metadata(self, metadata):
'\n Perform a search using arbitrary metadata, returning results as Dataset objects.\n\n Caution – slow! This will usually not use indexes.\n\n :param dict metadata:\n :rtype: list[datacube.model.Dataset]\n '
return self._make_many(self.... | -5,142,680,656,802,113,000 | Perform a search using arbitrary metadata, returning results as Dataset objects.
Caution – slow! This will usually not use indexes.
:param dict metadata:
:rtype: list[datacube.model.Dataset] | datacube/index/_datasets.py | search_by_metadata | cronosnull/agdc-v2 | python | def search_by_metadata(self, metadata):
'\n Perform a search using arbitrary metadata, returning results as Dataset objects.\n\n Caution – slow! This will usually not use indexes.\n\n :param dict metadata:\n :rtype: list[datacube.model.Dataset]\n '
return self._make_many(self.... |
def search(self, **query):
'\n Perform a search, returning results as Dataset objects.\n\n :param dict[str,str|float|datacube.model.Range] query:\n :rtype: __generator[datacube.model.Dataset]\n '
for (dataset_type, datasets) in self._do_search_by_product(query):
for dataset i... | -5,254,226,837,874,405,000 | Perform a search, returning results as Dataset objects.
:param dict[str,str|float|datacube.model.Range] query:
:rtype: __generator[datacube.model.Dataset] | datacube/index/_datasets.py | search | cronosnull/agdc-v2 | python | def search(self, **query):
'\n Perform a search, returning results as Dataset objects.\n\n :param dict[str,str|float|datacube.model.Range] query:\n :rtype: __generator[datacube.model.Dataset]\n '
for (dataset_type, datasets) in self._do_search_by_product(query):
for dataset i... |
def search_by_product(self, **query):
'\n Perform a search, returning datasets grouped by product type.\n\n :param dict[str,str|float|datacube.model.Range] query:\n :rtype: __generator[(datacube.model.DatasetType, __generator[datacube.model.Dataset])]]\n '
for (dataset_type, dataset... | -4,136,558,941,424,093,000 | Perform a search, returning datasets grouped by product type.
:param dict[str,str|float|datacube.model.Range] query:
:rtype: __generator[(datacube.model.DatasetType, __generator[datacube.model.Dataset])]] | datacube/index/_datasets.py | search_by_product | cronosnull/agdc-v2 | python | def search_by_product(self, **query):
'\n Perform a search, returning datasets grouped by product type.\n\n :param dict[str,str|float|datacube.model.Range] query:\n :rtype: __generator[(datacube.model.DatasetType, __generator[datacube.model.Dataset])]]\n '
for (dataset_type, dataset... |
def count(self, **query):
'\n Perform a search, returning count of results.\n\n :param dict[str,str|float|datacube.model.Range] query:\n :rtype: int\n '
result = 0
for (product_type, count) in self._do_count_by_product(query):
result += count
return result | 2,938,830,149,098,601,500 | Perform a search, returning count of results.
:param dict[str,str|float|datacube.model.Range] query:
:rtype: int | datacube/index/_datasets.py | count | cronosnull/agdc-v2 | python | def count(self, **query):
'\n Perform a search, returning count of results.\n\n :param dict[str,str|float|datacube.model.Range] query:\n :rtype: int\n '
result = 0
for (product_type, count) in self._do_count_by_product(query):
result += count
return result |
def count_by_product(self, **query):
'\n Perform a search, returning a count of for each matching product type.\n\n :param dict[str,str|float|datacube.model.Range] query:\n :returns: Sequence of (product, count)\n :rtype: __generator[(datacube.model.DatasetType, int)]]\n '
re... | -1,485,780,272,995,107,000 | Perform a search, returning a count of for each matching product type.
:param dict[str,str|float|datacube.model.Range] query:
:returns: Sequence of (product, count)
:rtype: __generator[(datacube.model.DatasetType, int)]] | datacube/index/_datasets.py | count_by_product | cronosnull/agdc-v2 | python | def count_by_product(self, **query):
'\n Perform a search, returning a count of for each matching product type.\n\n :param dict[str,str|float|datacube.model.Range] query:\n :returns: Sequence of (product, count)\n :rtype: __generator[(datacube.model.DatasetType, int)]]\n '
re... |
def count_by_product_through_time(self, period, **query):
"\n Perform a search, returning counts for each product grouped in time slices\n of the given period.\n\n :param dict[str,str|float|datacube.model.Range] query:\n :param str period: Time range for each slice: '1 month', '1 day' et... | -1,946,640,937,008,705,300 | Perform a search, returning counts for each product grouped in time slices
of the given period.
:param dict[str,str|float|datacube.model.Range] query:
:param str period: Time range for each slice: '1 month', '1 day' etc.
:returns: For each matching product type, a list of time ranges and their count.
:rtype: __generat... | datacube/index/_datasets.py | count_by_product_through_time | cronosnull/agdc-v2 | python | def count_by_product_through_time(self, period, **query):
"\n Perform a search, returning counts for each product grouped in time slices\n of the given period.\n\n :param dict[str,str|float|datacube.model.Range] query:\n :param str period: Time range for each slice: '1 month', '1 day' et... |
def count_product_through_time(self, period, **query):
"\n Perform a search, returning counts for a single product grouped in time slices\n of the given period.\n\n Will raise an error if the search terms match more than one product.\n\n :param dict[str,str|float|datacube.model.Range] qu... | 681,976,642,990,149,500 | Perform a search, returning counts for a single product grouped in time slices
of the given period.
Will raise an error if the search terms match more than one product.
:param dict[str,str|float|datacube.model.Range] query:
:param str period: Time range for each slice: '1 month', '1 day' etc.
:returns: For each match... | datacube/index/_datasets.py | count_product_through_time | cronosnull/agdc-v2 | python | def count_product_through_time(self, period, **query):
"\n Perform a search, returning counts for a single product grouped in time slices\n of the given period.\n\n Will raise an error if the search terms match more than one product.\n\n :param dict[str,str|float|datacube.model.Range] qu... |
def search_summaries(self, **query):
'\n Perform a search, returning just the search fields of each dataset.\n\n :param dict[str,str|float|datacube.model.Range] query:\n :rtype: dict\n '
for (dataset_type, results) in self._do_search_by_product(query, return_fields=True):
for... | -2,494,574,499,400,412,700 | Perform a search, returning just the search fields of each dataset.
:param dict[str,str|float|datacube.model.Range] query:
:rtype: dict | datacube/index/_datasets.py | search_summaries | cronosnull/agdc-v2 | python | def search_summaries(self, **query):
'\n Perform a search, returning just the search fields of each dataset.\n\n :param dict[str,str|float|datacube.model.Range] query:\n :rtype: dict\n '
for (dataset_type, results) in self._do_search_by_product(query, return_fields=True):
for... |
def search_eager(self, **query):
'\n Perform a search, returning results as Dataset objects.\n\n :param dict[str,str|float|datacube.model.Range] query:\n :rtype: list[datacube.model.Dataset]\n '
return list(self.search(**query)) | 2,361,861,580,404,206,000 | Perform a search, returning results as Dataset objects.
:param dict[str,str|float|datacube.model.Range] query:
:rtype: list[datacube.model.Dataset] | datacube/index/_datasets.py | search_eager | cronosnull/agdc-v2 | python | def search_eager(self, **query):
'\n Perform a search, returning results as Dataset objects.\n\n :param dict[str,str|float|datacube.model.Range] query:\n :rtype: list[datacube.model.Dataset]\n '
return list(self.search(**query)) |
def ultimate_replace(app, docname, source):
'Replaces variables in docs, including code blocks.\n\n From: https://github.com/sphinx-doc/sphinx/issues/4054#issuecomment-329097229\n '
result = source[0]
for key in app.config.ultimate_replacements:
result = result.replace(key, app.config.ultimate... | 4,424,882,896,295,911,400 | Replaces variables in docs, including code blocks.
From: https://github.com/sphinx-doc/sphinx/issues/4054#issuecomment-329097229 | docs/source/conf.py | ultimate_replace | Aeolun/sqlfluff | python | def ultimate_replace(app, docname, source):
'Replaces variables in docs, including code blocks.\n\n From: https://github.com/sphinx-doc/sphinx/issues/4054#issuecomment-329097229\n '
result = source[0]
for key in app.config.ultimate_replacements:
result = result.replace(key, app.config.ultimate... |
def setup(app):
'Configures the documentation app.'
app.add_config_value('ultimate_replacements', {}, True)
app.connect('source-read', ultimate_replace) | 8,226,218,855,073,592,000 | Configures the documentation app. | docs/source/conf.py | setup | Aeolun/sqlfluff | python | def setup(app):
app.add_config_value('ultimate_replacements', {}, True)
app.connect('source-read', ultimate_replace) |
@infer_dtype(np.hypot)
def hypot(x1, x2, out=None, where=None, **kwargs):
'\n Given the "legs" of a right triangle, return its hypotenuse.\n\n Equivalent to ``sqrt(x1**2 + x2**2)``, element-wise. If `x1` or\n `x2` is scalar_like (i.e., unambiguously cast-able to a scalar type),\n it is broadcast for us... | 3,499,966,831,407,212,000 | Given the "legs" of a right triangle, return its hypotenuse.
Equivalent to ``sqrt(x1**2 + x2**2)``, element-wise. If `x1` or
`x2` is scalar_like (i.e., unambiguously cast-able to a scalar type),
it is broadcast for use with each element of the other argument.
(See Examples)
Parameters
----------
x1, x2 : array_like
... | mars/tensor/arithmetic/hypot.py | hypot | Alfa-Shashank/mars | python | @infer_dtype(np.hypot)
def hypot(x1, x2, out=None, where=None, **kwargs):
'\n Given the "legs" of a right triangle, return its hypotenuse.\n\n Equivalent to ``sqrt(x1**2 + x2**2)``, element-wise. If `x1` or\n `x2` is scalar_like (i.e., unambiguously cast-able to a scalar type),\n it is broadcast for us... |
def sample_analyze_entities(gcs_content_uri):
'\n Analyzing Entities in text file stored in Cloud Storage\n\n Args:\n gcs_content_uri Google Cloud Storage URI where the file content is located.\n e.g. gs://[Your Bucket]/[Path to File]\n '
client = language_v1.LanguageServiceClient()
type_... | -7,760,454,302,406,207,000 | Analyzing Entities in text file stored in Cloud Storage
Args:
gcs_content_uri Google Cloud Storage URI where the file content is located.
e.g. gs://[Your Bucket]/[Path to File] | samples/v1/language_entities_gcs.py | sample_analyze_entities | MShaffar19/python-language | python | def sample_analyze_entities(gcs_content_uri):
'\n Analyzing Entities in text file stored in Cloud Storage\n\n Args:\n gcs_content_uri Google Cloud Storage URI where the file content is located.\n e.g. gs://[Your Bucket]/[Path to File]\n '
client = language_v1.LanguageServiceClient()
type_... |
def np2th(weights, conv=False):
'Possibly convert HWIO to OIHW.'
if conv:
weights = weights.transpose([3, 2, 0, 1])
return torch.from_numpy(weights) | 2,480,537,502,387,815,000 | Possibly convert HWIO to OIHW. | ViT-V-Net/models.py | np2th | junyuchen245/ViT-V-Net_for_3D_Image_Registration | python | def np2th(weights, conv=False):
if conv:
weights = weights.transpose([3, 2, 0, 1])
return torch.from_numpy(weights) |
@cached_property
def additional_properties_type():
'\n This must be a method because a model may have properties that are\n of type self, this must run after the class is loaded\n '
return (bool, date, datetime, dict, float, int, list, str, none_type) | 7,810,842,306,960,415,000 | This must be a method because a model may have properties that are
of type self, this must run after the class is loaded | sdks/python/client/openapi_client/model/fc_volume_source.py | additional_properties_type | 2kindsofcs/argo-workflows | python | @cached_property
def additional_properties_type():
'\n This must be a method because a model may have properties that are\n of type self, this must run after the class is loaded\n '
return (bool, date, datetime, dict, float, int, list, str, none_type) |
@cached_property
def openapi_types():
'\n This must be a method because a model may have properties that are\n of type self, this must run after the class is loaded\n\n Returns\n openapi_types (dict): The key is attribute name\n and the value is attribute type.\n ... | -7,114,574,193,233,615,000 | This must be a method because a model may have properties that are
of type self, this must run after the class is loaded
Returns
openapi_types (dict): The key is attribute name
and the value is attribute type. | sdks/python/client/openapi_client/model/fc_volume_source.py | openapi_types | 2kindsofcs/argo-workflows | python | @cached_property
def openapi_types():
'\n This must be a method because a model may have properties that are\n of type self, this must run after the class is loaded\n\n Returns\n openapi_types (dict): The key is attribute name\n and the value is attribute type.\n ... |
@classmethod
@convert_js_args_to_python_args
def _from_openapi_data(cls, *args, **kwargs):
'FCVolumeSource - a model defined in OpenAPI\n\n Keyword Args:\n _check_type (bool): if True, values for parameters in openapi_types\n will be type checked and a TypeError will... | -4,200,118,095,630,329,000 | FCVolumeSource - a model defined in OpenAPI
Keyword Args:
_check_type (bool): if True, values for parameters in openapi_types
will be type checked and a TypeError will be
raised if the wrong type is input.
Defaults to True
_path_to_item (t... | sdks/python/client/openapi_client/model/fc_volume_source.py | _from_openapi_data | 2kindsofcs/argo-workflows | python | @classmethod
@convert_js_args_to_python_args
def _from_openapi_data(cls, *args, **kwargs):
'FCVolumeSource - a model defined in OpenAPI\n\n Keyword Args:\n _check_type (bool): if True, values for parameters in openapi_types\n will be type checked and a TypeError will... |
@convert_js_args_to_python_args
def __init__(self, *args, **kwargs):
'FCVolumeSource - a model defined in OpenAPI\n\n Keyword Args:\n _check_type (bool): if True, values for parameters in openapi_types\n will be type checked and a TypeError will be\n ... | 6,153,289,572,221,368,000 | FCVolumeSource - a model defined in OpenAPI
Keyword Args:
_check_type (bool): if True, values for parameters in openapi_types
will be type checked and a TypeError will be
raised if the wrong type is input.
Defaults to True
_path_to_item (t... | sdks/python/client/openapi_client/model/fc_volume_source.py | __init__ | 2kindsofcs/argo-workflows | python | @convert_js_args_to_python_args
def __init__(self, *args, **kwargs):
'FCVolumeSource - a model defined in OpenAPI\n\n Keyword Args:\n _check_type (bool): if True, values for parameters in openapi_types\n will be type checked and a TypeError will be\n ... |
def IsLabBlocked(lab_name):
'Check if the lab is blocked.\n\n Args:\n lab_name: lab name\n Returns:\n true if the lab is blocked, otherwise false.\n '
device_blocklists = datastore_entities.DeviceBlocklist.query().filter((datastore_entities.DeviceBlocklist.lab_name == lab_name)).fetch(1)
return boo... | -7,152,990,764,287,082,000 | Check if the lab is blocked.
Args:
lab_name: lab name
Returns:
true if the lab is blocked, otherwise false. | tradefed_cluster/device_blocker.py | IsLabBlocked | maksonlee/tradefed_cluster | python | def IsLabBlocked(lab_name):
'Check if the lab is blocked.\n\n Args:\n lab_name: lab name\n Returns:\n true if the lab is blocked, otherwise false.\n '
device_blocklists = datastore_entities.DeviceBlocklist.query().filter((datastore_entities.DeviceBlocklist.lab_name == lab_name)).fetch(1)
return boo... |
def __init__(self, oracle: QuantumCircuit, state_preparation: Optional[QuantumCircuit]=None, zero_reflection: Optional[Union[(QuantumCircuit, Operator)]]=None, reflection_qubits: Optional[List[int]]=None, insert_barriers: bool=False, mcx_mode: str='noancilla', name: str='Q') -> None:
"\n Args:\n o... | -7,204,777,035,918,854,000 | Args:
oracle: The phase oracle implementing a reflection about the bad state. Note that this
is not a bitflip oracle, see the docstring for more information.
state_preparation: The operator preparing the good and bad state.
For Grover's algorithm, this is a n-qubit Hadamard gate and for amplitud... | qiskit/circuit/library/grover_operator.py | __init__ | SpinQTech/SpinQKit | python | def __init__(self, oracle: QuantumCircuit, state_preparation: Optional[QuantumCircuit]=None, zero_reflection: Optional[Union[(QuantumCircuit, Operator)]]=None, reflection_qubits: Optional[List[int]]=None, insert_barriers: bool=False, mcx_mode: str='noancilla', name: str='Q') -> None:
"\n Args:\n o... |
@property
def reflection_qubits(self):
'Reflection qubits, on which S0 is applied (if S0 is not user-specified).'
if (self._reflection_qubits is not None):
return self._reflection_qubits
num_state_qubits = (self.oracle.num_qubits - self.oracle.num_ancillas)
return list(range(num_state_qubits)) | 7,827,234,141,069,266,000 | Reflection qubits, on which S0 is applied (if S0 is not user-specified). | qiskit/circuit/library/grover_operator.py | reflection_qubits | SpinQTech/SpinQKit | python | @property
def reflection_qubits(self):
if (self._reflection_qubits is not None):
return self._reflection_qubits
num_state_qubits = (self.oracle.num_qubits - self.oracle.num_ancillas)
return list(range(num_state_qubits)) |
@property
def zero_reflection(self) -> QuantumCircuit:
'The subcircuit implementing the reflection about 0.'
if (self._zero_reflection is not None):
return self._zero_reflection
num_state_qubits = (self.oracle.num_qubits - self.oracle.num_ancillas)
return _zero_reflection(num_state_qubits, self.... | 5,482,765,425,153,560,000 | The subcircuit implementing the reflection about 0. | qiskit/circuit/library/grover_operator.py | zero_reflection | SpinQTech/SpinQKit | python | @property
def zero_reflection(self) -> QuantumCircuit:
if (self._zero_reflection is not None):
return self._zero_reflection
num_state_qubits = (self.oracle.num_qubits - self.oracle.num_ancillas)
return _zero_reflection(num_state_qubits, self.reflection_qubits, self._mcx_mode) |
@property
def state_preparation(self) -> QuantumCircuit:
'The subcircuit implementing the A operator or Hadamards.'
if (self._state_preparation is not None):
return self._state_preparation
num_state_qubits = (self.oracle.num_qubits - self.oracle.num_ancillas)
hadamards = QuantumCircuit(num_state... | 2,549,075,357,350,532,000 | The subcircuit implementing the A operator or Hadamards. | qiskit/circuit/library/grover_operator.py | state_preparation | SpinQTech/SpinQKit | python | @property
def state_preparation(self) -> QuantumCircuit:
if (self._state_preparation is not None):
return self._state_preparation
num_state_qubits = (self.oracle.num_qubits - self.oracle.num_ancillas)
hadamards = QuantumCircuit(num_state_qubits, name='H')
hadamards.h(self.reflection_qubits)... |
@property
def oracle(self):
'The oracle implementing a reflection about the bad state.'
return self._oracle | -1,036,016,382,031,906,400 | The oracle implementing a reflection about the bad state. | qiskit/circuit/library/grover_operator.py | oracle | SpinQTech/SpinQKit | python | @property
def oracle(self):
return self._oracle |
def __init__(self, path, name):
'\n Initizlize.\n :param path: path to the storage file;\n empty means the current direcory.\n :param name: file name, json file; may include a path.\n '
if path:
os.makedirs(path, exist_ok=True)
self.file = os.path.normpath(os.path.... | -9,043,549,866,801,133,000 | Initizlize.
:param path: path to the storage file;
empty means the current direcory.
:param name: file name, json file; may include a path. | netdata/workers/json_storage.py | __init__ | mincode/netdata | python | def __init__(self, path, name):
'\n Initizlize.\n :param path: path to the storage file;\n empty means the current direcory.\n :param name: file name, json file; may include a path.\n '
if path:
os.makedirs(path, exist_ok=True)
self.file = os.path.normpath(os.path.... |
def dump(self):
'\n Dump data into storage file.\n '
with open(self.file, 'w') as out_file:
json.dump(self.data, out_file, indent=self.indent) | -7,103,314,947,930,550,000 | Dump data into storage file. | netdata/workers/json_storage.py | dump | mincode/netdata | python | def dump(self):
'\n \n '
with open(self.file, 'w') as out_file:
json.dump(self.data, out_file, indent=self.indent) |
def get(self, item):
'\n Get stored item.\n :param item: name, string, of item to get.\n :return: stored item; raises a KeyError if item does not exist.\n '
return self.data[item] | -6,757,231,109,967,430,000 | Get stored item.
:param item: name, string, of item to get.
:return: stored item; raises a KeyError if item does not exist. | netdata/workers/json_storage.py | get | mincode/netdata | python | def get(self, item):
'\n Get stored item.\n :param item: name, string, of item to get.\n :return: stored item; raises a KeyError if item does not exist.\n '
return self.data[item] |
def set(self, item, value):
"\n Set item's value; causes the data to be dumped into the storage file.\n :param item: name, string of item to set.\n :param value: value to set.\n "
self.data[item] = value
self.dump() | 4,817,724,891,476,354,000 | Set item's value; causes the data to be dumped into the storage file.
:param item: name, string of item to set.
:param value: value to set. | netdata/workers/json_storage.py | set | mincode/netdata | python | def set(self, item, value):
"\n Set item's value; causes the data to be dumped into the storage file.\n :param item: name, string of item to set.\n :param value: value to set.\n "
self.data[item] = value
self.dump() |
def __getattr__(self, item):
'\n Get stored item with .-notation if not defined as a class member.\n :param item: name, string of item compatible\n with Python class member name.\n :return value of item.\n '
if (item in self.data):
return self.data[item]
else:
... | 8,440,963,905,404,084,000 | Get stored item with .-notation if not defined as a class member.
:param item: name, string of item compatible
with Python class member name.
:return value of item. | netdata/workers/json_storage.py | __getattr__ | mincode/netdata | python | def __getattr__(self, item):
'\n Get stored item with .-notation if not defined as a class member.\n :param item: name, string of item compatible\n with Python class member name.\n :return value of item.\n '
if (item in self.data):
return self.data[item]
else:
... |
def _request_locks(self, locks: list[str], id: Hashable, num_locks: int) -> bool:
'Request locks\n\n Parameters\n ----------\n locks: List[str]\n Names of the locks to request.\n id: Hashable\n Identifier of the `MultiLock` instance requesting the locks.\n nu... | -8,840,431,474,768,864,000 | Request locks
Parameters
----------
locks: List[str]
Names of the locks to request.
id: Hashable
Identifier of the `MultiLock` instance requesting the locks.
num_locks: int
Number of locks in `locks` requesting
Return
------
result: bool
Whether `num_locks` requested locks are free immediately or not. | distributed/multi_lock.py | _request_locks | bryanwweber/distributed | python | def _request_locks(self, locks: list[str], id: Hashable, num_locks: int) -> bool:
'Request locks\n\n Parameters\n ----------\n locks: List[str]\n Names of the locks to request.\n id: Hashable\n Identifier of the `MultiLock` instance requesting the locks.\n nu... |
def _refain_locks(self, locks, id):
'Cancel/release previously requested/acquired locks\n\n Parameters\n ----------\n locks: List[str]\n Names of the locks to refain.\n id: Hashable\n Identifier of the `MultiLock` instance refraining the locks.\n '
waiter... | 4,364,352,498,279,683,600 | Cancel/release previously requested/acquired locks
Parameters
----------
locks: List[str]
Names of the locks to refain.
id: Hashable
Identifier of the `MultiLock` instance refraining the locks. | distributed/multi_lock.py | _refain_locks | bryanwweber/distributed | python | def _refain_locks(self, locks, id):
'Cancel/release previously requested/acquired locks\n\n Parameters\n ----------\n locks: List[str]\n Names of the locks to refain.\n id: Hashable\n Identifier of the `MultiLock` instance refraining the locks.\n '
waiter... |
def acquire(self, blocking=True, timeout=None, num_locks=None):
'Acquire the lock\n\n Parameters\n ----------\n blocking : bool, optional\n If false, don\'t wait on the lock in the scheduler at all.\n timeout : string or number or timedelta, optional\n Seconds to wa... | -4,150,933,186,845,028,400 | Acquire the lock
Parameters
----------
blocking : bool, optional
If false, don't wait on the lock in the scheduler at all.
timeout : string or number or timedelta, optional
Seconds to wait on the lock in the scheduler. This does not
include local coroutine time, network transfer time, etc..
It is forb... | distributed/multi_lock.py | acquire | bryanwweber/distributed | python | def acquire(self, blocking=True, timeout=None, num_locks=None):
'Acquire the lock\n\n Parameters\n ----------\n blocking : bool, optional\n If false, don\'t wait on the lock in the scheduler at all.\n timeout : string or number or timedelta, optional\n Seconds to wa... |
def release(self):
'Release the lock if already acquired'
if (not self.locked()):
raise ValueError('Lock is not yet acquired')
ret = self.client.sync(self.client.scheduler.multi_lock_release, id=self.id)
self._locked = False
return ret | 3,468,605,964,698,990,600 | Release the lock if already acquired | distributed/multi_lock.py | release | bryanwweber/distributed | python | def release(self):
if (not self.locked()):
raise ValueError('Lock is not yet acquired')
ret = self.client.sync(self.client.scheduler.multi_lock_release, id=self.id)
self._locked = False
return ret |
def display_and_save_batch(title, batch, data, save=True, display=True):
'Display and save batch of image using plt'
im = torchvision.utils.make_grid(batch, nrow=int((batch.shape[0] ** 0.5)))
plt.title(title)
plt.imshow(np.transpose(im.cpu().numpy(), (1, 2, 0)), cmap='gray')
if save:
plt.sav... | -7,719,224,254,690,918,000 | Display and save batch of image using plt | Implementations/Conditional-Variational-Autoencoder/plot_utils.py | display_and_save_batch | jaywonchung/Learning-ML | python | def display_and_save_batch(title, batch, data, save=True, display=True):
im = torchvision.utils.make_grid(batch, nrow=int((batch.shape[0] ** 0.5)))
plt.title(title)
plt.imshow(np.transpose(im.cpu().numpy(), (1, 2, 0)), cmap='gray')
if save:
plt.savefig(((('results/' + title) + data) + '.png... |
def display_and_save_latent(batch, label, data, save=True, display=True):
'Display and save batch of 2-D latent variable using plt'
colors = ['black', 'red', 'green', 'blue', 'yellow', 'cyan', 'magenta', 'pink', 'violet', 'grey']
z = batch.cpu().detach().numpy()
l = label.cpu().numpy()
plt.title('La... | 7,770,787,316,878,940,000 | Display and save batch of 2-D latent variable using plt | Implementations/Conditional-Variational-Autoencoder/plot_utils.py | display_and_save_latent | jaywonchung/Learning-ML | python | def display_and_save_latent(batch, label, data, save=True, display=True):
colors = ['black', 'red', 'green', 'blue', 'yellow', 'cyan', 'magenta', 'pink', 'violet', 'grey']
z = batch.cpu().detach().numpy()
l = label.cpu().numpy()
plt.title('Latent variables')
plt.scatter(z[:, 0], z[:, 1], c=l, c... |
@staticmethod
def Args(parser):
'Args is called by calliope to gather arguments for this command.\n\n Args:\n parser: An argparse parser that you can use to add arguments that go\n on the command line after this command. Positional arguments are\n allowed.\n '
common_flags.operation... | -2,756,768,806,353,174,500 | Args is called by calliope to gather arguments for this command.
Args:
parser: An argparse parser that you can use to add arguments that go
on the command line after this command. Positional arguments are
allowed. | lib/surface/service_management/operations/describe.py | Args | bshaffer/google-cloud-sdk | python | @staticmethod
def Args(parser):
'Args is called by calliope to gather arguments for this command.\n\n Args:\n parser: An argparse parser that you can use to add arguments that go\n on the command line after this command. Positional arguments are\n allowed.\n '
common_flags.operation... |
def Run(self, args):
"Stubs 'service-management operations describe'.\n\n Args:\n args: argparse.Namespace, The arguments that this command was invoked\n with.\n "
pass | -7,147,610,344,865,069,000 | Stubs 'service-management operations describe'.
Args:
args: argparse.Namespace, The arguments that this command was invoked
with. | lib/surface/service_management/operations/describe.py | Run | bshaffer/google-cloud-sdk | python | def Run(self, args):
"Stubs 'service-management operations describe'.\n\n Args:\n args: argparse.Namespace, The arguments that this command was invoked\n with.\n "
pass |
def initialize_instances(infile):
'Read the m_trg.csv CSV data into a list of instances.'
instances = []
dat = open(infile, 'r')
reader = csv.reader(dat)
dat.close()
for row in reader:
instance = Instance([float(value) for value in row[:(- 1)]])
if (float(row[(- 1)]) < 0):
... | 563,886,251,217,483,300 | Read the m_trg.csv CSV data into a list of instances. | ABAGAIL_execution/flipflop.py | initialize_instances | tirthajyoti/Randomized_Optimization | python | def initialize_instances(infile):
instances = []
dat = open(infile, 'r')
reader = csv.reader(dat)
dat.close()
for row in reader:
instance = Instance([float(value) for value in row[:(- 1)]])
if (float(row[(- 1)]) < 0):
instance.setLabel(Instance(0))
else:
... |
def train(oa, network, oaName, training_ints, validation_ints, testing_ints, measure):
'Train a given network on a set of instances.\n '
print('\nError results for {}\n---------------------------'.format(oaName))
times = [0]
for iteration in xrange(TRAINING_ITERATIONS):
start = time.clock()
... | 6,266,635,343,969,500,000 | Train a given network on a set of instances. | ABAGAIL_execution/flipflop.py | train | tirthajyoti/Randomized_Optimization | python | def train(oa, network, oaName, training_ints, validation_ints, testing_ints, measure):
'\n '
print('\nError results for {}\n---------------------------'.format(oaName))
times = [0]
for iteration in xrange(TRAINING_ITERATIONS):
start = time.clock()
oa.train()
elapsed = (time.cl... |
def main():
'Run this experiment'
training_ints = initialize_instances('m_trg.csv')
testing_ints = initialize_instances('m_test.csv')
validation_ints = initialize_instances('m_val.csv')
factory = BackPropagationNetworkFactory()
measure = SumOfSquaresError()
data_set = DataSet(training_ints)
... | -8,651,872,616,011,747,000 | Run this experiment | ABAGAIL_execution/flipflop.py | main | tirthajyoti/Randomized_Optimization | python | def main():
training_ints = initialize_instances('m_trg.csv')
testing_ints = initialize_instances('m_test.csv')
validation_ints = initialize_instances('m_val.csv')
factory = BackPropagationNetworkFactory()
measure = SumOfSquaresError()
data_set = DataSet(training_ints)
relu = RELU()
... |
def __init__(__self__, resource_name: str, opts: Optional[pulumi.ResourceOptions]=None, compute_name: Optional[pulumi.Input[str]]=None, identity: Optional[pulumi.Input[pulumi.InputType['IdentityArgs']]]=None, location: Optional[pulumi.Input[str]]=None, properties: Optional[pulumi.Input[Union[(pulumi.InputType['AKSArgs'... | 8,050,948,739,499,512,000 | Machine Learning compute object wrapped into ARM resource envelope.
:param str resource_name: The name of the resource.
:param pulumi.ResourceOptions opts: Options for the resource.
:param pulumi.Input[str] compute_name: Name of the Azure Machine Learning compute.
:param pulumi.Input[pulumi.InputType['IdentityArgs']] ... | sdk/python/pulumi_azure_native/machinelearningservices/v20210101/machine_learning_compute.py | __init__ | pulumi-bot/pulumi-azure-native | python | def __init__(__self__, resource_name: str, opts: Optional[pulumi.ResourceOptions]=None, compute_name: Optional[pulumi.Input[str]]=None, identity: Optional[pulumi.Input[pulumi.InputType['IdentityArgs']]]=None, location: Optional[pulumi.Input[str]]=None, properties: Optional[pulumi.Input[Union[(pulumi.InputType['AKSArgs'... |
@staticmethod
def get(resource_name: str, id: pulumi.Input[str], opts: Optional[pulumi.ResourceOptions]=None) -> 'MachineLearningCompute':
"\n Get an existing MachineLearningCompute resource's state with the given name, id, and optional extra\n properties used to qualify the lookup.\n\n :param ... | -3,952,396,233,049,537,500 | Get an existing MachineLearningCompute 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 op... | sdk/python/pulumi_azure_native/machinelearningservices/v20210101/machine_learning_compute.py | get | pulumi-bot/pulumi-azure-native | python | @staticmethod
def get(resource_name: str, id: pulumi.Input[str], opts: Optional[pulumi.ResourceOptions]=None) -> 'MachineLearningCompute':
"\n Get an existing MachineLearningCompute resource's state with the given name, id, and optional extra\n properties used to qualify the lookup.\n\n :param ... |
@property
@pulumi.getter
def identity(self) -> pulumi.Output[Optional['outputs.IdentityResponse']]:
'\n The identity of the resource.\n '
return pulumi.get(self, 'identity') | -2,580,811,553,100,511,000 | The identity of the resource. | sdk/python/pulumi_azure_native/machinelearningservices/v20210101/machine_learning_compute.py | identity | pulumi-bot/pulumi-azure-native | python | @property
@pulumi.getter
def identity(self) -> pulumi.Output[Optional['outputs.IdentityResponse']]:
'\n \n '
return pulumi.get(self, 'identity') |
@property
@pulumi.getter
def location(self) -> pulumi.Output[Optional[str]]:
'\n Specifies the location of the resource.\n '
return pulumi.get(self, 'location') | 6,302,777,286,934,958,000 | Specifies the location of the resource. | sdk/python/pulumi_azure_native/machinelearningservices/v20210101/machine_learning_compute.py | location | pulumi-bot/pulumi-azure-native | python | @property
@pulumi.getter
def location(self) -> pulumi.Output[Optional[str]]:
'\n \n '
return pulumi.get(self, 'location') |
@property
@pulumi.getter
def name(self) -> pulumi.Output[str]:
'\n Specifies the name of the resource.\n '
return pulumi.get(self, 'name') | -5,472,184,884,634,436,000 | Specifies the name of the resource. | sdk/python/pulumi_azure_native/machinelearningservices/v20210101/machine_learning_compute.py | name | pulumi-bot/pulumi-azure-native | python | @property
@pulumi.getter
def name(self) -> pulumi.Output[str]:
'\n \n '
return pulumi.get(self, 'name') |
@property
@pulumi.getter
def properties(self) -> pulumi.Output[Any]:
'\n Compute properties\n '
return pulumi.get(self, 'properties') | -7,218,582,079,494,190,000 | Compute properties | sdk/python/pulumi_azure_native/machinelearningservices/v20210101/machine_learning_compute.py | properties | pulumi-bot/pulumi-azure-native | python | @property
@pulumi.getter
def properties(self) -> pulumi.Output[Any]:
'\n \n '
return pulumi.get(self, 'properties') |
@property
@pulumi.getter
def sku(self) -> pulumi.Output[Optional['outputs.SkuResponse']]:
'\n The sku of the workspace.\n '
return pulumi.get(self, 'sku') | -3,322,611,284,534,289,000 | The sku of the workspace. | sdk/python/pulumi_azure_native/machinelearningservices/v20210101/machine_learning_compute.py | sku | pulumi-bot/pulumi-azure-native | python | @property
@pulumi.getter
def sku(self) -> pulumi.Output[Optional['outputs.SkuResponse']]:
'\n \n '
return pulumi.get(self, 'sku') |
@property
@pulumi.getter(name='systemData')
def system_data(self) -> pulumi.Output['outputs.SystemDataResponse']:
'\n Read only system data\n '
return pulumi.get(self, 'system_data') | 723,081,282,536,590,700 | Read only system data | sdk/python/pulumi_azure_native/machinelearningservices/v20210101/machine_learning_compute.py | system_data | pulumi-bot/pulumi-azure-native | python | @property
@pulumi.getter(name='systemData')
def system_data(self) -> pulumi.Output['outputs.SystemDataResponse']:
'\n \n '
return pulumi.get(self, 'system_data') |
@property
@pulumi.getter
def tags(self) -> pulumi.Output[Optional[Mapping[(str, str)]]]:
'\n Contains resource tags defined as key/value pairs.\n '
return pulumi.get(self, 'tags') | -4,864,786,089,036,755,000 | Contains resource tags defined as key/value pairs. | sdk/python/pulumi_azure_native/machinelearningservices/v20210101/machine_learning_compute.py | tags | pulumi-bot/pulumi-azure-native | python | @property
@pulumi.getter
def tags(self) -> pulumi.Output[Optional[Mapping[(str, str)]]]:
'\n \n '
return pulumi.get(self, 'tags') |
@property
@pulumi.getter
def type(self) -> pulumi.Output[str]:
'\n Specifies the type of the resource.\n '
return pulumi.get(self, 'type') | 5,546,388,334,793,997,000 | Specifies the type of the resource. | sdk/python/pulumi_azure_native/machinelearningservices/v20210101/machine_learning_compute.py | type | pulumi-bot/pulumi-azure-native | python | @property
@pulumi.getter
def type(self) -> pulumi.Output[str]:
'\n \n '
return pulumi.get(self, 'type') |
async def async_setup_entry(hass, config_entry, async_add_entities):
'Set up OpenWeatherMap weather entity based on a config entry.'
domain_data = hass.data[DOMAIN][config_entry.entry_id]
name = domain_data[ENTRY_NAME]
weather_coordinator = domain_data[ENTRY_WEATHER_COORDINATOR]
unique_id = f'{confi... | -5,971,107,687,580,836,000 | Set up OpenWeatherMap weather entity based on a config entry. | homeassistant/components/openweathermap/weather.py | async_setup_entry | 123dev/core | python | async def async_setup_entry(hass, config_entry, async_add_entities):
domain_data = hass.data[DOMAIN][config_entry.entry_id]
name = domain_data[ENTRY_NAME]
weather_coordinator = domain_data[ENTRY_WEATHER_COORDINATOR]
unique_id = f'{config_entry.unique_id}'
owm_weather = OpenWeatherMapWeather(nam... |
def __init__(self, name, unique_id, weather_coordinator: WeatherUpdateCoordinator):
'Initialize the sensor.'
self._name = name
self._unique_id = unique_id
self._weather_coordinator = weather_coordinator | 4,389,320,978,801,046,000 | Initialize the sensor. | homeassistant/components/openweathermap/weather.py | __init__ | 123dev/core | python | def __init__(self, name, unique_id, weather_coordinator: WeatherUpdateCoordinator):
self._name = name
self._unique_id = unique_id
self._weather_coordinator = weather_coordinator |
@property
def name(self):
'Return the name of the sensor.'
return self._name | 8,691,954,631,286,512,000 | Return the name of the sensor. | homeassistant/components/openweathermap/weather.py | name | 123dev/core | python | @property
def name(self):
return self._name |
@property
def unique_id(self):
'Return a unique_id for this entity.'
return self._unique_id | 2,237,810,817,326,574,000 | Return a unique_id for this entity. | homeassistant/components/openweathermap/weather.py | unique_id | 123dev/core | python | @property
def unique_id(self):
return self._unique_id |
@property
def should_poll(self):
'Return the polling requirement of the entity.'
return False | 9,164,027,142,541,335,000 | Return the polling requirement of the entity. | homeassistant/components/openweathermap/weather.py | should_poll | 123dev/core | python | @property
def should_poll(self):
return False |
@property
def attribution(self):
'Return the attribution.'
return ATTRIBUTION | -4,777,674,644,330,317,000 | Return the attribution. | homeassistant/components/openweathermap/weather.py | attribution | 123dev/core | python | @property
def attribution(self):
return ATTRIBUTION |
@property
def condition(self):
'Return the current condition.'
return self._weather_coordinator.data[ATTR_API_CONDITION] | 8,621,755,588,087,073,000 | Return the current condition. | homeassistant/components/openweathermap/weather.py | condition | 123dev/core | python | @property
def condition(self):
return self._weather_coordinator.data[ATTR_API_CONDITION] |
@property
def temperature(self):
'Return the temperature.'
return self._weather_coordinator.data[ATTR_API_TEMPERATURE] | 7,313,664,048,823,649,000 | Return the temperature. | homeassistant/components/openweathermap/weather.py | temperature | 123dev/core | python | @property
def temperature(self):
return self._weather_coordinator.data[ATTR_API_TEMPERATURE] |
@property
def temperature_unit(self):
'Return the unit of measurement.'
return TEMP_CELSIUS | 4,571,780,805,438,814,700 | Return the unit of measurement. | homeassistant/components/openweathermap/weather.py | temperature_unit | 123dev/core | python | @property
def temperature_unit(self):
return TEMP_CELSIUS |
@property
def pressure(self):
'Return the pressure.'
return self._weather_coordinator.data[ATTR_API_PRESSURE] | 2,965,828,343,547,977,700 | Return the pressure. | homeassistant/components/openweathermap/weather.py | pressure | 123dev/core | python | @property
def pressure(self):
return self._weather_coordinator.data[ATTR_API_PRESSURE] |
@property
def humidity(self):
'Return the humidity.'
return self._weather_coordinator.data[ATTR_API_HUMIDITY] | 7,101,145,499,980,695,000 | Return the humidity. | homeassistant/components/openweathermap/weather.py | humidity | 123dev/core | python | @property
def humidity(self):
return self._weather_coordinator.data[ATTR_API_HUMIDITY] |
@property
def wind_speed(self):
'Return the wind speed.'
wind_speed = self._weather_coordinator.data[ATTR_API_WIND_SPEED]
if (self.hass.config.units.name == 'imperial'):
return round((wind_speed * 2.24), 2)
return round((wind_speed * 3.6), 2) | 2,837,666,101,896,959,000 | Return the wind speed. | homeassistant/components/openweathermap/weather.py | wind_speed | 123dev/core | python | @property
def wind_speed(self):
wind_speed = self._weather_coordinator.data[ATTR_API_WIND_SPEED]
if (self.hass.config.units.name == 'imperial'):
return round((wind_speed * 2.24), 2)
return round((wind_speed * 3.6), 2) |
@property
def wind_bearing(self):
'Return the wind bearing.'
return self._weather_coordinator.data[ATTR_API_WIND_BEARING] | 5,297,157,121,137,046,000 | Return the wind bearing. | homeassistant/components/openweathermap/weather.py | wind_bearing | 123dev/core | python | @property
def wind_bearing(self):
return self._weather_coordinator.data[ATTR_API_WIND_BEARING] |
@property
def forecast(self):
'Return the forecast array.'
return self._weather_coordinator.data[ATTR_API_FORECAST] | -6,175,109,922,992,382,000 | Return the forecast array. | homeassistant/components/openweathermap/weather.py | forecast | 123dev/core | python | @property
def forecast(self):
return self._weather_coordinator.data[ATTR_API_FORECAST] |
@property
def available(self):
'Return True if entity is available.'
return self._weather_coordinator.last_update_success | -3,304,158,879,303,020,000 | Return True if entity is available. | homeassistant/components/openweathermap/weather.py | available | 123dev/core | python | @property
def available(self):
return self._weather_coordinator.last_update_success |
async def async_added_to_hass(self):
'Connect to dispatcher listening for entity data notifications.'
self.async_on_remove(self._weather_coordinator.async_add_listener(self.async_write_ha_state)) | 7,899,978,953,877,624,000 | Connect to dispatcher listening for entity data notifications. | homeassistant/components/openweathermap/weather.py | async_added_to_hass | 123dev/core | python | async def async_added_to_hass(self):
self.async_on_remove(self._weather_coordinator.async_add_listener(self.async_write_ha_state)) |
async def async_update(self):
'Get the latest data from OWM and updates the states.'
(await self._weather_coordinator.async_request_refresh()) | -2,303,072,366,161,045,800 | Get the latest data from OWM and updates the states. | homeassistant/components/openweathermap/weather.py | async_update | 123dev/core | python | async def async_update(self):
(await self._weather_coordinator.async_request_refresh()) |
def get_widgets(self):
"\n Returns a list of widgets sorted by their 'order'.\n If two or more widgets have the same 'order', sort by label.\n "
return map((lambda x: x['widget']), filter((lambda x: (x['widget'] not in self.removed_widgets)), sorted(self.widgets.values(), key=(lambda x: (x[... | 4,196,100,985,637,145,000 | Returns a list of widgets sorted by their 'order'.
If two or more widgets have the same 'order', sort by label. | mayan/apps/common/classes.py | get_widgets | marumadang/mayan-edms | python | def get_widgets(self):
"\n Returns a list of widgets sorted by their 'order'.\n If two or more widgets have the same 'order', sort by label.\n "
return map((lambda x: x['widget']), filter((lambda x: (x['widget'] not in self.removed_widgets)), sorted(self.widgets.values(), key=(lambda x: (x[... |
def get_result(self, name):
'\n The method that produces the actual result. Must be implemented\n by each subclass.\n '
raise NotImplementedError | 2,257,598,814,406,162,000 | The method that produces the actual result. Must be implemented
by each subclass. | mayan/apps/common/classes.py | get_result | marumadang/mayan-edms | python | def get_result(self, name):
'\n The method that produces the actual result. Must be implemented\n by each subclass.\n '
raise NotImplementedError |
def sample_recognize(local_file_path):
'\n Transcribe a short audio file with multiple channels\n\n Args:\n local_file_path Path to local audio file, e.g. /path/audio.wav\n '
client = speech_v1.SpeechClient()
audio_channel_count = 2
enable_separate_recognition_per_channel = True
langua... | 6,229,858,521,637,275,000 | Transcribe a short audio file with multiple channels
Args:
local_file_path Path to local audio file, e.g. /path/audio.wav | speech/samples/v1/speech_transcribe_multichannel.py | sample_recognize | AzemaBaptiste/google-cloud-python | python | def sample_recognize(local_file_path):
'\n Transcribe a short audio file with multiple channels\n\n Args:\n local_file_path Path to local audio file, e.g. /path/audio.wav\n '
client = speech_v1.SpeechClient()
audio_channel_count = 2
enable_separate_recognition_per_channel = True
langua... |
def __init__(self, security_group_id=None):
'ShowSecurityGroupRequest - a model defined in huaweicloud sdk'
self._security_group_id = None
self.discriminator = None
self.security_group_id = security_group_id | 4,764,584,815,604,628,000 | ShowSecurityGroupRequest - a model defined in huaweicloud sdk | huaweicloud-sdk-vpc/huaweicloudsdkvpc/v3/model/show_security_group_request.py | __init__ | huaweicloud/huaweicloud-sdk-python-v3 | python | def __init__(self, security_group_id=None):
self._security_group_id = None
self.discriminator = None
self.security_group_id = security_group_id |
@property
def security_group_id(self):
'Gets the security_group_id of this ShowSecurityGroupRequest.\n\n 安全组资源ID\n\n :return: The security_group_id of this ShowSecurityGroupRequest.\n :rtype: str\n '
return self._security_group_id | 6,141,350,925,777,083,000 | Gets the security_group_id of this ShowSecurityGroupRequest.
安全组资源ID
:return: The security_group_id of this ShowSecurityGroupRequest.
:rtype: str | huaweicloud-sdk-vpc/huaweicloudsdkvpc/v3/model/show_security_group_request.py | security_group_id | huaweicloud/huaweicloud-sdk-python-v3 | python | @property
def security_group_id(self):
'Gets the security_group_id of this ShowSecurityGroupRequest.\n\n 安全组资源ID\n\n :return: The security_group_id of this ShowSecurityGroupRequest.\n :rtype: str\n '
return self._security_group_id |
@security_group_id.setter
def security_group_id(self, security_group_id):
'Sets the security_group_id of this ShowSecurityGroupRequest.\n\n 安全组资源ID\n\n :param security_group_id: The security_group_id of this ShowSecurityGroupRequest.\n :type: str\n '
self._security_group_id = securit... | -7,290,699,017,112,613,000 | Sets the security_group_id of this ShowSecurityGroupRequest.
安全组资源ID
:param security_group_id: The security_group_id of this ShowSecurityGroupRequest.
:type: str | huaweicloud-sdk-vpc/huaweicloudsdkvpc/v3/model/show_security_group_request.py | security_group_id | huaweicloud/huaweicloud-sdk-python-v3 | python | @security_group_id.setter
def security_group_id(self, security_group_id):
'Sets the security_group_id of this ShowSecurityGroupRequest.\n\n 安全组资源ID\n\n :param security_group_id: The security_group_id of this ShowSecurityGroupRequest.\n :type: str\n '
self._security_group_id = securit... |
def to_dict(self):
'Returns the model properties as a dict'
result = {}
for (attr, _) in six.iteritems(self.openapi_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map((lambda x: (x.to_dict() if hasattr(x, 'to_dict') else x)), value))
e... | 2,594,216,033,120,720,000 | Returns the model properties as a dict | huaweicloud-sdk-vpc/huaweicloudsdkvpc/v3/model/show_security_group_request.py | to_dict | huaweicloud/huaweicloud-sdk-python-v3 | python | def to_dict(self):
result = {}
for (attr, _) in six.iteritems(self.openapi_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map((lambda x: (x.to_dict() if hasattr(x, 'to_dict') else x)), value))
elif hasattr(value, 'to_dict'):
... |
def to_str(self):
'Returns the string representation of the model'
import simplejson as json
if six.PY2:
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
return json.dumps(sanitize_for_serialization(self), ensure_ascii=False) | -6,095,553,759,700,562,000 | Returns the string representation of the model | huaweicloud-sdk-vpc/huaweicloudsdkvpc/v3/model/show_security_group_request.py | to_str | huaweicloud/huaweicloud-sdk-python-v3 | python | def to_str(self):
import simplejson as json
if six.PY2:
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
return json.dumps(sanitize_for_serialization(self), ensure_ascii=False) |
def __repr__(self):
'For `print`'
return self.to_str() | -1,581,176,371,750,213,000 | For `print` | huaweicloud-sdk-vpc/huaweicloudsdkvpc/v3/model/show_security_group_request.py | __repr__ | huaweicloud/huaweicloud-sdk-python-v3 | python | def __repr__(self):
return self.to_str() |
def __eq__(self, other):
'Returns true if both objects are equal'
if (not isinstance(other, ShowSecurityGroupRequest)):
return False
return (self.__dict__ == other.__dict__) | -2,403,763,859,980,322,300 | Returns true if both objects are equal | huaweicloud-sdk-vpc/huaweicloudsdkvpc/v3/model/show_security_group_request.py | __eq__ | huaweicloud/huaweicloud-sdk-python-v3 | python | def __eq__(self, other):
if (not isinstance(other, ShowSecurityGroupRequest)):
return False
return (self.__dict__ == other.__dict__) |
def __ne__(self, other):
'Returns true if both objects are not equal'
return (not (self == other)) | 7,764,124,047,908,058,000 | Returns true if both objects are not equal | huaweicloud-sdk-vpc/huaweicloudsdkvpc/v3/model/show_security_group_request.py | __ne__ | huaweicloud/huaweicloud-sdk-python-v3 | python | def __ne__(self, other):
return (not (self == other)) |
def __init__(self, error_date_time=None, request_id=None):
'ErrorDetails - a model defined in Swagger'
self._error_date_time = None
self._request_id = None
self.discriminator = None
if (error_date_time is not None):
self.error_date_time = error_date_time
if (request_id is not None):
... | 180,176,011,986,121,900 | ErrorDetails - a model defined in Swagger | asposewordscloud/models/error_details.py | __init__ | rizwanniazigroupdocs/aspose-words-cloud-python | python | def __init__(self, error_date_time=None, request_id=None):
self._error_date_time = None
self._request_id = None
self.discriminator = None
if (error_date_time is not None):
self.error_date_time = error_date_time
if (request_id is not None):
self.request_id = request_id |
@property
def error_date_time(self):
'Gets the error_date_time of this ErrorDetails. # noqa: E501\n\n Error datetime. # noqa: E501\n\n :return: The error_date_time of this ErrorDetails. # noqa: E501\n :rtype: datetime\n '
return self._error_date_time | -9,134,720,129,385,786,000 | Gets the error_date_time of this ErrorDetails. # noqa: E501
Error datetime. # noqa: E501
:return: The error_date_time of this ErrorDetails. # noqa: E501
:rtype: datetime | asposewordscloud/models/error_details.py | error_date_time | rizwanniazigroupdocs/aspose-words-cloud-python | python | @property
def error_date_time(self):
'Gets the error_date_time of this ErrorDetails. # noqa: E501\n\n Error datetime. # noqa: E501\n\n :return: The error_date_time of this ErrorDetails. # noqa: E501\n :rtype: datetime\n '
return self._error_date_time |
@error_date_time.setter
def error_date_time(self, error_date_time):
'Sets the error_date_time of this ErrorDetails.\n\n Error datetime. # noqa: E501\n\n :param error_date_time: The error_date_time of this ErrorDetails. # noqa: E501\n :type: datetime\n '
self._error_date_time = erro... | 2,731,700,064,338,604,000 | Sets the error_date_time of this ErrorDetails.
Error datetime. # noqa: E501
:param error_date_time: The error_date_time of this ErrorDetails. # noqa: E501
:type: datetime | asposewordscloud/models/error_details.py | error_date_time | rizwanniazigroupdocs/aspose-words-cloud-python | python | @error_date_time.setter
def error_date_time(self, error_date_time):
'Sets the error_date_time of this ErrorDetails.\n\n Error datetime. # noqa: E501\n\n :param error_date_time: The error_date_time of this ErrorDetails. # noqa: E501\n :type: datetime\n '
self._error_date_time = erro... |
@property
def request_id(self):
'Gets the request_id of this ErrorDetails. # noqa: E501\n\n The request id. # noqa: E501\n\n :return: The request_id of this ErrorDetails. # noqa: E501\n :rtype: str\n '
return self._request_id | -2,747,279,147,444,605,400 | Gets the request_id of this ErrorDetails. # noqa: E501
The request id. # noqa: E501
:return: The request_id of this ErrorDetails. # noqa: E501
:rtype: str | asposewordscloud/models/error_details.py | request_id | rizwanniazigroupdocs/aspose-words-cloud-python | python | @property
def request_id(self):
'Gets the request_id of this ErrorDetails. # noqa: E501\n\n The request id. # noqa: E501\n\n :return: The request_id of this ErrorDetails. # noqa: E501\n :rtype: str\n '
return self._request_id |
@request_id.setter
def request_id(self, request_id):
'Sets the request_id of this ErrorDetails.\n\n The request id. # noqa: E501\n\n :param request_id: The request_id of this ErrorDetails. # noqa: E501\n :type: str\n '
self._request_id = request_id | 4,101,524,972,968,898,600 | Sets the request_id of this ErrorDetails.
The request id. # noqa: E501
:param request_id: The request_id of this ErrorDetails. # noqa: E501
:type: str | asposewordscloud/models/error_details.py | request_id | rizwanniazigroupdocs/aspose-words-cloud-python | python | @request_id.setter
def request_id(self, request_id):
'Sets the request_id of this ErrorDetails.\n\n The request id. # noqa: E501\n\n :param request_id: The request_id of this ErrorDetails. # noqa: E501\n :type: str\n '
self._request_id = request_id |
def to_dict(self):
'Returns the model properties as a dict'
result = {}
for (attr, _) in six.iteritems(self.swagger_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map((lambda x: (x.to_dict() if hasattr(x, 'to_dict') else x)), value))
e... | -2,772,352,302,133,010,000 | Returns the model properties as a dict | asposewordscloud/models/error_details.py | to_dict | rizwanniazigroupdocs/aspose-words-cloud-python | python | def to_dict(self):
result = {}
for (attr, _) in six.iteritems(self.swagger_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map((lambda x: (x.to_dict() if hasattr(x, 'to_dict') else x)), value))
elif hasattr(value, 'to_dict'):
... |
def to_json(self):
'Returns the model properties as a dict'
result = {}
for (attr, _) in six.iteritems(self.swagger_types):
value = getattr(self, attr)
if isinstance(value, list):
result[self.attribute_map[attr]] = list(map((lambda x: (x.to_dict() if hasattr(x, 'to_dict') else x)... | -5,130,988,191,037,985,000 | Returns the model properties as a dict | asposewordscloud/models/error_details.py | to_json | rizwanniazigroupdocs/aspose-words-cloud-python | python | def to_json(self):
result = {}
for (attr, _) in six.iteritems(self.swagger_types):
value = getattr(self, attr)
if isinstance(value, list):
result[self.attribute_map[attr]] = list(map((lambda x: (x.to_dict() if hasattr(x, 'to_dict') else x)), value))
elif hasattr(value, '... |
def to_str(self):
'Returns the string representation of the model'
return pprint.pformat(self.to_dict()) | 5,849,158,643,760,736,000 | Returns the string representation of the model | asposewordscloud/models/error_details.py | to_str | rizwanniazigroupdocs/aspose-words-cloud-python | python | def to_str(self):
return pprint.pformat(self.to_dict()) |
def __repr__(self):
'For `print` and `pprint`'
return self.to_str() | -8,960,031,694,814,905,000 | For `print` and `pprint` | asposewordscloud/models/error_details.py | __repr__ | rizwanniazigroupdocs/aspose-words-cloud-python | python | def __repr__(self):
return self.to_str() |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.