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 test_start_stop_gateway(self):
'Test start and stop of MQTT gateway.'
self.assertFalse(self.gateway.is_alive())
sensor = self._add_sensor(1)
sensor.children[1] = ChildSensor(1, self.gateway.const.Presentation.S_HUM)
sensor.children[1].values[self.gateway.const.SetReq.V_HUM] = '20'
self.gatew... | 6,097,585,171,282,758,000 | Test start and stop of MQTT gateway. | tests/test_gateway_mqtt.py | test_start_stop_gateway | jslove/pymysensors | python | def test_start_stop_gateway(self):
self.assertFalse(self.gateway.is_alive())
sensor = self._add_sensor(1)
sensor.children[1] = ChildSensor(1, self.gateway.const.Presentation.S_HUM)
sensor.children[1].values[self.gateway.const.SetReq.V_HUM] = '20'
self.gateway.recv('/1/1/2/0/1', , 0)
self.ga... |
def test_mqtt_load_persistence(self):
'Test load persistence file for MQTTGateway.'
sensor = self._add_sensor(1)
sensor.children[1] = ChildSensor(1, self.gateway.const.Presentation.S_HUM)
sensor.children[1].values[self.gateway.const.SetReq.V_HUM] = '20'
with tempfile.TemporaryDirectory() as temp_dir... | 6,610,524,837,255,244,000 | Test load persistence file for MQTTGateway. | tests/test_gateway_mqtt.py | test_mqtt_load_persistence | jslove/pymysensors | python | def test_mqtt_load_persistence(self):
sensor = self._add_sensor(1)
sensor.children[1] = ChildSensor(1, self.gateway.const.Presentation.S_HUM)
sensor.children[1].values[self.gateway.const.SetReq.V_HUM] = '20'
with tempfile.TemporaryDirectory() as temp_dir:
self.gateway.persistence_file = os.... |
def setUp(self):
'Set up test.'
self.mock_pub = mock.Mock()
self.mock_sub = mock.Mock()
self.gateway = None | 4,819,394,504,927,349,000 | Set up test. | tests/test_gateway_mqtt.py | setUp | jslove/pymysensors | python | def setUp(self):
self.mock_pub = mock.Mock()
self.mock_sub = mock.Mock()
self.gateway = None |
def _setup(self, in_prefix, out_prefix):
'Set up gateway.'
self.gateway = MQTTGateway(self.mock_pub, self.mock_sub, in_prefix=in_prefix, out_prefix=out_prefix) | 4,104,366,467,906,981,400 | Set up gateway. | tests/test_gateway_mqtt.py | _setup | jslove/pymysensors | python | def _setup(self, in_prefix, out_prefix):
self.gateway = MQTTGateway(self.mock_pub, self.mock_sub, in_prefix=in_prefix, out_prefix=out_prefix) |
def _add_sensor(self, sensorid):
'Add sensor node. Return sensor node instance.'
self.gateway.sensors[sensorid] = Sensor(sensorid)
return self.gateway.sensors[sensorid] | 8,655,351,742,864,993,000 | Add sensor node. Return sensor node instance. | tests/test_gateway_mqtt.py | _add_sensor | jslove/pymysensors | python | def _add_sensor(self, sensorid):
self.gateway.sensors[sensorid] = Sensor(sensorid)
return self.gateway.sensors[sensorid] |
def test_nested_prefix(self):
'Test recv method with nested topic prefix.'
self._setup('test/test-in', 'test/test-out')
sensor = self._add_sensor(1)
sensor.children[1] = ChildSensor(1, self.gateway.const.Presentation.S_HUM)
sensor.children[1].values[self.gateway.const.SetReq.V_HUM] = '20'
self.g... | 5,369,771,523,001,334,000 | Test recv method with nested topic prefix. | tests/test_gateway_mqtt.py | test_nested_prefix | jslove/pymysensors | python | def test_nested_prefix(self):
self._setup('test/test-in', 'test/test-out')
sensor = self._add_sensor(1)
sensor.children[1] = ChildSensor(1, self.gateway.const.Presentation.S_HUM)
sensor.children[1].values[self.gateway.const.SetReq.V_HUM] = '20'
self.gateway.recv('test/test-in/1/1/2/0/1', , 0)
... |
def __init__(self, key=None, name=None, local_vars_configuration=None):
'IoCertManagerAcmeV1ChallengeSpecSolverDns01CloudflareApiTokenSecretRef - a model defined in OpenAPI'
if (local_vars_configuration is None):
local_vars_configuration = Configuration()
self.local_vars_configuration = local_vars_c... | 4,513,740,388,721,282,600 | IoCertManagerAcmeV1ChallengeSpecSolverDns01CloudflareApiTokenSecretRef - a model defined in OpenAPI | kubernetes/client/models/io_cert_manager_acme_v1_challenge_spec_solver_dns01_cloudflare_api_token_secret_ref.py | __init__ | mariusgheorghies/python | python | def __init__(self, key=None, name=None, local_vars_configuration=None):
if (local_vars_configuration is None):
local_vars_configuration = Configuration()
self.local_vars_configuration = local_vars_configuration
self._key = None
self._name = None
self.discriminator = None
if (key is ... |
@property
def key(self):
"Gets the key of this IoCertManagerAcmeV1ChallengeSpecSolverDns01CloudflareApiTokenSecretRef. # noqa: E501\n\n The key of the entry in the Secret resource's `data` field to be used. Some instances of this field may be defaulted, in others it may be required. # noqa: E501\n\n ... | 8,283,897,539,841,171,000 | Gets the key of this IoCertManagerAcmeV1ChallengeSpecSolverDns01CloudflareApiTokenSecretRef. # noqa: E501
The key of the entry in the Secret resource's `data` field to be used. Some instances of this field may be defaulted, in others it may be required. # noqa: E501
:return: The key of this IoCertManagerAcmeV1Chall... | kubernetes/client/models/io_cert_manager_acme_v1_challenge_spec_solver_dns01_cloudflare_api_token_secret_ref.py | key | mariusgheorghies/python | python | @property
def key(self):
"Gets the key of this IoCertManagerAcmeV1ChallengeSpecSolverDns01CloudflareApiTokenSecretRef. # noqa: E501\n\n The key of the entry in the Secret resource's `data` field to be used. Some instances of this field may be defaulted, in others it may be required. # noqa: E501\n\n ... |
@key.setter
def key(self, key):
"Sets the key of this IoCertManagerAcmeV1ChallengeSpecSolverDns01CloudflareApiTokenSecretRef.\n\n The key of the entry in the Secret resource's `data` field to be used. Some instances of this field may be defaulted, in others it may be required. # noqa: E501\n\n :param... | 705,367,206,117,233,400 | Sets the key of this IoCertManagerAcmeV1ChallengeSpecSolverDns01CloudflareApiTokenSecretRef.
The key of the entry in the Secret resource's `data` field to be used. Some instances of this field may be defaulted, in others it may be required. # noqa: E501
:param key: The key of this IoCertManagerAcmeV1ChallengeSpecSol... | kubernetes/client/models/io_cert_manager_acme_v1_challenge_spec_solver_dns01_cloudflare_api_token_secret_ref.py | key | mariusgheorghies/python | python | @key.setter
def key(self, key):
"Sets the key of this IoCertManagerAcmeV1ChallengeSpecSolverDns01CloudflareApiTokenSecretRef.\n\n The key of the entry in the Secret resource's `data` field to be used. Some instances of this field may be defaulted, in others it may be required. # noqa: E501\n\n :param... |
@property
def name(self):
'Gets the name of this IoCertManagerAcmeV1ChallengeSpecSolverDns01CloudflareApiTokenSecretRef. # noqa: E501\n\n Name of the resource being referred to. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names # noqa: E501\n\n :return: The na... | 2,245,093,184,130,805,800 | Gets the name of this IoCertManagerAcmeV1ChallengeSpecSolverDns01CloudflareApiTokenSecretRef. # noqa: E501
Name of the resource being referred to. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names # noqa: E501
:return: The name of this IoCertManagerAcmeV1ChallengeSpecSolverDn... | kubernetes/client/models/io_cert_manager_acme_v1_challenge_spec_solver_dns01_cloudflare_api_token_secret_ref.py | name | mariusgheorghies/python | python | @property
def name(self):
'Gets the name of this IoCertManagerAcmeV1ChallengeSpecSolverDns01CloudflareApiTokenSecretRef. # noqa: E501\n\n Name of the resource being referred to. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names # noqa: E501\n\n :return: The na... |
@name.setter
def name(self, name):
'Sets the name of this IoCertManagerAcmeV1ChallengeSpecSolverDns01CloudflareApiTokenSecretRef.\n\n Name of the resource being referred to. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names # noqa: E501\n\n :param name: The nam... | 4,718,289,652,447,560,000 | Sets the name of this IoCertManagerAcmeV1ChallengeSpecSolverDns01CloudflareApiTokenSecretRef.
Name of the resource being referred to. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names # noqa: E501
:param name: The name of this IoCertManagerAcmeV1ChallengeSpecSolverDns01Cloudfl... | kubernetes/client/models/io_cert_manager_acme_v1_challenge_spec_solver_dns01_cloudflare_api_token_secret_ref.py | name | mariusgheorghies/python | python | @name.setter
def name(self, name):
'Sets the name of this IoCertManagerAcmeV1ChallengeSpecSolverDns01CloudflareApiTokenSecretRef.\n\n Name of the resource being referred to. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names # noqa: E501\n\n :param name: The nam... |
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... | 8,442,519,487,048,767,000 | Returns the model properties as a dict | kubernetes/client/models/io_cert_manager_acme_v1_challenge_spec_solver_dns01_cloudflare_api_token_secret_ref.py | to_dict | mariusgheorghies/python | 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'
return pprint.pformat(self.to_dict()) | 5,849,158,643,760,736,000 | Returns the string representation of the model | kubernetes/client/models/io_cert_manager_acme_v1_challenge_spec_solver_dns01_cloudflare_api_token_secret_ref.py | to_str | mariusgheorghies/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` | kubernetes/client/models/io_cert_manager_acme_v1_challenge_spec_solver_dns01_cloudflare_api_token_secret_ref.py | __repr__ | mariusgheorghies/python | python | def __repr__(self):
return self.to_str() |
def __eq__(self, other):
'Returns true if both objects are equal'
if (not isinstance(other, IoCertManagerAcmeV1ChallengeSpecSolverDns01CloudflareApiTokenSecretRef)):
return False
return (self.to_dict() == other.to_dict()) | 3,029,111,975,764,075,000 | Returns true if both objects are equal | kubernetes/client/models/io_cert_manager_acme_v1_challenge_spec_solver_dns01_cloudflare_api_token_secret_ref.py | __eq__ | mariusgheorghies/python | python | def __eq__(self, other):
if (not isinstance(other, IoCertManagerAcmeV1ChallengeSpecSolverDns01CloudflareApiTokenSecretRef)):
return False
return (self.to_dict() == other.to_dict()) |
def __ne__(self, other):
'Returns true if both objects are not equal'
if (not isinstance(other, IoCertManagerAcmeV1ChallengeSpecSolverDns01CloudflareApiTokenSecretRef)):
return True
return (self.to_dict() != other.to_dict()) | 8,941,883,050,080,361,000 | Returns true if both objects are not equal | kubernetes/client/models/io_cert_manager_acme_v1_challenge_spec_solver_dns01_cloudflare_api_token_secret_ref.py | __ne__ | mariusgheorghies/python | python | def __ne__(self, other):
if (not isinstance(other, IoCertManagerAcmeV1ChallengeSpecSolverDns01CloudflareApiTokenSecretRef)):
return True
return (self.to_dict() != other.to_dict()) |
@abc.abstractmethod
def create_api_object(self, *args, **kwargs):
'Create API object' | 89,623,001,943,350,850 | Create API object | bioconda_utils/githubhandler.py | create_api_object | erictleung/bioconda-utils | python | @abc.abstractmethod
def create_api_object(self, *args, **kwargs):
|
def get_file_relurl(self, path: str, branch_name: str='master') -> str:
'Format domain relative url for **path** on **branch_name**'
return '/{user}/{repo}/tree/{branch_name}/{path}'.format(branch_name=branch_name, path=path, **self.var_default) | 6,098,138,925,639,406,000 | Format domain relative url for **path** on **branch_name** | bioconda_utils/githubhandler.py | get_file_relurl | erictleung/bioconda-utils | python | def get_file_relurl(self, path: str, branch_name: str='master') -> str:
return '/{user}/{repo}/tree/{branch_name}/{path}'.format(branch_name=branch_name, path=path, **self.var_default) |
async def login(self, *args, **kwargs):
'Log into API (fills `self.username`)'
self.create_api_object(*args, **kwargs)
if (not self.token):
self.username = 'UNKNOWN [no token]'
else:
user = (await self.api.getitem('/user'))
self.username = user['login'] | 4,357,351,523,083,547,000 | Log into API (fills `self.username`) | bioconda_utils/githubhandler.py | login | erictleung/bioconda-utils | python | async def login(self, *args, **kwargs):
self.create_api_object(*args, **kwargs)
if (not self.token):
self.username = 'UNKNOWN [no token]'
else:
user = (await self.api.getitem('/user'))
self.username = user['login'] |
async def is_member(self, username) -> bool:
'Check if **username** is member of current org'
if (not username):
return False
var_data = copy(self.var_default)
var_data['username'] = username
try:
(await self.api.getitem(self.ORG_MEMBERS, var_data))
except gidgethub.BadRequest:
... | -9,075,334,939,153,031,000 | Check if **username** is member of current org | bioconda_utils/githubhandler.py | is_member | erictleung/bioconda-utils | python | async def is_member(self, username) -> bool:
if (not username):
return False
var_data = copy(self.var_default)
var_data['username'] = username
try:
(await self.api.getitem(self.ORG_MEMBERS, var_data))
except gidgethub.BadRequest:
logger.debug('User %s is not a member of ... |
async def get_prs(self, from_branch: Optional[str]=None, from_user: Optional[str]=None, to_branch: Optional[str]=None, number: Optional[int]=None, state: Optional[IssueState]=None) -> List[Dict[(Any, Any)]]:
'Retrieve list of PRs matching parameters\n\n Arguments:\n from_branch: Name of branch from ... | -222,368,685,826,390,300 | Retrieve list of PRs matching parameters
Arguments:
from_branch: Name of branch from which PR asks to pull
from_user: Name of user/org in from which to pull
(default: from auth)
to_branch: Name of branch into which to pull (default: master)
number: PR number | bioconda_utils/githubhandler.py | get_prs | erictleung/bioconda-utils | python | async def get_prs(self, from_branch: Optional[str]=None, from_user: Optional[str]=None, to_branch: Optional[str]=None, number: Optional[int]=None, state: Optional[IssueState]=None) -> List[Dict[(Any, Any)]]:
'Retrieve list of PRs matching parameters\n\n Arguments:\n from_branch: Name of branch from ... |
async def create_pr(self, title: str, from_branch: Optional[str]=None, from_user: Optional[str]=None, to_branch: Optional[str]='master', body: Optional[str]=None, maintainer_can_modify: bool=True) -> Dict[(Any, Any)]:
'Create new PR\n\n Arguments:\n title: Title of new PR\n from_branch: Nam... | -591,203,747,423,478,500 | Create new PR
Arguments:
title: Title of new PR
from_branch: Name of branch from which PR asks to pull
from_user: Name of user/org in from which to pull
to_branch: Name of branch into which to pull (default: master)
body: Body text of PR
maintainer_can_modify: Whether to allow maintainer to modify from_bra... | bioconda_utils/githubhandler.py | create_pr | erictleung/bioconda-utils | python | async def create_pr(self, title: str, from_branch: Optional[str]=None, from_user: Optional[str]=None, to_branch: Optional[str]='master', body: Optional[str]=None, maintainer_can_modify: bool=True) -> Dict[(Any, Any)]:
'Create new PR\n\n Arguments:\n title: Title of new PR\n from_branch: Nam... |
async def modify_issue(self, number: int, labels: Optional[List[str]]=None, title: Optional[str]=None, body: Optional[str]=None) -> Dict[(Any, Any)]:
'Modify existing issue (PRs are issues)\n\n Arguments:\n labels: list of labels to assign to issue\n title: new title\n body: new bo... | 5,488,880,197,617,060,000 | Modify existing issue (PRs are issues)
Arguments:
labels: list of labels to assign to issue
title: new title
body: new body | bioconda_utils/githubhandler.py | modify_issue | erictleung/bioconda-utils | python | async def modify_issue(self, number: int, labels: Optional[List[str]]=None, title: Optional[str]=None, body: Optional[str]=None) -> Dict[(Any, Any)]:
'Modify existing issue (PRs are issues)\n\n Arguments:\n labels: list of labels to assign to issue\n title: new title\n body: new bo... |
@staticmethod
def video(keywords: str):
'\n :return: < video object > regarding the query\n '
raw = _src(f'https://www.youtube.com/results?search_query={_parser(keywords)}&sp=EgIQAQ%253D%253D')
video_ids = re.findall('\\"videoId\\":\\"(.*?)\\"', raw)
return (Video(video_ids[0]) if video_id... | 7,022,613,803,821,999,000 | :return: < video object > regarding the query | src/_query.py | video | SlumberDemon/AioTube | python | @staticmethod
def video(keywords: str):
'\n \n '
raw = _src(f'https://www.youtube.com/results?search_query={_parser(keywords)}&sp=EgIQAQ%253D%253D')
video_ids = re.findall('\\"videoId\\":\\"(.*?)\\"', raw)
return (Video(video_ids[0]) if video_ids else None) |
@staticmethod
def channel(keywords: str):
'\n :return: < channel object > regarding the query\n '
raw = _src(f'https://www.youtube.com/results?search_query={_parser(keywords)}&sp=EgIQAg%253D%253D')
channel_ids = re.findall('{\\"channelId\\":\\"(.*?)\\"', raw)
return (Channel(channel_ids[0]... | -3,794,072,335,066,502,000 | :return: < channel object > regarding the query | src/_query.py | channel | SlumberDemon/AioTube | python | @staticmethod
def channel(keywords: str):
'\n \n '
raw = _src(f'https://www.youtube.com/results?search_query={_parser(keywords)}&sp=EgIQAg%253D%253D')
channel_ids = re.findall('{\\"channelId\\":\\"(.*?)\\"', raw)
return (Channel(channel_ids[0]) if channel_ids else None) |
@staticmethod
def videos(keywords: str, limit: int):
'\n :param str keywords: query to be searched on YouTube\n :param int limit: total number of videos to be searched\n :return: list of < video object > of each video regarding the query (consider limit)\n '
raw = _src(f'https://www.... | -2,091,650,791,094,011,600 | :param str keywords: query to be searched on YouTube
:param int limit: total number of videos to be searched
:return: list of < video object > of each video regarding the query (consider limit) | src/_query.py | videos | SlumberDemon/AioTube | python | @staticmethod
def videos(keywords: str, limit: int):
'\n :param str keywords: query to be searched on YouTube\n :param int limit: total number of videos to be searched\n :return: list of < video object > of each video regarding the query (consider limit)\n '
raw = _src(f'https://www.... |
@staticmethod
def channels(keywords: str, limit: int):
'\n :param str keywords: query to be searched on YouTube\n :param int limit: total number of channels to be searched\n :return: list of < channel object > of each video regarding the query (consider limit)\n '
raw = _src(f'https:... | -4,197,474,112,352,651,300 | :param str keywords: query to be searched on YouTube
:param int limit: total number of channels to be searched
:return: list of < channel object > of each video regarding the query (consider limit) | src/_query.py | channels | SlumberDemon/AioTube | python | @staticmethod
def channels(keywords: str, limit: int):
'\n :param str keywords: query to be searched on YouTube\n :param int limit: total number of channels to be searched\n :return: list of < channel object > of each video regarding the query (consider limit)\n '
raw = _src(f'https:... |
@staticmethod
def playlist(keywords: str):
'\n :return: < playlist object > regarding the query\n '
raw = _src(f'https://www.youtube.com/results?search_query={_parser(keywords)}&sp=EgIQAw%253D%253D')
found = re.findall('playlistId\\":\\"(.*?)\\"', raw)
return (Playlist(found[0]) if found e... | -310,729,293,607,817,340 | :return: < playlist object > regarding the query | src/_query.py | playlist | SlumberDemon/AioTube | python | @staticmethod
def playlist(keywords: str):
'\n \n '
raw = _src(f'https://www.youtube.com/results?search_query={_parser(keywords)}&sp=EgIQAw%253D%253D')
found = re.findall('playlistId\\":\\"(.*?)\\"', raw)
return (Playlist(found[0]) if found else None) |
@staticmethod
def playlists(keywords: str, limit: int):
'\n :param str keywords: query to be searched on YouTube\n :param int limit: total playlists be searched\n :return: list of < playlist object > of each playlist regarding the query (consider limit)\n '
raw = _src(f'https://www.y... | 1,905,786,711,633,011,500 | :param str keywords: query to be searched on YouTube
:param int limit: total playlists be searched
:return: list of < playlist object > of each playlist regarding the query (consider limit) | src/_query.py | playlists | SlumberDemon/AioTube | python | @staticmethod
def playlists(keywords: str, limit: int):
'\n :param str keywords: query to be searched on YouTube\n :param int limit: total playlists be searched\n :return: list of < playlist object > of each playlist regarding the query (consider limit)\n '
raw = _src(f'https://www.y... |
def create_world(self, **kwargs):
'Create World # noqa: E501\n\n Create a new world. This endpoint requires `assetUrl` to be a valid File object with `.vrcw` file extension, and `imageUrl` to be a valid File object with an image file extension. # noqa: E501\n This method makes a synchronous HTTP req... | 1,839,116,180,590,506,500 | Create World # noqa: E501
Create a new world. This endpoint requires `assetUrl` to be a valid File object with `.vrcw` file extension, and `imageUrl` to be a valid File object with an image file extension. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, ple... | vrchatapi/api/worlds_api.py | create_world | vrchatapi/vrchatapi-python | python | def create_world(self, **kwargs):
'Create World # noqa: E501\n\n Create a new world. This endpoint requires `assetUrl` to be a valid File object with `.vrcw` file extension, and `imageUrl` to be a valid File object with an image file extension. # noqa: E501\n This method makes a synchronous HTTP req... |
def delete_world(self, world_id, **kwargs):
'Delete World # noqa: E501\n\n Delete a world. Notice a world is never fully "deleted", only its ReleaseStatus is set to "hidden" and the linked Files are deleted. The WorldID is permanently reserved. # noqa: E501\n This method makes a synchronous HTTP req... | 3,682,070,476,055,268,400 | Delete World # noqa: E501
Delete a world. Notice a world is never fully "deleted", only its ReleaseStatus is set to "hidden" and the linked Files are deleted. The WorldID is permanently reserved. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass a... | vrchatapi/api/worlds_api.py | delete_world | vrchatapi/vrchatapi-python | python | def delete_world(self, world_id, **kwargs):
'Delete World # noqa: E501\n\n Delete a world. Notice a world is never fully "deleted", only its ReleaseStatus is set to "hidden" and the linked Files are deleted. The WorldID is permanently reserved. # noqa: E501\n This method makes a synchronous HTTP req... |
def get_active_worlds(self, **kwargs):
'List Active Worlds # noqa: E501\n\n Search and list currently Active worlds by query filters. # noqa: E501\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass async_req=True\n\n >>> threa... | 1,943,135,176,156,038,400 | List Active Worlds # noqa: E501
Search and list currently Active worlds by query filters. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_active_worlds(async_req=True)
>>> result = thread.get()
Keyword Args... | vrchatapi/api/worlds_api.py | get_active_worlds | vrchatapi/vrchatapi-python | python | def get_active_worlds(self, **kwargs):
'List Active Worlds # noqa: E501\n\n Search and list currently Active worlds by query filters. # noqa: E501\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass async_req=True\n\n >>> threa... |
def get_favorited_worlds(self, **kwargs):
'List Favorited Worlds # noqa: E501\n\n Search and list favorited worlds by query filters. # noqa: E501\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass async_req=True\n\n >>> thread... | -2,288,150,651,427,718,700 | List Favorited Worlds # noqa: E501
Search and list favorited worlds by query filters. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_favorited_worlds(async_req=True)
>>> result = thread.get()
Keyword Args:... | vrchatapi/api/worlds_api.py | get_favorited_worlds | vrchatapi/vrchatapi-python | python | def get_favorited_worlds(self, **kwargs):
'List Favorited Worlds # noqa: E501\n\n Search and list favorited worlds by query filters. # noqa: E501\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass async_req=True\n\n >>> thread... |
def get_recent_worlds(self, **kwargs):
'List Recent Worlds # noqa: E501\n\n Search and list recently visited worlds by query filters. # noqa: E501\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass async_req=True\n\n >>> threa... | 8,313,723,588,409,878,000 | List Recent Worlds # noqa: E501
Search and list recently visited worlds by query filters. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_recent_worlds(async_req=True)
>>> result = thread.get()
Keyword Args... | vrchatapi/api/worlds_api.py | get_recent_worlds | vrchatapi/vrchatapi-python | python | def get_recent_worlds(self, **kwargs):
'List Recent Worlds # noqa: E501\n\n Search and list recently visited worlds by query filters. # noqa: E501\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass async_req=True\n\n >>> threa... |
def get_world(self, world_id, **kwargs):
'Get World by ID # noqa: E501\n\n Get information about a specific World. # noqa: E501\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass async_req=True\n\n >>> thread = api.get_world(w... | 397,403,147,349,226,750 | Get World by ID # noqa: E501
Get information about a specific World. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_world(world_id, async_req=True)
>>> result = thread.get()
Args:
world_id (str):
Keywo... | vrchatapi/api/worlds_api.py | get_world | vrchatapi/vrchatapi-python | python | def get_world(self, world_id, **kwargs):
'Get World by ID # noqa: E501\n\n Get information about a specific World. # noqa: E501\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass async_req=True\n\n >>> thread = api.get_world(w... |
def get_world_instance(self, world_id, instance_id, **kwargs):
'Get World Instance # noqa: E501\n\n Returns a worlds instance. # noqa: E501\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass async_req=True\n\n >>> thread = api... | -4,952,419,516,927,023,000 | Get World Instance # noqa: E501
Returns a worlds instance. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_world_instance(world_id, instance_id, async_req=True)
>>> result = thread.get()
Args:
world_id (... | vrchatapi/api/worlds_api.py | get_world_instance | vrchatapi/vrchatapi-python | python | def get_world_instance(self, world_id, instance_id, **kwargs):
'Get World Instance # noqa: E501\n\n Returns a worlds instance. # noqa: E501\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass async_req=True\n\n >>> thread = api... |
def get_world_metadata(self, world_id, **kwargs):
'Get World Metadata # noqa: E501\n\n Return a worlds custom metadata. This is currently believed to be unused. Metadata can be set with `updateWorld` and can be any arbitrary object. # noqa: E501\n This method makes a synchronous HTTP request by defa... | -4,620,318,039,577,507,000 | Get World Metadata # noqa: E501
Return a worlds custom metadata. This is currently believed to be unused. Metadata can be set with `updateWorld` and can be any arbitrary object. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>>... | vrchatapi/api/worlds_api.py | get_world_metadata | vrchatapi/vrchatapi-python | python | def get_world_metadata(self, world_id, **kwargs):
'Get World Metadata # noqa: E501\n\n Return a worlds custom metadata. This is currently believed to be unused. Metadata can be set with `updateWorld` and can be any arbitrary object. # noqa: E501\n This method makes a synchronous HTTP request by defa... |
def get_world_publish_status(self, world_id, **kwargs):
'Get World Publish Status # noqa: E501\n\n Returns a worlds publish status. # noqa: E501\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass async_req=True\n\n >>> thread ... | -7,381,891,028,071,097,000 | Get World Publish Status # noqa: E501
Returns a worlds publish status. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_world_publish_status(world_id, async_req=True)
>>> result = thread.get()
Args:
world... | vrchatapi/api/worlds_api.py | get_world_publish_status | vrchatapi/vrchatapi-python | python | def get_world_publish_status(self, world_id, **kwargs):
'Get World Publish Status # noqa: E501\n\n Returns a worlds publish status. # noqa: E501\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass async_req=True\n\n >>> thread ... |
def publish_world(self, world_id, **kwargs):
'Publish World # noqa: E501\n\n Publish a world. You can only publish one world per week. # noqa: E501\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass async_req=True\n\n >>> thre... | 1,127,032,521,614,357,200 | Publish World # noqa: E501
Publish a world. You can only publish one world per week. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.publish_world(world_id, async_req=True)
>>> result = thread.get()
Args:
wo... | vrchatapi/api/worlds_api.py | publish_world | vrchatapi/vrchatapi-python | python | def publish_world(self, world_id, **kwargs):
'Publish World # noqa: E501\n\n Publish a world. You can only publish one world per week. # noqa: E501\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass async_req=True\n\n >>> thre... |
def search_worlds(self, **kwargs):
'Search All Worlds # noqa: E501\n\n Search and list any worlds by query filters. # noqa: E501\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass async_req=True\n\n >>> thread = api.search_wor... | -2,585,619,684,312,409,000 | Search All Worlds # noqa: E501
Search and list any worlds by query filters. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.search_worlds(async_req=True)
>>> result = thread.get()
Keyword Args:
featured (st... | vrchatapi/api/worlds_api.py | search_worlds | vrchatapi/vrchatapi-python | python | def search_worlds(self, **kwargs):
'Search All Worlds # noqa: E501\n\n Search and list any worlds by query filters. # noqa: E501\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass async_req=True\n\n >>> thread = api.search_wor... |
def unpublish_world(self, world_id, **kwargs):
'Unpublish World # noqa: E501\n\n Unpublish a world. # noqa: E501\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass async_req=True\n\n >>> thread = api.unpublish_world(world_id, ... | 9,081,196,738,494,386,000 | Unpublish World # noqa: E501
Unpublish a world. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.unpublish_world(world_id, async_req=True)
>>> result = thread.get()
Args:
world_id (str):
Keyword Args:
_r... | vrchatapi/api/worlds_api.py | unpublish_world | vrchatapi/vrchatapi-python | python | def unpublish_world(self, world_id, **kwargs):
'Unpublish World # noqa: E501\n\n Unpublish a world. # noqa: E501\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass async_req=True\n\n >>> thread = api.unpublish_world(world_id, ... |
def update_world(self, world_id, **kwargs):
'Update World # noqa: E501\n\n Update information about a specific World. # noqa: E501\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass async_req=True\n\n >>> thread = api.update_w... | 8,267,214,315,005,162,000 | Update World # noqa: E501
Update information about a specific World. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.update_world(world_id, async_req=True)
>>> result = thread.get()
Args:
world_id (str):
Ke... | vrchatapi/api/worlds_api.py | update_world | vrchatapi/vrchatapi-python | python | def update_world(self, world_id, **kwargs):
'Update World # noqa: E501\n\n Update information about a specific World. # noqa: E501\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass async_req=True\n\n >>> thread = api.update_w... |
def validate(self, lint_task_report, expected_messages, failed_count):
'Assert linter output messages with expected messages.'
for stdout in lint_task_report:
if stdout.failed:
for message in expected_messages:
self.assert_same_list_elements([message], stdout.trimmed_messages... | 9,054,549,909,367,451,000 | Assert linter output messages with expected messages. | scripts/linters/js_ts_linter_test.py | validate | Aryan-Abhishek/oppia | python | def validate(self, lint_task_report, expected_messages, failed_count):
for stdout in lint_task_report:
if stdout.failed:
for message in expected_messages:
self.assert_same_list_elements([message], stdout.trimmed_messages)
self.assert_failed_messages_count(stdout.... |
def tokenize(tokenizer, text_array, max_seq_len=64, pad_to_max_length=True, add_special_tokens=True):
' Returns tokenized IDs and attention mask\n The transformers encode_plus method returns the following:\n {\n input_ids: list[int],\n token_type_ids: list[int] if return_token_type_ids is True (default)... | -6,831,231,487,204,000,000 | Returns tokenized IDs and attention mask
The transformers encode_plus method returns the following:
{
input_ids: list[int],
token_type_ids: list[int] if return_token_type_ids is True (default)
attention_mask: list[int] if return_attention_mask is True (default)
overflowing_tokens: list[int] if a ``max_length`` is speci... | utils/utils.py | tokenize | suhasgupta791/mids-w251-final-project | python | def tokenize(tokenizer, text_array, max_seq_len=64, pad_to_max_length=True, add_special_tokens=True):
' Returns tokenized IDs and attention mask\n The transformers encode_plus method returns the following:\n {\n input_ids: list[int],\n token_type_ids: list[int] if return_token_type_ids is True (default)... |
def buildinfo_file_name(prefix):
'\n Filename of the binary package meta-data file\n '
name = os.path.join(prefix, '.spack/binary_distribution')
return name | 3,146,870,843,183,292,000 | Filename of the binary package meta-data file | lib/spack/spack/binary_distribution.py | buildinfo_file_name | AndrewGaspar/spack | python | def buildinfo_file_name(prefix):
'\n \n '
name = os.path.join(prefix, '.spack/binary_distribution')
return name |
def read_buildinfo_file(prefix):
'\n Read buildinfo file\n '
filename = buildinfo_file_name(prefix)
with open(filename, 'r') as inputfile:
content = inputfile.read()
buildinfo = yaml.load(content)
return buildinfo | 7,406,886,191,899,131,000 | Read buildinfo file | lib/spack/spack/binary_distribution.py | read_buildinfo_file | AndrewGaspar/spack | python | def read_buildinfo_file(prefix):
'\n \n '
filename = buildinfo_file_name(prefix)
with open(filename, 'r') as inputfile:
content = inputfile.read()
buildinfo = yaml.load(content)
return buildinfo |
def write_buildinfo_file(spec, workdir, rel=False):
'\n Create a cache file containing information\n required for the relocation\n '
prefix = spec.prefix
text_to_relocate = []
binary_to_relocate = []
link_to_relocate = []
blacklist = ('.spack', 'man')
prefix_to_hash = dict()
pre... | -354,899,277,047,931,700 | Create a cache file containing information
required for the relocation | lib/spack/spack/binary_distribution.py | write_buildinfo_file | AndrewGaspar/spack | python | def write_buildinfo_file(spec, workdir, rel=False):
'\n Create a cache file containing information\n required for the relocation\n '
prefix = spec.prefix
text_to_relocate = []
binary_to_relocate = []
link_to_relocate = []
blacklist = ('.spack', 'man')
prefix_to_hash = dict()
pre... |
def tarball_directory_name(spec):
'\n Return name of the tarball directory according to the convention\n <os>-<architecture>/<compiler>/<package>-<version>/\n '
return ('%s/%s/%s-%s' % (spec.architecture, str(spec.compiler).replace('@', '-'), spec.name, spec.version)) | -9,080,255,287,714,440,000 | Return name of the tarball directory according to the convention
<os>-<architecture>/<compiler>/<package>-<version>/ | lib/spack/spack/binary_distribution.py | tarball_directory_name | AndrewGaspar/spack | python | def tarball_directory_name(spec):
'\n Return name of the tarball directory according to the convention\n <os>-<architecture>/<compiler>/<package>-<version>/\n '
return ('%s/%s/%s-%s' % (spec.architecture, str(spec.compiler).replace('@', '-'), spec.name, spec.version)) |
def tarball_name(spec, ext):
'\n Return the name of the tarfile according to the convention\n <os>-<architecture>-<package>-<dag_hash><ext>\n '
return ('%s-%s-%s-%s-%s%s' % (spec.architecture, str(spec.compiler).replace('@', '-'), spec.name, spec.version, spec.dag_hash(), ext)) | 851,457,283,425,775,400 | Return the name of the tarfile according to the convention
<os>-<architecture>-<package>-<dag_hash><ext> | lib/spack/spack/binary_distribution.py | tarball_name | AndrewGaspar/spack | python | def tarball_name(spec, ext):
'\n Return the name of the tarfile according to the convention\n <os>-<architecture>-<package>-<dag_hash><ext>\n '
return ('%s-%s-%s-%s-%s%s' % (spec.architecture, str(spec.compiler).replace('@', '-'), spec.name, spec.version, spec.dag_hash(), ext)) |
def tarball_path_name(spec, ext):
'\n Return the full path+name for a given spec according to the convention\n <tarball_directory_name>/<tarball_name>\n '
return os.path.join(tarball_directory_name(spec), tarball_name(spec, ext)) | -774,360,739,942,398,700 | Return the full path+name for a given spec according to the convention
<tarball_directory_name>/<tarball_name> | lib/spack/spack/binary_distribution.py | tarball_path_name | AndrewGaspar/spack | python | def tarball_path_name(spec, ext):
'\n Return the full path+name for a given spec according to the convention\n <tarball_directory_name>/<tarball_name>\n '
return os.path.join(tarball_directory_name(spec), tarball_name(spec, ext)) |
def generate_package_index(cache_prefix):
'Create the build cache index page.\n\n Creates (or replaces) the "index.html" page at the location given in\n cache_prefix. This page contains a link for each binary package (*.yaml)\n and public key (*.key) under cache_prefix.\n '
tmpdir = tempfile.mkdtem... | 2,301,271,199,688,875,000 | Create the build cache index page.
Creates (or replaces) the "index.html" page at the location given in
cache_prefix. This page contains a link for each binary package (*.yaml)
and public key (*.key) under cache_prefix. | lib/spack/spack/binary_distribution.py | generate_package_index | AndrewGaspar/spack | python | def generate_package_index(cache_prefix):
'Create the build cache index page.\n\n Creates (or replaces) the "index.html" page at the location given in\n cache_prefix. This page contains a link for each binary package (*.yaml)\n and public key (*.key) under cache_prefix.\n '
tmpdir = tempfile.mkdtem... |
def build_tarball(spec, outdir, force=False, rel=False, unsigned=False, allow_root=False, key=None, regenerate_index=False):
'\n Build a tarball from given spec and put it into the directory structure\n used at the mirror (following <tarball_directory_name>).\n '
if (not spec.concrete):
raise V... | 7,027,555,427,446,063,000 | Build a tarball from given spec and put it into the directory structure
used at the mirror (following <tarball_directory_name>). | lib/spack/spack/binary_distribution.py | build_tarball | AndrewGaspar/spack | python | def build_tarball(spec, outdir, force=False, rel=False, unsigned=False, allow_root=False, key=None, regenerate_index=False):
'\n Build a tarball from given spec and put it into the directory structure\n used at the mirror (following <tarball_directory_name>).\n '
if (not spec.concrete):
raise V... |
def download_tarball(spec):
'\n Download binary tarball for given package into stage area\n Return True if successful\n '
if (not spack.mirror.MirrorCollection()):
tty.die(('Please add a spack mirror to allow ' + 'download of pre-compiled packages.'))
tarball = tarball_path_name(spec, '.spa... | -2,976,945,472,007,021,000 | Download binary tarball for given package into stage area
Return True if successful | lib/spack/spack/binary_distribution.py | download_tarball | AndrewGaspar/spack | python | def download_tarball(spec):
'\n Download binary tarball for given package into stage area\n Return True if successful\n '
if (not spack.mirror.MirrorCollection()):
tty.die(('Please add a spack mirror to allow ' + 'download of pre-compiled packages.'))
tarball = tarball_path_name(spec, '.spa... |
def make_package_relative(workdir, spec, allow_root):
'\n Change paths in binaries to relative paths. Change absolute symlinks\n to relative symlinks.\n '
prefix = spec.prefix
buildinfo = read_buildinfo_file(workdir)
old_layout_root = buildinfo['buildpath']
orig_path_names = list()
cur_... | 2,882,771,149,939,471,000 | Change paths in binaries to relative paths. Change absolute symlinks
to relative symlinks. | lib/spack/spack/binary_distribution.py | make_package_relative | AndrewGaspar/spack | python | def make_package_relative(workdir, spec, allow_root):
'\n Change paths in binaries to relative paths. Change absolute symlinks\n to relative symlinks.\n '
prefix = spec.prefix
buildinfo = read_buildinfo_file(workdir)
old_layout_root = buildinfo['buildpath']
orig_path_names = list()
cur_... |
def check_package_relocatable(workdir, spec, allow_root):
'\n Check if package binaries are relocatable.\n Change links to placeholder links.\n '
buildinfo = read_buildinfo_file(workdir)
cur_path_names = list()
for filename in buildinfo['relocate_binaries']:
cur_path_names.append(os.pat... | 1,812,976,719,999,216,600 | Check if package binaries are relocatable.
Change links to placeholder links. | lib/spack/spack/binary_distribution.py | check_package_relocatable | AndrewGaspar/spack | python | def check_package_relocatable(workdir, spec, allow_root):
'\n Check if package binaries are relocatable.\n Change links to placeholder links.\n '
buildinfo = read_buildinfo_file(workdir)
cur_path_names = list()
for filename in buildinfo['relocate_binaries']:
cur_path_names.append(os.pat... |
def relocate_package(spec, allow_root):
'\n Relocate the given package\n '
workdir = str(spec.prefix)
buildinfo = read_buildinfo_file(workdir)
new_layout_root = str(spack.store.layout.root)
new_prefix = str(spec.prefix)
new_rel_prefix = str(os.path.relpath(new_prefix, new_layout_root))
... | -1,651,716,833,346,948,600 | Relocate the given package | lib/spack/spack/binary_distribution.py | relocate_package | AndrewGaspar/spack | python | def relocate_package(spec, allow_root):
'\n \n '
workdir = str(spec.prefix)
buildinfo = read_buildinfo_file(workdir)
new_layout_root = str(spack.store.layout.root)
new_prefix = str(spec.prefix)
new_rel_prefix = str(os.path.relpath(new_prefix, new_layout_root))
new_spack_prefix = str(sp... |
def extract_tarball(spec, filename, allow_root=False, unsigned=False, force=False):
'\n extract binary tarball for given package into install area\n '
if os.path.exists(spec.prefix):
if force:
shutil.rmtree(spec.prefix)
else:
raise NoOverwriteException(str(spec.pref... | -5,361,161,429,013,797,000 | extract binary tarball for given package into install area | lib/spack/spack/binary_distribution.py | extract_tarball | AndrewGaspar/spack | python | def extract_tarball(spec, filename, allow_root=False, unsigned=False, force=False):
'\n \n '
if os.path.exists(spec.prefix):
if force:
shutil.rmtree(spec.prefix)
else:
raise NoOverwriteException(str(spec.prefix))
tmpdir = tempfile.mkdtemp()
stagepath = os.pa... |
def try_download_specs(urls=None, force=False):
'\n Try to download the urls and cache them\n '
global _cached_specs
if (urls is None):
return {}
for link in urls:
with Stage(link, name='build_cache', keep=True) as stage:
if (force and os.path.exists(stage.save_filename... | -4,851,680,199,834,589,000 | Try to download the urls and cache them | lib/spack/spack/binary_distribution.py | try_download_specs | AndrewGaspar/spack | python | def try_download_specs(urls=None, force=False):
'\n \n '
global _cached_specs
if (urls is None):
return {}
for link in urls:
with Stage(link, name='build_cache', keep=True) as stage:
if (force and os.path.exists(stage.save_filename)):
os.remove(stage.sav... |
def get_spec(spec=None, force=False):
'\n Check if spec.yaml exists on mirrors and return it if it does\n '
global _cached_specs
urls = set()
if (spec is None):
return {}
specfile_name = tarball_name(spec, '.spec.yaml')
if (not spack.mirror.MirrorCollection()):
tty.debug('N... | -2,687,261,658,887,346,700 | Check if spec.yaml exists on mirrors and return it if it does | lib/spack/spack/binary_distribution.py | get_spec | AndrewGaspar/spack | python | def get_spec(spec=None, force=False):
'\n \n '
global _cached_specs
urls = set()
if (spec is None):
return {}
specfile_name = tarball_name(spec, '.spec.yaml')
if (not spack.mirror.MirrorCollection()):
tty.debug('No Spack mirrors are currently configured')
return {}
... |
def get_specs(force=False, allarch=False):
"\n Get spec.yaml's for build caches available on mirror\n "
arch = architecture.Arch(architecture.platform(), 'default_os', 'default_target')
arch_pattern = '([^-]*-[^-]*-[^-]*)'
if (not allarch):
arch_pattern = ('(%s-%s-[^-]*)' % (arch.platform,... | -211,493,935,287,844,900 | Get spec.yaml's for build caches available on mirror | lib/spack/spack/binary_distribution.py | get_specs | AndrewGaspar/spack | python | def get_specs(force=False, allarch=False):
"\n \n "
arch = architecture.Arch(architecture.platform(), 'default_os', 'default_target')
arch_pattern = '([^-]*-[^-]*-[^-]*)'
if (not allarch):
arch_pattern = ('(%s-%s-[^-]*)' % (arch.platform, arch.os))
regex_pattern = ('%s(.*)(spec.yaml$)'... |
def get_keys(install=False, trust=False, force=False):
'\n Get pgp public keys available on mirror\n with suffix .key or .pub\n '
if (not spack.mirror.MirrorCollection()):
tty.die(('Please add a spack mirror to allow ' + 'download of build caches.'))
keys = set()
for mirror in spack.mir... | 386,161,436,998,631,300 | Get pgp public keys available on mirror
with suffix .key or .pub | lib/spack/spack/binary_distribution.py | get_keys | AndrewGaspar/spack | python | def get_keys(install=False, trust=False, force=False):
'\n Get pgp public keys available on mirror\n with suffix .key or .pub\n '
if (not spack.mirror.MirrorCollection()):
tty.die(('Please add a spack mirror to allow ' + 'download of build caches.'))
keys = set()
for mirror in spack.mir... |
def check_specs_against_mirrors(mirrors, specs, output_file=None, rebuild_on_errors=False):
"Check all the given specs against buildcaches on the given mirrors and\n determine if any of the specs need to be rebuilt. Reasons for needing to\n rebuild include binary cache for spec isn't present on a mirror, or ... | -2,557,679,248,075,223,600 | Check all the given specs against buildcaches on the given mirrors and
determine if any of the specs need to be rebuilt. Reasons for needing to
rebuild include binary cache for spec isn't present on a mirror, or it is
present but the full_hash has changed since last time spec was built.
Arguments:
mirrors (dict):... | lib/spack/spack/binary_distribution.py | check_specs_against_mirrors | AndrewGaspar/spack | python | def check_specs_against_mirrors(mirrors, specs, output_file=None, rebuild_on_errors=False):
"Check all the given specs against buildcaches on the given mirrors and\n determine if any of the specs need to be rebuilt. Reasons for needing to\n rebuild include binary cache for spec isn't present on a mirror, or ... |
def get_model(name, **kwargs):
"Returns a pre-defined model by name\n\n Parameters\n ----------\n name : str\n Name of the model.\n pretrained : bool\n Whether to load the pretrained weights for model.\n classes : int\n Number of classes for the output layer.\n ctx : Context, ... | -3,677,196,965,192,728,600 | Returns a pre-defined model by name
Parameters
----------
name : str
Name of the model.
pretrained : bool
Whether to load the pretrained weights for model.
classes : int
Number of classes for the output layer.
ctx : Context, default CPU
The context in which to load the pretrained weights.
root : str, d... | gluoncv/model_zoo/model_zoo.py | get_model | Ellinier/gluon-cv | python | def get_model(name, **kwargs):
"Returns a pre-defined model by name\n\n Parameters\n ----------\n name : str\n Name of the model.\n pretrained : bool\n Whether to load the pretrained weights for model.\n classes : int\n Number of classes for the output layer.\n ctx : Context, ... |
def do_import(self, timestamp):
'Call one key import RPC.'
rescan = (self.rescan == Rescan.yes)
assert_equal(self.address['solvable'], True)
assert_equal(self.address['isscript'], (self.address_type == AddressType.p2sh_segwit))
assert_equal(self.address['iswitness'], (self.address_type == AddressTyp... | 6,954,097,585,418,948,000 | Call one key import RPC. | test/functional/wallet_import_rescan.py | do_import | 124327288/bitcoin | python | def do_import(self, timestamp):
rescan = (self.rescan == Rescan.yes)
assert_equal(self.address['solvable'], True)
assert_equal(self.address['isscript'], (self.address_type == AddressType.p2sh_segwit))
assert_equal(self.address['iswitness'], (self.address_type == AddressType.bech32))
if self.add... |
def check(self, txid=None, amount=None, confirmation_height=None):
'Verify that listtransactions/listreceivedbyaddress return expected values.'
txs = self.node.listtransactions(label=self.label, count=10000, include_watchonly=True)
current_height = self.node.getblockcount()
assert_equal(len(txs), self.e... | -7,781,182,308,574,544,000 | Verify that listtransactions/listreceivedbyaddress return expected values. | test/functional/wallet_import_rescan.py | check | 124327288/bitcoin | python | def check(self, txid=None, amount=None, confirmation_height=None):
txs = self.node.listtransactions(label=self.label, count=10000, include_watchonly=True)
current_height = self.node.getblockcount()
assert_equal(len(txs), self.expected_txs)
addresses = self.node.listreceivedbyaddress(minconf=0, incl... |
def _maybe_to_categorical(array):
'\n Coerce to a categorical if a series is given.\n\n Internal use ONLY.\n '
if isinstance(array, (ABCSeries, ABCCategoricalIndex)):
return array._values
elif isinstance(array, np.ndarray):
return Categorical(array)
return array | 2,237,787,623,372,904,200 | Coerce to a categorical if a series is given.
Internal use ONLY. | pandas/core/arrays/categorical.py | _maybe_to_categorical | Adirio/pandas | python | def _maybe_to_categorical(array):
'\n Coerce to a categorical if a series is given.\n\n Internal use ONLY.\n '
if isinstance(array, (ABCSeries, ABCCategoricalIndex)):
return array._values
elif isinstance(array, np.ndarray):
return Categorical(array)
return array |
def contains(cat, key, container):
'\n Helper for membership check for ``key`` in ``cat``.\n\n This is a helper method for :method:`__contains__`\n and :class:`CategoricalIndex.__contains__`.\n\n Returns True if ``key`` is in ``cat.categories`` and the\n location of ``key`` in ``categories`` is in ``... | -3,630,981,666,279,502,300 | Helper for membership check for ``key`` in ``cat``.
This is a helper method for :method:`__contains__`
and :class:`CategoricalIndex.__contains__`.
Returns True if ``key`` is in ``cat.categories`` and the
location of ``key`` in ``categories`` is in ``container``.
Parameters
----------
cat : :class:`Categorical`or :cl... | pandas/core/arrays/categorical.py | contains | Adirio/pandas | python | def contains(cat, key, container):
'\n Helper for membership check for ``key`` in ``cat``.\n\n This is a helper method for :method:`__contains__`\n and :class:`CategoricalIndex.__contains__`.\n\n Returns True if ``key`` is in ``cat.categories`` and the\n location of ``key`` in ``categories`` is in ``... |
def _get_codes_for_values(values, categories):
'\n utility routine to turn values into codes given the specified categories\n '
from pandas.core.algorithms import _get_data_algo, _hashtables
if is_dtype_equal(values.dtype, categories.dtype):
values = getattr(values, 'values', values)
c... | -9,121,178,497,724,465,000 | utility routine to turn values into codes given the specified categories | pandas/core/arrays/categorical.py | _get_codes_for_values | Adirio/pandas | python | def _get_codes_for_values(values, categories):
'\n \n '
from pandas.core.algorithms import _get_data_algo, _hashtables
if is_dtype_equal(values.dtype, categories.dtype):
values = getattr(values, 'values', values)
categories = getattr(categories, 'values', categories)
else:
... |
def _recode_for_categories(codes, old_categories, new_categories):
"\n Convert a set of codes for to a new set of categories\n\n Parameters\n ----------\n codes : array\n old_categories, new_categories : Index\n\n Returns\n -------\n new_codes : array\n\n Examples\n --------\n >>> o... | -1,359,974,398,921,035,300 | Convert a set of codes for to a new set of categories
Parameters
----------
codes : array
old_categories, new_categories : Index
Returns
-------
new_codes : array
Examples
--------
>>> old_cat = pd.Index(['b', 'a', 'c'])
>>> new_cat = pd.Index(['a', 'b'])
>>> codes = np.array([0, 1, 1, 2])
>>> _recode_for_categories... | pandas/core/arrays/categorical.py | _recode_for_categories | Adirio/pandas | python | def _recode_for_categories(codes, old_categories, new_categories):
"\n Convert a set of codes for to a new set of categories\n\n Parameters\n ----------\n codes : array\n old_categories, new_categories : Index\n\n Returns\n -------\n new_codes : array\n\n Examples\n --------\n >>> o... |
def _factorize_from_iterable(values):
'\n Factorize an input `values` into `categories` and `codes`. Preserves\n categorical dtype in `categories`.\n\n *This is an internal function*\n\n Parameters\n ----------\n values : list-like\n\n Returns\n -------\n codes : ndarray\n categories :... | 8,827,019,310,461,227,000 | Factorize an input `values` into `categories` and `codes`. Preserves
categorical dtype in `categories`.
*This is an internal function*
Parameters
----------
values : list-like
Returns
-------
codes : ndarray
categories : Index
If `values` has a categorical dtype, then `categories` is
a CategoricalIndex keepi... | pandas/core/arrays/categorical.py | _factorize_from_iterable | Adirio/pandas | python | def _factorize_from_iterable(values):
'\n Factorize an input `values` into `categories` and `codes`. Preserves\n categorical dtype in `categories`.\n\n *This is an internal function*\n\n Parameters\n ----------\n values : list-like\n\n Returns\n -------\n codes : ndarray\n categories :... |
def _factorize_from_iterables(iterables):
'\n A higher-level wrapper over `_factorize_from_iterable`.\n\n *This is an internal function*\n\n Parameters\n ----------\n iterables : list-like of list-likes\n\n Returns\n -------\n codes_list : list of ndarrays\n categories_list : list of Inde... | -2,717,126,921,247,107,600 | A higher-level wrapper over `_factorize_from_iterable`.
*This is an internal function*
Parameters
----------
iterables : list-like of list-likes
Returns
-------
codes_list : list of ndarrays
categories_list : list of Indexes
Notes
-----
See `_factorize_from_iterable` for more info. | pandas/core/arrays/categorical.py | _factorize_from_iterables | Adirio/pandas | python | def _factorize_from_iterables(iterables):
'\n A higher-level wrapper over `_factorize_from_iterable`.\n\n *This is an internal function*\n\n Parameters\n ----------\n iterables : list-like of list-likes\n\n Returns\n -------\n codes_list : list of ndarrays\n categories_list : list of Inde... |
@property
def categories(self):
'The categories of this categorical.\n\n Setting assigns new values to each category (effectively a rename of\n each individual category).\n\n The assigned value has to be a list-like object. All items must be\n unique and the number of items in the new ca... | 3,570,044,184,654,974,500 | The categories of this categorical.
Setting assigns new values to each category (effectively a rename of
each individual category).
The assigned value has to be a list-like object. All items must be
unique and the number of items in the new categories must be the same
as the number of items in the old categories.
As... | pandas/core/arrays/categorical.py | categories | Adirio/pandas | python | @property
def categories(self):
'The categories of this categorical.\n\n Setting assigns new values to each category (effectively a rename of\n each individual category).\n\n The assigned value has to be a list-like object. All items must be\n unique and the number of items in the new ca... |
@property
def ordered(self):
'Whether the categories have an ordered relationship'
return self.dtype.ordered | 5,481,432,134,851,482,000 | Whether the categories have an ordered relationship | pandas/core/arrays/categorical.py | ordered | Adirio/pandas | python | @property
def ordered(self):
return self.dtype.ordered |
@property
def dtype(self):
'The :class:`~pandas.api.types.CategoricalDtype` for this instance'
return self._dtype | 1,338,917,948,512,637,200 | The :class:`~pandas.api.types.CategoricalDtype` for this instance | pandas/core/arrays/categorical.py | dtype | Adirio/pandas | python | @property
def dtype(self):
return self._dtype |
def copy(self):
' Copy constructor. '
return self._constructor(values=self._codes.copy(), dtype=self.dtype, fastpath=True) | -2,809,920,600,592,299,500 | Copy constructor. | pandas/core/arrays/categorical.py | copy | Adirio/pandas | python | def copy(self):
' '
return self._constructor(values=self._codes.copy(), dtype=self.dtype, fastpath=True) |
def astype(self, dtype, copy=True):
'\n Coerce this type to another dtype\n\n Parameters\n ----------\n dtype : numpy dtype or pandas type\n copy : bool, default True\n By default, astype always returns a newly allocated object.\n If copy is set to False and ... | 1,461,506,608,232,021,000 | Coerce this type to another dtype
Parameters
----------
dtype : numpy dtype or pandas type
copy : bool, default True
By default, astype always returns a newly allocated object.
If copy is set to False and dtype is categorical, the original
object is returned.
.. versionadded:: 0.19.0 | pandas/core/arrays/categorical.py | astype | Adirio/pandas | python | def astype(self, dtype, copy=True):
'\n Coerce this type to another dtype\n\n Parameters\n ----------\n dtype : numpy dtype or pandas type\n copy : bool, default True\n By default, astype always returns a newly allocated object.\n If copy is set to False and ... |
@cache_readonly
def ndim(self):
'Number of dimensions of the Categorical '
return self._codes.ndim | 736,434,692,953,517,700 | Number of dimensions of the Categorical | pandas/core/arrays/categorical.py | ndim | Adirio/pandas | python | @cache_readonly
def ndim(self):
' '
return self._codes.ndim |
@cache_readonly
def size(self):
' return the len of myself '
return len(self) | 4,024,009,921,628,190,700 | return the len of myself | pandas/core/arrays/categorical.py | size | Adirio/pandas | python | @cache_readonly
def size(self):
' '
return len(self) |
@cache_readonly
def itemsize(self):
' return the size of a single category '
return self.categories.itemsize | 4,548,285,990,129,604,000 | return the size of a single category | pandas/core/arrays/categorical.py | itemsize | Adirio/pandas | python | @cache_readonly
def itemsize(self):
' '
return self.categories.itemsize |
def tolist(self):
'\n Return a list of the values.\n\n These are each a scalar type, which is a Python scalar\n (for str, int, float) or a pandas scalar\n (for Timestamp/Timedelta/Interval/Period)\n '
return list(self) | 7,588,057,621,989,776,000 | Return a list of the values.
These are each a scalar type, which is a Python scalar
(for str, int, float) or a pandas scalar
(for Timestamp/Timedelta/Interval/Period) | pandas/core/arrays/categorical.py | tolist | Adirio/pandas | python | def tolist(self):
'\n Return a list of the values.\n\n These are each a scalar type, which is a Python scalar\n (for str, int, float) or a pandas scalar\n (for Timestamp/Timedelta/Interval/Period)\n '
return list(self) |
@property
def base(self):
' compat, we are always our own object '
return None | -4,100,637,562,349,485,600 | compat, we are always our own object | pandas/core/arrays/categorical.py | base | Adirio/pandas | python | @property
def base(self):
' '
return None |
@classmethod
def _from_inferred_categories(cls, inferred_categories, inferred_codes, dtype):
"Construct a Categorical from inferred values\n\n For inferred categories (`dtype` is None) the categories are sorted.\n For explicit `dtype`, the `inferred_categories` are cast to the\n appropriate typ... | 6,075,375,981,098,576,000 | Construct a Categorical from inferred values
For inferred categories (`dtype` is None) the categories are sorted.
For explicit `dtype`, the `inferred_categories` are cast to the
appropriate type.
Parameters
----------
inferred_categories : Index
inferred_codes : Index
dtype : CategoricalDtype or 'category'
Returns
... | pandas/core/arrays/categorical.py | _from_inferred_categories | Adirio/pandas | python | @classmethod
def _from_inferred_categories(cls, inferred_categories, inferred_codes, dtype):
"Construct a Categorical from inferred values\n\n For inferred categories (`dtype` is None) the categories are sorted.\n For explicit `dtype`, the `inferred_categories` are cast to the\n appropriate typ... |
@classmethod
def from_codes(cls, codes, categories, ordered=False):
'\n Make a Categorical type from codes and categories arrays.\n\n This constructor is useful if you already have codes and categories and\n so do not need the (computation intensive) factorization step, which is\n usuall... | -2,980,025,623,766,717,000 | Make a Categorical type from codes and categories arrays.
This constructor is useful if you already have codes and categories and
so do not need the (computation intensive) factorization step, which is
usually done on the constructor.
If your data does not follow this convention, please use the normal
constructor.
P... | pandas/core/arrays/categorical.py | from_codes | Adirio/pandas | python | @classmethod
def from_codes(cls, codes, categories, ordered=False):
'\n Make a Categorical type from codes and categories arrays.\n\n This constructor is useful if you already have codes and categories and\n so do not need the (computation intensive) factorization step, which is\n usuall... |
def _get_codes(self):
' Get the codes.\n\n Returns\n -------\n codes : integer array view\n A non writable view of the `codes` array.\n '
v = self._codes.view()
v.flags.writeable = False
return v | -7,600,924,652,233,758,000 | Get the codes.
Returns
-------
codes : integer array view
A non writable view of the `codes` array. | pandas/core/arrays/categorical.py | _get_codes | Adirio/pandas | python | def _get_codes(self):
' Get the codes.\n\n Returns\n -------\n codes : integer array view\n A non writable view of the `codes` array.\n '
v = self._codes.view()
v.flags.writeable = False
return v |
def _set_codes(self, codes):
'\n Not settable by the user directly\n '
raise ValueError('cannot set Categorical codes directly') | 5,406,395,936,789,598,000 | Not settable by the user directly | pandas/core/arrays/categorical.py | _set_codes | Adirio/pandas | python | def _set_codes(self, codes):
'\n \n '
raise ValueError('cannot set Categorical codes directly') |
def _set_categories(self, categories, fastpath=False):
" Sets new categories inplace\n\n Parameters\n ----------\n fastpath : boolean (default: False)\n Don't perform validation of the categories for uniqueness or nulls\n\n Examples\n --------\n >>> c = pd.Categor... | 5,246,180,266,847,194,000 | Sets new categories inplace
Parameters
----------
fastpath : boolean (default: False)
Don't perform validation of the categories for uniqueness or nulls
Examples
--------
>>> c = pd.Categorical(['a', 'b'])
>>> c
[a, b]
Categories (2, object): [a, b]
>>> c._set_categories(pd.Index(['a', 'c']))
>>> c
[a, c]
Categor... | pandas/core/arrays/categorical.py | _set_categories | Adirio/pandas | python | def _set_categories(self, categories, fastpath=False):
" Sets new categories inplace\n\n Parameters\n ----------\n fastpath : boolean (default: False)\n Don't perform validation of the categories for uniqueness or nulls\n\n Examples\n --------\n >>> c = pd.Categor... |
def _set_dtype(self, dtype):
"Internal method for directly updating the CategoricalDtype\n\n Parameters\n ----------\n dtype : CategoricalDtype\n\n Notes\n -----\n We don't do any validation here. It's assumed that the dtype is\n a (valid) instance of `CategoricalDty... | -6,067,429,269,616,330,000 | Internal method for directly updating the CategoricalDtype
Parameters
----------
dtype : CategoricalDtype
Notes
-----
We don't do any validation here. It's assumed that the dtype is
a (valid) instance of `CategoricalDtype`. | pandas/core/arrays/categorical.py | _set_dtype | Adirio/pandas | python | def _set_dtype(self, dtype):
"Internal method for directly updating the CategoricalDtype\n\n Parameters\n ----------\n dtype : CategoricalDtype\n\n Notes\n -----\n We don't do any validation here. It's assumed that the dtype is\n a (valid) instance of `CategoricalDty... |
def set_ordered(self, value, inplace=False):
'\n Sets the ordered attribute to the boolean value\n\n Parameters\n ----------\n value : boolean to set whether this categorical is ordered (True) or\n not (False)\n inplace : boolean (default: False)\n Whether or n... | -5,951,419,796,902,331,000 | Sets the ordered attribute to the boolean value
Parameters
----------
value : boolean to set whether this categorical is ordered (True) or
not (False)
inplace : boolean (default: False)
Whether or not to set the ordered attribute inplace or return a copy
of this categorical with ordered set to the value | pandas/core/arrays/categorical.py | set_ordered | Adirio/pandas | python | def set_ordered(self, value, inplace=False):
'\n Sets the ordered attribute to the boolean value\n\n Parameters\n ----------\n value : boolean to set whether this categorical is ordered (True) or\n not (False)\n inplace : boolean (default: False)\n Whether or n... |
def as_ordered(self, inplace=False):
'\n Sets the Categorical to be ordered\n\n Parameters\n ----------\n inplace : boolean (default: False)\n Whether or not to set the ordered attribute inplace or return a copy\n of this categorical with ordered set to True\n ... | 578,445,005,402,782 | Sets the Categorical to be ordered
Parameters
----------
inplace : boolean (default: False)
Whether or not to set the ordered attribute inplace or return a copy
of this categorical with ordered set to True | pandas/core/arrays/categorical.py | as_ordered | Adirio/pandas | python | def as_ordered(self, inplace=False):
'\n Sets the Categorical to be ordered\n\n Parameters\n ----------\n inplace : boolean (default: False)\n Whether or not to set the ordered attribute inplace or return a copy\n of this categorical with ordered set to True\n ... |
def as_unordered(self, inplace=False):
'\n Sets the Categorical to be unordered\n\n Parameters\n ----------\n inplace : boolean (default: False)\n Whether or not to set the ordered attribute inplace or return a copy\n of this categorical with ordered set to False\n ... | -5,309,315,199,635,879,000 | Sets the Categorical to be unordered
Parameters
----------
inplace : boolean (default: False)
Whether or not to set the ordered attribute inplace or return a copy
of this categorical with ordered set to False | pandas/core/arrays/categorical.py | as_unordered | Adirio/pandas | python | def as_unordered(self, inplace=False):
'\n Sets the Categorical to be unordered\n\n Parameters\n ----------\n inplace : boolean (default: False)\n Whether or not to set the ordered attribute inplace or return a copy\n of this categorical with ordered set to False\n ... |
def set_categories(self, new_categories, ordered=None, rename=False, inplace=False):
' Sets the categories to the specified new_categories.\n\n `new_categories` can include new categories (which will result in\n unused categories) or remove old categories (which results in values\n set to NaN).... | -3,923,649,045,691,250,000 | Sets the categories to the specified new_categories.
`new_categories` can include new categories (which will result in
unused categories) or remove old categories (which results in values
set to NaN). If `rename==True`, the categories will simple be renamed
(less or more items than in old categories will result in val... | pandas/core/arrays/categorical.py | set_categories | Adirio/pandas | python | def set_categories(self, new_categories, ordered=None, rename=False, inplace=False):
' Sets the categories to the specified new_categories.\n\n `new_categories` can include new categories (which will result in\n unused categories) or remove old categories (which results in values\n set to NaN).... |
def rename_categories(self, new_categories, inplace=False):
" Renames categories.\n\n Raises\n ------\n ValueError\n If new categories are list-like and do not have the same number of\n items than the current categories or do not validate as categories\n\n Parameter... | 4,900,925,190,630,737,000 | Renames categories.
Raises
------
ValueError
If new categories are list-like and do not have the same number of
items than the current categories or do not validate as categories
Parameters
----------
new_categories : list-like, dict-like or callable
* list-like: all items must be unique and the number of... | pandas/core/arrays/categorical.py | rename_categories | Adirio/pandas | python | def rename_categories(self, new_categories, inplace=False):
" Renames categories.\n\n Raises\n ------\n ValueError\n If new categories are list-like and do not have the same number of\n items than the current categories or do not validate as categories\n\n Parameter... |
def reorder_categories(self, new_categories, ordered=None, inplace=False):
' Reorders categories as specified in new_categories.\n\n `new_categories` need to include all old categories and no new category\n items.\n\n Raises\n ------\n ValueError\n If the new categories... | -1,027,613,687,673,260,500 | Reorders categories as specified in new_categories.
`new_categories` need to include all old categories and no new category
items.
Raises
------
ValueError
If the new categories do not contain all old category items or any
new ones
Parameters
----------
new_categories : Index-like
The categories in new or... | pandas/core/arrays/categorical.py | reorder_categories | Adirio/pandas | python | def reorder_categories(self, new_categories, ordered=None, inplace=False):
' Reorders categories as specified in new_categories.\n\n `new_categories` need to include all old categories and no new category\n items.\n\n Raises\n ------\n ValueError\n If the new categories... |
def add_categories(self, new_categories, inplace=False):
' Add new categories.\n\n `new_categories` will be included at the last/highest place in the\n categories and will be unused directly after this call.\n\n Raises\n ------\n ValueError\n If the new categories inclu... | -7,761,468,792,164,887,000 | Add new categories.
`new_categories` will be included at the last/highest place in the
categories and will be unused directly after this call.
Raises
------
ValueError
If the new categories include old categories or do not validate as
categories
Parameters
----------
new_categories : category or list-like of... | pandas/core/arrays/categorical.py | add_categories | Adirio/pandas | python | def add_categories(self, new_categories, inplace=False):
' Add new categories.\n\n `new_categories` will be included at the last/highest place in the\n categories and will be unused directly after this call.\n\n Raises\n ------\n ValueError\n If the new categories inclu... |
def remove_categories(self, removals, inplace=False):
' Removes the specified categories.\n\n `removals` must be included in the old categories. Values which were in\n the removed categories will be set to NaN\n\n Raises\n ------\n ValueError\n If the removals are not c... | 613,014,990,297,959,800 | Removes the specified categories.
`removals` must be included in the old categories. Values which were in
the removed categories will be set to NaN
Raises
------
ValueError
If the removals are not contained in the categories
Parameters
----------
removals : category or list of categories
The categories which ... | pandas/core/arrays/categorical.py | remove_categories | Adirio/pandas | python | def remove_categories(self, removals, inplace=False):
' Removes the specified categories.\n\n `removals` must be included in the old categories. Values which were in\n the removed categories will be set to NaN\n\n Raises\n ------\n ValueError\n If the removals are not c... |
def remove_unused_categories(self, inplace=False):
' Removes categories which are not used.\n\n Parameters\n ----------\n inplace : boolean (default: False)\n Whether or not to drop unused categories inplace or return a copy of\n this categorical with unused categories dropp... | -2,912,470,624,796,751,000 | Removes categories which are not used.
Parameters
----------
inplace : boolean (default: False)
Whether or not to drop unused categories inplace or return a copy of
this categorical with unused categories dropped.
Returns
-------
cat : Categorical with unused categories dropped or None if inplace.
See also
---... | pandas/core/arrays/categorical.py | remove_unused_categories | Adirio/pandas | python | def remove_unused_categories(self, inplace=False):
' Removes categories which are not used.\n\n Parameters\n ----------\n inplace : boolean (default: False)\n Whether or not to drop unused categories inplace or return a copy of\n this categorical with unused categories dropp... |
def map(self, mapper):
"\n Map categories using input correspondence (dict, Series, or function).\n\n Maps the categories to new categories. If the mapping correspondence is\n one-to-one the result is a :class:`~pandas.Categorical` which has the\n same order property as the original, oth... | 3,000,125,632,197,192,700 | Map categories using input correspondence (dict, Series, or function).
Maps the categories to new categories. If the mapping correspondence is
one-to-one the result is a :class:`~pandas.Categorical` which has the
same order property as the original, otherwise a :class:`~pandas.Index`
is returned.
If a `dict` or :clas... | pandas/core/arrays/categorical.py | map | Adirio/pandas | python | def map(self, mapper):
"\n Map categories using input correspondence (dict, Series, or function).\n\n Maps the categories to new categories. If the mapping correspondence is\n one-to-one the result is a :class:`~pandas.Categorical` which has the\n same order property as the original, oth... |
@property
def shape(self):
' Shape of the Categorical.\n\n For internal compatibility with numpy arrays.\n\n Returns\n -------\n shape : tuple\n '
return tuple([len(self._codes)]) | 5,707,964,752,293,149,000 | Shape of the Categorical.
For internal compatibility with numpy arrays.
Returns
-------
shape : tuple | pandas/core/arrays/categorical.py | shape | Adirio/pandas | python | @property
def shape(self):
' Shape of the Categorical.\n\n For internal compatibility with numpy arrays.\n\n Returns\n -------\n shape : tuple\n '
return tuple([len(self._codes)]) |
def shift(self, periods):
'\n Shift Categorical by desired number of periods.\n\n Parameters\n ----------\n periods : int\n Number of periods to move, can be positive or negative\n\n Returns\n -------\n shifted : Categorical\n '
codes = self.cod... | -8,439,460,178,993,714,000 | Shift Categorical by desired number of periods.
Parameters
----------
periods : int
Number of periods to move, can be positive or negative
Returns
-------
shifted : Categorical | pandas/core/arrays/categorical.py | shift | Adirio/pandas | python | def shift(self, periods):
'\n Shift Categorical by desired number of periods.\n\n Parameters\n ----------\n periods : int\n Number of periods to move, can be positive or negative\n\n Returns\n -------\n shifted : Categorical\n '
codes = self.cod... |
def __array__(self, dtype=None):
'\n The numpy array interface.\n\n Returns\n -------\n values : numpy array\n A numpy array of either the specified dtype or,\n if dtype==None (default), the same dtype as\n categorical.categories.dtype\n '
ret ... | 2,061,315,902,725,703,000 | The numpy array interface.
Returns
-------
values : numpy array
A numpy array of either the specified dtype or,
if dtype==None (default), the same dtype as
categorical.categories.dtype | pandas/core/arrays/categorical.py | __array__ | Adirio/pandas | python | def __array__(self, dtype=None):
'\n The numpy array interface.\n\n Returns\n -------\n values : numpy array\n A numpy array of either the specified dtype or,\n if dtype==None (default), the same dtype as\n categorical.categories.dtype\n '
ret ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.