text
stringlengths
0
828
3965,"def _concrete_acl_list(self, acl_docs):
""""""Concretize a list of ACL documents.
:param list acl_docs: A list of ACL documents. Should come from the API.
:returns: A list of :py:class:`ACL` objects.
:rtype: list
""""""
if not acl_docs:
return []
return list(filter(None, [self._concrete_acl(acl_doc=doc) for doc in acl_docs]))"
3966,"def _default_request_kwargs(self):
""""""The default request keyword arguments to be passed to the requests library.""""""
defaults = copy.deepcopy(super(Acls, self)._default_request_kwargs)
defaults.setdefault('headers', {}).update({
'X-Auth-Token': self._client.auth._token
})
return defaults"
3967,"def _url(self):
""""""The URL of this ACL object.""""""
base_url = self._client._url.rstrip('/')
return '{}/instances/{}/acls/{}/'.format(base_url, self.instance_name, self.id)"
3968,"def first(pipe, items=1):
''' first is essentially the next() function except it's second argument
determines how many of the first items you want. If items is more than
1 the output is an islice of the generator. If items is 1, the first
item is returned
'''
pipe = iter(pipe)
return next(pipe) if items == 1 else islice(pipe, 0, items)"
3969,"def create_state(cls, state, **kwargs):
""""""Create State
Create a new State
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async=True
>>> thread = api.create_state(state, async=True)
>>> result = thread.get()
:param async bool
:param State state: Attributes of state to create (required)
:return: State
If the method is called asynchronously,
returns the request thread.
""""""
kwargs['_return_http_data_only'] = True
if kwargs.get('async'):
return cls._create_state_with_http_info(state, **kwargs)
else:
(data) = cls._create_state_with_http_info(state, **kwargs)
return data"
3970,"def delete_state_by_id(cls, state_id, **kwargs):
""""""Delete State
Delete an instance of State by its ID.
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async=True
>>> thread = api.delete_state_by_id(state_id, async=True)
>>> result = thread.get()
:param async bool
:param str state_id: ID of state to delete. (required)
:return: None
If the method is called asynchronously,
returns the request thread.
""""""
kwargs['_return_http_data_only'] = True
if kwargs.get('async'):
return cls._delete_state_by_id_with_http_info(state_id, **kwargs)
else:
(data) = cls._delete_state_by_id_with_http_info(state_id, **kwargs)
return data"
3971,"def get_state_by_id(cls, state_id, **kwargs):
""""""Find State
Return single instance of State by its ID.
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async=True
>>> thread = api.get_state_by_id(state_id, async=True)
>>> result = thread.get()
:param async bool
:param str state_id: ID of state to return (required)
:return: State
If the method is called asynchronously,
returns the request thread.
""""""
kwargs['_return_http_data_only'] = True
if kwargs.get('async'):
return cls._get_state_by_id_with_http_info(state_id, **kwargs)
else:
(data) = cls._get_state_by_id_with_http_info(state_id, **kwargs)
return data"
3972,"def list_all_states(cls, **kwargs):
""""""List States
Return a list of States
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async=True
>>> thread = api.list_all_states(async=True)