repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
partition
stringclasses
1 value
openid/python-openid
openid/consumer/consumer.py
AuthRequest.formMarkup
def formMarkup(self, realm, return_to=None, immediate=False, form_tag_attrs=None): """Get html for a form to submit this request to the IDP. @param form_tag_attrs: Dictionary of attributes to be added to the form tag. 'accept-charset' and 'enctype' have defaults that...
python
def formMarkup(self, realm, return_to=None, immediate=False, form_tag_attrs=None): """Get html for a form to submit this request to the IDP. @param form_tag_attrs: Dictionary of attributes to be added to the form tag. 'accept-charset' and 'enctype' have defaults that...
[ "def", "formMarkup", "(", "self", ",", "realm", ",", "return_to", "=", "None", ",", "immediate", "=", "False", ",", "form_tag_attrs", "=", "None", ")", ":", "message", "=", "self", ".", "getMessage", "(", "realm", ",", "return_to", ",", "immediate", ")",...
Get html for a form to submit this request to the IDP. @param form_tag_attrs: Dictionary of attributes to be added to the form tag. 'accept-charset' and 'enctype' have defaults that can be overridden. If a value is supplied for 'action' or 'method', it will be replaced. ...
[ "Get", "html", "for", "a", "form", "to", "submit", "this", "request", "to", "the", "IDP", "." ]
f7e13536f0d1828d3cef5ae7a7b55cabadff37fc
https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/consumer/consumer.py#L1649-L1661
train
openid/python-openid
openid/consumer/consumer.py
AuthRequest.htmlMarkup
def htmlMarkup(self, realm, return_to=None, immediate=False, form_tag_attrs=None): """Get an autosubmitting HTML page that submits this request to the IDP. This is just a wrapper for formMarkup. @see: formMarkup @returns: str """ return oidutil.autoSubmitHT...
python
def htmlMarkup(self, realm, return_to=None, immediate=False, form_tag_attrs=None): """Get an autosubmitting HTML page that submits this request to the IDP. This is just a wrapper for formMarkup. @see: formMarkup @returns: str """ return oidutil.autoSubmitHT...
[ "def", "htmlMarkup", "(", "self", ",", "realm", ",", "return_to", "=", "None", ",", "immediate", "=", "False", ",", "form_tag_attrs", "=", "None", ")", ":", "return", "oidutil", ".", "autoSubmitHTML", "(", "self", ".", "formMarkup", "(", "realm", ",", "r...
Get an autosubmitting HTML page that submits this request to the IDP. This is just a wrapper for formMarkup. @see: formMarkup @returns: str
[ "Get", "an", "autosubmitting", "HTML", "page", "that", "submits", "this", "request", "to", "the", "IDP", ".", "This", "is", "just", "a", "wrapper", "for", "formMarkup", "." ]
f7e13536f0d1828d3cef5ae7a7b55cabadff37fc
https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/consumer/consumer.py#L1663-L1675
train
openid/python-openid
openid/consumer/consumer.py
SuccessResponse.isSigned
def isSigned(self, ns_uri, ns_key): """Return whether a particular key is signed, regardless of its namespace alias """ return self.message.getKey(ns_uri, ns_key) in self.signed_fields
python
def isSigned(self, ns_uri, ns_key): """Return whether a particular key is signed, regardless of its namespace alias """ return self.message.getKey(ns_uri, ns_key) in self.signed_fields
[ "def", "isSigned", "(", "self", ",", "ns_uri", ",", "ns_key", ")", ":", "return", "self", ".", "message", ".", "getKey", "(", "ns_uri", ",", "ns_key", ")", "in", "self", ".", "signed_fields" ]
Return whether a particular key is signed, regardless of its namespace alias
[ "Return", "whether", "a", "particular", "key", "is", "signed", "regardless", "of", "its", "namespace", "alias" ]
f7e13536f0d1828d3cef5ae7a7b55cabadff37fc
https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/consumer/consumer.py#L1759-L1763
train
openid/python-openid
openid/consumer/consumer.py
SuccessResponse.getSigned
def getSigned(self, ns_uri, ns_key, default=None): """Return the specified signed field if available, otherwise return default """ if self.isSigned(ns_uri, ns_key): return self.message.getArg(ns_uri, ns_key, default) else: return default
python
def getSigned(self, ns_uri, ns_key, default=None): """Return the specified signed field if available, otherwise return default """ if self.isSigned(ns_uri, ns_key): return self.message.getArg(ns_uri, ns_key, default) else: return default
[ "def", "getSigned", "(", "self", ",", "ns_uri", ",", "ns_key", ",", "default", "=", "None", ")", ":", "if", "self", ".", "isSigned", "(", "ns_uri", ",", "ns_key", ")", ":", "return", "self", ".", "message", ".", "getArg", "(", "ns_uri", ",", "ns_key"...
Return the specified signed field if available, otherwise return default
[ "Return", "the", "specified", "signed", "field", "if", "available", "otherwise", "return", "default" ]
f7e13536f0d1828d3cef5ae7a7b55cabadff37fc
https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/consumer/consumer.py#L1765-L1772
train
openid/python-openid
openid/consumer/consumer.py
SuccessResponse.getSignedNS
def getSignedNS(self, ns_uri): """Get signed arguments from the response message. Return a dict of all arguments in the specified namespace. If any of the arguments are not signed, return None. """ msg_args = self.message.getArgs(ns_uri) for key in msg_args.iterkeys():...
python
def getSignedNS(self, ns_uri): """Get signed arguments from the response message. Return a dict of all arguments in the specified namespace. If any of the arguments are not signed, return None. """ msg_args = self.message.getArgs(ns_uri) for key in msg_args.iterkeys():...
[ "def", "getSignedNS", "(", "self", ",", "ns_uri", ")", ":", "msg_args", "=", "self", ".", "message", ".", "getArgs", "(", "ns_uri", ")", "for", "key", "in", "msg_args", ".", "iterkeys", "(", ")", ":", "if", "not", "self", ".", "isSigned", "(", "ns_ur...
Get signed arguments from the response message. Return a dict of all arguments in the specified namespace. If any of the arguments are not signed, return None.
[ "Get", "signed", "arguments", "from", "the", "response", "message", ".", "Return", "a", "dict", "of", "all", "arguments", "in", "the", "specified", "namespace", ".", "If", "any", "of", "the", "arguments", "are", "not", "signed", "return", "None", "." ]
f7e13536f0d1828d3cef5ae7a7b55cabadff37fc
https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/consumer/consumer.py#L1774-L1787
train
openid/python-openid
openid/consumer/consumer.py
SuccessResponse.extensionResponse
def extensionResponse(self, namespace_uri, require_signed): """Return response arguments in the specified namespace. @param namespace_uri: The namespace URI of the arguments to be returned. @param require_signed: True if the arguments should be among those signed in the respons...
python
def extensionResponse(self, namespace_uri, require_signed): """Return response arguments in the specified namespace. @param namespace_uri: The namespace URI of the arguments to be returned. @param require_signed: True if the arguments should be among those signed in the respons...
[ "def", "extensionResponse", "(", "self", ",", "namespace_uri", ",", "require_signed", ")", ":", "if", "require_signed", ":", "return", "self", ".", "getSignedNS", "(", "namespace_uri", ")", "else", ":", "return", "self", ".", "message", ".", "getArgs", "(", ...
Return response arguments in the specified namespace. @param namespace_uri: The namespace URI of the arguments to be returned. @param require_signed: True if the arguments should be among those signed in the response, False if you don't care. If require_signed is True and the ...
[ "Return", "response", "arguments", "in", "the", "specified", "namespace", "." ]
f7e13536f0d1828d3cef5ae7a7b55cabadff37fc
https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/consumer/consumer.py#L1789-L1804
train
openid/python-openid
openid/yadis/filters.py
mkFilter
def mkFilter(parts): """Convert a filter-convertable thing into a filter @param parts: a filter, an endpoint, a callable, or a list of any of these. """ # Convert the parts into a list, and pass to mkCompoundFilter if parts is None: parts = [BasicServiceEndpoint] try: parts = l...
python
def mkFilter(parts): """Convert a filter-convertable thing into a filter @param parts: a filter, an endpoint, a callable, or a list of any of these. """ # Convert the parts into a list, and pass to mkCompoundFilter if parts is None: parts = [BasicServiceEndpoint] try: parts = l...
[ "def", "mkFilter", "(", "parts", ")", ":", "if", "parts", "is", "None", ":", "parts", "=", "[", "BasicServiceEndpoint", "]", "try", ":", "parts", "=", "list", "(", "parts", ")", "except", "TypeError", ":", "return", "mkCompoundFilter", "(", "[", "parts",...
Convert a filter-convertable thing into a filter @param parts: a filter, an endpoint, a callable, or a list of any of these.
[ "Convert", "a", "filter", "-", "convertable", "thing", "into", "a", "filter" ]
f7e13536f0d1828d3cef5ae7a7b55cabadff37fc
https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/yadis/filters.py#L146-L160
train
openid/python-openid
openid/yadis/filters.py
TransformFilterMaker.getServiceEndpoints
def getServiceEndpoints(self, yadis_url, service_element): """Returns an iterator of endpoint objects produced by the filter functions.""" endpoints = [] # Do an expansion of the service element by xrd:Type and xrd:URI for type_uris, uri, _ in expandService(service_element): ...
python
def getServiceEndpoints(self, yadis_url, service_element): """Returns an iterator of endpoint objects produced by the filter functions.""" endpoints = [] # Do an expansion of the service element by xrd:Type and xrd:URI for type_uris, uri, _ in expandService(service_element): ...
[ "def", "getServiceEndpoints", "(", "self", ",", "yadis_url", ",", "service_element", ")", ":", "endpoints", "=", "[", "]", "for", "type_uris", ",", "uri", ",", "_", "in", "expandService", "(", "service_element", ")", ":", "endpoint", "=", "BasicServiceEndpoint...
Returns an iterator of endpoint objects produced by the filter functions.
[ "Returns", "an", "iterator", "of", "endpoint", "objects", "produced", "by", "the", "filter", "functions", "." ]
f7e13536f0d1828d3cef5ae7a7b55cabadff37fc
https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/yadis/filters.py#L95-L112
train
openid/python-openid
openid/yadis/filters.py
TransformFilterMaker.applyFilters
def applyFilters(self, endpoint): """Apply filter functions to an endpoint until one of them returns non-None.""" for filter_function in self.filter_functions: e = filter_function(endpoint) if e is not None: # Once one of the filters has returned an ...
python
def applyFilters(self, endpoint): """Apply filter functions to an endpoint until one of them returns non-None.""" for filter_function in self.filter_functions: e = filter_function(endpoint) if e is not None: # Once one of the filters has returned an ...
[ "def", "applyFilters", "(", "self", ",", "endpoint", ")", ":", "for", "filter_function", "in", "self", ".", "filter_functions", ":", "e", "=", "filter_function", "(", "endpoint", ")", "if", "e", "is", "not", "None", ":", "return", "e", "return", "None" ]
Apply filter functions to an endpoint until one of them returns non-None.
[ "Apply", "filter", "functions", "to", "an", "endpoint", "until", "one", "of", "them", "returns", "non", "-", "None", "." ]
f7e13536f0d1828d3cef5ae7a7b55cabadff37fc
https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/yadis/filters.py#L114-L124
train
openid/python-openid
openid/yadis/filters.py
CompoundFilter.getServiceEndpoints
def getServiceEndpoints(self, yadis_url, service_element): """Generate all endpoint objects for all of the subfilters of this filter and return their concatenation.""" endpoints = [] for subfilter in self.subfilters: endpoints.extend( subfilter.getServiceEndpo...
python
def getServiceEndpoints(self, yadis_url, service_element): """Generate all endpoint objects for all of the subfilters of this filter and return their concatenation.""" endpoints = [] for subfilter in self.subfilters: endpoints.extend( subfilter.getServiceEndpo...
[ "def", "getServiceEndpoints", "(", "self", ",", "yadis_url", ",", "service_element", ")", ":", "endpoints", "=", "[", "]", "for", "subfilter", "in", "self", ".", "subfilters", ":", "endpoints", ".", "extend", "(", "subfilter", ".", "getServiceEndpoints", "(", ...
Generate all endpoint objects for all of the subfilters of this filter and return their concatenation.
[ "Generate", "all", "endpoint", "objects", "for", "all", "of", "the", "subfilters", "of", "this", "filter", "and", "return", "their", "concatenation", "." ]
f7e13536f0d1828d3cef5ae7a7b55cabadff37fc
https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/yadis/filters.py#L133-L140
train
openid/python-openid
openid/cryptutil.py
randomString
def randomString(length, chrs=None): """Produce a string of length random bytes, chosen from chrs.""" if chrs is None: return getBytes(length) else: n = len(chrs) return ''.join([chrs[randrange(n)] for _ in xrange(length)])
python
def randomString(length, chrs=None): """Produce a string of length random bytes, chosen from chrs.""" if chrs is None: return getBytes(length) else: n = len(chrs) return ''.join([chrs[randrange(n)] for _ in xrange(length)])
[ "def", "randomString", "(", "length", ",", "chrs", "=", "None", ")", ":", "if", "chrs", "is", "None", ":", "return", "getBytes", "(", "length", ")", "else", ":", "n", "=", "len", "(", "chrs", ")", "return", "''", ".", "join", "(", "[", "chrs", "[...
Produce a string of length random bytes, chosen from chrs.
[ "Produce", "a", "string", "of", "length", "random", "bytes", "chosen", "from", "chrs", "." ]
f7e13536f0d1828d3cef5ae7a7b55cabadff37fc
https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/cryptutil.py#L214-L220
train
ethereum/eth-hash
eth_hash/main.py
Keccak256._hasher_first_run
def _hasher_first_run(self, preimage): ''' Invoke the backend on-demand, and check an expected hash result, then replace this first run with the new hasher method. This is a bit of a hacky way to minimize overhead on hash calls after this first one. ''' new_hasher = self....
python
def _hasher_first_run(self, preimage): ''' Invoke the backend on-demand, and check an expected hash result, then replace this first run with the new hasher method. This is a bit of a hacky way to minimize overhead on hash calls after this first one. ''' new_hasher = self....
[ "def", "_hasher_first_run", "(", "self", ",", "preimage", ")", ":", "new_hasher", "=", "self", ".", "_backend", ".", "keccak256", "assert", "new_hasher", "(", "b''", ")", "==", "b\"\\xc5\\xd2F\\x01\\x86\\xf7#<\\x92~}\\xb2\\xdc\\xc7\\x03\\xc0\\xe5\\x00\\xb6S\\xca\\x82';\\x7b...
Invoke the backend on-demand, and check an expected hash result, then replace this first run with the new hasher method. This is a bit of a hacky way to minimize overhead on hash calls after this first one.
[ "Invoke", "the", "backend", "on", "-", "demand", "and", "check", "an", "expected", "hash", "result", "then", "replace", "this", "first", "run", "with", "the", "new", "hasher", "method", ".", "This", "is", "a", "bit", "of", "a", "hacky", "way", "to", "m...
d05c8ac0710e2dc16aae2c8a1e406ee7cbe78871
https://github.com/ethereum/eth-hash/blob/d05c8ac0710e2dc16aae2c8a1e406ee7cbe78871/eth_hash/main.py#L16-L25
train
lukasgeiter/mkdocs-awesome-pages-plugin
mkdocs_awesome_pages_plugin/utils.py
dirname
def dirname(path: Optional[str]) -> Optional[str]: """ Returns the directory component of a pathname and None if the argument is None """ if path is not None: return os.path.dirname(path)
python
def dirname(path: Optional[str]) -> Optional[str]: """ Returns the directory component of a pathname and None if the argument is None """ if path is not None: return os.path.dirname(path)
[ "def", "dirname", "(", "path", ":", "Optional", "[", "str", "]", ")", "->", "Optional", "[", "str", "]", ":", "if", "path", "is", "not", "None", ":", "return", "os", ".", "path", ".", "dirname", "(", "path", ")" ]
Returns the directory component of a pathname and None if the argument is None
[ "Returns", "the", "directory", "component", "of", "a", "pathname", "and", "None", "if", "the", "argument", "is", "None" ]
f5693418b71a0849c5fee3b3307e117983c4e2d8
https://github.com/lukasgeiter/mkdocs-awesome-pages-plugin/blob/f5693418b71a0849c5fee3b3307e117983c4e2d8/mkdocs_awesome_pages_plugin/utils.py#L19-L22
train
lukasgeiter/mkdocs-awesome-pages-plugin
mkdocs_awesome_pages_plugin/utils.py
basename
def basename(path: Optional[str]) -> Optional[str]: """ Returns the final component of a pathname and None if the argument is None """ if path is not None: return os.path.basename(path)
python
def basename(path: Optional[str]) -> Optional[str]: """ Returns the final component of a pathname and None if the argument is None """ if path is not None: return os.path.basename(path)
[ "def", "basename", "(", "path", ":", "Optional", "[", "str", "]", ")", "->", "Optional", "[", "str", "]", ":", "if", "path", "is", "not", "None", ":", "return", "os", ".", "path", ".", "basename", "(", "path", ")" ]
Returns the final component of a pathname and None if the argument is None
[ "Returns", "the", "final", "component", "of", "a", "pathname", "and", "None", "if", "the", "argument", "is", "None" ]
f5693418b71a0849c5fee3b3307e117983c4e2d8
https://github.com/lukasgeiter/mkdocs-awesome-pages-plugin/blob/f5693418b71a0849c5fee3b3307e117983c4e2d8/mkdocs_awesome_pages_plugin/utils.py#L25-L28
train
lukasgeiter/mkdocs-awesome-pages-plugin
mkdocs_awesome_pages_plugin/utils.py
normpath
def normpath(path: Optional[str]) -> Optional[str]: """ Normalizes the path, returns None if the argument is None """ if path is not None: return os.path.normpath(path)
python
def normpath(path: Optional[str]) -> Optional[str]: """ Normalizes the path, returns None if the argument is None """ if path is not None: return os.path.normpath(path)
[ "def", "normpath", "(", "path", ":", "Optional", "[", "str", "]", ")", "->", "Optional", "[", "str", "]", ":", "if", "path", "is", "not", "None", ":", "return", "os", ".", "path", ".", "normpath", "(", "path", ")" ]
Normalizes the path, returns None if the argument is None
[ "Normalizes", "the", "path", "returns", "None", "if", "the", "argument", "is", "None" ]
f5693418b71a0849c5fee3b3307e117983c4e2d8
https://github.com/lukasgeiter/mkdocs-awesome-pages-plugin/blob/f5693418b71a0849c5fee3b3307e117983c4e2d8/mkdocs_awesome_pages_plugin/utils.py#L31-L34
train
lukasgeiter/mkdocs-awesome-pages-plugin
mkdocs_awesome_pages_plugin/utils.py
join_paths
def join_paths(path1: Optional[str], path2: Optional[str]) -> Optional[str]: """ Joins two paths if neither of them is None """ if path1 is not None and path2 is not None: return os.path.join(path1, path2)
python
def join_paths(path1: Optional[str], path2: Optional[str]) -> Optional[str]: """ Joins two paths if neither of them is None """ if path1 is not None and path2 is not None: return os.path.join(path1, path2)
[ "def", "join_paths", "(", "path1", ":", "Optional", "[", "str", "]", ",", "path2", ":", "Optional", "[", "str", "]", ")", "->", "Optional", "[", "str", "]", ":", "if", "path1", "is", "not", "None", "and", "path2", "is", "not", "None", ":", "return"...
Joins two paths if neither of them is None
[ "Joins", "two", "paths", "if", "neither", "of", "them", "is", "None" ]
f5693418b71a0849c5fee3b3307e117983c4e2d8
https://github.com/lukasgeiter/mkdocs-awesome-pages-plugin/blob/f5693418b71a0849c5fee3b3307e117983c4e2d8/mkdocs_awesome_pages_plugin/utils.py#L37-L40
train
msiemens/PyGitUp
PyGitUp/git_wrapper.py
GitWrapper.stasher
def stasher(self): """ A stashing contextmanager. """ # nonlocal for python2 stashed = [False] clean = [False] def stash(): if clean[0] or not self.repo.is_dirty(submodules=False): clean[0] = True return ...
python
def stasher(self): """ A stashing contextmanager. """ # nonlocal for python2 stashed = [False] clean = [False] def stash(): if clean[0] or not self.repo.is_dirty(submodules=False): clean[0] = True return ...
[ "def", "stasher", "(", "self", ")", ":", "stashed", "=", "[", "False", "]", "clean", "=", "[", "False", "]", "def", "stash", "(", ")", ":", "if", "clean", "[", "0", "]", "or", "not", "self", ".", "repo", ".", "is_dirty", "(", "submodules", "=", ...
A stashing contextmanager.
[ "A", "stashing", "contextmanager", "." ]
b1f78831cb6b8d29d3a7d59f7a2b54fdd0720e9c
https://github.com/msiemens/PyGitUp/blob/b1f78831cb6b8d29d3a7d59f7a2b54fdd0720e9c/PyGitUp/git_wrapper.py#L117-L154
train
msiemens/PyGitUp
PyGitUp/git_wrapper.py
GitWrapper.checkout
def checkout(self, branch_name): """ Checkout a branch by name. """ try: find( self.repo.branches, lambda b: b.name == branch_name ).checkout() except OrigCheckoutError as e: raise CheckoutError(branch_name, details=e)
python
def checkout(self, branch_name): """ Checkout a branch by name. """ try: find( self.repo.branches, lambda b: b.name == branch_name ).checkout() except OrigCheckoutError as e: raise CheckoutError(branch_name, details=e)
[ "def", "checkout", "(", "self", ",", "branch_name", ")", ":", "try", ":", "find", "(", "self", ".", "repo", ".", "branches", ",", "lambda", "b", ":", "b", ".", "name", "==", "branch_name", ")", ".", "checkout", "(", ")", "except", "OrigCheckoutError", ...
Checkout a branch by name.
[ "Checkout", "a", "branch", "by", "name", "." ]
b1f78831cb6b8d29d3a7d59f7a2b54fdd0720e9c
https://github.com/msiemens/PyGitUp/blob/b1f78831cb6b8d29d3a7d59f7a2b54fdd0720e9c/PyGitUp/git_wrapper.py#L156-L163
train
msiemens/PyGitUp
PyGitUp/git_wrapper.py
GitWrapper.rebase
def rebase(self, target_branch): """ Rebase to target branch. """ current_branch = self.repo.active_branch arguments = ( ([self.config('git-up.rebase.arguments')] or []) + [target_branch.name] ) try: self._run('rebase', *argum...
python
def rebase(self, target_branch): """ Rebase to target branch. """ current_branch = self.repo.active_branch arguments = ( ([self.config('git-up.rebase.arguments')] or []) + [target_branch.name] ) try: self._run('rebase', *argum...
[ "def", "rebase", "(", "self", ",", "target_branch", ")", ":", "current_branch", "=", "self", ".", "repo", ".", "active_branch", "arguments", "=", "(", "(", "[", "self", ".", "config", "(", "'git-up.rebase.arguments'", ")", "]", "or", "[", "]", ")", "+", ...
Rebase to target branch.
[ "Rebase", "to", "target", "branch", "." ]
b1f78831cb6b8d29d3a7d59f7a2b54fdd0720e9c
https://github.com/msiemens/PyGitUp/blob/b1f78831cb6b8d29d3a7d59f7a2b54fdd0720e9c/PyGitUp/git_wrapper.py#L165-L177
train
msiemens/PyGitUp
PyGitUp/git_wrapper.py
GitWrapper.push
def push(self, *args, **kwargs): ''' Push commits to remote ''' stdout = six.b('') # Execute command cmd = self.git.push(as_process=True, *args, **kwargs) # Capture output while True: output = cmd.stdout.read(1) sys.stdout.write(outpu...
python
def push(self, *args, **kwargs): ''' Push commits to remote ''' stdout = six.b('') # Execute command cmd = self.git.push(as_process=True, *args, **kwargs) # Capture output while True: output = cmd.stdout.read(1) sys.stdout.write(outpu...
[ "def", "push", "(", "self", ",", "*", "args", ",", "**", "kwargs", ")", ":", "stdout", "=", "six", ".", "b", "(", "''", ")", "cmd", "=", "self", ".", "git", ".", "push", "(", "as_process", "=", "True", ",", "*", "args", ",", "**", "kwargs", "...
Push commits to remote
[ "Push", "commits", "to", "remote" ]
b1f78831cb6b8d29d3a7d59f7a2b54fdd0720e9c
https://github.com/msiemens/PyGitUp/blob/b1f78831cb6b8d29d3a7d59f7a2b54fdd0720e9c/PyGitUp/git_wrapper.py#L220-L252
train
msiemens/PyGitUp
PyGitUp/git_wrapper.py
GitWrapper.change_count
def change_count(self): """ The number of changes in the working directory. """ status = self.git.status(porcelain=True, untracked_files='no').strip() if not status: return 0 else: return len(status.split('\n'))
python
def change_count(self): """ The number of changes in the working directory. """ status = self.git.status(porcelain=True, untracked_files='no').strip() if not status: return 0 else: return len(status.split('\n'))
[ "def", "change_count", "(", "self", ")", ":", "status", "=", "self", ".", "git", ".", "status", "(", "porcelain", "=", "True", ",", "untracked_files", "=", "'no'", ")", ".", "strip", "(", ")", "if", "not", "status", ":", "return", "0", "else", ":", ...
The number of changes in the working directory.
[ "The", "number", "of", "changes", "in", "the", "working", "directory", "." ]
b1f78831cb6b8d29d3a7d59f7a2b54fdd0720e9c
https://github.com/msiemens/PyGitUp/blob/b1f78831cb6b8d29d3a7d59f7a2b54fdd0720e9c/PyGitUp/git_wrapper.py#L262-L268
train
msiemens/PyGitUp
PyGitUp/utils.py
uniq
def uniq(seq): """ Return a copy of seq without duplicates. """ seen = set() return [x for x in seq if str(x) not in seen and not seen.add(str(x))]
python
def uniq(seq): """ Return a copy of seq without duplicates. """ seen = set() return [x for x in seq if str(x) not in seen and not seen.add(str(x))]
[ "def", "uniq", "(", "seq", ")", ":", "seen", "=", "set", "(", ")", "return", "[", "x", "for", "x", "in", "seq", "if", "str", "(", "x", ")", "not", "in", "seen", "and", "not", "seen", ".", "add", "(", "str", "(", "x", ")", ")", "]" ]
Return a copy of seq without duplicates.
[ "Return", "a", "copy", "of", "seq", "without", "duplicates", "." ]
b1f78831cb6b8d29d3a7d59f7a2b54fdd0720e9c
https://github.com/msiemens/PyGitUp/blob/b1f78831cb6b8d29d3a7d59f7a2b54fdd0720e9c/PyGitUp/utils.py#L24-L27
train
msiemens/PyGitUp
release.py
current_version
def current_version(): """ Get the current version number from setup.py """ # Monkeypatch setuptools.setup so we get the verison number import setuptools version = [None] def monkey_setup(**settings): version[0] = settings['version'] old_setup = setuptools.setup setuptools...
python
def current_version(): """ Get the current version number from setup.py """ # Monkeypatch setuptools.setup so we get the verison number import setuptools version = [None] def monkey_setup(**settings): version[0] = settings['version'] old_setup = setuptools.setup setuptools...
[ "def", "current_version", "(", ")", ":", "import", "setuptools", "version", "=", "[", "None", "]", "def", "monkey_setup", "(", "**", "settings", ")", ":", "version", "[", "0", "]", "=", "settings", "[", "'version'", "]", "old_setup", "=", "setuptools", "...
Get the current version number from setup.py
[ "Get", "the", "current", "version", "number", "from", "setup", ".", "py" ]
b1f78831cb6b8d29d3a7d59f7a2b54fdd0720e9c
https://github.com/msiemens/PyGitUp/blob/b1f78831cb6b8d29d3a7d59f7a2b54fdd0720e9c/release.py#L22-L41
train
msiemens/PyGitUp
PyGitUp/gitup.py
run
def run(version, quiet, no_fetch, push, **kwargs): # pragma: no cover """ A nicer `git pull`. """ if version: if NO_DISTRIBUTE: print(colored('Please install \'git-up\' via pip in order to ' 'get version information.', 'yellow')) else: ...
python
def run(version, quiet, no_fetch, push, **kwargs): # pragma: no cover """ A nicer `git pull`. """ if version: if NO_DISTRIBUTE: print(colored('Please install \'git-up\' via pip in order to ' 'get version information.', 'yellow')) else: ...
[ "def", "run", "(", "version", ",", "quiet", ",", "no_fetch", ",", "push", ",", "**", "kwargs", ")", ":", "if", "version", ":", "if", "NO_DISTRIBUTE", ":", "print", "(", "colored", "(", "'Please install \\'git-up\\' via pip in order to '", "'get version information...
A nicer `git pull`.
[ "A", "nicer", "git", "pull", "." ]
b1f78831cb6b8d29d3a7d59f7a2b54fdd0720e9c
https://github.com/msiemens/PyGitUp/blob/b1f78831cb6b8d29d3a7d59f7a2b54fdd0720e9c/PyGitUp/gitup.py#L628-L656
train
msiemens/PyGitUp
PyGitUp/gitup.py
GitUp.run
def run(self): """ Run all the git-up stuff. """ try: if self.should_fetch: self.fetch() self.rebase_all_branches() if self.with_bundler(): self.check_bundler() if self.settings['push.auto']: s...
python
def run(self): """ Run all the git-up stuff. """ try: if self.should_fetch: self.fetch() self.rebase_all_branches() if self.with_bundler(): self.check_bundler() if self.settings['push.auto']: s...
[ "def", "run", "(", "self", ")", ":", "try", ":", "if", "self", ".", "should_fetch", ":", "self", ".", "fetch", "(", ")", "self", ".", "rebase_all_branches", "(", ")", "if", "self", ".", "with_bundler", "(", ")", ":", "self", ".", "check_bundler", "("...
Run all the git-up stuff.
[ "Run", "all", "the", "git", "-", "up", "stuff", "." ]
b1f78831cb6b8d29d3a7d59f7a2b54fdd0720e9c
https://github.com/msiemens/PyGitUp/blob/b1f78831cb6b8d29d3a7d59f7a2b54fdd0720e9c/PyGitUp/gitup.py#L193-L214
train
msiemens/PyGitUp
PyGitUp/gitup.py
GitUp.fetch
def fetch(self): """ Fetch the recent refs from the remotes. Unless git-up.fetch.all is set to true, all remotes with locally existent branches will be fetched. """ fetch_kwargs = {'multiple': True} fetch_args = [] if self.is_prune(): ...
python
def fetch(self): """ Fetch the recent refs from the remotes. Unless git-up.fetch.all is set to true, all remotes with locally existent branches will be fetched. """ fetch_kwargs = {'multiple': True} fetch_args = [] if self.is_prune(): ...
[ "def", "fetch", "(", "self", ")", ":", "fetch_kwargs", "=", "{", "'multiple'", ":", "True", "}", "fetch_args", "=", "[", "]", "if", "self", ".", "is_prune", "(", ")", ":", "fetch_kwargs", "[", "'prune'", "]", "=", "True", "if", "self", ".", "settings...
Fetch the recent refs from the remotes. Unless git-up.fetch.all is set to true, all remotes with locally existent branches will be fetched.
[ "Fetch", "the", "recent", "refs", "from", "the", "remotes", ".", "Unless", "git", "-", "up", ".", "fetch", ".", "all", "is", "set", "to", "true", "all", "remotes", "with", "locally", "existent", "branches", "will", "be", "fetched", "." ]
b1f78831cb6b8d29d3a7d59f7a2b54fdd0720e9c
https://github.com/msiemens/PyGitUp/blob/b1f78831cb6b8d29d3a7d59f7a2b54fdd0720e9c/PyGitUp/gitup.py#L311-L341
train
msiemens/PyGitUp
PyGitUp/gitup.py
GitUp.log
def log(self, branch, remote): """ Call a log-command, if set by git-up.fetch.all. """ log_hook = self.settings['rebase.log-hook'] if log_hook: if ON_WINDOWS: # pragma: no cover # Running a string in CMD from Python is not that easy on # Windo...
python
def log(self, branch, remote): """ Call a log-command, if set by git-up.fetch.all. """ log_hook = self.settings['rebase.log-hook'] if log_hook: if ON_WINDOWS: # pragma: no cover # Running a string in CMD from Python is not that easy on # Windo...
[ "def", "log", "(", "self", ",", "branch", ",", "remote", ")", ":", "log_hook", "=", "self", ".", "settings", "[", "'rebase.log-hook'", "]", "if", "log_hook", ":", "if", "ON_WINDOWS", ":", "log_hook", "=", "re", ".", "sub", "(", "r'\\$(\\d+)'", ",", "r'...
Call a log-command, if set by git-up.fetch.all.
[ "Call", "a", "log", "-", "command", "if", "set", "by", "git", "-", "up", ".", "fetch", ".", "all", "." ]
b1f78831cb6b8d29d3a7d59f7a2b54fdd0720e9c
https://github.com/msiemens/PyGitUp/blob/b1f78831cb6b8d29d3a7d59f7a2b54fdd0720e9c/PyGitUp/gitup.py#L374-L424
train
msiemens/PyGitUp
PyGitUp/gitup.py
GitUp.version_info
def version_info(self): """ Tell, what version we're running at and if it's up to date. """ # Retrive and show local version info package = pkg.get_distribution('git-up') local_version_str = package.version local_version = package.parsed_version print('GitUp ver...
python
def version_info(self): """ Tell, what version we're running at and if it's up to date. """ # Retrive and show local version info package = pkg.get_distribution('git-up') local_version_str = package.version local_version = package.parsed_version print('GitUp ver...
[ "def", "version_info", "(", "self", ")", ":", "package", "=", "pkg", ".", "get_distribution", "(", "'git-up'", ")", "local_version_str", "=", "package", ".", "version", "local_version", "=", "package", ".", "parsed_version", "print", "(", "'GitUp version is: '", ...
Tell, what version we're running at and if it's up to date.
[ "Tell", "what", "version", "we", "re", "running", "at", "and", "if", "it", "s", "up", "to", "date", "." ]
b1f78831cb6b8d29d3a7d59f7a2b54fdd0720e9c
https://github.com/msiemens/PyGitUp/blob/b1f78831cb6b8d29d3a7d59f7a2b54fdd0720e9c/PyGitUp/gitup.py#L426-L461
train
msiemens/PyGitUp
PyGitUp/gitup.py
GitUp.load_config
def load_config(self): """ Load the configuration from git config. """ for key in self.settings: value = self.config(key) # Parse true/false if value == '' or value is None: continue # Not set by user, go on if val...
python
def load_config(self): """ Load the configuration from git config. """ for key in self.settings: value = self.config(key) # Parse true/false if value == '' or value is None: continue # Not set by user, go on if val...
[ "def", "load_config", "(", "self", ")", ":", "for", "key", "in", "self", ".", "settings", ":", "value", "=", "self", ".", "config", "(", "key", ")", "if", "value", "==", "''", "or", "value", "is", "None", ":", "continue", "if", "value", ".", "lower...
Load the configuration from git config.
[ "Load", "the", "configuration", "from", "git", "config", "." ]
b1f78831cb6b8d29d3a7d59f7a2b54fdd0720e9c
https://github.com/msiemens/PyGitUp/blob/b1f78831cb6b8d29d3a7d59f7a2b54fdd0720e9c/PyGitUp/gitup.py#L467-L483
train
msiemens/PyGitUp
PyGitUp/gitup.py
GitUp.check_bundler
def check_bundler(self): """ Run the bundler check. """ def get_config(name): return name if self.config('bundler.' + name) else '' from pkg_resources import Requirement, resource_filename relative_path = os.path.join('PyGitUp', 'check-bundler.rb') ...
python
def check_bundler(self): """ Run the bundler check. """ def get_config(name): return name if self.config('bundler.' + name) else '' from pkg_resources import Requirement, resource_filename relative_path = os.path.join('PyGitUp', 'check-bundler.rb') ...
[ "def", "check_bundler", "(", "self", ")", ":", "def", "get_config", "(", "name", ")", ":", "return", "name", "if", "self", ".", "config", "(", "'bundler.'", "+", "name", ")", "else", "''", "from", "pkg_resources", "import", "Requirement", ",", "resource_fi...
Run the bundler check.
[ "Run", "the", "bundler", "check", "." ]
b1f78831cb6b8d29d3a7d59f7a2b54fdd0720e9c
https://github.com/msiemens/PyGitUp/blob/b1f78831cb6b8d29d3a7d59f7a2b54fdd0720e9c/PyGitUp/gitup.py#L555-L576
train
mikemaccana/python-docx
docx.py
opendocx
def opendocx(file): '''Open a docx file, return a document XML tree''' mydoc = zipfile.ZipFile(file) xmlcontent = mydoc.read('word/document.xml') document = etree.fromstring(xmlcontent) return document
python
def opendocx(file): '''Open a docx file, return a document XML tree''' mydoc = zipfile.ZipFile(file) xmlcontent = mydoc.read('word/document.xml') document = etree.fromstring(xmlcontent) return document
[ "def", "opendocx", "(", "file", ")", ":", "mydoc", "=", "zipfile", ".", "ZipFile", "(", "file", ")", "xmlcontent", "=", "mydoc", ".", "read", "(", "'word/document.xml'", ")", "document", "=", "etree", ".", "fromstring", "(", "xmlcontent", ")", "return", ...
Open a docx file, return a document XML tree
[ "Open", "a", "docx", "file", "return", "a", "document", "XML", "tree" ]
4c9b46dbebe3d2a9b82dbcd35af36584a36fd9fe
https://github.com/mikemaccana/python-docx/blob/4c9b46dbebe3d2a9b82dbcd35af36584a36fd9fe/docx.py#L81-L86
train
mikemaccana/python-docx
docx.py
makeelement
def makeelement(tagname, tagtext=None, nsprefix='w', attributes=None, attrnsprefix=None): '''Create an element & return it''' # Deal with list of nsprefix by making namespacemap namespacemap = None if isinstance(nsprefix, list): namespacemap = {} for prefix in nsprefix: ...
python
def makeelement(tagname, tagtext=None, nsprefix='w', attributes=None, attrnsprefix=None): '''Create an element & return it''' # Deal with list of nsprefix by making namespacemap namespacemap = None if isinstance(nsprefix, list): namespacemap = {} for prefix in nsprefix: ...
[ "def", "makeelement", "(", "tagname", ",", "tagtext", "=", "None", ",", "nsprefix", "=", "'w'", ",", "attributes", "=", "None", ",", "attrnsprefix", "=", "None", ")", ":", "namespacemap", "=", "None", "if", "isinstance", "(", "nsprefix", ",", "list", ")"...
Create an element & return it
[ "Create", "an", "element", "&", "return", "it" ]
4c9b46dbebe3d2a9b82dbcd35af36584a36fd9fe
https://github.com/mikemaccana/python-docx/blob/4c9b46dbebe3d2a9b82dbcd35af36584a36fd9fe/docx.py#L95-L131
train
mikemaccana/python-docx
docx.py
heading
def heading(headingtext, headinglevel, lang='en'): '''Make a new heading, return the heading element''' lmap = {'en': 'Heading', 'it': 'Titolo'} # Make our elements paragraph = makeelement('p') pr = makeelement('pPr') pStyle = makeelement( 'pStyle', attributes={'val': lmap[lang]+str(head...
python
def heading(headingtext, headinglevel, lang='en'): '''Make a new heading, return the heading element''' lmap = {'en': 'Heading', 'it': 'Titolo'} # Make our elements paragraph = makeelement('p') pr = makeelement('pPr') pStyle = makeelement( 'pStyle', attributes={'val': lmap[lang]+str(head...
[ "def", "heading", "(", "headingtext", ",", "headinglevel", ",", "lang", "=", "'en'", ")", ":", "lmap", "=", "{", "'en'", ":", "'Heading'", ",", "'it'", ":", "'Titolo'", "}", "paragraph", "=", "makeelement", "(", "'p'", ")", "pr", "=", "makeelement", "(...
Make a new heading, return the heading element
[ "Make", "a", "new", "heading", "return", "the", "heading", "element" ]
4c9b46dbebe3d2a9b82dbcd35af36584a36fd9fe
https://github.com/mikemaccana/python-docx/blob/4c9b46dbebe3d2a9b82dbcd35af36584a36fd9fe/docx.py#L278-L294
train
mikemaccana/python-docx
docx.py
clean
def clean(document): """ Perform misc cleaning operations on documents. Returns cleaned document. """ newdocument = document # Clean empty text and r tags for t in ('t', 'r'): rmlist = [] for element in newdocument.iter(): if element.tag == '{%s}%s' % (nsprefixe...
python
def clean(document): """ Perform misc cleaning operations on documents. Returns cleaned document. """ newdocument = document # Clean empty text and r tags for t in ('t', 'r'): rmlist = [] for element in newdocument.iter(): if element.tag == '{%s}%s' % (nsprefixe...
[ "def", "clean", "(", "document", ")", ":", "newdocument", "=", "document", "for", "t", "in", "(", "'t'", ",", "'r'", ")", ":", "rmlist", "=", "[", "]", "for", "element", "in", "newdocument", ".", "iter", "(", ")", ":", "if", "element", ".", "tag", ...
Perform misc cleaning operations on documents. Returns cleaned document.
[ "Perform", "misc", "cleaning", "operations", "on", "documents", ".", "Returns", "cleaned", "document", "." ]
4c9b46dbebe3d2a9b82dbcd35af36584a36fd9fe
https://github.com/mikemaccana/python-docx/blob/4c9b46dbebe3d2a9b82dbcd35af36584a36fd9fe/docx.py#L644-L661
train
mikemaccana/python-docx
docx.py
findTypeParent
def findTypeParent(element, tag): """ Finds fist parent of element of the given type @param object element: etree element @param string the tag parent to search for @return object element: the found parent or None when not found """ p = element while True: p = p.getparent() ...
python
def findTypeParent(element, tag): """ Finds fist parent of element of the given type @param object element: etree element @param string the tag parent to search for @return object element: the found parent or None when not found """ p = element while True: p = p.getparent() ...
[ "def", "findTypeParent", "(", "element", ",", "tag", ")", ":", "p", "=", "element", "while", "True", ":", "p", "=", "p", ".", "getparent", "(", ")", "if", "p", ".", "tag", "==", "tag", ":", "return", "p", "return", "None" ]
Finds fist parent of element of the given type @param object element: etree element @param string the tag parent to search for @return object element: the found parent or None when not found
[ "Finds", "fist", "parent", "of", "element", "of", "the", "given", "type" ]
4c9b46dbebe3d2a9b82dbcd35af36584a36fd9fe
https://github.com/mikemaccana/python-docx/blob/4c9b46dbebe3d2a9b82dbcd35af36584a36fd9fe/docx.py#L664-L680
train
mikemaccana/python-docx
docx.py
AdvSearch
def AdvSearch(document, search, bs=3): '''Return set of all regex matches This is an advanced version of python-docx.search() that takes into account blocks of <bs> elements at a time. What it does: It searches the entire document body for text blocks. Since the text to search could be spawned...
python
def AdvSearch(document, search, bs=3): '''Return set of all regex matches This is an advanced version of python-docx.search() that takes into account blocks of <bs> elements at a time. What it does: It searches the entire document body for text blocks. Since the text to search could be spawned...
[ "def", "AdvSearch", "(", "document", ",", "search", ",", "bs", "=", "3", ")", ":", "searchre", "=", "re", ".", "compile", "(", "search", ")", "matches", "=", "[", "]", "searchels", "=", "[", "]", "for", "element", "in", "document", ".", "iter", "("...
Return set of all regex matches This is an advanced version of python-docx.search() that takes into account blocks of <bs> elements at a time. What it does: It searches the entire document body for text blocks. Since the text to search could be spawned across multiple text blocks, we need to a...
[ "Return", "set", "of", "all", "regex", "matches" ]
4c9b46dbebe3d2a9b82dbcd35af36584a36fd9fe
https://github.com/mikemaccana/python-docx/blob/4c9b46dbebe3d2a9b82dbcd35af36584a36fd9fe/docx.py#L683-L756
train
mikemaccana/python-docx
docx.py
getdocumenttext
def getdocumenttext(document): '''Return the raw text of a document, as a list of paragraphs.''' paratextlist = [] # Compile a list of all paragraph (p) elements paralist = [] for element in document.iter(): # Find p (paragraph) elements if element.tag == '{'+nsprefixes['w']+'}p': ...
python
def getdocumenttext(document): '''Return the raw text of a document, as a list of paragraphs.''' paratextlist = [] # Compile a list of all paragraph (p) elements paralist = [] for element in document.iter(): # Find p (paragraph) elements if element.tag == '{'+nsprefixes['w']+'}p': ...
[ "def", "getdocumenttext", "(", "document", ")", ":", "paratextlist", "=", "[", "]", "paralist", "=", "[", "]", "for", "element", "in", "document", ".", "iter", "(", ")", ":", "if", "element", ".", "tag", "==", "'{'", "+", "nsprefixes", "[", "'w'", "]...
Return the raw text of a document, as a list of paragraphs.
[ "Return", "the", "raw", "text", "of", "a", "document", "as", "a", "list", "of", "paragraphs", "." ]
4c9b46dbebe3d2a9b82dbcd35af36584a36fd9fe
https://github.com/mikemaccana/python-docx/blob/4c9b46dbebe3d2a9b82dbcd35af36584a36fd9fe/docx.py#L910-L935
train
mikemaccana/python-docx
docx.py
wordrelationships
def wordrelationships(relationshiplist): '''Generate a Word relationships file''' # Default list of relationships # FIXME: using string hack instead of making element #relationships = makeelement('Relationships', nsprefix='pr') relationships = etree.fromstring( '<Relationships xmlns="http://...
python
def wordrelationships(relationshiplist): '''Generate a Word relationships file''' # Default list of relationships # FIXME: using string hack instead of making element #relationships = makeelement('Relationships', nsprefix='pr') relationships = etree.fromstring( '<Relationships xmlns="http://...
[ "def", "wordrelationships", "(", "relationshiplist", ")", ":", "relationships", "=", "etree", ".", "fromstring", "(", "'<Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006'", "'/relationships\"></Relationships>'", ")", "count", "=", "0", "for", "relationship",...
Generate a Word relationships file
[ "Generate", "a", "Word", "relationships", "file" ]
4c9b46dbebe3d2a9b82dbcd35af36584a36fd9fe
https://github.com/mikemaccana/python-docx/blob/4c9b46dbebe3d2a9b82dbcd35af36584a36fd9fe/docx.py#L1031-L1049
train
mikemaccana/python-docx
docx.py
savedocx
def savedocx( document, coreprops, appprops, contenttypes, websettings, wordrelationships, output, imagefiledict=None): """ Save a modified document """ if imagefiledict is None: warn( 'Using savedocx() without imagefiledict parameter will be deprec' 'ated...
python
def savedocx( document, coreprops, appprops, contenttypes, websettings, wordrelationships, output, imagefiledict=None): """ Save a modified document """ if imagefiledict is None: warn( 'Using savedocx() without imagefiledict parameter will be deprec' 'ated...
[ "def", "savedocx", "(", "document", ",", "coreprops", ",", "appprops", ",", "contenttypes", ",", "websettings", ",", "wordrelationships", ",", "output", ",", "imagefiledict", "=", "None", ")", ":", "if", "imagefiledict", "is", "None", ":", "warn", "(", "'Usi...
Save a modified document
[ "Save", "a", "modified", "document" ]
4c9b46dbebe3d2a9b82dbcd35af36584a36fd9fe
https://github.com/mikemaccana/python-docx/blob/4c9b46dbebe3d2a9b82dbcd35af36584a36fd9fe/docx.py#L1052-L1107
train
couchbase/couchbase-python-client
couchbase/bucket.py
_depr
def _depr(fn, usage, stacklevel=3): """Internal convenience function for deprecation warnings""" warn('{0} is deprecated. Use {1} instead'.format(fn, usage), stacklevel=stacklevel, category=DeprecationWarning)
python
def _depr(fn, usage, stacklevel=3): """Internal convenience function for deprecation warnings""" warn('{0} is deprecated. Use {1} instead'.format(fn, usage), stacklevel=stacklevel, category=DeprecationWarning)
[ "def", "_depr", "(", "fn", ",", "usage", ",", "stacklevel", "=", "3", ")", ":", "warn", "(", "'{0} is deprecated. Use {1} instead'", ".", "format", "(", "fn", ",", "usage", ")", ",", "stacklevel", "=", "stacklevel", ",", "category", "=", "DeprecationWarning"...
Internal convenience function for deprecation warnings
[ "Internal", "convenience", "function", "for", "deprecation", "warnings" ]
a7bada167785bf79a29c39f820d932a433a6a535
https://github.com/couchbase/couchbase-python-client/blob/a7bada167785bf79a29c39f820d932a433a6a535/couchbase/bucket.py#L44-L47
train
couchbase/couchbase-python-client
couchbase/bucket.py
Bucket.upsert
def upsert(self, key, value, cas=0, ttl=0, format=None, persist_to=0, replicate_to=0): """Unconditionally store the object in Couchbase. :param key: The key to set the value with. By default, the key must be either a :class:`bytes` or :class:`str` object encodable...
python
def upsert(self, key, value, cas=0, ttl=0, format=None, persist_to=0, replicate_to=0): """Unconditionally store the object in Couchbase. :param key: The key to set the value with. By default, the key must be either a :class:`bytes` or :class:`str` object encodable...
[ "def", "upsert", "(", "self", ",", "key", ",", "value", ",", "cas", "=", "0", ",", "ttl", "=", "0", ",", "format", "=", "None", ",", "persist_to", "=", "0", ",", "replicate_to", "=", "0", ")", ":", "return", "_Base", ".", "upsert", "(", "self", ...
Unconditionally store the object in Couchbase. :param key: The key to set the value with. By default, the key must be either a :class:`bytes` or :class:`str` object encodable as UTF-8. If a custom `transcoder` class is used (see :meth:`~__init__`), then the key o...
[ "Unconditionally", "store", "the", "object", "in", "Couchbase", "." ]
a7bada167785bf79a29c39f820d932a433a6a535
https://github.com/couchbase/couchbase-python-client/blob/a7bada167785bf79a29c39f820d932a433a6a535/couchbase/bucket.py#L328-L410
train
couchbase/couchbase-python-client
couchbase/bucket.py
Bucket.insert
def insert(self, key, value, ttl=0, format=None, persist_to=0, replicate_to=0): """Store an object in Couchbase unless it already exists. Follows the same conventions as :meth:`upsert` but the value is stored only if it does not exist already. Conversely, the value is not stored if the ...
python
def insert(self, key, value, ttl=0, format=None, persist_to=0, replicate_to=0): """Store an object in Couchbase unless it already exists. Follows the same conventions as :meth:`upsert` but the value is stored only if it does not exist already. Conversely, the value is not stored if the ...
[ "def", "insert", "(", "self", ",", "key", ",", "value", ",", "ttl", "=", "0", ",", "format", "=", "None", ",", "persist_to", "=", "0", ",", "replicate_to", "=", "0", ")", ":", "return", "_Base", ".", "insert", "(", "self", ",", "key", ",", "value...
Store an object in Couchbase unless it already exists. Follows the same conventions as :meth:`upsert` but the value is stored only if it does not exist already. Conversely, the value is not stored if the key already exists. Notably missing from this method is the `cas` parameter, this ...
[ "Store", "an", "object", "in", "Couchbase", "unless", "it", "already", "exists", "." ]
a7bada167785bf79a29c39f820d932a433a6a535
https://github.com/couchbase/couchbase-python-client/blob/a7bada167785bf79a29c39f820d932a433a6a535/couchbase/bucket.py#L412-L428
train
couchbase/couchbase-python-client
couchbase/bucket.py
Bucket.prepend
def prepend(self, key, value, cas=0, format=None, persist_to=0, replicate_to=0): """Prepend a string to an existing value in Couchbase. .. seealso:: :meth:`append`, :meth:`prepend_multi` """ return _Base.prepend(self, key, value, cas=cas, format=format, ...
python
def prepend(self, key, value, cas=0, format=None, persist_to=0, replicate_to=0): """Prepend a string to an existing value in Couchbase. .. seealso:: :meth:`append`, :meth:`prepend_multi` """ return _Base.prepend(self, key, value, cas=cas, format=format, ...
[ "def", "prepend", "(", "self", ",", "key", ",", "value", ",", "cas", "=", "0", ",", "format", "=", "None", ",", "persist_to", "=", "0", ",", "replicate_to", "=", "0", ")", ":", "return", "_Base", ".", "prepend", "(", "self", ",", "key", ",", "val...
Prepend a string to an existing value in Couchbase. .. seealso:: :meth:`append`, :meth:`prepend_multi`
[ "Prepend", "a", "string", "to", "an", "existing", "value", "in", "Couchbase", "." ]
a7bada167785bf79a29c39f820d932a433a6a535
https://github.com/couchbase/couchbase-python-client/blob/a7bada167785bf79a29c39f820d932a433a6a535/couchbase/bucket.py#L475-L482
train
couchbase/couchbase-python-client
couchbase/bucket.py
Bucket.get
def get(self, key, ttl=0, quiet=None, replica=False, no_format=False): """Obtain an object stored in Couchbase by given key. :param string key: The key to fetch. The type of key is the same as mentioned in :meth:`upsert` :param int ttl: If specified, indicates that the key's expira...
python
def get(self, key, ttl=0, quiet=None, replica=False, no_format=False): """Obtain an object stored in Couchbase by given key. :param string key: The key to fetch. The type of key is the same as mentioned in :meth:`upsert` :param int ttl: If specified, indicates that the key's expira...
[ "def", "get", "(", "self", ",", "key", ",", "ttl", "=", "0", ",", "quiet", "=", "None", ",", "replica", "=", "False", ",", "no_format", "=", "False", ")", ":", "return", "_Base", ".", "get", "(", "self", ",", "key", ",", "ttl", "=", "ttl", ",",...
Obtain an object stored in Couchbase by given key. :param string key: The key to fetch. The type of key is the same as mentioned in :meth:`upsert` :param int ttl: If specified, indicates that the key's expiration time should be *modified* when retrieving the value. :pa...
[ "Obtain", "an", "object", "stored", "in", "Couchbase", "by", "given", "key", "." ]
a7bada167785bf79a29c39f820d932a433a6a535
https://github.com/couchbase/couchbase-python-client/blob/a7bada167785bf79a29c39f820d932a433a6a535/couchbase/bucket.py#L484-L554
train
couchbase/couchbase-python-client
couchbase/bucket.py
Bucket.touch
def touch(self, key, ttl=0): """Update a key's expiration time :param string key: The key whose expiration time should be modified :param int ttl: The new expiration time. If the expiration time is `0` then the key never expires (and any existing expiration i...
python
def touch(self, key, ttl=0): """Update a key's expiration time :param string key: The key whose expiration time should be modified :param int ttl: The new expiration time. If the expiration time is `0` then the key never expires (and any existing expiration i...
[ "def", "touch", "(", "self", ",", "key", ",", "ttl", "=", "0", ")", ":", "return", "_Base", ".", "touch", "(", "self", ",", "key", ",", "ttl", "=", "ttl", ")" ]
Update a key's expiration time :param string key: The key whose expiration time should be modified :param int ttl: The new expiration time. If the expiration time is `0` then the key never expires (and any existing expiration is removed) :return: :class:`.Ope...
[ "Update", "a", "key", "s", "expiration", "time" ]
a7bada167785bf79a29c39f820d932a433a6a535
https://github.com/couchbase/couchbase-python-client/blob/a7bada167785bf79a29c39f820d932a433a6a535/couchbase/bucket.py#L556-L578
train
couchbase/couchbase-python-client
couchbase/bucket.py
Bucket.lock
def lock(self, key, ttl=0): """Lock and retrieve a key-value entry in Couchbase. :param key: A string which is the key to lock. :param ttl: a TTL for which the lock should be valid. While the lock is active, attempts to access the key (via other :meth:`lock`, :meth:`ups...
python
def lock(self, key, ttl=0): """Lock and retrieve a key-value entry in Couchbase. :param key: A string which is the key to lock. :param ttl: a TTL for which the lock should be valid. While the lock is active, attempts to access the key (via other :meth:`lock`, :meth:`ups...
[ "def", "lock", "(", "self", ",", "key", ",", "ttl", "=", "0", ")", ":", "return", "_Base", ".", "lock", "(", "self", ",", "key", ",", "ttl", "=", "ttl", ")" ]
Lock and retrieve a key-value entry in Couchbase. :param key: A string which is the key to lock. :param ttl: a TTL for which the lock should be valid. While the lock is active, attempts to access the key (via other :meth:`lock`, :meth:`upsert` or other mutation calls) ...
[ "Lock", "and", "retrieve", "a", "key", "-", "value", "entry", "in", "Couchbase", "." ]
a7bada167785bf79a29c39f820d932a433a6a535
https://github.com/couchbase/couchbase-python-client/blob/a7bada167785bf79a29c39f820d932a433a6a535/couchbase/bucket.py#L580-L647
train
couchbase/couchbase-python-client
couchbase/bucket.py
Bucket.unlock
def unlock(self, key, cas): """Unlock a Locked Key in Couchbase. This unlocks an item previously locked by :meth:`lock` :param key: The key to unlock :param cas: The cas returned from :meth:`lock`'s :class:`.Result` object. See :meth:`lock` for an example. ...
python
def unlock(self, key, cas): """Unlock a Locked Key in Couchbase. This unlocks an item previously locked by :meth:`lock` :param key: The key to unlock :param cas: The cas returned from :meth:`lock`'s :class:`.Result` object. See :meth:`lock` for an example. ...
[ "def", "unlock", "(", "self", ",", "key", ",", "cas", ")", ":", "return", "_Base", ".", "unlock", "(", "self", ",", "key", ",", "cas", "=", "cas", ")" ]
Unlock a Locked Key in Couchbase. This unlocks an item previously locked by :meth:`lock` :param key: The key to unlock :param cas: The cas returned from :meth:`lock`'s :class:`.Result` object. See :meth:`lock` for an example. :raise: :exc:`.TemporaryFailError` if ...
[ "Unlock", "a", "Locked", "Key", "in", "Couchbase", "." ]
a7bada167785bf79a29c39f820d932a433a6a535
https://github.com/couchbase/couchbase-python-client/blob/a7bada167785bf79a29c39f820d932a433a6a535/couchbase/bucket.py#L649-L666
train
couchbase/couchbase-python-client
couchbase/bucket.py
Bucket.remove
def remove(self, key, cas=0, quiet=None, persist_to=0, replicate_to=0): """Remove the key-value entry for a given key in Couchbase. :param key: A string which is the key to remove. The format and type of the key follows the same conventions as in :meth:`upsert` :type key...
python
def remove(self, key, cas=0, quiet=None, persist_to=0, replicate_to=0): """Remove the key-value entry for a given key in Couchbase. :param key: A string which is the key to remove. The format and type of the key follows the same conventions as in :meth:`upsert` :type key...
[ "def", "remove", "(", "self", ",", "key", ",", "cas", "=", "0", ",", "quiet", "=", "None", ",", "persist_to", "=", "0", ",", "replicate_to", "=", "0", ")", ":", "return", "_Base", ".", "remove", "(", "self", ",", "key", ",", "cas", "=", "cas", ...
Remove the key-value entry for a given key in Couchbase. :param key: A string which is the key to remove. The format and type of the key follows the same conventions as in :meth:`upsert` :type key: string, dict, or tuple/list :param int cas: The CAS to use for the remov...
[ "Remove", "the", "key", "-", "value", "entry", "for", "a", "given", "key", "in", "Couchbase", "." ]
a7bada167785bf79a29c39f820d932a433a6a535
https://github.com/couchbase/couchbase-python-client/blob/a7bada167785bf79a29c39f820d932a433a6a535/couchbase/bucket.py#L668-L725
train
couchbase/couchbase-python-client
couchbase/bucket.py
Bucket.counter
def counter(self, key, delta=1, initial=None, ttl=0): """Increment or decrement the numeric value of an item. This method instructs the server to treat the item stored under the given key as a numeric counter. Counter operations require that the stored value exists as a string ...
python
def counter(self, key, delta=1, initial=None, ttl=0): """Increment or decrement the numeric value of an item. This method instructs the server to treat the item stored under the given key as a numeric counter. Counter operations require that the stored value exists as a string ...
[ "def", "counter", "(", "self", ",", "key", ",", "delta", "=", "1", ",", "initial", "=", "None", ",", "ttl", "=", "0", ")", ":", "return", "_Base", ".", "counter", "(", "self", ",", "key", ",", "delta", "=", "delta", ",", "initial", "=", "initial"...
Increment or decrement the numeric value of an item. This method instructs the server to treat the item stored under the given key as a numeric counter. Counter operations require that the stored value exists as a string representation of a number (e.g. ``123``). If storing ite...
[ "Increment", "or", "decrement", "the", "numeric", "value", "of", "an", "item", "." ]
a7bada167785bf79a29c39f820d932a433a6a535
https://github.com/couchbase/couchbase-python-client/blob/a7bada167785bf79a29c39f820d932a433a6a535/couchbase/bucket.py#L727-L784
train
couchbase/couchbase-python-client
couchbase/bucket.py
Bucket.mutate_in
def mutate_in(self, key, *specs, **kwargs): """Perform multiple atomic modifications within a document. :param key: The key of the document to modify :param specs: A list of specs (See :mod:`.couchbase.subdocument`) :param bool create_doc: Whether the document should be crea...
python
def mutate_in(self, key, *specs, **kwargs): """Perform multiple atomic modifications within a document. :param key: The key of the document to modify :param specs: A list of specs (See :mod:`.couchbase.subdocument`) :param bool create_doc: Whether the document should be crea...
[ "def", "mutate_in", "(", "self", ",", "key", ",", "*", "specs", ",", "**", "kwargs", ")", ":", "sdflags", "=", "kwargs", ".", "pop", "(", "'_sd_doc_flags'", ",", "0", ")", "if", "kwargs", ".", "pop", "(", "'insert_doc'", ",", "False", ")", ":", "sd...
Perform multiple atomic modifications within a document. :param key: The key of the document to modify :param specs: A list of specs (See :mod:`.couchbase.subdocument`) :param bool create_doc: Whether the document should be create if it doesn't exist :param bool insert_doc: ...
[ "Perform", "multiple", "atomic", "modifications", "within", "a", "document", "." ]
a7bada167785bf79a29c39f820d932a433a6a535
https://github.com/couchbase/couchbase-python-client/blob/a7bada167785bf79a29c39f820d932a433a6a535/couchbase/bucket.py#L786-L828
train
couchbase/couchbase-python-client
couchbase/bucket.py
Bucket.lookup_in
def lookup_in(self, key, *specs, **kwargs): """Atomically retrieve one or more paths from a document. :param key: The key of the document to lookup :param spec: A list of specs (see :mod:`.couchbase.subdocument`) :return: A :class:`.couchbase.result.SubdocResult` object. Thi...
python
def lookup_in(self, key, *specs, **kwargs): """Atomically retrieve one or more paths from a document. :param key: The key of the document to lookup :param spec: A list of specs (see :mod:`.couchbase.subdocument`) :return: A :class:`.couchbase.result.SubdocResult` object. Thi...
[ "def", "lookup_in", "(", "self", ",", "key", ",", "*", "specs", ",", "**", "kwargs", ")", ":", "return", "super", "(", "Bucket", ",", "self", ")", ".", "lookup_in", "(", "{", "key", ":", "specs", "}", ",", "**", "kwargs", ")" ]
Atomically retrieve one or more paths from a document. :param key: The key of the document to lookup :param spec: A list of specs (see :mod:`.couchbase.subdocument`) :return: A :class:`.couchbase.result.SubdocResult` object. This object contains the results and any errors of the ...
[ "Atomically", "retrieve", "one", "or", "more", "paths", "from", "a", "document", "." ]
a7bada167785bf79a29c39f820d932a433a6a535
https://github.com/couchbase/couchbase-python-client/blob/a7bada167785bf79a29c39f820d932a433a6a535/couchbase/bucket.py#L830-L853
train
couchbase/couchbase-python-client
couchbase/bucket.py
Bucket.retrieve_in
def retrieve_in(self, key, *paths, **kwargs): """Atomically fetch one or more paths from a document. Convenience method for retrieval operations. This functions identically to :meth:`lookup_in`. As such, the following two forms are equivalent: .. code-block:: python ...
python
def retrieve_in(self, key, *paths, **kwargs): """Atomically fetch one or more paths from a document. Convenience method for retrieval operations. This functions identically to :meth:`lookup_in`. As such, the following two forms are equivalent: .. code-block:: python ...
[ "def", "retrieve_in", "(", "self", ",", "key", ",", "*", "paths", ",", "**", "kwargs", ")", ":", "import", "couchbase", ".", "subdocument", "as", "SD", "return", "self", ".", "lookup_in", "(", "key", ",", "*", "tuple", "(", "SD", ".", "get", "(", "...
Atomically fetch one or more paths from a document. Convenience method for retrieval operations. This functions identically to :meth:`lookup_in`. As such, the following two forms are equivalent: .. code-block:: python import couchbase.subdocument as SD rv = cb....
[ "Atomically", "fetch", "one", "or", "more", "paths", "from", "a", "document", "." ]
a7bada167785bf79a29c39f820d932a433a6a535
https://github.com/couchbase/couchbase-python-client/blob/a7bada167785bf79a29c39f820d932a433a6a535/couchbase/bucket.py#L855-L880
train
couchbase/couchbase-python-client
couchbase/bucket.py
Bucket.stats
def stats(self, keys=None, keystats=False): """Request server statistics. Fetches stats from each node in the cluster. Without a key specified the server will respond with a default set of statistical information. It returns the a `dict` with stats keys and node-value pairs as a...
python
def stats(self, keys=None, keystats=False): """Request server statistics. Fetches stats from each node in the cluster. Without a key specified the server will respond with a default set of statistical information. It returns the a `dict` with stats keys and node-value pairs as a...
[ "def", "stats", "(", "self", ",", "keys", "=", "None", ",", "keystats", "=", "False", ")", ":", "if", "keys", "and", "not", "isinstance", "(", "keys", ",", "(", "tuple", ",", "list", ")", ")", ":", "keys", "=", "(", "keys", ",", ")", "return", ...
Request server statistics. Fetches stats from each node in the cluster. Without a key specified the server will respond with a default set of statistical information. It returns the a `dict` with stats keys and node-value pairs as a value. :param keys: One or several stats to q...
[ "Request", "server", "statistics", "." ]
a7bada167785bf79a29c39f820d932a433a6a535
https://github.com/couchbase/couchbase-python-client/blob/a7bada167785bf79a29c39f820d932a433a6a535/couchbase/bucket.py#L898-L925
train
couchbase/couchbase-python-client
couchbase/bucket.py
Bucket.observe
def observe(self, key, master_only=False): """Return storage information for a key. It returns a :class:`.ValueResult` object with the ``value`` field set to a list of :class:`~.ObserveInfo` objects. Each element in the list responds to the storage status for the key on the give...
python
def observe(self, key, master_only=False): """Return storage information for a key. It returns a :class:`.ValueResult` object with the ``value`` field set to a list of :class:`~.ObserveInfo` objects. Each element in the list responds to the storage status for the key on the give...
[ "def", "observe", "(", "self", ",", "key", ",", "master_only", "=", "False", ")", ":", "return", "_Base", ".", "observe", "(", "self", ",", "key", ",", "master_only", "=", "master_only", ")" ]
Return storage information for a key. It returns a :class:`.ValueResult` object with the ``value`` field set to a list of :class:`~.ObserveInfo` objects. Each element in the list responds to the storage status for the key on the given node. The length of the list (and thus the number ...
[ "Return", "storage", "information", "for", "a", "key", "." ]
a7bada167785bf79a29c39f820d932a433a6a535
https://github.com/couchbase/couchbase-python-client/blob/a7bada167785bf79a29c39f820d932a433a6a535/couchbase/bucket.py#L977-L993
train
couchbase/couchbase-python-client
couchbase/bucket.py
Bucket.endure
def endure(self, key, persist_to=-1, replicate_to=-1, cas=0, check_removed=False, timeout=5.0, interval=0.010): """Wait until a key has been distributed to one or more nodes By default, when items are stored to Couchbase, the operation is considered successful if the vBucket mast...
python
def endure(self, key, persist_to=-1, replicate_to=-1, cas=0, check_removed=False, timeout=5.0, interval=0.010): """Wait until a key has been distributed to one or more nodes By default, when items are stored to Couchbase, the operation is considered successful if the vBucket mast...
[ "def", "endure", "(", "self", ",", "key", ",", "persist_to", "=", "-", "1", ",", "replicate_to", "=", "-", "1", ",", "cas", "=", "0", ",", "check_removed", "=", "False", ",", "timeout", "=", "5.0", ",", "interval", "=", "0.010", ")", ":", "kv", "...
Wait until a key has been distributed to one or more nodes By default, when items are stored to Couchbase, the operation is considered successful if the vBucket master (i.e. the "primary" node) for the key has successfully stored the item in its memory. In most situations, this...
[ "Wait", "until", "a", "key", "has", "been", "distributed", "to", "one", "or", "more", "nodes" ]
a7bada167785bf79a29c39f820d932a433a6a535
https://github.com/couchbase/couchbase-python-client/blob/a7bada167785bf79a29c39f820d932a433a6a535/couchbase/bucket.py#L995-L1077
train
couchbase/couchbase-python-client
couchbase/bucket.py
Bucket.endure_multi
def endure_multi(self, keys, persist_to=-1, replicate_to=-1, timeout=5.0, interval=0.010, check_removed=False): """Check durability requirements for multiple keys :param keys: The keys to check The type of keys may be one of the following: * Sequence of keys ...
python
def endure_multi(self, keys, persist_to=-1, replicate_to=-1, timeout=5.0, interval=0.010, check_removed=False): """Check durability requirements for multiple keys :param keys: The keys to check The type of keys may be one of the following: * Sequence of keys ...
[ "def", "endure_multi", "(", "self", ",", "keys", ",", "persist_to", "=", "-", "1", ",", "replicate_to", "=", "-", "1", ",", "timeout", "=", "5.0", ",", "interval", "=", "0.010", ",", "check_removed", "=", "False", ")", ":", "return", "_Base", ".", "e...
Check durability requirements for multiple keys :param keys: The keys to check The type of keys may be one of the following: * Sequence of keys * A :class:`~couchbase.result.MultiResult` object * A ``dict`` with CAS values as the dictionary value * A seq...
[ "Check", "durability", "requirements", "for", "multiple", "keys" ]
a7bada167785bf79a29c39f820d932a433a6a535
https://github.com/couchbase/couchbase-python-client/blob/a7bada167785bf79a29c39f820d932a433a6a535/couchbase/bucket.py#L1274-L1294
train
couchbase/couchbase-python-client
couchbase/bucket.py
Bucket.remove_multi
def remove_multi(self, kvs, quiet=None): """Remove multiple items from the cluster :param kvs: Iterable of keys to delete from the cluster. If you wish to specify a CAS for each item, then you may pass a dictionary of keys mapping to cas, like `remove_multi({k1:cas1, k2:cas2}`) ...
python
def remove_multi(self, kvs, quiet=None): """Remove multiple items from the cluster :param kvs: Iterable of keys to delete from the cluster. If you wish to specify a CAS for each item, then you may pass a dictionary of keys mapping to cas, like `remove_multi({k1:cas1, k2:cas2}`) ...
[ "def", "remove_multi", "(", "self", ",", "kvs", ",", "quiet", "=", "None", ")", ":", "return", "_Base", ".", "remove_multi", "(", "self", ",", "kvs", ",", "quiet", "=", "quiet", ")" ]
Remove multiple items from the cluster :param kvs: Iterable of keys to delete from the cluster. If you wish to specify a CAS for each item, then you may pass a dictionary of keys mapping to cas, like `remove_multi({k1:cas1, k2:cas2}`) :param quiet: Whether an exception should be...
[ "Remove", "multiple", "items", "from", "the", "cluster" ]
a7bada167785bf79a29c39f820d932a433a6a535
https://github.com/couchbase/couchbase-python-client/blob/a7bada167785bf79a29c39f820d932a433a6a535/couchbase/bucket.py#L1296-L1307
train
couchbase/couchbase-python-client
couchbase/bucket.py
Bucket.counter_multi
def counter_multi(self, kvs, initial=None, delta=1, ttl=0): """Perform counter operations on multiple items :param kvs: Keys to operate on. See below for more options :param initial: Initial value to use for all keys. :param delta: Delta value for all keys. :param ttl: Expiratio...
python
def counter_multi(self, kvs, initial=None, delta=1, ttl=0): """Perform counter operations on multiple items :param kvs: Keys to operate on. See below for more options :param initial: Initial value to use for all keys. :param delta: Delta value for all keys. :param ttl: Expiratio...
[ "def", "counter_multi", "(", "self", ",", "kvs", ",", "initial", "=", "None", ",", "delta", "=", "1", ",", "ttl", "=", "0", ")", ":", "return", "_Base", ".", "counter_multi", "(", "self", ",", "kvs", ",", "initial", "=", "initial", ",", "delta", "=...
Perform counter operations on multiple items :param kvs: Keys to operate on. See below for more options :param initial: Initial value to use for all keys. :param delta: Delta value for all keys. :param ttl: Expiration value to use for all keys :return: A :class:`~.MultiResult` ...
[ "Perform", "counter", "operations", "on", "multiple", "items" ]
a7bada167785bf79a29c39f820d932a433a6a535
https://github.com/couchbase/couchbase-python-client/blob/a7bada167785bf79a29c39f820d932a433a6a535/couchbase/bucket.py#L1309-L1352
train
couchbase/couchbase-python-client
couchbase/bucket.py
Bucket.rget
def rget(self, key, replica_index=None, quiet=None): """Get an item from a replica node :param string key: The key to fetch :param int replica_index: The replica index to fetch. If this is ``None`` then this method will return once any replica responds. Use :attr:`config...
python
def rget(self, key, replica_index=None, quiet=None): """Get an item from a replica node :param string key: The key to fetch :param int replica_index: The replica index to fetch. If this is ``None`` then this method will return once any replica responds. Use :attr:`config...
[ "def", "rget", "(", "self", ",", "key", ",", "replica_index", "=", "None", ",", "quiet", "=", "None", ")", ":", "if", "replica_index", "is", "not", "None", ":", "return", "_Base", ".", "_rgetix", "(", "self", ",", "key", ",", "replica", "=", "replica...
Get an item from a replica node :param string key: The key to fetch :param int replica_index: The replica index to fetch. If this is ``None`` then this method will return once any replica responds. Use :attr:`configured_replica_count` to figure out the upper bound fo...
[ "Get", "an", "item", "from", "a", "replica", "node" ]
a7bada167785bf79a29c39f820d932a433a6a535
https://github.com/couchbase/couchbase-python-client/blob/a7bada167785bf79a29c39f820d932a433a6a535/couchbase/bucket.py#L1354-L1379
train
couchbase/couchbase-python-client
couchbase/bucket.py
Bucket.query
def query(self, design, view, use_devmode=False, **kwargs): """ Query a pre-defined MapReduce view, passing parameters. This method executes a view on the cluster. It accepts various parameters for the view and returns an iterable object (specifically, a :class:`~.View`). ...
python
def query(self, design, view, use_devmode=False, **kwargs): """ Query a pre-defined MapReduce view, passing parameters. This method executes a view on the cluster. It accepts various parameters for the view and returns an iterable object (specifically, a :class:`~.View`). ...
[ "def", "query", "(", "self", ",", "design", ",", "view", ",", "use_devmode", "=", "False", ",", "**", "kwargs", ")", ":", "design", "=", "self", ".", "_mk_devmode", "(", "design", ",", "use_devmode", ")", "itercls", "=", "kwargs", ".", "pop", "(", "'...
Query a pre-defined MapReduce view, passing parameters. This method executes a view on the cluster. It accepts various parameters for the view and returns an iterable object (specifically, a :class:`~.View`). :param string design: The design document :param string view: The vie...
[ "Query", "a", "pre", "-", "defined", "MapReduce", "view", "passing", "parameters", "." ]
a7bada167785bf79a29c39f820d932a433a6a535
https://github.com/couchbase/couchbase-python-client/blob/a7bada167785bf79a29c39f820d932a433a6a535/couchbase/bucket.py#L1435-L1477
train
couchbase/couchbase-python-client
couchbase/bucket.py
Bucket.n1ql_query
def n1ql_query(self, query, *args, **kwargs): """ Execute a N1QL query. This method is mainly a wrapper around the :class:`~.N1QLQuery` and :class:`~.N1QLRequest` objects, which contain the inputs and outputs of the query. Using an explicit :class:`~.N1QLQuery`:: ...
python
def n1ql_query(self, query, *args, **kwargs): """ Execute a N1QL query. This method is mainly a wrapper around the :class:`~.N1QLQuery` and :class:`~.N1QLRequest` objects, which contain the inputs and outputs of the query. Using an explicit :class:`~.N1QLQuery`:: ...
[ "def", "n1ql_query", "(", "self", ",", "query", ",", "*", "args", ",", "**", "kwargs", ")", ":", "if", "not", "isinstance", "(", "query", ",", "N1QLQuery", ")", ":", "query", "=", "N1QLQuery", "(", "query", ")", "itercls", "=", "kwargs", ".", "pop", ...
Execute a N1QL query. This method is mainly a wrapper around the :class:`~.N1QLQuery` and :class:`~.N1QLRequest` objects, which contain the inputs and outputs of the query. Using an explicit :class:`~.N1QLQuery`:: query = N1QLQuery( 'SELECT airportname FROM...
[ "Execute", "a", "N1QL", "query", "." ]
a7bada167785bf79a29c39f820d932a433a6a535
https://github.com/couchbase/couchbase-python-client/blob/a7bada167785bf79a29c39f820d932a433a6a535/couchbase/bucket.py#L1479-L1517
train
couchbase/couchbase-python-client
couchbase/bucket.py
Bucket.analytics_query
def analytics_query(self, query, host, *args, **kwargs): """ Execute an Analytics query. This method is mainly a wrapper around the :class:`~.AnalyticsQuery` and :class:`~.AnalyticsRequest` objects, which contain the inputs and outputs of the query. Using an explicit :c...
python
def analytics_query(self, query, host, *args, **kwargs): """ Execute an Analytics query. This method is mainly a wrapper around the :class:`~.AnalyticsQuery` and :class:`~.AnalyticsRequest` objects, which contain the inputs and outputs of the query. Using an explicit :c...
[ "def", "analytics_query", "(", "self", ",", "query", ",", "host", ",", "*", "args", ",", "**", "kwargs", ")", ":", "if", "not", "isinstance", "(", "query", ",", "AnalyticsQuery", ")", ":", "query", "=", "AnalyticsQuery", "(", "query", ",", "*", "args",...
Execute an Analytics query. This method is mainly a wrapper around the :class:`~.AnalyticsQuery` and :class:`~.AnalyticsRequest` objects, which contain the inputs and outputs of the query. Using an explicit :class:`~.AnalyticsQuery`:: query = AnalyticsQuery( ...
[ "Execute", "an", "Analytics", "query", "." ]
a7bada167785bf79a29c39f820d932a433a6a535
https://github.com/couchbase/couchbase-python-client/blob/a7bada167785bf79a29c39f820d932a433a6a535/couchbase/bucket.py#L1519-L1554
train
couchbase/couchbase-python-client
couchbase/bucket.py
Bucket.search
def search(self, index, query, **kwargs): """ Perform full-text searches .. versionadded:: 2.0.9 .. warning:: The full-text search API is experimental and subject to change :param str index: Name of the index to query :param couchbase.fulltext.SearchQuery ...
python
def search(self, index, query, **kwargs): """ Perform full-text searches .. versionadded:: 2.0.9 .. warning:: The full-text search API is experimental and subject to change :param str index: Name of the index to query :param couchbase.fulltext.SearchQuery ...
[ "def", "search", "(", "self", ",", "index", ",", "query", ",", "**", "kwargs", ")", ":", "itercls", "=", "kwargs", ".", "pop", "(", "'itercls'", ",", "_FTS", ".", "SearchRequest", ")", "iterargs", "=", "itercls", ".", "mk_kwargs", "(", "kwargs", ")", ...
Perform full-text searches .. versionadded:: 2.0.9 .. warning:: The full-text search API is experimental and subject to change :param str index: Name of the index to query :param couchbase.fulltext.SearchQuery query: Query to issue :param couchbase.fulltext.Params...
[ "Perform", "full", "-", "text", "searches" ]
a7bada167785bf79a29c39f820d932a433a6a535
https://github.com/couchbase/couchbase-python-client/blob/a7bada167785bf79a29c39f820d932a433a6a535/couchbase/bucket.py#L1559-L1588
train
couchbase/couchbase-python-client
couchbase/bucket.py
Bucket.is_ssl
def is_ssl(self): """ Read-only boolean property indicating whether SSL is used for this connection. If this property is true, then all communication between this object and the Couchbase cluster is encrypted using SSL. See :meth:`__init__` for more information on conne...
python
def is_ssl(self): """ Read-only boolean property indicating whether SSL is used for this connection. If this property is true, then all communication between this object and the Couchbase cluster is encrypted using SSL. See :meth:`__init__` for more information on conne...
[ "def", "is_ssl", "(", "self", ")", ":", "mode", "=", "self", ".", "_cntl", "(", "op", "=", "_LCB", ".", "LCB_CNTL_SSL_MODE", ",", "value_type", "=", "'int'", ")", "return", "mode", "&", "_LCB", ".", "LCB_SSL_ENABLED", "!=", "0" ]
Read-only boolean property indicating whether SSL is used for this connection. If this property is true, then all communication between this object and the Couchbase cluster is encrypted using SSL. See :meth:`__init__` for more information on connection options.
[ "Read", "-", "only", "boolean", "property", "indicating", "whether", "SSL", "is", "used", "for", "this", "connection", "." ]
a7bada167785bf79a29c39f820d932a433a6a535
https://github.com/couchbase/couchbase-python-client/blob/a7bada167785bf79a29c39f820d932a433a6a535/couchbase/bucket.py#L1740-L1751
train
couchbase/couchbase-python-client
couchbase/bucket.py
Bucket.flush
def flush(self): """ Clears the bucket's contents. .. note:: This functionality requires that the flush option be enabled for the bucket by the cluster administrator. You can enable flush on the bucket using the administrative console (See http:/...
python
def flush(self): """ Clears the bucket's contents. .. note:: This functionality requires that the flush option be enabled for the bucket by the cluster administrator. You can enable flush on the bucket using the administrative console (See http:/...
[ "def", "flush", "(", "self", ")", ":", "path", "=", "'/pools/default/buckets/{0}/controller/doFlush'", "path", "=", "path", ".", "format", "(", "self", ".", "bucket", ")", "return", "self", ".", "_http_request", "(", "type", "=", "_LCB", ".", "LCB_HTTP_TYPE_MA...
Clears the bucket's contents. .. note:: This functionality requires that the flush option be enabled for the bucket by the cluster administrator. You can enable flush on the bucket using the administrative console (See http://docs.couchbase.com/admin/admin/UI/ui...
[ "Clears", "the", "bucket", "s", "contents", "." ]
a7bada167785bf79a29c39f820d932a433a6a535
https://github.com/couchbase/couchbase-python-client/blob/a7bada167785bf79a29c39f820d932a433a6a535/couchbase/bucket.py#L2070-L2095
train
couchbase/couchbase-python-client
couchbase/bucket.py
Bucket.map_add
def map_add(self, key, mapkey, value, create=False, **kwargs): """ Set a value for a key in a map. .. warning:: The functionality of the various `map_*`, `list_*`, `queue_*` and `set_*` functions are considered experimental and are included in the library to...
python
def map_add(self, key, mapkey, value, create=False, **kwargs): """ Set a value for a key in a map. .. warning:: The functionality of the various `map_*`, `list_*`, `queue_*` and `set_*` functions are considered experimental and are included in the library to...
[ "def", "map_add", "(", "self", ",", "key", ",", "mapkey", ",", "value", ",", "create", "=", "False", ",", "**", "kwargs", ")", ":", "op", "=", "SD", ".", "upsert", "(", "mapkey", ",", "value", ")", "sdres", "=", "self", ".", "mutate_in", "(", "ke...
Set a value for a key in a map. .. warning:: The functionality of the various `map_*`, `list_*`, `queue_*` and `set_*` functions are considered experimental and are included in the library to demonstrate new functionality. They may change in the future or be rem...
[ "Set", "a", "value", "for", "a", "key", "in", "a", "map", "." ]
a7bada167785bf79a29c39f820d932a433a6a535
https://github.com/couchbase/couchbase-python-client/blob/a7bada167785bf79a29c39f820d932a433a6a535/couchbase/bucket.py#L2111-L2144
train
couchbase/couchbase-python-client
couchbase/bucket.py
Bucket.map_get
def map_get(self, key, mapkey): """ Retrieve a value from a map. :param str key: The document ID :param str mapkey: Key within the map to retrieve :return: :class:`~.ValueResult` :raise: :exc:`IndexError` if the mapkey does not exist :raise: :cb_exc:`NotFoundErro...
python
def map_get(self, key, mapkey): """ Retrieve a value from a map. :param str key: The document ID :param str mapkey: Key within the map to retrieve :return: :class:`~.ValueResult` :raise: :exc:`IndexError` if the mapkey does not exist :raise: :cb_exc:`NotFoundErro...
[ "def", "map_get", "(", "self", ",", "key", ",", "mapkey", ")", ":", "op", "=", "SD", ".", "get", "(", "mapkey", ")", "sdres", "=", "self", ".", "lookup_in", "(", "key", ",", "op", ")", "return", "self", ".", "_wrap_dsop", "(", "sdres", ",", "True...
Retrieve a value from a map. :param str key: The document ID :param str mapkey: Key within the map to retrieve :return: :class:`~.ValueResult` :raise: :exc:`IndexError` if the mapkey does not exist :raise: :cb_exc:`NotFoundError` if the document does not exist. .. seeal...
[ "Retrieve", "a", "value", "from", "a", "map", "." ]
a7bada167785bf79a29c39f820d932a433a6a535
https://github.com/couchbase/couchbase-python-client/blob/a7bada167785bf79a29c39f820d932a433a6a535/couchbase/bucket.py#L2147-L2161
train
couchbase/couchbase-python-client
couchbase/bucket.py
Bucket.map_remove
def map_remove(self, key, mapkey, **kwargs): """ Remove an item from a map. :param str key: The document ID :param str mapkey: The key in the map :param kwargs: See :meth:`mutate_in` for options :raise: :exc:`IndexError` if the mapkey does not exist :raise: :cb_e...
python
def map_remove(self, key, mapkey, **kwargs): """ Remove an item from a map. :param str key: The document ID :param str mapkey: The key in the map :param kwargs: See :meth:`mutate_in` for options :raise: :exc:`IndexError` if the mapkey does not exist :raise: :cb_e...
[ "def", "map_remove", "(", "self", ",", "key", ",", "mapkey", ",", "**", "kwargs", ")", ":", "op", "=", "SD", ".", "remove", "(", "mapkey", ")", "sdres", "=", "self", ".", "mutate_in", "(", "key", ",", "op", ",", "**", "kwargs", ")", "return", "se...
Remove an item from a map. :param str key: The document ID :param str mapkey: The key in the map :param kwargs: See :meth:`mutate_in` for options :raise: :exc:`IndexError` if the mapkey does not exist :raise: :cb_exc:`NotFoundError` if the document does not exist. .. Re...
[ "Remove", "an", "item", "from", "a", "map", "." ]
a7bada167785bf79a29c39f820d932a433a6a535
https://github.com/couchbase/couchbase-python-client/blob/a7bada167785bf79a29c39f820d932a433a6a535/couchbase/bucket.py#L2164-L2182
train
couchbase/couchbase-python-client
couchbase/bucket.py
Bucket.map_size
def map_size(self, key): """ Get the number of items in the map. :param str key: The document ID of the map :return int: The number of items in the map :raise: :cb_exc:`NotFoundError` if the document does not exist. .. seealso:: :meth:`map_add` """ # TOD...
python
def map_size(self, key): """ Get the number of items in the map. :param str key: The document ID of the map :return int: The number of items in the map :raise: :cb_exc:`NotFoundError` if the document does not exist. .. seealso:: :meth:`map_add` """ # TOD...
[ "def", "map_size", "(", "self", ",", "key", ")", ":", "rv", "=", "self", ".", "get", "(", "key", ")", "return", "len", "(", "rv", ".", "value", ")" ]
Get the number of items in the map. :param str key: The document ID of the map :return int: The number of items in the map :raise: :cb_exc:`NotFoundError` if the document does not exist. .. seealso:: :meth:`map_add`
[ "Get", "the", "number", "of", "items", "in", "the", "map", "." ]
a7bada167785bf79a29c39f820d932a433a6a535
https://github.com/couchbase/couchbase-python-client/blob/a7bada167785bf79a29c39f820d932a433a6a535/couchbase/bucket.py#L2185-L2200
train
couchbase/couchbase-python-client
couchbase/bucket.py
Bucket.list_append
def list_append(self, key, value, create=False, **kwargs): """ Add an item to the end of a list. :param str key: The document ID of the list :param value: The value to append :param create: Whether the list should be created if it does not exist. Note that this op...
python
def list_append(self, key, value, create=False, **kwargs): """ Add an item to the end of a list. :param str key: The document ID of the list :param value: The value to append :param create: Whether the list should be created if it does not exist. Note that this op...
[ "def", "list_append", "(", "self", ",", "key", ",", "value", ",", "create", "=", "False", ",", "**", "kwargs", ")", ":", "op", "=", "SD", ".", "array_append", "(", "''", ",", "value", ")", "sdres", "=", "self", ".", "mutate_in", "(", "key", ",", ...
Add an item to the end of a list. :param str key: The document ID of the list :param value: The value to append :param create: Whether the list should be created if it does not exist. Note that this option only works on servers >= 4.6 :param kwargs: Additional arguments t...
[ "Add", "an", "item", "to", "the", "end", "of", "a", "list", "." ]
a7bada167785bf79a29c39f820d932a433a6a535
https://github.com/couchbase/couchbase-python-client/blob/a7bada167785bf79a29c39f820d932a433a6a535/couchbase/bucket.py#L2203-L2225
train
couchbase/couchbase-python-client
couchbase/bucket.py
Bucket.list_prepend
def list_prepend(self, key, value, create=False, **kwargs): """ Add an item to the beginning of a list. :param str key: Document ID :param value: Value to prepend :param bool create: Whether the list should be created if it does not exist :param kwargs: Addit...
python
def list_prepend(self, key, value, create=False, **kwargs): """ Add an item to the beginning of a list. :param str key: Document ID :param value: Value to prepend :param bool create: Whether the list should be created if it does not exist :param kwargs: Addit...
[ "def", "list_prepend", "(", "self", ",", "key", ",", "value", ",", "create", "=", "False", ",", "**", "kwargs", ")", ":", "op", "=", "SD", ".", "array_prepend", "(", "''", ",", "value", ")", "sdres", "=", "self", ".", "mutate_in", "(", "key", ",", ...
Add an item to the beginning of a list. :param str key: Document ID :param value: Value to prepend :param bool create: Whether the list should be created if it does not exist :param kwargs: Additional arguments to :meth:`mutate_in`. :return: :class:`OperationResult`....
[ "Add", "an", "item", "to", "the", "beginning", "of", "a", "list", "." ]
a7bada167785bf79a29c39f820d932a433a6a535
https://github.com/couchbase/couchbase-python-client/blob/a7bada167785bf79a29c39f820d932a433a6a535/couchbase/bucket.py#L2228-L2248
train
couchbase/couchbase-python-client
couchbase/bucket.py
Bucket.list_set
def list_set(self, key, index, value, **kwargs): """ Sets an item within a list at a given position. :param key: The key of the document :param index: The position to replace :param value: The value to be inserted :param kwargs: Additional arguments to :meth:`mutate_in` ...
python
def list_set(self, key, index, value, **kwargs): """ Sets an item within a list at a given position. :param key: The key of the document :param index: The position to replace :param value: The value to be inserted :param kwargs: Additional arguments to :meth:`mutate_in` ...
[ "def", "list_set", "(", "self", ",", "key", ",", "index", ",", "value", ",", "**", "kwargs", ")", ":", "op", "=", "SD", ".", "replace", "(", "'[{0}]'", ".", "format", "(", "index", ")", ",", "value", ")", "sdres", "=", "self", ".", "mutate_in", "...
Sets an item within a list at a given position. :param key: The key of the document :param index: The position to replace :param value: The value to be inserted :param kwargs: Additional arguments to :meth:`mutate_in` :return: :class:`OperationResult` :raise: :cb_exc:`No...
[ "Sets", "an", "item", "within", "a", "list", "at", "a", "given", "position", "." ]
a7bada167785bf79a29c39f820d932a433a6a535
https://github.com/couchbase/couchbase-python-client/blob/a7bada167785bf79a29c39f820d932a433a6a535/couchbase/bucket.py#L2251-L2273
train
couchbase/couchbase-python-client
couchbase/bucket.py
Bucket.set_add
def set_add(self, key, value, create=False, **kwargs): """ Add an item to a set if the item does not yet exist. :param key: The document ID :param value: Value to add :param create: Create the set if it does not exist :param kwargs: Arguments to :meth:`mutate_in` ...
python
def set_add(self, key, value, create=False, **kwargs): """ Add an item to a set if the item does not yet exist. :param key: The document ID :param value: Value to add :param create: Create the set if it does not exist :param kwargs: Arguments to :meth:`mutate_in` ...
[ "def", "set_add", "(", "self", ",", "key", ",", "value", ",", "create", "=", "False", ",", "**", "kwargs", ")", ":", "op", "=", "SD", ".", "array_addunique", "(", "''", ",", "value", ")", "try", ":", "sdres", "=", "self", ".", "mutate_in", "(", "...
Add an item to a set if the item does not yet exist. :param key: The document ID :param value: Value to add :param create: Create the set if it does not exist :param kwargs: Arguments to :meth:`mutate_in` :return: A :class:`~.OperationResult` if the item was added, :rais...
[ "Add", "an", "item", "to", "a", "set", "if", "the", "item", "does", "not", "yet", "exist", "." ]
a7bada167785bf79a29c39f820d932a433a6a535
https://github.com/couchbase/couchbase-python-client/blob/a7bada167785bf79a29c39f820d932a433a6a535/couchbase/bucket.py#L2276-L2295
train
couchbase/couchbase-python-client
couchbase/bucket.py
Bucket.set_remove
def set_remove(self, key, value, **kwargs): """ Remove an item from a set. :param key: The docuent ID :param value: Value to remove :param kwargs: Arguments to :meth:`mutate_in` :return: A :class:`OperationResult` if the item was removed, false otherwise...
python
def set_remove(self, key, value, **kwargs): """ Remove an item from a set. :param key: The docuent ID :param value: Value to remove :param kwargs: Arguments to :meth:`mutate_in` :return: A :class:`OperationResult` if the item was removed, false otherwise...
[ "def", "set_remove", "(", "self", ",", "key", ",", "value", ",", "**", "kwargs", ")", ":", "while", "True", ":", "rv", "=", "self", ".", "get", "(", "key", ")", "try", ":", "ix", "=", "rv", ".", "value", ".", "index", "(", "value", ")", "kwargs...
Remove an item from a set. :param key: The docuent ID :param value: Value to remove :param kwargs: Arguments to :meth:`mutate_in` :return: A :class:`OperationResult` if the item was removed, false otherwise :raise: :cb_exc:`NotFoundError` if the set does not exi...
[ "Remove", "an", "item", "from", "a", "set", "." ]
a7bada167785bf79a29c39f820d932a433a6a535
https://github.com/couchbase/couchbase-python-client/blob/a7bada167785bf79a29c39f820d932a433a6a535/couchbase/bucket.py#L2298-L2320
train
couchbase/couchbase-python-client
couchbase/bucket.py
Bucket.list_remove
def list_remove(self, key, index, **kwargs): """ Remove the element at a specific index from a list. :param key: The document ID of the list :param index: The index to remove :param kwargs: Arguments to :meth:`mutate_in` :return: :class:`OperationResult` :raise: ...
python
def list_remove(self, key, index, **kwargs): """ Remove the element at a specific index from a list. :param key: The document ID of the list :param index: The index to remove :param kwargs: Arguments to :meth:`mutate_in` :return: :class:`OperationResult` :raise: ...
[ "def", "list_remove", "(", "self", ",", "key", ",", "index", ",", "**", "kwargs", ")", ":", "return", "self", ".", "map_remove", "(", "key", ",", "'[{0}]'", ".", "format", "(", "index", ")", ",", "**", "kwargs", ")" ]
Remove the element at a specific index from a list. :param key: The document ID of the list :param index: The index to remove :param kwargs: Arguments to :meth:`mutate_in` :return: :class:`OperationResult` :raise: :exc:`IndexError` if the index does not exist :raise: :cb...
[ "Remove", "the", "element", "at", "a", "specific", "index", "from", "a", "list", "." ]
a7bada167785bf79a29c39f820d932a433a6a535
https://github.com/couchbase/couchbase-python-client/blob/a7bada167785bf79a29c39f820d932a433a6a535/couchbase/bucket.py#L2358-L2369
train
couchbase/couchbase-python-client
couchbase/bucket.py
Bucket.queue_push
def queue_push(self, key, value, create=False, **kwargs): """ Add an item to the end of a queue. :param key: The document ID of the queue :param value: The item to add to the queue :param create: Whether the queue should be created if it does not exist :param kwargs: Arg...
python
def queue_push(self, key, value, create=False, **kwargs): """ Add an item to the end of a queue. :param key: The document ID of the queue :param value: The item to add to the queue :param create: Whether the queue should be created if it does not exist :param kwargs: Arg...
[ "def", "queue_push", "(", "self", ",", "key", ",", "value", ",", "create", "=", "False", ",", "**", "kwargs", ")", ":", "return", "self", ".", "list_prepend", "(", "key", ",", "value", ",", "**", "kwargs", ")" ]
Add an item to the end of a queue. :param key: The document ID of the queue :param value: The item to add to the queue :param create: Whether the queue should be created if it does not exist :param kwargs: Arguments to pass to :meth:`mutate_in` :return: :class:`OperationResult` ...
[ "Add", "an", "item", "to", "the", "end", "of", "a", "queue", "." ]
a7bada167785bf79a29c39f820d932a433a6a535
https://github.com/couchbase/couchbase-python-client/blob/a7bada167785bf79a29c39f820d932a433a6a535/couchbase/bucket.py#L2383-L2403
train
couchbase/couchbase-python-client
couchbase/bucket.py
Bucket.queue_pop
def queue_pop(self, key, **kwargs): """ Remove and return the first item queue. :param key: The document ID :param kwargs: Arguments passed to :meth:`mutate_in` :return: A :class:`ValueResult` :raise: :cb_exc:`QueueEmpty` if there are no items in the queue. :rais...
python
def queue_pop(self, key, **kwargs): """ Remove and return the first item queue. :param key: The document ID :param kwargs: Arguments passed to :meth:`mutate_in` :return: A :class:`ValueResult` :raise: :cb_exc:`QueueEmpty` if there are no items in the queue. :rais...
[ "def", "queue_pop", "(", "self", ",", "key", ",", "**", "kwargs", ")", ":", "while", "True", ":", "try", ":", "itm", "=", "self", ".", "list_get", "(", "key", ",", "-", "1", ")", "except", "IndexError", ":", "raise", "E", ".", "QueueEmpty", "kwargs...
Remove and return the first item queue. :param key: The document ID :param kwargs: Arguments passed to :meth:`mutate_in` :return: A :class:`ValueResult` :raise: :cb_exc:`QueueEmpty` if there are no items in the queue. :raise: :cb_exc:`NotFoundError` if the queue does not exist.
[ "Remove", "and", "return", "the", "first", "item", "queue", "." ]
a7bada167785bf79a29c39f820d932a433a6a535
https://github.com/couchbase/couchbase-python-client/blob/a7bada167785bf79a29c39f820d932a433a6a535/couchbase/bucket.py#L2406-L2429
train
couchbase/couchbase-python-client
couchbase/asynchronous/rowsbase.py
AsyncRowsBase._callback
def _callback(self, mres): """ This is invoked as the row callback. If 'rows' is true, then we are a row callback, otherwise the request has ended and it's time to collect the other data """ try: rows = self._process_payload(self.raw.rows) if rows:...
python
def _callback(self, mres): """ This is invoked as the row callback. If 'rows' is true, then we are a row callback, otherwise the request has ended and it's time to collect the other data """ try: rows = self._process_payload(self.raw.rows) if rows:...
[ "def", "_callback", "(", "self", ",", "mres", ")", ":", "try", ":", "rows", "=", "self", ".", "_process_payload", "(", "self", ".", "raw", ".", "rows", ")", "if", "rows", ":", "self", ".", "on_rows", "(", "rows", ")", "if", "self", ".", "raw", "....
This is invoked as the row callback. If 'rows' is true, then we are a row callback, otherwise the request has ended and it's time to collect the other data
[ "This", "is", "invoked", "as", "the", "row", "callback", ".", "If", "rows", "is", "true", "then", "we", "are", "a", "row", "callback", "otherwise", "the", "request", "has", "ended", "and", "it", "s", "time", "to", "collect", "the", "other", "data" ]
a7bada167785bf79a29c39f820d932a433a6a535
https://github.com/couchbase/couchbase-python-client/blob/a7bada167785bf79a29c39f820d932a433a6a535/couchbase/asynchronous/rowsbase.py#L66-L80
train
couchbase/couchbase-python-client
examples/item.py
Player.create
def create(cls, name, email, cb): """ Create the basic structure of a player """ it = cls(name, create_structure=True) it.value['email'] = email # In an actual application you'd probably want to use 'add', # but since this app might be run multiple times, you don...
python
def create(cls, name, email, cb): """ Create the basic structure of a player """ it = cls(name, create_structure=True) it.value['email'] = email # In an actual application you'd probably want to use 'add', # but since this app might be run multiple times, you don...
[ "def", "create", "(", "cls", ",", "name", ",", "email", ",", "cb", ")", ":", "it", "=", "cls", "(", "name", ",", "create_structure", "=", "True", ")", "it", ".", "value", "[", "'email'", "]", "=", "email", "cb", ".", "upsert_multi", "(", "ItemSeque...
Create the basic structure of a player
[ "Create", "the", "basic", "structure", "of", "a", "player" ]
a7bada167785bf79a29c39f820d932a433a6a535
https://github.com/couchbase/couchbase-python-client/blob/a7bada167785bf79a29c39f820d932a433a6a535/examples/item.py#L32-L43
train
couchbase/couchbase-python-client
couchbase/bucketmanager.py
BucketManager._doc_rev
def _doc_rev(self, res): """ Returns the rev id from the header """ jstr = res.headers['X-Couchbase-Meta'] jobj = json.loads(jstr) return jobj['rev']
python
def _doc_rev(self, res): """ Returns the rev id from the header """ jstr = res.headers['X-Couchbase-Meta'] jobj = json.loads(jstr) return jobj['rev']
[ "def", "_doc_rev", "(", "self", ",", "res", ")", ":", "jstr", "=", "res", ".", "headers", "[", "'X-Couchbase-Meta'", "]", "jobj", "=", "json", ".", "loads", "(", "jstr", ")", "return", "jobj", "[", "'rev'", "]" ]
Returns the rev id from the header
[ "Returns", "the", "rev", "id", "from", "the", "header" ]
a7bada167785bf79a29c39f820d932a433a6a535
https://github.com/couchbase/couchbase-python-client/blob/a7bada167785bf79a29c39f820d932a433a6a535/couchbase/bucketmanager.py#L47-L53
train
couchbase/couchbase-python-client
couchbase/bucketmanager.py
BucketManager.design_create
def design_create(self, name, ddoc, use_devmode=True, syncwait=0): """ Store a design document :param string name: The name of the design :param ddoc: The actual contents of the design document :type ddoc: string or dict If ``ddoc`` is a string, it is passed, as-is,...
python
def design_create(self, name, ddoc, use_devmode=True, syncwait=0): """ Store a design document :param string name: The name of the design :param ddoc: The actual contents of the design document :type ddoc: string or dict If ``ddoc`` is a string, it is passed, as-is,...
[ "def", "design_create", "(", "self", ",", "name", ",", "ddoc", ",", "use_devmode", "=", "True", ",", "syncwait", "=", "0", ")", ":", "name", "=", "self", ".", "_cb", ".", "_mk_devmode", "(", "name", ",", "use_devmode", ")", "fqname", "=", "\"_design/{0...
Store a design document :param string name: The name of the design :param ddoc: The actual contents of the design document :type ddoc: string or dict If ``ddoc`` is a string, it is passed, as-is, to the server. Otherwise it is serialized as JSON, and its ``_id`` field i...
[ "Store", "a", "design", "document" ]
a7bada167785bf79a29c39f820d932a433a6a535
https://github.com/couchbase/couchbase-python-client/blob/a7bada167785bf79a29c39f820d932a433a6a535/couchbase/bucketmanager.py#L130-L190
train
couchbase/couchbase-python-client
couchbase/bucketmanager.py
BucketManager.design_get
def design_get(self, name, use_devmode=True): """ Retrieve a design document :param string name: The name of the design document :param bool use_devmode: Whether this design document is still in "development" mode :return: A :class:`~couchbase.result.HttpResult` con...
python
def design_get(self, name, use_devmode=True): """ Retrieve a design document :param string name: The name of the design document :param bool use_devmode: Whether this design document is still in "development" mode :return: A :class:`~couchbase.result.HttpResult` con...
[ "def", "design_get", "(", "self", ",", "name", ",", "use_devmode", "=", "True", ")", ":", "name", "=", "self", ".", "_mk_devmode", "(", "name", ",", "use_devmode", ")", "existing", "=", "self", ".", "_http_request", "(", "type", "=", "_LCB", ".", "LCB_...
Retrieve a design document :param string name: The name of the design document :param bool use_devmode: Whether this design document is still in "development" mode :return: A :class:`~couchbase.result.HttpResult` containing a dict representing the format of the design d...
[ "Retrieve", "a", "design", "document" ]
a7bada167785bf79a29c39f820d932a433a6a535
https://github.com/couchbase/couchbase-python-client/blob/a7bada167785bf79a29c39f820d932a433a6a535/couchbase/bucketmanager.py#L192-L215
train
couchbase/couchbase-python-client
couchbase/bucketmanager.py
BucketManager.design_delete
def design_delete(self, name, use_devmode=True, syncwait=0): """ Delete a design document :param string name: The name of the design document to delete :param bool use_devmode: Whether the design to delete is a development mode design doc. :param float syncwait: Tim...
python
def design_delete(self, name, use_devmode=True, syncwait=0): """ Delete a design document :param string name: The name of the design document to delete :param bool use_devmode: Whether the design to delete is a development mode design doc. :param float syncwait: Tim...
[ "def", "design_delete", "(", "self", ",", "name", ",", "use_devmode", "=", "True", ",", "syncwait", "=", "0", ")", ":", "name", "=", "self", ".", "_mk_devmode", "(", "name", ",", "use_devmode", ")", "existing", "=", "None", "if", "syncwait", ":", "try"...
Delete a design document :param string name: The name of the design document to delete :param bool use_devmode: Whether the design to delete is a development mode design doc. :param float syncwait: Timeout for operation verification. See :meth:`design_create` for more i...
[ "Delete", "a", "design", "document" ]
a7bada167785bf79a29c39f820d932a433a6a535
https://github.com/couchbase/couchbase-python-client/blob/a7bada167785bf79a29c39f820d932a433a6a535/couchbase/bucketmanager.py#L249-L284
train
couchbase/couchbase-python-client
couchbase/bucketmanager.py
BucketManager.design_list
def design_list(self): """ List all design documents for the current bucket. :return: A :class:`~couchbase.result.HttpResult` containing a dict, with keys being the ID of the design document. .. note:: This information is derived using the ``pools/d...
python
def design_list(self): """ List all design documents for the current bucket. :return: A :class:`~couchbase.result.HttpResult` containing a dict, with keys being the ID of the design document. .. note:: This information is derived using the ``pools/d...
[ "def", "design_list", "(", "self", ")", ":", "ret", "=", "self", ".", "_http_request", "(", "type", "=", "_LCB", ".", "LCB_HTTP_TYPE_MANAGEMENT", ",", "path", "=", "\"/pools/default/buckets/{0}/ddocs\"", ".", "format", "(", "self", ".", "_cb", ".", "bucket", ...
List all design documents for the current bucket. :return: A :class:`~couchbase.result.HttpResult` containing a dict, with keys being the ID of the design document. .. note:: This information is derived using the ``pools/default/buckets/<bucket>ddocs`` endpoint, bu...
[ "List", "all", "design", "documents", "for", "the", "current", "bucket", "." ]
a7bada167785bf79a29c39f820d932a433a6a535
https://github.com/couchbase/couchbase-python-client/blob/a7bada167785bf79a29c39f820d932a433a6a535/couchbase/bucketmanager.py#L286-L338
train
couchbase/couchbase-python-client
couchbase/bucketmanager.py
BucketManager.n1ql_index_create
def n1ql_index_create(self, ix, **kwargs): """ Create an index for use with N1QL. :param str ix: The name of the index to create :param bool defer: Whether the building of indexes should be deferred. If creating multiple indexes on an existing dataset, using the ...
python
def n1ql_index_create(self, ix, **kwargs): """ Create an index for use with N1QL. :param str ix: The name of the index to create :param bool defer: Whether the building of indexes should be deferred. If creating multiple indexes on an existing dataset, using the ...
[ "def", "n1ql_index_create", "(", "self", ",", "ix", ",", "**", "kwargs", ")", ":", "defer", "=", "kwargs", ".", "pop", "(", "'defer'", ",", "False", ")", "ignore_exists", "=", "kwargs", ".", "pop", "(", "'ignore_exists'", ",", "False", ")", "primary", ...
Create an index for use with N1QL. :param str ix: The name of the index to create :param bool defer: Whether the building of indexes should be deferred. If creating multiple indexes on an existing dataset, using the `defer` option in conjunction with :meth:`build_def...
[ "Create", "an", "index", "for", "use", "with", "N1QL", "." ]
a7bada167785bf79a29c39f820d932a433a6a535
https://github.com/couchbase/couchbase-python-client/blob/a7bada167785bf79a29c39f820d932a433a6a535/couchbase/bucketmanager.py#L355-L412
train
couchbase/couchbase-python-client
couchbase/bucketmanager.py
BucketManager.n1ql_index_create_primary
def n1ql_index_create_primary(self, defer=False, ignore_exists=False): """ Create the primary index on the bucket. Equivalent to:: n1ql_index_create('', primary=True, **kwargs) :param bool defer: :param bool ignore_exists: .. seealso:: :meth:`create_index`...
python
def n1ql_index_create_primary(self, defer=False, ignore_exists=False): """ Create the primary index on the bucket. Equivalent to:: n1ql_index_create('', primary=True, **kwargs) :param bool defer: :param bool ignore_exists: .. seealso:: :meth:`create_index`...
[ "def", "n1ql_index_create_primary", "(", "self", ",", "defer", "=", "False", ",", "ignore_exists", "=", "False", ")", ":", "return", "self", ".", "n1ql_index_create", "(", "''", ",", "defer", "=", "defer", ",", "primary", "=", "True", ",", "ignore_exists", ...
Create the primary index on the bucket. Equivalent to:: n1ql_index_create('', primary=True, **kwargs) :param bool defer: :param bool ignore_exists: .. seealso:: :meth:`create_index`
[ "Create", "the", "primary", "index", "on", "the", "bucket", "." ]
a7bada167785bf79a29c39f820d932a433a6a535
https://github.com/couchbase/couchbase-python-client/blob/a7bada167785bf79a29c39f820d932a433a6a535/couchbase/bucketmanager.py#L414-L428
train
couchbase/couchbase-python-client
couchbase/bucketmanager.py
BucketManager.n1ql_index_drop
def n1ql_index_drop(self, ix, primary=False, **kwargs): """ Delete an index from the cluster. :param str ix: the name of the index :param bool primary: if this index is a primary index :param bool ignore_missing: Do not raise an exception if the index does not exist ...
python
def n1ql_index_drop(self, ix, primary=False, **kwargs): """ Delete an index from the cluster. :param str ix: the name of the index :param bool primary: if this index is a primary index :param bool ignore_missing: Do not raise an exception if the index does not exist ...
[ "def", "n1ql_index_drop", "(", "self", ",", "ix", ",", "primary", "=", "False", ",", "**", "kwargs", ")", ":", "info", "=", "self", ".", "_mk_index_def", "(", "ix", ",", "primary", ")", "return", "IxmgmtRequest", "(", "self", ".", "_cb", ",", "'drop'",...
Delete an index from the cluster. :param str ix: the name of the index :param bool primary: if this index is a primary index :param bool ignore_missing: Do not raise an exception if the index does not exist :raise: :exc:`~.NotFoundError` if the index does not exist and ...
[ "Delete", "an", "index", "from", "the", "cluster", "." ]
a7bada167785bf79a29c39f820d932a433a6a535
https://github.com/couchbase/couchbase-python-client/blob/a7bada167785bf79a29c39f820d932a433a6a535/couchbase/bucketmanager.py#L430-L442
train
couchbase/couchbase-python-client
couchbase/bucketmanager.py
BucketManager.n1ql_index_build_deferred
def n1ql_index_build_deferred(self, other_buckets=False): """ Instruct the server to begin building any previously deferred index definitions. This method will gather a list of all pending indexes in the cluster (including those created using the `defer` option with :met...
python
def n1ql_index_build_deferred(self, other_buckets=False): """ Instruct the server to begin building any previously deferred index definitions. This method will gather a list of all pending indexes in the cluster (including those created using the `defer` option with :met...
[ "def", "n1ql_index_build_deferred", "(", "self", ",", "other_buckets", "=", "False", ")", ":", "info", "=", "N1qlIndex", "(", ")", "if", "not", "other_buckets", ":", "info", ".", "keyspace", "=", "self", ".", "_cb", ".", "bucket", "return", "IxmgmtRequest", ...
Instruct the server to begin building any previously deferred index definitions. This method will gather a list of all pending indexes in the cluster (including those created using the `defer` option with :meth:`create_index`) and start building them in an efficient manner. :pa...
[ "Instruct", "the", "server", "to", "begin", "building", "any", "previously", "deferred", "index", "definitions", "." ]
a7bada167785bf79a29c39f820d932a433a6a535
https://github.com/couchbase/couchbase-python-client/blob/a7bada167785bf79a29c39f820d932a433a6a535/couchbase/bucketmanager.py#L466-L497
train
couchbase/couchbase-python-client
couchbase/bucketmanager.py
BucketManager.n1ql_index_watch
def n1ql_index_watch(self, indexes, timeout=30, interval=0.2, watch_primary=False): """ Await completion of index building This method will wait up to `timeout` seconds for every index in `indexes` to have been built. It will poll the cluster every `inte...
python
def n1ql_index_watch(self, indexes, timeout=30, interval=0.2, watch_primary=False): """ Await completion of index building This method will wait up to `timeout` seconds for every index in `indexes` to have been built. It will poll the cluster every `inte...
[ "def", "n1ql_index_watch", "(", "self", ",", "indexes", ",", "timeout", "=", "30", ",", "interval", "=", "0.2", ",", "watch_primary", "=", "False", ")", ":", "kwargs", "=", "{", "'timeout_us'", ":", "int", "(", "timeout", "*", "1000000", ")", ",", "'in...
Await completion of index building This method will wait up to `timeout` seconds for every index in `indexes` to have been built. It will poll the cluster every `interval` seconds. :param list indexes: A list of indexes to check. This is returned by :meth:`build_deferred_in...
[ "Await", "completion", "of", "index", "building" ]
a7bada167785bf79a29c39f820d932a433a6a535
https://github.com/couchbase/couchbase-python-client/blob/a7bada167785bf79a29c39f820d932a433a6a535/couchbase/bucketmanager.py#L499-L528
train
couchbase/couchbase-python-client
couchbase/views/params.py
QueryBase._set_range_common
def _set_range_common(self, k_sugar, k_start, k_end, value): """ Checks to see if the client-side convenience key is present, and if so converts the sugar convenience key into its real server-side equivalents. :param string k_sugar: The client-side convenience key :param...
python
def _set_range_common(self, k_sugar, k_start, k_end, value): """ Checks to see if the client-side convenience key is present, and if so converts the sugar convenience key into its real server-side equivalents. :param string k_sugar: The client-side convenience key :param...
[ "def", "_set_range_common", "(", "self", ",", "k_sugar", ",", "k_start", ",", "k_end", ",", "value", ")", ":", "if", "not", "isinstance", "(", "value", ",", "(", "list", ",", "tuple", ",", "_Unspec", ")", ")", ":", "raise", "ArgumentError", ".", "pyexc...
Checks to see if the client-side convenience key is present, and if so converts the sugar convenience key into its real server-side equivalents. :param string k_sugar: The client-side convenience key :param string k_start: The server-side key specifying the beginning of the ...
[ "Checks", "to", "see", "if", "the", "client", "-", "side", "convenience", "key", "is", "present", "and", "if", "so", "converts", "the", "sugar", "convenience", "key", "into", "its", "real", "server", "-", "side", "equivalents", "." ]
a7bada167785bf79a29c39f820d932a433a6a535
https://github.com/couchbase/couchbase-python-client/blob/a7bada167785bf79a29c39f820d932a433a6a535/couchbase/views/params.py#L276-L319
train
couchbase/couchbase-python-client
couchbase/views/params.py
QueryBase.update
def update(self, copy=False, **params): """ Chained assignment operator. This may be used to quickly assign extra parameters to the :class:`Query` object. Example:: q = Query(reduce=True, full_sec=True) # Someplace later v = View(design, v...
python
def update(self, copy=False, **params): """ Chained assignment operator. This may be used to quickly assign extra parameters to the :class:`Query` object. Example:: q = Query(reduce=True, full_sec=True) # Someplace later v = View(design, v...
[ "def", "update", "(", "self", ",", "copy", "=", "False", ",", "**", "params", ")", ":", "if", "copy", ":", "self", "=", "deepcopy", "(", "self", ")", "for", "k", ",", "v", "in", "params", ".", "items", "(", ")", ":", "if", "not", "hasattr", "("...
Chained assignment operator. This may be used to quickly assign extra parameters to the :class:`Query` object. Example:: q = Query(reduce=True, full_sec=True) # Someplace later v = View(design, view, query=q.update(mapkey_range=["foo"])) Its prim...
[ "Chained", "assignment", "operator", "." ]
a7bada167785bf79a29c39f820d932a433a6a535
https://github.com/couchbase/couchbase-python-client/blob/a7bada167785bf79a29c39f820d932a433a6a535/couchbase/views/params.py#L362-L401
train
couchbase/couchbase-python-client
couchbase/views/params.py
QueryBase.from_any
def from_any(cls, params, **ctor_opts): """ Creates a new Query object from input. :param params: Parameter to convert to query :type params: dict, string, or :class:`Query` If ``params`` is a :class:`Query` object already, a deep copy is made and a new :class:`Query` o...
python
def from_any(cls, params, **ctor_opts): """ Creates a new Query object from input. :param params: Parameter to convert to query :type params: dict, string, or :class:`Query` If ``params`` is a :class:`Query` object already, a deep copy is made and a new :class:`Query` o...
[ "def", "from_any", "(", "cls", ",", "params", ",", "**", "ctor_opts", ")", ":", "if", "isinstance", "(", "params", ",", "cls", ")", ":", "return", "deepcopy", "(", "params", ")", "elif", "isinstance", "(", "params", ",", "dict", ")", ":", "ctor_opts", ...
Creates a new Query object from input. :param params: Parameter to convert to query :type params: dict, string, or :class:`Query` If ``params`` is a :class:`Query` object already, a deep copy is made and a new :class:`Query` object is returned. If ``params`` is a string, then ...
[ "Creates", "a", "new", "Query", "object", "from", "input", "." ]
a7bada167785bf79a29c39f820d932a433a6a535
https://github.com/couchbase/couchbase-python-client/blob/a7bada167785bf79a29c39f820d932a433a6a535/couchbase/views/params.py#L404-L446
train
couchbase/couchbase-python-client
couchbase/views/params.py
QueryBase.encoded
def encoded(self): """ Returns an encoded form of the query """ if not self._encoded: self._encoded = self._encode() if self._base_str: return '&'.join((self._base_str, self._encoded)) else: return self._encoded
python
def encoded(self): """ Returns an encoded form of the query """ if not self._encoded: self._encoded = self._encode() if self._base_str: return '&'.join((self._base_str, self._encoded)) else: return self._encoded
[ "def", "encoded", "(", "self", ")", ":", "if", "not", "self", ".", "_encoded", ":", "self", ".", "_encoded", "=", "self", ".", "_encode", "(", ")", "if", "self", ".", "_base_str", ":", "return", "'&'", ".", "join", "(", "(", "self", ".", "_base_str...
Returns an encoded form of the query
[ "Returns", "an", "encoded", "form", "of", "the", "query" ]
a7bada167785bf79a29c39f820d932a433a6a535
https://github.com/couchbase/couchbase-python-client/blob/a7bada167785bf79a29c39f820d932a433a6a535/couchbase/views/params.py#L475-L486
train
couchbase/couchbase-python-client
txcouchbase/bucket.py
RawBucket.registerDeferred
def registerDeferred(self, event, d): """ Register a defer to be fired at the firing of a specific event. :param string event: Currently supported values are `connect`. Another value may be `_dtor` which will register an event to fire when this object has been completely des...
python
def registerDeferred(self, event, d): """ Register a defer to be fired at the firing of a specific event. :param string event: Currently supported values are `connect`. Another value may be `_dtor` which will register an event to fire when this object has been completely des...
[ "def", "registerDeferred", "(", "self", ",", "event", ",", "d", ")", ":", "try", ":", "self", ".", "_evq", "[", "event", "]", ".", "schedule", "(", "d", ")", "except", "KeyError", ":", "raise", "ValueError", "(", "\"No such event type\"", ",", "event", ...
Register a defer to be fired at the firing of a specific event. :param string event: Currently supported values are `connect`. Another value may be `_dtor` which will register an event to fire when this object has been completely destroyed. :param event: The defered to fire when th...
[ "Register", "a", "defer", "to", "be", "fired", "at", "the", "firing", "of", "a", "specific", "event", "." ]
a7bada167785bf79a29c39f820d932a433a6a535
https://github.com/couchbase/couchbase-python-client/blob/a7bada167785bf79a29c39f820d932a433a6a535/txcouchbase/bucket.py#L149-L180
train
couchbase/couchbase-python-client
txcouchbase/bucket.py
RawBucket.queryEx
def queryEx(self, viewcls, *args, **kwargs): """ Query a view, with the ``viewcls`` instance receiving events of the query as they arrive. :param type viewcls: A class (derived from :class:`AsyncViewBase`) to instantiate Other arguments are passed to the standard `que...
python
def queryEx(self, viewcls, *args, **kwargs): """ Query a view, with the ``viewcls`` instance receiving events of the query as they arrive. :param type viewcls: A class (derived from :class:`AsyncViewBase`) to instantiate Other arguments are passed to the standard `que...
[ "def", "queryEx", "(", "self", ",", "viewcls", ",", "*", "args", ",", "**", "kwargs", ")", ":", "kwargs", "[", "'itercls'", "]", "=", "viewcls", "o", "=", "super", "(", "AsyncBucket", ",", "self", ")", ".", "query", "(", "*", "args", ",", "**", "...
Query a view, with the ``viewcls`` instance receiving events of the query as they arrive. :param type viewcls: A class (derived from :class:`AsyncViewBase`) to instantiate Other arguments are passed to the standard `query` method. This functions exactly like the :meth:`~couc...
[ "Query", "a", "view", "with", "the", "viewcls", "instance", "receiving", "events", "of", "the", "query", "as", "they", "arrive", "." ]
a7bada167785bf79a29c39f820d932a433a6a535
https://github.com/couchbase/couchbase-python-client/blob/a7bada167785bf79a29c39f820d932a433a6a535/txcouchbase/bucket.py#L239-L261
train
couchbase/couchbase-python-client
txcouchbase/bucket.py
RawBucket.n1qlQueryEx
def n1qlQueryEx(self, cls, *args, **kwargs): """ Execute a N1QL statement providing a custom handler for rows. This method allows you to define your own subclass (of :class:`~AsyncN1QLRequest`) which can handle rows as they are received from the network. :param cls: The...
python
def n1qlQueryEx(self, cls, *args, **kwargs): """ Execute a N1QL statement providing a custom handler for rows. This method allows you to define your own subclass (of :class:`~AsyncN1QLRequest`) which can handle rows as they are received from the network. :param cls: The...
[ "def", "n1qlQueryEx", "(", "self", ",", "cls", ",", "*", "args", ",", "**", "kwargs", ")", ":", "kwargs", "[", "'itercls'", "]", "=", "cls", "o", "=", "super", "(", "AsyncBucket", ",", "self", ")", ".", "n1ql_query", "(", "*", "args", ",", "**", ...
Execute a N1QL statement providing a custom handler for rows. This method allows you to define your own subclass (of :class:`~AsyncN1QLRequest`) which can handle rows as they are received from the network. :param cls: The subclass (not instance) to use :param args: Positional a...
[ "Execute", "a", "N1QL", "statement", "providing", "a", "custom", "handler", "for", "rows", "." ]
a7bada167785bf79a29c39f820d932a433a6a535
https://github.com/couchbase/couchbase-python-client/blob/a7bada167785bf79a29c39f820d932a433a6a535/txcouchbase/bucket.py#L291-L311
train
couchbase/couchbase-python-client
txcouchbase/bucket.py
RawBucket.n1qlQueryAll
def n1qlQueryAll(self, *args, **kwargs): """ Execute a N1QL query, retrieving all rows. This method returns a :class:`Deferred` object which is executed with a :class:`~.N1QLRequest` object. The object may be iterated over to yield the rows in the result set. This metho...
python
def n1qlQueryAll(self, *args, **kwargs): """ Execute a N1QL query, retrieving all rows. This method returns a :class:`Deferred` object which is executed with a :class:`~.N1QLRequest` object. The object may be iterated over to yield the rows in the result set. This metho...
[ "def", "n1qlQueryAll", "(", "self", ",", "*", "args", ",", "**", "kwargs", ")", ":", "if", "not", "self", ".", "connected", ":", "cb", "=", "lambda", "x", ":", "self", ".", "n1qlQueryAll", "(", "*", "args", ",", "**", "kwargs", ")", "return", "self...
Execute a N1QL query, retrieving all rows. This method returns a :class:`Deferred` object which is executed with a :class:`~.N1QLRequest` object. The object may be iterated over to yield the rows in the result set. This method is similar to :meth:`~couchbase.bucket.Bucket.n1ql_query` ...
[ "Execute", "a", "N1QL", "query", "retrieving", "all", "rows", "." ]
a7bada167785bf79a29c39f820d932a433a6a535
https://github.com/couchbase/couchbase-python-client/blob/a7bada167785bf79a29c39f820d932a433a6a535/txcouchbase/bucket.py#L313-L345
train
couchbase/couchbase-python-client
txcouchbase/bucket.py
Bucket._wrap
def _wrap(self, meth, *args, **kwargs): """ Calls a given method with the appropriate arguments, or defers such a call until the instance has been connected """ if not self.connected: return self._connectSchedule(self._wrap, meth, *args, **kwargs) opres = met...
python
def _wrap(self, meth, *args, **kwargs): """ Calls a given method with the appropriate arguments, or defers such a call until the instance has been connected """ if not self.connected: return self._connectSchedule(self._wrap, meth, *args, **kwargs) opres = met...
[ "def", "_wrap", "(", "self", ",", "meth", ",", "*", "args", ",", "**", "kwargs", ")", ":", "if", "not", "self", ".", "connected", ":", "return", "self", ".", "_connectSchedule", "(", "self", ".", "_wrap", ",", "meth", ",", "*", "args", ",", "**", ...
Calls a given method with the appropriate arguments, or defers such a call until the instance has been connected
[ "Calls", "a", "given", "method", "with", "the", "appropriate", "arguments", "or", "defers", "such", "a", "call", "until", "the", "instance", "has", "been", "connected" ]
a7bada167785bf79a29c39f820d932a433a6a535
https://github.com/couchbase/couchbase-python-client/blob/a7bada167785bf79a29c39f820d932a433a6a535/txcouchbase/bucket.py#L467-L476
train
couchbase/couchbase-python-client
couchbase/transcoder.py
get_decode_format
def get_decode_format(flags): """ Returns a tuple of format, recognized """ c_flags = flags & FMT_COMMON_MASK l_flags = flags & FMT_LEGACY_MASK if c_flags: if c_flags not in COMMON_FORMATS: return FMT_BYTES, False else: return COMMON2UNIFIED[c_flags], Tru...
python
def get_decode_format(flags): """ Returns a tuple of format, recognized """ c_flags = flags & FMT_COMMON_MASK l_flags = flags & FMT_LEGACY_MASK if c_flags: if c_flags not in COMMON_FORMATS: return FMT_BYTES, False else: return COMMON2UNIFIED[c_flags], Tru...
[ "def", "get_decode_format", "(", "flags", ")", ":", "c_flags", "=", "flags", "&", "FMT_COMMON_MASK", "l_flags", "=", "flags", "&", "FMT_LEGACY_MASK", "if", "c_flags", ":", "if", "c_flags", "not", "in", "COMMON_FORMATS", ":", "return", "FMT_BYTES", ",", "False"...
Returns a tuple of format, recognized
[ "Returns", "a", "tuple", "of", "format", "recognized" ]
a7bada167785bf79a29c39f820d932a433a6a535
https://github.com/couchbase/couchbase-python-client/blob/a7bada167785bf79a29c39f820d932a433a6a535/couchbase/transcoder.py#L43-L59
train
couchbase/couchbase-python-client
couchbase/admin.py
Admin.bucket_create
def bucket_create(self, name, bucket_type='couchbase', bucket_password='', replicas=0, ram_quota=1024, flush_enabled=False): """ Create a new bucket :param string name: The name of the bucket to create :param string bucket_type: The type of bu...
python
def bucket_create(self, name, bucket_type='couchbase', bucket_password='', replicas=0, ram_quota=1024, flush_enabled=False): """ Create a new bucket :param string name: The name of the bucket to create :param string bucket_type: The type of bu...
[ "def", "bucket_create", "(", "self", ",", "name", ",", "bucket_type", "=", "'couchbase'", ",", "bucket_password", "=", "''", ",", "replicas", "=", "0", ",", "ram_quota", "=", "1024", ",", "flush_enabled", "=", "False", ")", ":", "params", "=", "{", "'nam...
Create a new bucket :param string name: The name of the bucket to create :param string bucket_type: The type of bucket to create. This can either be `couchbase` to create a couchbase style bucket (which persists data and supports replication) or `memcached` (which is...
[ "Create", "a", "new", "bucket" ]
a7bada167785bf79a29c39f820d932a433a6a535
https://github.com/couchbase/couchbase-python-client/blob/a7bada167785bf79a29c39f820d932a433a6a535/couchbase/admin.py#L162-L210
train