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 draw_map(): '\n 绘制世界地图\n 遇到一个很神奇的问题:\n 两个列表必须写死数据地图才会渲染数据,如果数据是从方法中获得,则地图不渲染数据\n :return:\n ' (countrys_names, confirmed_count) = read_csv() confirmed_count_list = [] for item in confirmed_count: confirmed_count_list.append(int(item)) c = Map().add('确诊人数', [list(z) for z i...
-3,497,472,359,941,637,600
绘制世界地图 遇到一个很神奇的问题: 两个列表必须写死数据地图才会渲染数据,如果数据是从方法中获得,则地图不渲染数据 :return:
python-data-analysis/2019-nCoV-global/global_map.py
draw_map
DearCasper/python-learning
python
def draw_map(): '\n 绘制世界地图\n 遇到一个很神奇的问题:\n 两个列表必须写死数据地图才会渲染数据,如果数据是从方法中获得,则地图不渲染数据\n :return:\n ' (countrys_names, confirmed_count) = read_csv() confirmed_count_list = [] for item in confirmed_count: confirmed_count_list.append(int(item)) c = Map().add('确诊人数', [list(z) for z i...
def size_num_grads(link): 'Count total size of all gradient arrays of a given link\n\n Args:\n link (chainer.link.Link): Target link object.\n ' size = 0 num = 0 for param in link.params(): if (param.size == 0): continue size += param.size num += 1 re...
-9,161,413,702,474,069,000
Count total size of all gradient arrays of a given link Args: link (chainer.link.Link): Target link object.
chainer/training/updaters/multiprocess_parallel_updater.py
size_num_grads
Lynkzhang/Chainer-UM
python
def size_num_grads(link): 'Count total size of all gradient arrays of a given link\n\n Args:\n link (chainer.link.Link): Target link object.\n ' size = 0 num = 0 for param in link.params(): if (param.size == 0): continue size += param.size num += 1 re...
def gather_grads(link): 'Put together all gradient arrays and make a single array\n\n Args:\n link (chainer.link.Link): Target link object.\n Return:\n cupy.ndarray\n ' if (link.xp is numpy): raise RuntimeError('gather_grads works only on GPU.') return _gather(link, 'grad')
-4,323,672,895,691,865,600
Put together all gradient arrays and make a single array Args: link (chainer.link.Link): Target link object. Return: cupy.ndarray
chainer/training/updaters/multiprocess_parallel_updater.py
gather_grads
Lynkzhang/Chainer-UM
python
def gather_grads(link): 'Put together all gradient arrays and make a single array\n\n Args:\n link (chainer.link.Link): Target link object.\n Return:\n cupy.ndarray\n ' if (link.xp is numpy): raise RuntimeError('gather_grads works only on GPU.') return _gather(link, 'grad')
def gather_params(link): 'Put together all gradient arrays and make a single array\n\n Args:\n link (chainer.link.Link): Target link object.\n Return:\n cupy.ndarray\n ' if (link.xp is numpy): raise RuntimeError('Link.gather_params works only on GPU.') return _gather(link, 'da...
-5,200,660,742,070,774,000
Put together all gradient arrays and make a single array Args: link (chainer.link.Link): Target link object. Return: cupy.ndarray
chainer/training/updaters/multiprocess_parallel_updater.py
gather_params
Lynkzhang/Chainer-UM
python
def gather_params(link): 'Put together all gradient arrays and make a single array\n\n Args:\n link (chainer.link.Link): Target link object.\n Return:\n cupy.ndarray\n ' if (link.xp is numpy): raise RuntimeError('Link.gather_params works only on GPU.') return _gather(link, 'da...
def scatter_grads(link, array): 'Put back contents of the specified array to the related gradient arrays\n\n Args:\n link (chainer.link.Link): Target link object.\n array (cupy.ndarray): gathered array created by gather_grads()\n ' return _scatter(link, array, 'grad')
7,692,519,946,315,319,000
Put back contents of the specified array to the related gradient arrays Args: link (chainer.link.Link): Target link object. array (cupy.ndarray): gathered array created by gather_grads()
chainer/training/updaters/multiprocess_parallel_updater.py
scatter_grads
Lynkzhang/Chainer-UM
python
def scatter_grads(link, array): 'Put back contents of the specified array to the related gradient arrays\n\n Args:\n link (chainer.link.Link): Target link object.\n array (cupy.ndarray): gathered array created by gather_grads()\n ' return _scatter(link, array, 'grad')
def scatter_params(link, array): 'Put back contents of the specified array to the related gradient arrays\n\n Args:\n link (chainer.link.Link): Target link object.\n array (cupy.ndarray): gathered array created by gather_params()\n ' return _scatter(link, array, 'data')
-5,699,551,748,872,963,000
Put back contents of the specified array to the related gradient arrays Args: link (chainer.link.Link): Target link object. array (cupy.ndarray): gathered array created by gather_params()
chainer/training/updaters/multiprocess_parallel_updater.py
scatter_params
Lynkzhang/Chainer-UM
python
def scatter_params(link, array): 'Put back contents of the specified array to the related gradient arrays\n\n Args:\n link (chainer.link.Link): Target link object.\n array (cupy.ndarray): gathered array created by gather_params()\n ' return _scatter(link, array, 'data')
def _get_nccl_data_type(dtype): 'Get data type for NCCL' if (dtype == numpy.float32): nccl_data_type = nccl.NCCL_FLOAT elif (dtype == numpy.float16): nccl_data_type = nccl.NCCL_HALF elif (dtype == numpy.float64): nccl_data_type = nccl.NCCL_DOUBLE else: raise RuntimeEr...
-2,394,153,031,925,755,400
Get data type for NCCL
chainer/training/updaters/multiprocess_parallel_updater.py
_get_nccl_data_type
Lynkzhang/Chainer-UM
python
def _get_nccl_data_type(dtype): if (dtype == numpy.float32): nccl_data_type = nccl.NCCL_FLOAT elif (dtype == numpy.float16): nccl_data_type = nccl.NCCL_HALF elif (dtype == numpy.float64): nccl_data_type = nccl.NCCL_DOUBLE else: raise RuntimeError('Unexpected data typ...
def ensure_server() -> libtmux.Server: '\n Either create new or return existing server\n ' return libtmux.Server()
7,596,910,660,909,000,000
Either create new or return existing server
kmux/tmux.py
ensure_server
kiemlicz/kmux
python
def ensure_server() -> libtmux.Server: '\n \n ' return libtmux.Server()
def grayscale(self): "Applies the Grayscale transform\n This will return an image with only one color channel\n but NOTE: to see the returned image as grayscale\n (assuming your grayscaled image is called 'gray')\n you should call plt.imshow(gray, cmap='gray')" return cv2.cvtColor(se...
-5,467,729,550,303,214,000
Applies the Grayscale transform This will return an image with only one color channel but NOTE: to see the returned image as grayscale (assuming your grayscaled image is called 'gray') you should call plt.imshow(gray, cmap='gray')
color.py
grayscale
mhhm2005eg/CarND-Advanced-Lane-Lines
python
def grayscale(self): "Applies the Grayscale transform\n This will return an image with only one color channel\n but NOTE: to see the returned image as grayscale\n (assuming your grayscaled image is called 'gray')\n you should call plt.imshow(gray, cmap='gray')" return cv2.cvtColor(se...
def peer_has_block(self, header_hash: bytes32, peer_id: bytes32, weight: uint128, height: uint32, new_peak: bool): '\n Adds a record that a certain peer has a block.\n ' if (header_hash == self.sync_target_header_hash): self.peers_changed.set() if (header_hash in self.peak_to_peer): ...
-334,373,693,815,353,800
Adds a record that a certain peer has a block.
seno/full_node/sync_store.py
peer_has_block
AcidBurnSB/seno-blockchain
python
def peer_has_block(self, header_hash: bytes32, peer_id: bytes32, weight: uint128, height: uint32, new_peak: bool): '\n \n ' if (header_hash == self.sync_target_header_hash): self.peers_changed.set() if (header_hash in self.peak_to_peer): self.peak_to_peer[header_hash].add(peer_...
def get_peers_that_have_peak(self, header_hashes: List[bytes32]) -> Set[bytes32]: '\n Returns: peer ids of peers that have at least one of the header hashes.\n ' node_ids: Set[bytes32] = set() for header_hash in header_hashes: if (header_hash in self.peak_to_peer): for node...
36,668,548,843,882,770
Returns: peer ids of peers that have at least one of the header hashes.
seno/full_node/sync_store.py
get_peers_that_have_peak
AcidBurnSB/seno-blockchain
python
def get_peers_that_have_peak(self, header_hashes: List[bytes32]) -> Set[bytes32]: '\n \n ' node_ids: Set[bytes32] = set() for header_hash in header_hashes: if (header_hash in self.peak_to_peer): for node_id in self.peak_to_peer[header_hash]: node_ids.add(nod...
def get_peak_of_each_peer(self) -> Dict[(bytes32, Tuple[(bytes32, uint32, uint128)])]: '\n Returns: dictionary of peer id to peak information.\n ' ret = {} for (peer_id, v) in self.peer_to_peak.items(): if (v[0] not in self.peak_to_peer): continue ret[peer_id] = v ...
-2,512,652,720,815,065,600
Returns: dictionary of peer id to peak information.
seno/full_node/sync_store.py
get_peak_of_each_peer
AcidBurnSB/seno-blockchain
python
def get_peak_of_each_peer(self) -> Dict[(bytes32, Tuple[(bytes32, uint32, uint128)])]: '\n \n ' ret = {} for (peer_id, v) in self.peer_to_peak.items(): if (v[0] not in self.peak_to_peer): continue ret[peer_id] = v return ret
def get_heaviest_peak(self) -> Optional[Tuple[(bytes32, uint32, uint128)]]: '\n Returns: the header_hash, height, and weight of the heaviest block that one of our peers has notified\n us of.\n ' if (len(self.peer_to_peak) == 0): return None heaviest_peak_hash: Optional[bytes32] ...
-3,561,257,540,632,519,700
Returns: the header_hash, height, and weight of the heaviest block that one of our peers has notified us of.
seno/full_node/sync_store.py
get_heaviest_peak
AcidBurnSB/seno-blockchain
python
def get_heaviest_peak(self) -> Optional[Tuple[(bytes32, uint32, uint128)]]: '\n Returns: the header_hash, height, and weight of the heaviest block that one of our peers has notified\n us of.\n ' if (len(self.peer_to_peak) == 0): return None heaviest_peak_hash: Optional[bytes32] ...
async def clear_sync_info(self): '\n Clears the peak_to_peer info which can get quite large.\n ' self.peak_to_peer = {}
7,185,190,742,401,591,000
Clears the peak_to_peer info which can get quite large.
seno/full_node/sync_store.py
clear_sync_info
AcidBurnSB/seno-blockchain
python
async def clear_sync_info(self): '\n \n ' self.peak_to_peer = {}
def __init__(self, email_address=None, email_type=None, status=None, merge_fields=None, interests=None, language=None, vip=None, location=None, marketing_permissions=None, ip_signup=None, timestamp_signup=None, ip_opt=None, timestamp_opt=None, tags=None): 'AddListMembers1 - a model defined in Swagger' self._ema...
3,081,994,696,511,349,000
AddListMembers1 - a model defined in Swagger
mailchimp_marketing_asyncio/models/add_list_members1.py
__init__
RWiggers/mailchimp-marketing-asyncio
python
def __init__(self, email_address=None, email_type=None, status=None, merge_fields=None, interests=None, language=None, vip=None, location=None, marketing_permissions=None, ip_signup=None, timestamp_signup=None, ip_opt=None, timestamp_opt=None, tags=None): self._email_address = None self._email_type = None ...
@property def email_address(self): 'Gets the email_address of this AddListMembers1. # noqa: E501\n\n Email address for a subscriber. # noqa: E501\n\n :return: The email_address of this AddListMembers1. # noqa: E501\n :rtype: str\n ' return self._email_address
-1,458,265,820,136,020,700
Gets the email_address of this AddListMembers1. # noqa: E501 Email address for a subscriber. # noqa: E501 :return: The email_address of this AddListMembers1. # noqa: E501 :rtype: str
mailchimp_marketing_asyncio/models/add_list_members1.py
email_address
RWiggers/mailchimp-marketing-asyncio
python
@property def email_address(self): 'Gets the email_address of this AddListMembers1. # noqa: E501\n\n Email address for a subscriber. # noqa: E501\n\n :return: The email_address of this AddListMembers1. # noqa: E501\n :rtype: str\n ' return self._email_address
@email_address.setter def email_address(self, email_address): 'Sets the email_address of this AddListMembers1.\n\n Email address for a subscriber. # noqa: E501\n\n :param email_address: The email_address of this AddListMembers1. # noqa: E501\n :type: str\n ' if (email_address is No...
7,775,084,497,611,737,000
Sets the email_address of this AddListMembers1. Email address for a subscriber. # noqa: E501 :param email_address: The email_address of this AddListMembers1. # noqa: E501 :type: str
mailchimp_marketing_asyncio/models/add_list_members1.py
email_address
RWiggers/mailchimp-marketing-asyncio
python
@email_address.setter def email_address(self, email_address): 'Sets the email_address of this AddListMembers1.\n\n Email address for a subscriber. # noqa: E501\n\n :param email_address: The email_address of this AddListMembers1. # noqa: E501\n :type: str\n ' if (email_address is No...
@property def email_type(self): "Gets the email_type of this AddListMembers1. # noqa: E501\n\n Type of email this member asked to get ('html' or 'text'). # noqa: E501\n\n :return: The email_type of this AddListMembers1. # noqa: E501\n :rtype: str\n " return self._email_type
995,840,052,661,736,000
Gets the email_type of this AddListMembers1. # noqa: E501 Type of email this member asked to get ('html' or 'text'). # noqa: E501 :return: The email_type of this AddListMembers1. # noqa: E501 :rtype: str
mailchimp_marketing_asyncio/models/add_list_members1.py
email_type
RWiggers/mailchimp-marketing-asyncio
python
@property def email_type(self): "Gets the email_type of this AddListMembers1. # noqa: E501\n\n Type of email this member asked to get ('html' or 'text'). # noqa: E501\n\n :return: The email_type of this AddListMembers1. # noqa: E501\n :rtype: str\n " return self._email_type
@email_type.setter def email_type(self, email_type): "Sets the email_type of this AddListMembers1.\n\n Type of email this member asked to get ('html' or 'text'). # noqa: E501\n\n :param email_type: The email_type of this AddListMembers1. # noqa: E501\n :type: str\n " self._email_ty...
-8,059,765,046,876,889,000
Sets the email_type of this AddListMembers1. Type of email this member asked to get ('html' or 'text'). # noqa: E501 :param email_type: The email_type of this AddListMembers1. # noqa: E501 :type: str
mailchimp_marketing_asyncio/models/add_list_members1.py
email_type
RWiggers/mailchimp-marketing-asyncio
python
@email_type.setter def email_type(self, email_type): "Sets the email_type of this AddListMembers1.\n\n Type of email this member asked to get ('html' or 'text'). # noqa: E501\n\n :param email_type: The email_type of this AddListMembers1. # noqa: E501\n :type: str\n " self._email_ty...
@property def status(self): "Gets the status of this AddListMembers1. # noqa: E501\n\n Subscriber's current status. # noqa: E501\n\n :return: The status of this AddListMembers1. # noqa: E501\n :rtype: str\n " return self._status
-8,841,901,392,601,686,000
Gets the status of this AddListMembers1. # noqa: E501 Subscriber's current status. # noqa: E501 :return: The status of this AddListMembers1. # noqa: E501 :rtype: str
mailchimp_marketing_asyncio/models/add_list_members1.py
status
RWiggers/mailchimp-marketing-asyncio
python
@property def status(self): "Gets the status of this AddListMembers1. # noqa: E501\n\n Subscriber's current status. # noqa: E501\n\n :return: The status of this AddListMembers1. # noqa: E501\n :rtype: str\n " return self._status
@status.setter def status(self, status): "Sets the status of this AddListMembers1.\n\n Subscriber's current status. # noqa: E501\n\n :param status: The status of this AddListMembers1. # noqa: E501\n :type: str\n " if (status is None): raise ValueError('Invalid value for `st...
-4,489,359,152,190,322,700
Sets the status of this AddListMembers1. Subscriber's current status. # noqa: E501 :param status: The status of this AddListMembers1. # noqa: E501 :type: str
mailchimp_marketing_asyncio/models/add_list_members1.py
status
RWiggers/mailchimp-marketing-asyncio
python
@status.setter def status(self, status): "Sets the status of this AddListMembers1.\n\n Subscriber's current status. # noqa: E501\n\n :param status: The status of this AddListMembers1. # noqa: E501\n :type: str\n " if (status is None): raise ValueError('Invalid value for `st...
@property def merge_fields(self): 'Gets the merge_fields of this AddListMembers1. # noqa: E501\n\n A dictionary of merge fields where the keys are the merge tags. See the [Merge Fields documentation](https://mailchimp.com/developer/marketing/docs/merge-fields/#structure) for more about the structure. # noq...
5,729,846,895,573,442,000
Gets the merge_fields of this AddListMembers1. # noqa: E501 A dictionary of merge fields where the keys are the merge tags. See the [Merge Fields documentation](https://mailchimp.com/developer/marketing/docs/merge-fields/#structure) for more about the structure. # noqa: E501 :return: The merge_fields of this AddLis...
mailchimp_marketing_asyncio/models/add_list_members1.py
merge_fields
RWiggers/mailchimp-marketing-asyncio
python
@property def merge_fields(self): 'Gets the merge_fields of this AddListMembers1. # noqa: E501\n\n A dictionary of merge fields where the keys are the merge tags. See the [Merge Fields documentation](https://mailchimp.com/developer/marketing/docs/merge-fields/#structure) for more about the structure. # noq...
@merge_fields.setter def merge_fields(self, merge_fields): 'Sets the merge_fields of this AddListMembers1.\n\n A dictionary of merge fields where the keys are the merge tags. See the [Merge Fields documentation](https://mailchimp.com/developer/marketing/docs/merge-fields/#structure) for more about the struct...
1,798,863,505,504,119,800
Sets the merge_fields of this AddListMembers1. A dictionary of merge fields where the keys are the merge tags. See the [Merge Fields documentation](https://mailchimp.com/developer/marketing/docs/merge-fields/#structure) for more about the structure. # noqa: E501 :param merge_fields: The merge_fields of this AddListM...
mailchimp_marketing_asyncio/models/add_list_members1.py
merge_fields
RWiggers/mailchimp-marketing-asyncio
python
@merge_fields.setter def merge_fields(self, merge_fields): 'Sets the merge_fields of this AddListMembers1.\n\n A dictionary of merge fields where the keys are the merge tags. See the [Merge Fields documentation](https://mailchimp.com/developer/marketing/docs/merge-fields/#structure) for more about the struct...
@property def interests(self): "Gets the interests of this AddListMembers1. # noqa: E501\n\n The key of this object's properties is the ID of the interest in question. # noqa: E501\n\n :return: The interests of this AddListMembers1. # noqa: E501\n :rtype: dict(str, bool)\n " retur...
-7,395,813,785,538,401,000
Gets the interests of this AddListMembers1. # noqa: E501 The key of this object's properties is the ID of the interest in question. # noqa: E501 :return: The interests of this AddListMembers1. # noqa: E501 :rtype: dict(str, bool)
mailchimp_marketing_asyncio/models/add_list_members1.py
interests
RWiggers/mailchimp-marketing-asyncio
python
@property def interests(self): "Gets the interests of this AddListMembers1. # noqa: E501\n\n The key of this object's properties is the ID of the interest in question. # noqa: E501\n\n :return: The interests of this AddListMembers1. # noqa: E501\n :rtype: dict(str, bool)\n " retur...
@interests.setter def interests(self, interests): "Sets the interests of this AddListMembers1.\n\n The key of this object's properties is the ID of the interest in question. # noqa: E501\n\n :param interests: The interests of this AddListMembers1. # noqa: E501\n :type: dict(str, bool)\n ...
-4,364,914,497,824,911,000
Sets the interests of this AddListMembers1. The key of this object's properties is the ID of the interest in question. # noqa: E501 :param interests: The interests of this AddListMembers1. # noqa: E501 :type: dict(str, bool)
mailchimp_marketing_asyncio/models/add_list_members1.py
interests
RWiggers/mailchimp-marketing-asyncio
python
@interests.setter def interests(self, interests): "Sets the interests of this AddListMembers1.\n\n The key of this object's properties is the ID of the interest in question. # noqa: E501\n\n :param interests: The interests of this AddListMembers1. # noqa: E501\n :type: dict(str, bool)\n ...
@property def language(self): "Gets the language of this AddListMembers1. # noqa: E501\n\n If set/detected, the [subscriber's language](https://mailchimp.com/help/view-and-edit-contact-languages/). # noqa: E501\n\n :return: The language of this AddListMembers1. # noqa: E501\n :rtype: str\n ...
5,055,788,823,884,538,000
Gets the language of this AddListMembers1. # noqa: E501 If set/detected, the [subscriber's language](https://mailchimp.com/help/view-and-edit-contact-languages/). # noqa: E501 :return: The language of this AddListMembers1. # noqa: E501 :rtype: str
mailchimp_marketing_asyncio/models/add_list_members1.py
language
RWiggers/mailchimp-marketing-asyncio
python
@property def language(self): "Gets the language of this AddListMembers1. # noqa: E501\n\n If set/detected, the [subscriber's language](https://mailchimp.com/help/view-and-edit-contact-languages/). # noqa: E501\n\n :return: The language of this AddListMembers1. # noqa: E501\n :rtype: str\n ...
@language.setter def language(self, language): "Sets the language of this AddListMembers1.\n\n If set/detected, the [subscriber's language](https://mailchimp.com/help/view-and-edit-contact-languages/). # noqa: E501\n\n :param language: The language of this AddListMembers1. # noqa: E501\n :typ...
3,258,681,828,675,341,300
Sets the language of this AddListMembers1. If set/detected, the [subscriber's language](https://mailchimp.com/help/view-and-edit-contact-languages/). # noqa: E501 :param language: The language of this AddListMembers1. # noqa: E501 :type: str
mailchimp_marketing_asyncio/models/add_list_members1.py
language
RWiggers/mailchimp-marketing-asyncio
python
@language.setter def language(self, language): "Sets the language of this AddListMembers1.\n\n If set/detected, the [subscriber's language](https://mailchimp.com/help/view-and-edit-contact-languages/). # noqa: E501\n\n :param language: The language of this AddListMembers1. # noqa: E501\n :typ...
@property def vip(self): 'Gets the vip of this AddListMembers1. # noqa: E501\n\n [VIP status](https://mailchimp.com/help/designate-and-send-to-vip-contacts/) for subscriber. # noqa: E501\n\n :return: The vip of this AddListMembers1. # noqa: E501\n :rtype: bool\n ' return self._vip
-392,789,501,235,498,200
Gets the vip of this AddListMembers1. # noqa: E501 [VIP status](https://mailchimp.com/help/designate-and-send-to-vip-contacts/) for subscriber. # noqa: E501 :return: The vip of this AddListMembers1. # noqa: E501 :rtype: bool
mailchimp_marketing_asyncio/models/add_list_members1.py
vip
RWiggers/mailchimp-marketing-asyncio
python
@property def vip(self): 'Gets the vip of this AddListMembers1. # noqa: E501\n\n [VIP status](https://mailchimp.com/help/designate-and-send-to-vip-contacts/) for subscriber. # noqa: E501\n\n :return: The vip of this AddListMembers1. # noqa: E501\n :rtype: bool\n ' return self._vip
@vip.setter def vip(self, vip): 'Sets the vip of this AddListMembers1.\n\n [VIP status](https://mailchimp.com/help/designate-and-send-to-vip-contacts/) for subscriber. # noqa: E501\n\n :param vip: The vip of this AddListMembers1. # noqa: E501\n :type: bool\n ' self._vip = vip
-5,151,318,988,252,167,000
Sets the vip of this AddListMembers1. [VIP status](https://mailchimp.com/help/designate-and-send-to-vip-contacts/) for subscriber. # noqa: E501 :param vip: The vip of this AddListMembers1. # noqa: E501 :type: bool
mailchimp_marketing_asyncio/models/add_list_members1.py
vip
RWiggers/mailchimp-marketing-asyncio
python
@vip.setter def vip(self, vip): 'Sets the vip of this AddListMembers1.\n\n [VIP status](https://mailchimp.com/help/designate-and-send-to-vip-contacts/) for subscriber. # noqa: E501\n\n :param vip: The vip of this AddListMembers1. # noqa: E501\n :type: bool\n ' self._vip = vip
@property def location(self): 'Gets the location of this AddListMembers1. # noqa: E501\n\n\n :return: The location of this AddListMembers1. # noqa: E501\n :rtype: Location\n ' return self._location
4,798,484,802,868,938,000
Gets the location of this AddListMembers1. # noqa: E501 :return: The location of this AddListMembers1. # noqa: E501 :rtype: Location
mailchimp_marketing_asyncio/models/add_list_members1.py
location
RWiggers/mailchimp-marketing-asyncio
python
@property def location(self): 'Gets the location of this AddListMembers1. # noqa: E501\n\n\n :return: The location of this AddListMembers1. # noqa: E501\n :rtype: Location\n ' return self._location
@location.setter def location(self, location): 'Sets the location of this AddListMembers1.\n\n\n :param location: The location of this AddListMembers1. # noqa: E501\n :type: Location\n ' self._location = location
-9,192,074,986,748,529,000
Sets the location of this AddListMembers1. :param location: The location of this AddListMembers1. # noqa: E501 :type: Location
mailchimp_marketing_asyncio/models/add_list_members1.py
location
RWiggers/mailchimp-marketing-asyncio
python
@location.setter def location(self, location): 'Sets the location of this AddListMembers1.\n\n\n :param location: The location of this AddListMembers1. # noqa: E501\n :type: Location\n ' self._location = location
@property def marketing_permissions(self): 'Gets the marketing_permissions of this AddListMembers1. # noqa: E501\n\n The marketing permissions for the subscriber. # noqa: E501\n\n :return: The marketing_permissions of this AddListMembers1. # noqa: E501\n :rtype: list[MarketingPermission1]\n ...
-209,653,211,692,470,000
Gets the marketing_permissions of this AddListMembers1. # noqa: E501 The marketing permissions for the subscriber. # noqa: E501 :return: The marketing_permissions of this AddListMembers1. # noqa: E501 :rtype: list[MarketingPermission1]
mailchimp_marketing_asyncio/models/add_list_members1.py
marketing_permissions
RWiggers/mailchimp-marketing-asyncio
python
@property def marketing_permissions(self): 'Gets the marketing_permissions of this AddListMembers1. # noqa: E501\n\n The marketing permissions for the subscriber. # noqa: E501\n\n :return: The marketing_permissions of this AddListMembers1. # noqa: E501\n :rtype: list[MarketingPermission1]\n ...
@marketing_permissions.setter def marketing_permissions(self, marketing_permissions): 'Sets the marketing_permissions of this AddListMembers1.\n\n The marketing permissions for the subscriber. # noqa: E501\n\n :param marketing_permissions: The marketing_permissions of this AddListMembers1. # noqa: E...
4,081,623,534,439,569,400
Sets the marketing_permissions of this AddListMembers1. The marketing permissions for the subscriber. # noqa: E501 :param marketing_permissions: The marketing_permissions of this AddListMembers1. # noqa: E501 :type: list[MarketingPermission1]
mailchimp_marketing_asyncio/models/add_list_members1.py
marketing_permissions
RWiggers/mailchimp-marketing-asyncio
python
@marketing_permissions.setter def marketing_permissions(self, marketing_permissions): 'Sets the marketing_permissions of this AddListMembers1.\n\n The marketing permissions for the subscriber. # noqa: E501\n\n :param marketing_permissions: The marketing_permissions of this AddListMembers1. # noqa: E...
@property def ip_signup(self): 'Gets the ip_signup of this AddListMembers1. # noqa: E501\n\n IP address the subscriber signed up from. # noqa: E501\n\n :return: The ip_signup of this AddListMembers1. # noqa: E501\n :rtype: str\n ' return self._ip_signup
-9,131,692,653,842,025,000
Gets the ip_signup of this AddListMembers1. # noqa: E501 IP address the subscriber signed up from. # noqa: E501 :return: The ip_signup of this AddListMembers1. # noqa: E501 :rtype: str
mailchimp_marketing_asyncio/models/add_list_members1.py
ip_signup
RWiggers/mailchimp-marketing-asyncio
python
@property def ip_signup(self): 'Gets the ip_signup of this AddListMembers1. # noqa: E501\n\n IP address the subscriber signed up from. # noqa: E501\n\n :return: The ip_signup of this AddListMembers1. # noqa: E501\n :rtype: str\n ' return self._ip_signup
@ip_signup.setter def ip_signup(self, ip_signup): 'Sets the ip_signup of this AddListMembers1.\n\n IP address the subscriber signed up from. # noqa: E501\n\n :param ip_signup: The ip_signup of this AddListMembers1. # noqa: E501\n :type: str\n ' self._ip_signup = ip_signup
8,695,358,424,534,109,000
Sets the ip_signup of this AddListMembers1. IP address the subscriber signed up from. # noqa: E501 :param ip_signup: The ip_signup of this AddListMembers1. # noqa: E501 :type: str
mailchimp_marketing_asyncio/models/add_list_members1.py
ip_signup
RWiggers/mailchimp-marketing-asyncio
python
@ip_signup.setter def ip_signup(self, ip_signup): 'Sets the ip_signup of this AddListMembers1.\n\n IP address the subscriber signed up from. # noqa: E501\n\n :param ip_signup: The ip_signup of this AddListMembers1. # noqa: E501\n :type: str\n ' self._ip_signup = ip_signup
@property def timestamp_signup(self): 'Gets the timestamp_signup of this AddListMembers1. # noqa: E501\n\n The date and time the subscriber signed up for the list in ISO 8601 format. # noqa: E501\n\n :return: The timestamp_signup of this AddListMembers1. # noqa: E501\n :rtype: datetime\n ...
7,031,646,117,093,732,000
Gets the timestamp_signup of this AddListMembers1. # noqa: E501 The date and time the subscriber signed up for the list in ISO 8601 format. # noqa: E501 :return: The timestamp_signup of this AddListMembers1. # noqa: E501 :rtype: datetime
mailchimp_marketing_asyncio/models/add_list_members1.py
timestamp_signup
RWiggers/mailchimp-marketing-asyncio
python
@property def timestamp_signup(self): 'Gets the timestamp_signup of this AddListMembers1. # noqa: E501\n\n The date and time the subscriber signed up for the list in ISO 8601 format. # noqa: E501\n\n :return: The timestamp_signup of this AddListMembers1. # noqa: E501\n :rtype: datetime\n ...
@timestamp_signup.setter def timestamp_signup(self, timestamp_signup): 'Sets the timestamp_signup of this AddListMembers1.\n\n The date and time the subscriber signed up for the list in ISO 8601 format. # noqa: E501\n\n :param timestamp_signup: The timestamp_signup of this AddListMembers1. # noqa: E...
-2,677,855,865,278,813,000
Sets the timestamp_signup of this AddListMembers1. The date and time the subscriber signed up for the list in ISO 8601 format. # noqa: E501 :param timestamp_signup: The timestamp_signup of this AddListMembers1. # noqa: E501 :type: datetime
mailchimp_marketing_asyncio/models/add_list_members1.py
timestamp_signup
RWiggers/mailchimp-marketing-asyncio
python
@timestamp_signup.setter def timestamp_signup(self, timestamp_signup): 'Sets the timestamp_signup of this AddListMembers1.\n\n The date and time the subscriber signed up for the list in ISO 8601 format. # noqa: E501\n\n :param timestamp_signup: The timestamp_signup of this AddListMembers1. # noqa: E...
@property def ip_opt(self): 'Gets the ip_opt of this AddListMembers1. # noqa: E501\n\n The IP address the subscriber used to confirm their opt-in status. # noqa: E501\n\n :return: The ip_opt of this AddListMembers1. # noqa: E501\n :rtype: str\n ' return self._ip_opt
-4,255,675,526,227,299,000
Gets the ip_opt of this AddListMembers1. # noqa: E501 The IP address the subscriber used to confirm their opt-in status. # noqa: E501 :return: The ip_opt of this AddListMembers1. # noqa: E501 :rtype: str
mailchimp_marketing_asyncio/models/add_list_members1.py
ip_opt
RWiggers/mailchimp-marketing-asyncio
python
@property def ip_opt(self): 'Gets the ip_opt of this AddListMembers1. # noqa: E501\n\n The IP address the subscriber used to confirm their opt-in status. # noqa: E501\n\n :return: The ip_opt of this AddListMembers1. # noqa: E501\n :rtype: str\n ' return self._ip_opt
@ip_opt.setter def ip_opt(self, ip_opt): 'Sets the ip_opt of this AddListMembers1.\n\n The IP address the subscriber used to confirm their opt-in status. # noqa: E501\n\n :param ip_opt: The ip_opt of this AddListMembers1. # noqa: E501\n :type: str\n ' self._ip_opt = ip_opt
-3,171,704,755,062,573,000
Sets the ip_opt of this AddListMembers1. The IP address the subscriber used to confirm their opt-in status. # noqa: E501 :param ip_opt: The ip_opt of this AddListMembers1. # noqa: E501 :type: str
mailchimp_marketing_asyncio/models/add_list_members1.py
ip_opt
RWiggers/mailchimp-marketing-asyncio
python
@ip_opt.setter def ip_opt(self, ip_opt): 'Sets the ip_opt of this AddListMembers1.\n\n The IP address the subscriber used to confirm their opt-in status. # noqa: E501\n\n :param ip_opt: The ip_opt of this AddListMembers1. # noqa: E501\n :type: str\n ' self._ip_opt = ip_opt
@property def timestamp_opt(self): 'Gets the timestamp_opt of this AddListMembers1. # noqa: E501\n\n The date and time the subscribe confirmed their opt-in status in ISO 8601 format. # noqa: E501\n\n :return: The timestamp_opt of this AddListMembers1. # noqa: E501\n :rtype: datetime\n ...
1,856,651,276,959,445,200
Gets the timestamp_opt of this AddListMembers1. # noqa: E501 The date and time the subscribe confirmed their opt-in status in ISO 8601 format. # noqa: E501 :return: The timestamp_opt of this AddListMembers1. # noqa: E501 :rtype: datetime
mailchimp_marketing_asyncio/models/add_list_members1.py
timestamp_opt
RWiggers/mailchimp-marketing-asyncio
python
@property def timestamp_opt(self): 'Gets the timestamp_opt of this AddListMembers1. # noqa: E501\n\n The date and time the subscribe confirmed their opt-in status in ISO 8601 format. # noqa: E501\n\n :return: The timestamp_opt of this AddListMembers1. # noqa: E501\n :rtype: datetime\n ...
@timestamp_opt.setter def timestamp_opt(self, timestamp_opt): 'Sets the timestamp_opt of this AddListMembers1.\n\n The date and time the subscribe confirmed their opt-in status in ISO 8601 format. # noqa: E501\n\n :param timestamp_opt: The timestamp_opt of this AddListMembers1. # noqa: E501\n ...
-7,590,912,189,221,661,000
Sets the timestamp_opt of this AddListMembers1. The date and time the subscribe confirmed their opt-in status in ISO 8601 format. # noqa: E501 :param timestamp_opt: The timestamp_opt of this AddListMembers1. # noqa: E501 :type: datetime
mailchimp_marketing_asyncio/models/add_list_members1.py
timestamp_opt
RWiggers/mailchimp-marketing-asyncio
python
@timestamp_opt.setter def timestamp_opt(self, timestamp_opt): 'Sets the timestamp_opt of this AddListMembers1.\n\n The date and time the subscribe confirmed their opt-in status in ISO 8601 format. # noqa: E501\n\n :param timestamp_opt: The timestamp_opt of this AddListMembers1. # noqa: E501\n ...
@property def tags(self): 'Gets the tags of this AddListMembers1. # noqa: E501\n\n The tags that are associated with a member. # noqa: E501\n\n :return: The tags of this AddListMembers1. # noqa: E501\n :rtype: list[str]\n ' return self._tags
-1,838,366,037,586,048,800
Gets the tags of this AddListMembers1. # noqa: E501 The tags that are associated with a member. # noqa: E501 :return: The tags of this AddListMembers1. # noqa: E501 :rtype: list[str]
mailchimp_marketing_asyncio/models/add_list_members1.py
tags
RWiggers/mailchimp-marketing-asyncio
python
@property def tags(self): 'Gets the tags of this AddListMembers1. # noqa: E501\n\n The tags that are associated with a member. # noqa: E501\n\n :return: The tags of this AddListMembers1. # noqa: E501\n :rtype: list[str]\n ' return self._tags
@tags.setter def tags(self, tags): 'Sets the tags of this AddListMembers1.\n\n The tags that are associated with a member. # noqa: E501\n\n :param tags: The tags of this AddListMembers1. # noqa: E501\n :type: list[str]\n ' self._tags = tags
-8,568,244,354,649,068,000
Sets the tags of this AddListMembers1. The tags that are associated with a member. # noqa: E501 :param tags: The tags of this AddListMembers1. # noqa: E501 :type: list[str]
mailchimp_marketing_asyncio/models/add_list_members1.py
tags
RWiggers/mailchimp-marketing-asyncio
python
@tags.setter def tags(self, tags): 'Sets the tags of this AddListMembers1.\n\n The tags that are associated with a member. # noqa: E501\n\n :param tags: The tags of this AddListMembers1. # noqa: E501\n :type: list[str]\n ' self._tags = tags
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...
-6,043,816,492,661,430,000
Returns the model properties as a dict
mailchimp_marketing_asyncio/models/add_list_members1.py
to_dict
RWiggers/mailchimp-marketing-asyncio
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_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
mailchimp_marketing_asyncio/models/add_list_members1.py
to_str
RWiggers/mailchimp-marketing-asyncio
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`
mailchimp_marketing_asyncio/models/add_list_members1.py
__repr__
RWiggers/mailchimp-marketing-asyncio
python
def __repr__(self): return self.to_str()
def __eq__(self, other): 'Returns true if both objects are equal' if (not isinstance(other, AddListMembers1)): return False return (self.__dict__ == other.__dict__)
-6,343,505,069,438,291,000
Returns true if both objects are equal
mailchimp_marketing_asyncio/models/add_list_members1.py
__eq__
RWiggers/mailchimp-marketing-asyncio
python
def __eq__(self, other): if (not isinstance(other, AddListMembers1)): 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
mailchimp_marketing_asyncio/models/add_list_members1.py
__ne__
RWiggers/mailchimp-marketing-asyncio
python
def __ne__(self, other): return (not (self == other))
def __init__(self, config_entry: config_entries.ConfigEntry) -> None: 'Init object.' self.config_entry = config_entry
-2,559,020,865,665,428,000
Init object.
homeassistant/components/xiaomi_miio/config_flow.py
__init__
0xFEEDC0DE64/homeassistant-core
python
def __init__(self, config_entry: config_entries.ConfigEntry) -> None: self.config_entry = config_entry
async def async_step_init(self, user_input=None): 'Manage the options.' errors = {} if (user_input is not None): use_cloud = user_input.get(CONF_CLOUD_SUBDEVICES, False) cloud_username = self.config_entry.data.get(CONF_CLOUD_USERNAME) cloud_password = self.config_entry.data.get(CONF_...
-6,022,703,587,631,939,000
Manage the options.
homeassistant/components/xiaomi_miio/config_flow.py
async_step_init
0xFEEDC0DE64/homeassistant-core
python
async def async_step_init(self, user_input=None): errors = {} if (user_input is not None): use_cloud = user_input.get(CONF_CLOUD_SUBDEVICES, False) cloud_username = self.config_entry.data.get(CONF_CLOUD_USERNAME) cloud_password = self.config_entry.data.get(CONF_CLOUD_PASSWORD) ...
def __init__(self): 'Initialize.' self.host = None self.mac = None self.token = None self.model = None self.name = None self.cloud_username = None self.cloud_password = None self.cloud_country = None self.cloud_devices = {}
-5,904,689,502,503,525,000
Initialize.
homeassistant/components/xiaomi_miio/config_flow.py
__init__
0xFEEDC0DE64/homeassistant-core
python
def __init__(self): self.host = None self.mac = None self.token = None self.model = None self.name = None self.cloud_username = None self.cloud_password = None self.cloud_country = None self.cloud_devices = {}
@staticmethod @callback def async_get_options_flow(config_entry) -> OptionsFlowHandler: 'Get the options flow.' return OptionsFlowHandler(config_entry)
5,334,322,877,548,666,000
Get the options flow.
homeassistant/components/xiaomi_miio/config_flow.py
async_get_options_flow
0xFEEDC0DE64/homeassistant-core
python
@staticmethod @callback def async_get_options_flow(config_entry) -> OptionsFlowHandler: return OptionsFlowHandler(config_entry)
async def async_step_reauth(self, user_input=None): 'Perform reauth upon an authentication error or missing cloud credentials.' self.host = user_input[CONF_HOST] self.token = user_input[CONF_TOKEN] self.mac = user_input[CONF_MAC] self.model = user_input.get(CONF_MODEL) return (await self.async_s...
8,628,532,616,613,430,000
Perform reauth upon an authentication error or missing cloud credentials.
homeassistant/components/xiaomi_miio/config_flow.py
async_step_reauth
0xFEEDC0DE64/homeassistant-core
python
async def async_step_reauth(self, user_input=None): self.host = user_input[CONF_HOST] self.token = user_input[CONF_TOKEN] self.mac = user_input[CONF_MAC] self.model = user_input.get(CONF_MODEL) return (await self.async_step_reauth_confirm())
async def async_step_reauth_confirm(self, user_input=None): 'Dialog that informs the user that reauth is required.' if (user_input is not None): return (await self.async_step_cloud()) return self.async_show_form(step_id='reauth_confirm', data_schema=vol.Schema({}))
-3,886,696,658,973,102,600
Dialog that informs the user that reauth is required.
homeassistant/components/xiaomi_miio/config_flow.py
async_step_reauth_confirm
0xFEEDC0DE64/homeassistant-core
python
async def async_step_reauth_confirm(self, user_input=None): if (user_input is not None): return (await self.async_step_cloud()) return self.async_show_form(step_id='reauth_confirm', data_schema=vol.Schema({}))
async def async_step_import(self, conf: dict): 'Import a configuration from config.yaml.' self.host = conf[CONF_HOST] self.token = conf[CONF_TOKEN] self.name = conf.get(CONF_NAME) self.model = conf.get(CONF_MODEL) self.context.update({'title_placeholders': {'name': f'YAML import {self.host}'}}) ...
1,010,408,588,209,126,900
Import a configuration from config.yaml.
homeassistant/components/xiaomi_miio/config_flow.py
async_step_import
0xFEEDC0DE64/homeassistant-core
python
async def async_step_import(self, conf: dict): self.host = conf[CONF_HOST] self.token = conf[CONF_TOKEN] self.name = conf.get(CONF_NAME) self.model = conf.get(CONF_MODEL) self.context.update({'title_placeholders': {'name': f'YAML import {self.host}'}}) return (await self.async_step_connect(...
async def async_step_user(self, user_input=None): 'Handle a flow initialized by the user.' return (await self.async_step_cloud())
3,497,861,031,134,423,000
Handle a flow initialized by the user.
homeassistant/components/xiaomi_miio/config_flow.py
async_step_user
0xFEEDC0DE64/homeassistant-core
python
async def async_step_user(self, user_input=None): return (await self.async_step_cloud())
async def async_step_zeroconf(self, discovery_info): 'Handle zeroconf discovery.' name = discovery_info.get('name') self.host = discovery_info.get('host') self.mac = discovery_info.get('properties', {}).get('mac') if (self.mac is None): poch = discovery_info.get('properties', {}).get('poch',...
6,474,276,426,894,509,000
Handle zeroconf discovery.
homeassistant/components/xiaomi_miio/config_flow.py
async_step_zeroconf
0xFEEDC0DE64/homeassistant-core
python
async def async_step_zeroconf(self, discovery_info): name = discovery_info.get('name') self.host = discovery_info.get('host') self.mac = discovery_info.get('properties', {}).get('mac') if (self.mac is None): poch = discovery_info.get('properties', {}).get('poch', ) result = search('...
def extract_cloud_info(self, cloud_device_info): 'Extract the cloud info.' if (self.host is None): self.host = cloud_device_info['localip'] if (self.mac is None): self.mac = format_mac(cloud_device_info['mac']) if (self.model is None): self.model = cloud_device_info['model'] ...
1,728,987,662,477,281,300
Extract the cloud info.
homeassistant/components/xiaomi_miio/config_flow.py
extract_cloud_info
0xFEEDC0DE64/homeassistant-core
python
def extract_cloud_info(self, cloud_device_info): if (self.host is None): self.host = cloud_device_info['localip'] if (self.mac is None): self.mac = format_mac(cloud_device_info['mac']) if (self.model is None): self.model = cloud_device_info['model'] if (self.name is None): ...
async def async_step_cloud(self, user_input=None): 'Configure a xiaomi miio device through the Miio Cloud.' errors = {} if (user_input is not None): if user_input[CONF_MANUAL]: return (await self.async_step_manual()) cloud_username = user_input.get(CONF_CLOUD_USERNAME) cl...
-5,096,489,469,025,828,000
Configure a xiaomi miio device through the Miio Cloud.
homeassistant/components/xiaomi_miio/config_flow.py
async_step_cloud
0xFEEDC0DE64/homeassistant-core
python
async def async_step_cloud(self, user_input=None): errors = {} if (user_input is not None): if user_input[CONF_MANUAL]: return (await self.async_step_manual()) cloud_username = user_input.get(CONF_CLOUD_USERNAME) cloud_password = user_input.get(CONF_CLOUD_PASSWORD) ...
async def async_step_select(self, user_input=None): 'Handle multiple cloud devices found.' errors = {} if (user_input is not None): cloud_device = self.cloud_devices[user_input['select_device']] self.extract_cloud_info(cloud_device) return (await self.async_step_connect()) select...
5,268,307,135,454,738,000
Handle multiple cloud devices found.
homeassistant/components/xiaomi_miio/config_flow.py
async_step_select
0xFEEDC0DE64/homeassistant-core
python
async def async_step_select(self, user_input=None): errors = {} if (user_input is not None): cloud_device = self.cloud_devices[user_input['select_device']] self.extract_cloud_info(cloud_device) return (await self.async_step_connect()) select_schema = vol.Schema({vol.Required('se...
async def async_step_manual(self, user_input=None): 'Configure a xiaomi miio device Manually.' errors = {} if (user_input is not None): self.token = user_input[CONF_TOKEN] if user_input.get(CONF_HOST): self.host = user_input[CONF_HOST] return (await self.async_step_connec...
362,390,456,201,465,700
Configure a xiaomi miio device Manually.
homeassistant/components/xiaomi_miio/config_flow.py
async_step_manual
0xFEEDC0DE64/homeassistant-core
python
async def async_step_manual(self, user_input=None): errors = {} if (user_input is not None): self.token = user_input[CONF_TOKEN] if user_input.get(CONF_HOST): self.host = user_input[CONF_HOST] return (await self.async_step_connect()) if self.host: schema = vo...
async def async_step_connect(self, user_input=None): 'Connect to a xiaomi miio device.' errors = {} if ((self.host is None) or (self.token is None)): return self.async_abort(reason='incomplete_info') if (user_input is not None): self.model = user_input[CONF_MODEL] connect_device_clas...
-748,321,618,283,200,400
Connect to a xiaomi miio device.
homeassistant/components/xiaomi_miio/config_flow.py
async_step_connect
0xFEEDC0DE64/homeassistant-core
python
async def async_step_connect(self, user_input=None): errors = {} if ((self.host is None) or (self.token is None)): return self.async_abort(reason='incomplete_info') if (user_input is not None): self.model = user_input[CONF_MODEL] connect_device_class = ConnectXiaomiDevice(self.hass)...
def is_jpeg(data): "\n Check whether a bytes object (or similar) contains JPEG (JFIF) data.\n Returns False for truncated files.\n Taken from simplejpeg.is_jpeg, but less strict because it doesn't check EOI, as most JPEG viewers don't really throw error for missing EOI.\n\n :param data: JPEG (JFIF) data...
4,500,547,273,639,981,600
Check whether a bytes object (or similar) contains JPEG (JFIF) data. Returns False for truncated files. Taken from simplejpeg.is_jpeg, but less strict because it doesn't check EOI, as most JPEG viewers don't really throw error for missing EOI. :param data: JPEG (JFIF) data :return: True if JPEG
src/gulpio2/fileio.py
is_jpeg
kiyoon/GulpIO2
python
def is_jpeg(data): "\n Check whether a bytes object (or similar) contains JPEG (JFIF) data.\n Returns False for truncated files.\n Taken from simplejpeg.is_jpeg, but less strict because it doesn't check EOI, as most JPEG viewers don't really throw error for missing EOI.\n\n :param data: JPEG (JFIF) data...
def calculate_chunk_slices(items_per_chunk, num_items): 'Calculate slices for indexing an adapter.\n\n Parameters\n ----------\n items_per_chunk: int\n Approximate number of items per chunk.\n num_items: int\n Total number of items.\n\n Returns\n -------\n list of slices\n\n ' ...
-1,868,767,188,175,562,800
Calculate slices for indexing an adapter. Parameters ---------- items_per_chunk: int Approximate number of items per chunk. num_items: int Total number of items. Returns ------- list of slices
src/gulpio2/fileio.py
calculate_chunk_slices
kiyoon/GulpIO2
python
def calculate_chunk_slices(items_per_chunk, num_items): 'Calculate slices for indexing an adapter.\n\n Parameters\n ----------\n items_per_chunk: int\n Approximate number of items per chunk.\n num_items: int\n Total number of items.\n\n Returns\n -------\n list of slices\n\n ' ...
def chunks(self): ' Return a generator over existing GulpChunk objects which are ready\n to be opened and read from. ' return self.__iter__()
3,609,108,842,850,875,400
Return a generator over existing GulpChunk objects which are ready to be opened and read from.
src/gulpio2/fileio.py
chunks
kiyoon/GulpIO2
python
def chunks(self): ' Return a generator over existing GulpChunk objects which are ready\n to be opened and read from. ' return self.__iter__()
def new_chunks(self, total_new_chunks): ' Return a generator over freshly setup GulpChunk objects which are ready\n to be opened and written to.\n\n Parameters\n ----------\n total_new_chunks: int\n The total number of new chunks to initialize.\n ' return (GulpChunk...
6,015,641,194,201,491,000
Return a generator over freshly setup GulpChunk objects which are ready to be opened and written to. Parameters ---------- total_new_chunks: int The total number of new chunks to initialize.
src/gulpio2/fileio.py
new_chunks
kiyoon/GulpIO2
python
def new_chunks(self, total_new_chunks): ' Return a generator over freshly setup GulpChunk objects which are ready\n to be opened and written to.\n\n Parameters\n ----------\n total_new_chunks: int\n The total number of new chunks to initialize.\n ' return (GulpChunk...
@contextmanager def open(self, flag='rb'): "Open the gulp chunk for reading.\n\n Parameters\n ----------\n flag: str\n 'rb': Read binary\n 'wb': Write binary\n 'ab': Append to binary\n\n Notes\n -----\n Works as a context manager but returns...
-4,415,841,470,561,487,000
Open the gulp chunk for reading. Parameters ---------- flag: str 'rb': Read binary 'wb': Write binary 'ab': Append to binary Notes ----- Works as a context manager but returns None.
src/gulpio2/fileio.py
open
kiyoon/GulpIO2
python
@contextmanager def open(self, flag='rb'): "Open the gulp chunk for reading.\n\n Parameters\n ----------\n flag: str\n 'rb': Read binary\n 'wb': Write binary\n 'ab': Append to binary\n\n Notes\n -----\n Works as a context manager but returns...
def flush(self): 'Flush all buffers and write the meta file.' self.fp.flush() self.serializer.dump(self.meta_dict, self.meta_file_path)
9,160,402,057,853,548,000
Flush all buffers and write the meta file.
src/gulpio2/fileio.py
flush
kiyoon/GulpIO2
python
def flush(self): self.fp.flush() self.serializer.dump(self.meta_dict, self.meta_file_path)
def append(self, id_, meta_data, frames, jpeg_encode_quality=_DEFAULT_JPEG_QUALITY): ' Append an item to the gulp.\n\n Parameters\n ----------\n id_ : str\n The ID of the item\n meta_data: dict\n The meta-data associated with the item.\n frames: list of numpy...
4,820,802,838,144,094,000
Append an item to the gulp. Parameters ---------- id_ : str The ID of the item meta_data: dict The meta-data associated with the item. frames: list of numpy arrays The frames of the item as a list of numpy dictionaries consisting of image pixel values.
src/gulpio2/fileio.py
append
kiyoon/GulpIO2
python
def append(self, id_, meta_data, frames, jpeg_encode_quality=_DEFAULT_JPEG_QUALITY): ' Append an item to the gulp.\n\n Parameters\n ----------\n id_ : str\n The ID of the item\n meta_data: dict\n The meta-data associated with the item.\n frames: list of numpy...
def read_frames(self, id_, slice_=None): ' Read frames for a single item.\n\n Parameters\n ----------\n id_: str\n The ID of the item\n slice_: slice or list of ints:\n A slice or list of indices with which to select frames.\n\n Returns\n -------\n ...
-7,096,632,636,170,711,000
Read frames for a single item. Parameters ---------- id_: str The ID of the item slice_: slice or list of ints: A slice or list of indices with which to select frames. Returns ------- frames (int), meta(dict) The frames of the item as a list of numpy arrays consisting of image pixel values. And the me...
src/gulpio2/fileio.py
read_frames
kiyoon/GulpIO2
python
def read_frames(self, id_, slice_=None): ' Read frames for a single item.\n\n Parameters\n ----------\n id_: str\n The ID of the item\n slice_: slice or list of ints:\n A slice or list of indices with which to select frames.\n\n Returns\n -------\n ...
def iter_all(self, accepted_ids=None, shuffle=False): ' Iterate over all frames in the gulp.\n\n Parameters\n ----------\n accepted_ids: list of str\n A filter for accepted ids.\n shuffle: bool\n Shuffle the items or not.\n\n Returns\n -------\n ...
3,772,652,658,498,743,000
Iterate over all frames in the gulp. Parameters ---------- accepted_ids: list of str A filter for accepted ids. shuffle: bool Shuffle the items or not. Returns ------- iterator An iterator that yield a series of frames,meta tuples. See `read_frames` for details.
src/gulpio2/fileio.py
iter_all
kiyoon/GulpIO2
python
def iter_all(self, accepted_ids=None, shuffle=False): ' Iterate over all frames in the gulp.\n\n Parameters\n ----------\n accepted_ids: list of str\n A filter for accepted ids.\n shuffle: bool\n Shuffle the items or not.\n\n Returns\n -------\n ...
def write_chunk(self, output_chunk, input_slice): 'Write from an input slice in the adapter to an output chunk.\n\n Parameters\n ----------\n output_chunk: GulpChunk\n The chunk to write to\n input_slice: slice\n The slice to use from the adapter.\n\n ' wit...
-3,292,202,568,721,897,000
Write from an input slice in the adapter to an output chunk. Parameters ---------- output_chunk: GulpChunk The chunk to write to input_slice: slice The slice to use from the adapter.
src/gulpio2/fileio.py
write_chunk
kiyoon/GulpIO2
python
def write_chunk(self, output_chunk, input_slice): 'Write from an input slice in the adapter to an output chunk.\n\n Parameters\n ----------\n output_chunk: GulpChunk\n The chunk to write to\n input_slice: slice\n The slice to use from the adapter.\n\n ' wit...
def __init__(self, gansynth_subset=False, estimate_f0_and_loudness=False, **kwargs): 'Constructs a NsynthConfig.\n\n Args:\n gansynth_subset: bool, whether to use the subset of the dataset introduced\n in the ICLR 2019 GANSynth paper (Engel, et al. 2018). This subset uses\n acoustic-only instr...
-1,277,827,415,216,770,300
Constructs a NsynthConfig. Args: gansynth_subset: bool, whether to use the subset of the dataset introduced in the ICLR 2019 GANSynth paper (Engel, et al. 2018). This subset uses acoustic-only instrument sources and limits the pitches to the interval [24, 84]. The train and test splits are also modified ...
tensorflow_datasets/audio/nsynth.py
__init__
Alex-Fabbri/datasets
python
def __init__(self, gansynth_subset=False, estimate_f0_and_loudness=False, **kwargs): 'Constructs a NsynthConfig.\n\n Args:\n gansynth_subset: bool, whether to use the subset of the dataset introduced\n in the ICLR 2019 GANSynth paper (Engel, et al. 2018). This subset uses\n acoustic-only instr...
def _split_generators(self, dl_manager): 'Returns splits.' dl_urls = {} dl_urls['examples'] = {split: (_BASE_DOWNLOAD_PATH + ('%s.tfrecord.tar' % split)) for split in _SPLITS} dl_urls['instrument_labels'] = (_BASE_DOWNLOAD_PATH + 'instrument_labels.txt') if self.builder_config.gansynth_subset: ...
2,251,434,939,515,742,500
Returns splits.
tensorflow_datasets/audio/nsynth.py
_split_generators
Alex-Fabbri/datasets
python
def _split_generators(self, dl_manager): dl_urls = {} dl_urls['examples'] = {split: (_BASE_DOWNLOAD_PATH + ('%s.tfrecord.tar' % split)) for split in _SPLITS} dl_urls['instrument_labels'] = (_BASE_DOWNLOAD_PATH + 'instrument_labels.txt') if self.builder_config.gansynth_subset: dl_urls['gansy...
def _build_pcollection(self, pipeline, tfrecord_dirs, ids, split): 'Build PCollection of examples for split.' beam = tfds.core.lazy_imports.apache_beam def _emit_base_example(ex): 'Maps an input example to a TFDS example.' beam.metrics.Metrics.counter(split, 'base-examples').inc() f...
1,458,585,263,117,671,200
Build PCollection of examples for split.
tensorflow_datasets/audio/nsynth.py
_build_pcollection
Alex-Fabbri/datasets
python
def _build_pcollection(self, pipeline, tfrecord_dirs, ids, split): beam = tfds.core.lazy_imports.apache_beam def _emit_base_example(ex): 'Maps an input example to a TFDS example.' beam.metrics.Metrics.counter(split, 'base-examples').inc() features = ex.features.feature retu...
def _emit_base_example(ex): 'Maps an input example to a TFDS example.' beam.metrics.Metrics.counter(split, 'base-examples').inc() features = ex.features.feature return {'id': features['note_str'].bytes_list.value[0], 'audio': np.array(features['audio'].float_list.value, dtype=np.float32), 'pitch': featu...
4,464,020,363,926,044,700
Maps an input example to a TFDS example.
tensorflow_datasets/audio/nsynth.py
_emit_base_example
Alex-Fabbri/datasets
python
def _emit_base_example(ex): beam.metrics.Metrics.counter(split, 'base-examples').inc() features = ex.features.feature return {'id': features['note_str'].bytes_list.value[0], 'audio': np.array(features['audio'].float_list.value, dtype=np.float32), 'pitch': features['pitch'].int64_list.value[0], 'velocit...
def _estimate_f0(ex): 'Estimate the fundamental frequency using CREPE and add to example.' ex = ex.copy() beam.metrics.Metrics.counter(split, 'estimate-f0').inc() (_, f0_hz, f0_confidence, _) = tfds.core.lazy_imports.crepe.predict(ex['audio'], sr=_AUDIO_RATE, viterbi=True, step_size=(1000 / _F0_AND_LOUD...
6,520,584,630,848,258,000
Estimate the fundamental frequency using CREPE and add to example.
tensorflow_datasets/audio/nsynth.py
_estimate_f0
Alex-Fabbri/datasets
python
def _estimate_f0(ex): ex = ex.copy() beam.metrics.Metrics.counter(split, 'estimate-f0').inc() (_, f0_hz, f0_confidence, _) = tfds.core.lazy_imports.crepe.predict(ex['audio'], sr=_AUDIO_RATE, viterbi=True, step_size=(1000 / _F0_AND_LOUDNESS_RATE), verbose=0) f0_midi = tfds.core.lazy_imports.librosa....
def _compute_loudness(ex): 'Compute loudness and add to example.' ex = ex.copy() beam.metrics.Metrics.counter(split, 'compute-loudness').inc() librosa = tfds.core.lazy_imports.librosa n_fft = 2048 amin = 1e-15 top_db = 200.0 stft = librosa.stft(ex['audio'], n_fft=n_fft, hop_length=int((_...
8,235,905,811,359,947,000
Compute loudness and add to example.
tensorflow_datasets/audio/nsynth.py
_compute_loudness
Alex-Fabbri/datasets
python
def _compute_loudness(ex): ex = ex.copy() beam.metrics.Metrics.counter(split, 'compute-loudness').inc() librosa = tfds.core.lazy_imports.librosa n_fft = 2048 amin = 1e-15 top_db = 200.0 stft = librosa.stft(ex['audio'], n_fft=n_fft, hop_length=int((_AUDIO_RATE // _F0_AND_LOUDNESS_RATE)))...
def validate_k8s_version(namespace): 'Validates a string as a possible Kubernetes version. An empty string is also valid, which tells the server\n to use its default version.' if namespace.kubernetes_version: k8s_release_regex = re.compile('^[v|V]?(\\d+\\.\\d+\\.\\d+.*)$') found = k8s_release...
4,560,851,881,821,565,000
Validates a string as a possible Kubernetes version. An empty string is also valid, which tells the server to use its default version.
src/aks-preview/azext_aks_preview/_validators.py
validate_k8s_version
andyzhangx/azure-cli-extensions
python
def validate_k8s_version(namespace): 'Validates a string as a possible Kubernetes version. An empty string is also valid, which tells the server\n to use its default version.' if namespace.kubernetes_version: k8s_release_regex = re.compile('^[v|V]?(\\d+\\.\\d+\\.\\d+.*)$') found = k8s_release...
def validate_linux_host_name(namespace): "Validates a string as a legal host name component.\n\n This validation will also occur server-side in the ARM API, but that may take\n a minute or two before the user sees it. So it's more user-friendly to validate\n in the CLI pre-flight.\n " rfc1123_regex ...
9,058,301,189,045,302,000
Validates a string as a legal host name component. This validation will also occur server-side in the ARM API, but that may take a minute or two before the user sees it. So it's more user-friendly to validate in the CLI pre-flight.
src/aks-preview/azext_aks_preview/_validators.py
validate_linux_host_name
andyzhangx/azure-cli-extensions
python
def validate_linux_host_name(namespace): "Validates a string as a legal host name component.\n\n This validation will also occur server-side in the ARM API, but that may take\n a minute or two before the user sees it. So it's more user-friendly to validate\n in the CLI pre-flight.\n " rfc1123_regex ...
def validate_max_pods(namespace): 'Validates that max_pods is set to a reasonable minimum number.' minimum_pods_required = ceil(((((namespace.node_count * 2) + 6) + 1) / namespace.node_count)) if ((namespace.max_pods != 0) and (namespace.max_pods < minimum_pods_required)): raise CLIError('--max-pods...
7,976,692,459,901,999,000
Validates that max_pods is set to a reasonable minimum number.
src/aks-preview/azext_aks_preview/_validators.py
validate_max_pods
andyzhangx/azure-cli-extensions
python
def validate_max_pods(namespace): minimum_pods_required = ceil(((((namespace.node_count * 2) + 6) + 1) / namespace.node_count)) if ((namespace.max_pods != 0) and (namespace.max_pods < minimum_pods_required)): raise CLIError('--max-pods must be at least {} for a managed Kubernetes cluster to functio...
def validate_nodes_count(namespace): 'Validate that min_count and max_count is set to 1-100' if (namespace.min_count is not None): if ((namespace.min_count < 1) or (namespace.min_count > 100)): raise CLIError('--min-count must be in the range [1,100]') if (namespace.max_count is not None...
4,935,573,627,725,259,000
Validate that min_count and max_count is set to 1-100
src/aks-preview/azext_aks_preview/_validators.py
validate_nodes_count
andyzhangx/azure-cli-extensions
python
def validate_nodes_count(namespace): if (namespace.min_count is not None): if ((namespace.min_count < 1) or (namespace.min_count > 100)): raise CLIError('--min-count must be in the range [1,100]') if (namespace.max_count is not None): if ((namespace.max_count < 1) or (namespace....
def validate_nodepool_name(namespace): 'Validates a nodepool name to be at most 12 characters, alphanumeric only.' if (namespace.nodepool_name != ''): if (len(namespace.nodepool_name) > 12): raise CLIError('--nodepool-name can contain atmost 12 characters') if (not namespace.nodepool...
-4,239,464,942,452,206,600
Validates a nodepool name to be at most 12 characters, alphanumeric only.
src/aks-preview/azext_aks_preview/_validators.py
validate_nodepool_name
andyzhangx/azure-cli-extensions
python
def validate_nodepool_name(namespace): if (namespace.nodepool_name != ): if (len(namespace.nodepool_name) > 12): raise CLIError('--nodepool-name can contain atmost 12 characters') if (not namespace.nodepool_name.isalnum()): raise CLIError('--nodepool-name should only con...
def validate_vm_set_type(namespace): 'Validates the vm set type string.' if (namespace.vm_set_type is not None): if (namespace.vm_set_type == ''): return if ((namespace.vm_set_type.lower() != 'availabilityset') and (namespace.vm_set_type.lower() != 'virtualmachinescalesets')): ...
4,283,648,957,399,007,000
Validates the vm set type string.
src/aks-preview/azext_aks_preview/_validators.py
validate_vm_set_type
andyzhangx/azure-cli-extensions
python
def validate_vm_set_type(namespace): if (namespace.vm_set_type is not None): if (namespace.vm_set_type == ): return if ((namespace.vm_set_type.lower() != 'availabilityset') and (namespace.vm_set_type.lower() != 'virtualmachinescalesets')): raise CLIError('--vm-set-type c...
def validate_load_balancer_sku(namespace): 'Validates the load balancer sku string.' if (namespace.load_balancer_sku is not None): if (namespace.load_balancer_sku == ''): return if ((namespace.load_balancer_sku.lower() != 'basic') and (namespace.load_balancer_sku.lower() != 'standard...
214,954,928,562,401,760
Validates the load balancer sku string.
src/aks-preview/azext_aks_preview/_validators.py
validate_load_balancer_sku
andyzhangx/azure-cli-extensions
python
def validate_load_balancer_sku(namespace): if (namespace.load_balancer_sku is not None): if (namespace.load_balancer_sku == ): return if ((namespace.load_balancer_sku.lower() != 'basic') and (namespace.load_balancer_sku.lower() != 'standard')): raise CLIError('--load-bal...
def validate_load_balancer_outbound_ips(namespace): 'validate load balancer profile outbound IP ids' if (namespace.load_balancer_outbound_ips is not None): ip_id_list = [x.strip() for x in namespace.load_balancer_outbound_ips.split(',')] if (not all(ip_id_list)): raise CLIError('--lo...
5,513,461,929,437,336,000
validate load balancer profile outbound IP ids
src/aks-preview/azext_aks_preview/_validators.py
validate_load_balancer_outbound_ips
andyzhangx/azure-cli-extensions
python
def validate_load_balancer_outbound_ips(namespace): if (namespace.load_balancer_outbound_ips is not None): ip_id_list = [x.strip() for x in namespace.load_balancer_outbound_ips.split(',')] if (not all(ip_id_list)): raise CLIError('--load-balancer-outbound-ips cannot contain whitespa...
def validate_load_balancer_outbound_ip_prefixes(namespace): 'validate load balancer profile outbound IP prefix ids' if (namespace.load_balancer_outbound_ip_prefixes is not None): ip_prefix_id_list = [x.strip() for x in namespace.load_balancer_outbound_ip_prefixes.split(',')] if (not all(ip_prefi...
1,773,393,025,881,589,000
validate load balancer profile outbound IP prefix ids
src/aks-preview/azext_aks_preview/_validators.py
validate_load_balancer_outbound_ip_prefixes
andyzhangx/azure-cli-extensions
python
def validate_load_balancer_outbound_ip_prefixes(namespace): if (namespace.load_balancer_outbound_ip_prefixes is not None): ip_prefix_id_list = [x.strip() for x in namespace.load_balancer_outbound_ip_prefixes.split(',')] if (not all(ip_prefix_id_list)): raise CLIError('--load-balance...
def validate_taints(namespace): 'Validates that provided taint is a valid format' regex = re.compile('^[a-zA-Z\\d][\\w\\-\\.\\/]{0,252}=[a-zA-Z\\d][\\w\\-\\.]{0,62}:(NoSchedule|PreferNoSchedule|NoExecute)$') if ((namespace.node_taints is not None) and (namespace.node_taints != '')): for taint in nam...
3,300,243,401,317,772,000
Validates that provided taint is a valid format
src/aks-preview/azext_aks_preview/_validators.py
validate_taints
andyzhangx/azure-cli-extensions
python
def validate_taints(namespace): regex = re.compile('^[a-zA-Z\\d][\\w\\-\\.\\/]{0,252}=[a-zA-Z\\d][\\w\\-\\.]{0,62}:(NoSchedule|PreferNoSchedule|NoExecute)$') if ((namespace.node_taints is not None) and (namespace.node_taints != )): for taint in namespace.node_taints.split(','): if (tain...
def validate_priority(namespace): 'Validates the node pool priority string.' if (namespace.priority is not None): if (namespace.priority == ''): return if ((namespace.priority != 'Low') and (namespace.priority != 'Regular')): raise CLIError('--priority can only be Low or ...
7,004,494,543,943,205,000
Validates the node pool priority string.
src/aks-preview/azext_aks_preview/_validators.py
validate_priority
andyzhangx/azure-cli-extensions
python
def validate_priority(namespace): if (namespace.priority is not None): if (namespace.priority == ): return if ((namespace.priority != 'Low') and (namespace.priority != 'Regular')): raise CLIError('--priority can only be Low or Regular')
def validate_eviction_policy(namespace): 'Validates the node pool priority string.' if (namespace.eviction_policy is not None): if (namespace.eviction_policy == ''): return if ((namespace.eviction_policy != 'Delete') and (namespace.eviction_policy != 'Deallocate')): raise...
-8,553,922,939,024,618,000
Validates the node pool priority string.
src/aks-preview/azext_aks_preview/_validators.py
validate_eviction_policy
andyzhangx/azure-cli-extensions
python
def validate_eviction_policy(namespace): if (namespace.eviction_policy is not None): if (namespace.eviction_policy == ): return if ((namespace.eviction_policy != 'Delete') and (namespace.eviction_policy != 'Deallocate')): raise CLIError('--eviction-policy can only be Del...
def _num_frame_valid(nsp_src, nsp_win, len_hop): "Computes the number of frames with 'valid' setting" return ((nsp_src - (nsp_win - len_hop)) // len_hop)
-5,105,235,960,667,779,000
Computes the number of frames with 'valid' setting
tests/test_time_frequency.py
_num_frame_valid
Path-A/kapre
python
def _num_frame_valid(nsp_src, nsp_win, len_hop): return ((nsp_src - (nsp_win - len_hop)) // len_hop)
def _num_frame_same(nsp_src, len_hop): "Computes the number of frames with 'same' setting" return int(np.ceil((float(nsp_src) / len_hop)))
-5,171,118,155,236,767,000
Computes the number of frames with 'same' setting
tests/test_time_frequency.py
_num_frame_same
Path-A/kapre
python
def _num_frame_same(nsp_src, len_hop): return int(np.ceil((float(nsp_src) / len_hop)))
def allclose_phase(a, b, atol=0.001): 'Testing phase.\n Remember that a small error in complex value may lead to a large phase difference\n if the norm is very small.\n\n Therefore, it makes more sense to test it on the complex value itself rather than breaking it down to phase.\n\n ' np.testing.ass...
6,064,070,407,929,880,000
Testing phase. Remember that a small error in complex value may lead to a large phase difference if the norm is very small. Therefore, it makes more sense to test it on the complex value itself rather than breaking it down to phase.
tests/test_time_frequency.py
allclose_phase
Path-A/kapre
python
def allclose_phase(a, b, atol=0.001): 'Testing phase.\n Remember that a small error in complex value may lead to a large phase difference\n if the norm is very small.\n\n Therefore, it makes more sense to test it on the complex value itself rather than breaking it down to phase.\n\n ' np.testing.ass...
@pytest.mark.parametrize('n_fft', [512]) @pytest.mark.parametrize('sr', [22050]) @pytest.mark.parametrize('hop_length', [None, 256]) @pytest.mark.parametrize('n_ch', [2]) @pytest.mark.parametrize('data_format', ['default', 'channels_first', 'channels_last']) @pytest.mark.parametrize('amin', [1e-05, 0.001]) @pytest.mark...
9,109,858,188,567,050,000
Test the correctness of melspectrogram. Note that mel filterbank is tested separated
tests/test_time_frequency.py
test_melspectrogram_correctness
Path-A/kapre
python
@pytest.mark.parametrize('n_fft', [512]) @pytest.mark.parametrize('sr', [22050]) @pytest.mark.parametrize('hop_length', [None, 256]) @pytest.mark.parametrize('n_ch', [2]) @pytest.mark.parametrize('data_format', ['default', 'channels_first', 'channels_last']) @pytest.mark.parametrize('amin', [1e-05, 0.001]) @pytest.mark...
@pytest.mark.parametrize('data_format', ['default', 'channels_first', 'channels_last']) def test_log_spectrogram_runnable(data_format): 'test if log spectrogram layer works well' (src_mono, batch_src, input_shape) = get_audio(data_format=data_format, n_ch=1) _ = get_log_frequency_spectrogram_layer(input_sha...
2,736,683,118,145,581,600
test if log spectrogram layer works well
tests/test_time_frequency.py
test_log_spectrogram_runnable
Path-A/kapre
python
@pytest.mark.parametrize('data_format', ['default', 'channels_first', 'channels_last']) def test_log_spectrogram_runnable(data_format): (src_mono, batch_src, input_shape) = get_audio(data_format=data_format, n_ch=1) _ = get_log_frequency_spectrogram_layer(input_shape, return_decibel=True) _ = get_log_f...
@pytest.mark.xfail def test_log_spectrogram_fail(): 'test if log spectrogram layer works well' (src_mono, batch_src, input_shape) = get_audio(data_format='channels_last', n_ch=1) _ = get_log_frequency_spectrogram_layer(input_shape, return_decibel=True, log_n_bins=200)
-2,335,011,064,550,476,300
test if log spectrogram layer works well
tests/test_time_frequency.py
test_log_spectrogram_fail
Path-A/kapre
python
@pytest.mark.xfail def test_log_spectrogram_fail(): (src_mono, batch_src, input_shape) = get_audio(data_format='channels_last', n_ch=1) _ = get_log_frequency_spectrogram_layer(input_shape, return_decibel=True, log_n_bins=200)
def test_delta(): 'test delta layer' specgrams = np.array([1.0, 2.0, 3.0, 4.0], dtype=np.float32) specgrams = np.reshape(specgrams, (1, (- 1), 1, 1)) delta_model = tensorflow.keras.models.Sequential() delta_model.add(Delta(win_length=3, input_shape=(4, 1, 1), data_format='channels_last')) delta_...
-849,587,254,323,033,900
test delta layer
tests/test_time_frequency.py
test_delta
Path-A/kapre
python
def test_delta(): specgrams = np.array([1.0, 2.0, 3.0, 4.0], dtype=np.float32) specgrams = np.reshape(specgrams, (1, (- 1), 1, 1)) delta_model = tensorflow.keras.models.Sequential() delta_model.add(Delta(win_length=3, input_shape=(4, 1, 1), data_format='channels_last')) delta_kapre = delta_mode...
def test_save_load(): 'test saving/loading of models that has stft, melspectorgrma, and log frequency.' (src_mono, batch_src, input_shape) = get_audio(data_format='channels_last', n_ch=1) save_load_compare(STFT(input_shape=input_shape, pad_begin=True), batch_src, allclose_complex_numbers) save_load_comp...
-2,395,560,271,028,600,300
test saving/loading of models that has stft, melspectorgrma, and log frequency.
tests/test_time_frequency.py
test_save_load
Path-A/kapre
python
def test_save_load(): (src_mono, batch_src, input_shape) = get_audio(data_format='channels_last', n_ch=1) save_load_compare(STFT(input_shape=input_shape, pad_begin=True), batch_src, allclose_complex_numbers) save_load_compare(get_melspectrogram_layer(input_shape=input_shape, return_decibel=True), batch...
def round_to_memory_units(memory_bytes, round_up): 'Round bytes to the nearest memory unit.' return from_memory_units(to_memory_units(memory_bytes, round_up))
-2,739,755,447,883,276,300
Round bytes to the nearest memory unit.
python/ray/ray_constants.py
round_to_memory_units
stephanie-wang/ray
python
def round_to_memory_units(memory_bytes, round_up): return from_memory_units(to_memory_units(memory_bytes, round_up))
def from_memory_units(memory_units): 'Convert from memory units -> bytes.' return (memory_units * MEMORY_RESOURCE_UNIT_BYTES)
-8,630,025,388,805,738,000
Convert from memory units -> bytes.
python/ray/ray_constants.py
from_memory_units
stephanie-wang/ray
python
def from_memory_units(memory_units): return (memory_units * MEMORY_RESOURCE_UNIT_BYTES)