repository_name
stringlengths
7
55
func_path_in_repository
stringlengths
4
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
75
104k
language
stringclasses
1 value
func_code_string
stringlengths
75
104k
func_code_tokens
listlengths
19
28.4k
func_documentation_string
stringlengths
1
46.9k
func_documentation_tokens
listlengths
1
1.97k
split_name
stringclasses
1 value
func_code_url
stringlengths
87
315
twisted/txaws
txaws/server/schema.py
Structure.format
def format(self, value): """ Convert a dictionary of processed values to a dictionary of raw values. """ if not isinstance(value, Arguments): value = value.iteritems() return dict((k, self.fields[k].format(v)) for k, v in value)
python
def format(self, value): """ Convert a dictionary of processed values to a dictionary of raw values. """ if not isinstance(value, Arguments): value = value.iteritems() return dict((k, self.fields[k].format(v)) for k, v in value)
[ "def", "format", "(", "self", ",", "value", ")", ":", "if", "not", "isinstance", "(", "value", ",", "Arguments", ")", ":", "value", "=", "value", ".", "iteritems", "(", ")", "return", "dict", "(", "(", "k", ",", "self", ".", "fields", "[", "k", "...
Convert a dictionary of processed values to a dictionary of raw values.
[ "Convert", "a", "dictionary", "of", "processed", "values", "to", "a", "dictionary", "of", "raw", "values", "." ]
train
https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/server/schema.py#L454-L460
twisted/txaws
txaws/server/schema.py
Arguments._wrap
def _wrap(self, value): """Wrap the given L{tree} with L{Arguments} as necessary. @param tree: A {dict}, containing L{dict}s and/or leaf values, nested arbitrarily deep. """ if isinstance(value, dict): if any(isinstance(name, int) for name in value.keys()): ...
python
def _wrap(self, value): """Wrap the given L{tree} with L{Arguments} as necessary. @param tree: A {dict}, containing L{dict}s and/or leaf values, nested arbitrarily deep. """ if isinstance(value, dict): if any(isinstance(name, int) for name in value.keys()): ...
[ "def", "_wrap", "(", "self", ",", "value", ")", ":", "if", "isinstance", "(", "value", ",", "dict", ")", ":", "if", "any", "(", "isinstance", "(", "name", ",", "int", ")", "for", "name", "in", "value", ".", "keys", "(", ")", ")", ":", "if", "no...
Wrap the given L{tree} with L{Arguments} as necessary. @param tree: A {dict}, containing L{dict}s and/or leaf values, nested arbitrarily deep.
[ "Wrap", "the", "given", "L", "{", "tree", "}", "with", "L", "{", "Arguments", "}", "as", "necessary", "." ]
train
https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/server/schema.py#L496-L514
twisted/txaws
txaws/server/schema.py
Schema.extract
def extract(self, params): """Extract parameters from a raw C{dict} according to this schema. @param params: The raw parameters to parse. @return: A tuple of an L{Arguments} object holding the extracted arguments and any unparsed arguments. """ structure = Structure(...
python
def extract(self, params): """Extract parameters from a raw C{dict} according to this schema. @param params: The raw parameters to parse. @return: A tuple of an L{Arguments} object holding the extracted arguments and any unparsed arguments. """ structure = Structure(...
[ "def", "extract", "(", "self", ",", "params", ")", ":", "structure", "=", "Structure", "(", "fields", "=", "dict", "(", "[", "(", "p", ".", "name", ",", "p", ")", "for", "p", "in", "self", ".", "_parameters", "]", ")", ")", "try", ":", "tree", ...
Extract parameters from a raw C{dict} according to this schema. @param params: The raw parameters to parse. @return: A tuple of an L{Arguments} object holding the extracted arguments and any unparsed arguments.
[ "Extract", "parameters", "from", "a", "raw", "C", "{", "dict", "}", "according", "to", "this", "schema", "." ]
train
https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/server/schema.py#L590-L605
twisted/txaws
txaws/server/schema.py
Schema.bundle
def bundle(self, *arguments, **extra): """Bundle the given arguments in a C{dict} with EC2-style format. @param arguments: L{Arguments} instances to bundle. Keys in later objects will override those in earlier objects. @param extra: Any number of additional parameters. These will ov...
python
def bundle(self, *arguments, **extra): """Bundle the given arguments in a C{dict} with EC2-style format. @param arguments: L{Arguments} instances to bundle. Keys in later objects will override those in earlier objects. @param extra: Any number of additional parameters. These will ov...
[ "def", "bundle", "(", "self", ",", "*", "arguments", ",", "*", "*", "extra", ")", ":", "params", "=", "{", "}", "for", "argument", "in", "arguments", ":", "params", ".", "update", "(", "argument", ")", "params", ".", "update", "(", "extra", ")", "r...
Bundle the given arguments in a C{dict} with EC2-style format. @param arguments: L{Arguments} instances to bundle. Keys in later objects will override those in earlier objects. @param extra: Any number of additional parameters. These will override similarly named arguments in L{...
[ "Bundle", "the", "given", "arguments", "in", "a", "C", "{", "dict", "}", "with", "EC2", "-", "style", "format", "." ]
train
https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/server/schema.py#L607-L636
twisted/txaws
txaws/server/schema.py
Schema.get_parameter
def get_parameter(self, name): """ Get the parameter on this schema with the given C{name}. """ for parameter in self._parameters: if parameter.name == name: return parameter
python
def get_parameter(self, name): """ Get the parameter on this schema with the given C{name}. """ for parameter in self._parameters: if parameter.name == name: return parameter
[ "def", "get_parameter", "(", "self", ",", "name", ")", ":", "for", "parameter", "in", "self", ".", "_parameters", ":", "if", "parameter", ".", "name", "==", "name", ":", "return", "parameter" ]
Get the parameter on this schema with the given C{name}.
[ "Get", "the", "parameter", "on", "this", "schema", "with", "the", "given", "C", "{", "name", "}", "." ]
train
https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/server/schema.py#L638-L644
twisted/txaws
txaws/server/schema.py
Schema._convert_flat_to_nest
def _convert_flat_to_nest(self, params): """ Convert a structure in the form of:: {'foo.1.bar': 'value', 'foo.2.baz': 'value'} to:: {'foo': {'1': {'bar': 'value'}, '2': {'baz': 'value'}}} This is intended for use both during p...
python
def _convert_flat_to_nest(self, params): """ Convert a structure in the form of:: {'foo.1.bar': 'value', 'foo.2.baz': 'value'} to:: {'foo': {'1': {'bar': 'value'}, '2': {'baz': 'value'}}} This is intended for use both during p...
[ "def", "_convert_flat_to_nest", "(", "self", ",", "params", ")", ":", "result", "=", "{", "}", "for", "k", ",", "v", "in", "params", ".", "iteritems", "(", ")", ":", "last", "=", "result", "segments", "=", "k", ".", "split", "(", "'.'", ")", "for",...
Convert a structure in the form of:: {'foo.1.bar': 'value', 'foo.2.baz': 'value'} to:: {'foo': {'1': {'bar': 'value'}, '2': {'baz': 'value'}}} This is intended for use both during parsing of HTTP arguments like 'foo.1.bar=value' and w...
[ "Convert", "a", "structure", "in", "the", "form", "of", "::" ]
train
https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/server/schema.py#L646-L678
twisted/txaws
txaws/server/schema.py
Schema._convert_nest_to_flat
def _convert_nest_to_flat(self, params, _result=None, _prefix=None): """ Convert a data structure that looks like:: {"foo": {"bar": "baz", "shimmy": "sham"}} to:: {"foo.bar": "baz", "foo.shimmy": "sham"} This is the inverse of L{_convert_flat_to_n...
python
def _convert_nest_to_flat(self, params, _result=None, _prefix=None): """ Convert a data structure that looks like:: {"foo": {"bar": "baz", "shimmy": "sham"}} to:: {"foo.bar": "baz", "foo.shimmy": "sham"} This is the inverse of L{_convert_flat_to_n...
[ "def", "_convert_nest_to_flat", "(", "self", ",", "params", ",", "_result", "=", "None", ",", "_prefix", "=", "None", ")", ":", "if", "_result", "is", "None", ":", "_result", "=", "{", "}", "for", "k", ",", "v", "in", "params", ".", "iteritems", "(",...
Convert a data structure that looks like:: {"foo": {"bar": "baz", "shimmy": "sham"}} to:: {"foo.bar": "baz", "foo.shimmy": "sham"} This is the inverse of L{_convert_flat_to_nest}.
[ "Convert", "a", "data", "structure", "that", "looks", "like", "::" ]
train
https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/server/schema.py#L680-L704
twisted/txaws
txaws/server/schema.py
Schema.extend
def extend(self, *schema_items, **kwargs): """ Add any number of schema items to a new schema. Takes the same arguments as the constructor, and returns a new L{Schema} instance. If parameters, result, or errors is specified, they will be merged with the existing paramet...
python
def extend(self, *schema_items, **kwargs): """ Add any number of schema items to a new schema. Takes the same arguments as the constructor, and returns a new L{Schema} instance. If parameters, result, or errors is specified, they will be merged with the existing paramet...
[ "def", "extend", "(", "self", ",", "*", "schema_items", ",", "*", "*", "kwargs", ")", ":", "new_kwargs", "=", "{", "'name'", ":", "self", ".", "name", ",", "'doc'", ":", "self", ".", "doc", ",", "'parameters'", ":", "self", ".", "_parameters", "[", ...
Add any number of schema items to a new schema. Takes the same arguments as the constructor, and returns a new L{Schema} instance. If parameters, result, or errors is specified, they will be merged with the existing parameters, result, or errors.
[ "Add", "any", "number", "of", "schema", "items", "to", "a", "new", "schema", "." ]
train
https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/server/schema.py#L706-L732
twisted/txaws
txaws/server/schema.py
Schema._convert_old_schema
def _convert_old_schema(self, parameters): """ Convert an ugly old schema, using dotted names, to the hot new schema, using List and Structure. The old schema assumes that every other dot implies an array. So a list of two parameters, [Integer("foo.bar.baz.quux"), I...
python
def _convert_old_schema(self, parameters): """ Convert an ugly old schema, using dotted names, to the hot new schema, using List and Structure. The old schema assumes that every other dot implies an array. So a list of two parameters, [Integer("foo.bar.baz.quux"), I...
[ "def", "_convert_old_schema", "(", "self", ",", "parameters", ")", ":", "# 'merged' here is an associative list that maps parameter names to", "# Parameter instances, OR sub-associative lists which represent nested", "# lists and structures.", "# e.g.,", "# [Integer(\"foo\")]", "# becom...
Convert an ugly old schema, using dotted names, to the hot new schema, using List and Structure. The old schema assumes that every other dot implies an array. So a list of two parameters, [Integer("foo.bar.baz.quux"), Integer("foo.bar.shimmy")] becomes:: [List...
[ "Convert", "an", "ugly", "old", "schema", "using", "dotted", "names", "to", "the", "hot", "new", "schema", "using", "List", "and", "Structure", "." ]
train
https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/server/schema.py#L734-L771
twisted/txaws
txaws/server/schema.py
Schema._inner_convert_old_schema
def _inner_convert_old_schema(self, node, depth): """ Internal recursion helper for L{_convert_old_schema}. @param node: A node in the associative list tree as described in _convert_old_schema. A two tuple of (name, parameter). @param depth: The depth that the node is at. Th...
python
def _inner_convert_old_schema(self, node, depth): """ Internal recursion helper for L{_convert_old_schema}. @param node: A node in the associative list tree as described in _convert_old_schema. A two tuple of (name, parameter). @param depth: The depth that the node is at. Th...
[ "def", "_inner_convert_old_schema", "(", "self", ",", "node", ",", "depth", ")", ":", "name", ",", "parameter_description", "=", "node", "if", "not", "isinstance", "(", "parameter_description", ",", "list", ")", ":", "# This is a leaf, i.e., an actual L{Parameter} ins...
Internal recursion helper for L{_convert_old_schema}. @param node: A node in the associative list tree as described in _convert_old_schema. A two tuple of (name, parameter). @param depth: The depth that the node is at. This is important to know if we're currently processing a li...
[ "Internal", "recursion", "helper", "for", "L", "{", "_convert_old_schema", "}", "." ]
train
https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/server/schema.py#L773-L806
Duke-GCB/DukeDSClient
ddsc/core/util.py
wait_for_processes
def wait_for_processes(processes, size, progress_queue, watcher, item): """ Watch progress queue for errors or progress. Cleanup processes on error or success. :param processes: [Process]: processes we are waiting to finish downloading a file :param size: int: how many values we expect to be process...
python
def wait_for_processes(processes, size, progress_queue, watcher, item): """ Watch progress queue for errors or progress. Cleanup processes on error or success. :param processes: [Process]: processes we are waiting to finish downloading a file :param size: int: how many values we expect to be process...
[ "def", "wait_for_processes", "(", "processes", ",", "size", ",", "progress_queue", ",", "watcher", ",", "item", ")", ":", "while", "size", ">", "0", ":", "progress_type", ",", "value", "=", "progress_queue", ".", "get", "(", ")", "if", "progress_type", "==...
Watch progress queue for errors or progress. Cleanup processes on error or success. :param processes: [Process]: processes we are waiting to finish downloading a file :param size: int: how many values we expect to be processed by processes :param progress_queue: ProgressQueue: queue which will receive t...
[ "Watch", "progress", "queue", "for", "errors", "or", "progress", ".", "Cleanup", "processes", "on", "error", "or", "success", ".", ":", "param", "processes", ":", "[", "Process", "]", ":", "processes", "we", "are", "waiting", "to", "finish", "downloading", ...
train
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/util.py#L312-L338
Duke-GCB/DukeDSClient
ddsc/core/util.py
verify_file_private
def verify_file_private(filename): """ Raises ValueError the file permissions allow group/other On windows this never raises due to the implementation of stat. """ if platform.system().upper() != 'WINDOWS': filename = os.path.expanduser(filename) if os.path.exists(filename): ...
python
def verify_file_private(filename): """ Raises ValueError the file permissions allow group/other On windows this never raises due to the implementation of stat. """ if platform.system().upper() != 'WINDOWS': filename = os.path.expanduser(filename) if os.path.exists(filename): ...
[ "def", "verify_file_private", "(", "filename", ")", ":", "if", "platform", ".", "system", "(", ")", ".", "upper", "(", ")", "!=", "'WINDOWS'", ":", "filename", "=", "os", ".", "path", ".", "expanduser", "(", "filename", ")", "if", "os", ".", "path", ...
Raises ValueError the file permissions allow group/other On windows this never raises due to the implementation of stat.
[ "Raises", "ValueError", "the", "file", "permissions", "allow", "group", "/", "other", "On", "windows", "this", "never", "raises", "due", "to", "the", "implementation", "of", "stat", "." ]
train
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/util.py#L350-L360
Duke-GCB/DukeDSClient
ddsc/core/util.py
ProgressPrinter.transferring_item
def transferring_item(self, item, increment_amt=1): """ Update progress that item is about to be transferred. :param item: LocalFile, LocalFolder, or LocalContent(project) that is about to be sent. :param increment_amt: int amount to increase our count(how much progress have we made) ...
python
def transferring_item(self, item, increment_amt=1): """ Update progress that item is about to be transferred. :param item: LocalFile, LocalFolder, or LocalContent(project) that is about to be sent. :param increment_amt: int amount to increase our count(how much progress have we made) ...
[ "def", "transferring_item", "(", "self", ",", "item", ",", "increment_amt", "=", "1", ")", ":", "self", ".", "cnt", "+=", "increment_amt", "percent_done", "=", "int", "(", "float", "(", "self", ".", "cnt", ")", "/", "float", "(", "self", ".", "total", ...
Update progress that item is about to be transferred. :param item: LocalFile, LocalFolder, or LocalContent(project) that is about to be sent. :param increment_amt: int amount to increase our count(how much progress have we made)
[ "Update", "progress", "that", "item", "is", "about", "to", "be", "transferred", ".", ":", "param", "item", ":", "LocalFile", "LocalFolder", "or", "LocalContent", "(", "project", ")", "that", "is", "about", "to", "be", "sent", ".", ":", "param", "increment_...
train
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/util.py#L61-L74
Duke-GCB/DukeDSClient
ddsc/core/util.py
ProgressPrinter.finished
def finished(self): """ Must be called to print final progress label. """ self.progress_bar.set_state(ProgressBar.STATE_DONE) self.progress_bar.show()
python
def finished(self): """ Must be called to print final progress label. """ self.progress_bar.set_state(ProgressBar.STATE_DONE) self.progress_bar.show()
[ "def", "finished", "(", "self", ")", ":", "self", ".", "progress_bar", ".", "set_state", "(", "ProgressBar", ".", "STATE_DONE", ")", "self", ".", "progress_bar", ".", "show", "(", ")" ]
Must be called to print final progress label.
[ "Must", "be", "called", "to", "print", "final", "progress", "label", "." ]
train
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/util.py#L76-L81
Duke-GCB/DukeDSClient
ddsc/core/util.py
ProgressPrinter.start_waiting
def start_waiting(self): """ Show waiting progress bar until done_waiting is called. Only has an effect if we are in waiting state. """ if not self.waiting: self.waiting = True wait_msg = "Waiting for project to become ready for {}".format(self.msg_verb) ...
python
def start_waiting(self): """ Show waiting progress bar until done_waiting is called. Only has an effect if we are in waiting state. """ if not self.waiting: self.waiting = True wait_msg = "Waiting for project to become ready for {}".format(self.msg_verb) ...
[ "def", "start_waiting", "(", "self", ")", ":", "if", "not", "self", ".", "waiting", ":", "self", ".", "waiting", "=", "True", "wait_msg", "=", "\"Waiting for project to become ready for {}\"", ".", "format", "(", "self", ".", "msg_verb", ")", "self", ".", "p...
Show waiting progress bar until done_waiting is called. Only has an effect if we are in waiting state.
[ "Show", "waiting", "progress", "bar", "until", "done_waiting", "is", "called", ".", "Only", "has", "an", "effect", "if", "we", "are", "in", "waiting", "state", "." ]
train
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/util.py#L90-L98
Duke-GCB/DukeDSClient
ddsc/core/util.py
ProgressPrinter.done_waiting
def done_waiting(self): """ Show running progress bar (only has an effect if we are in waiting state). """ if self.waiting: self.waiting = False self.progress_bar.show_running()
python
def done_waiting(self): """ Show running progress bar (only has an effect if we are in waiting state). """ if self.waiting: self.waiting = False self.progress_bar.show_running()
[ "def", "done_waiting", "(", "self", ")", ":", "if", "self", ".", "waiting", ":", "self", ".", "waiting", "=", "False", "self", ".", "progress_bar", ".", "show_running", "(", ")" ]
Show running progress bar (only has an effect if we are in waiting state).
[ "Show", "running", "progress", "bar", "(", "only", "has", "an", "effect", "if", "we", "are", "in", "waiting", "state", ")", "." ]
train
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/util.py#L100-L106
Duke-GCB/DukeDSClient
ddsc/core/util.py
ProgressBar.show_waiting
def show_waiting(self, wait_msg): """ Show waiting progress bar until done_waiting is called. Only has an effect if we are in waiting state. :param wait_msg: str: message describing what we are waiting for """ self.wait_msg = wait_msg self.set_state(ProgressBar.ST...
python
def show_waiting(self, wait_msg): """ Show waiting progress bar until done_waiting is called. Only has an effect if we are in waiting state. :param wait_msg: str: message describing what we are waiting for """ self.wait_msg = wait_msg self.set_state(ProgressBar.ST...
[ "def", "show_waiting", "(", "self", ",", "wait_msg", ")", ":", "self", ".", "wait_msg", "=", "wait_msg", "self", ".", "set_state", "(", "ProgressBar", ".", "STATE_WAITING", ")", "self", ".", "show", "(", ")" ]
Show waiting progress bar until done_waiting is called. Only has an effect if we are in waiting state. :param wait_msg: str: message describing what we are waiting for
[ "Show", "waiting", "progress", "bar", "until", "done_waiting", "is", "called", ".", "Only", "has", "an", "effect", "if", "we", "are", "in", "waiting", "state", ".", ":", "param", "wait_msg", ":", "str", ":", "message", "describing", "what", "we", "are", ...
train
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/util.py#L157-L165
Duke-GCB/DukeDSClient
ddsc/core/util.py
ProjectWalker._visit_content
def _visit_content(item, parent, visitor): """ Recursively visit nodes in the project tree. :param item: LocalContent/LocalFolder/LocalFile we are traversing down from :param parent: LocalContent/LocalFolder parent or None :param visitor: object visiting the tree """ ...
python
def _visit_content(item, parent, visitor): """ Recursively visit nodes in the project tree. :param item: LocalContent/LocalFolder/LocalFile we are traversing down from :param parent: LocalContent/LocalFolder parent or None :param visitor: object visiting the tree """ ...
[ "def", "_visit_content", "(", "item", ",", "parent", ",", "visitor", ")", ":", "if", "KindType", ".", "is_project", "(", "item", ")", ":", "visitor", ".", "visit_project", "(", "item", ")", "elif", "KindType", ".", "is_folder", "(", "item", ")", ":", "...
Recursively visit nodes in the project tree. :param item: LocalContent/LocalFolder/LocalFile we are traversing down from :param parent: LocalContent/LocalFolder parent or None :param visitor: object visiting the tree
[ "Recursively", "visit", "nodes", "in", "the", "project", "tree", ".", ":", "param", "item", ":", "LocalContent", "/", "LocalFolder", "/", "LocalFile", "we", "are", "traversing", "down", "from", ":", "param", "parent", ":", "LocalContent", "/", "LocalFolder", ...
train
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/util.py#L183-L198
twisted/txaws
txaws/s3/client.py
s3_url_context
def s3_url_context(service_endpoint, bucket=None, object_name=None): """ Create a URL based on the given service endpoint and suitable for the given bucket or object. @param service_endpoint: The service endpoint on which to base the resulting URL. @type service_endpoint: L{AWSServiceEndpoi...
python
def s3_url_context(service_endpoint, bucket=None, object_name=None): """ Create a URL based on the given service endpoint and suitable for the given bucket or object. @param service_endpoint: The service endpoint on which to base the resulting URL. @type service_endpoint: L{AWSServiceEndpoi...
[ "def", "s3_url_context", "(", "service_endpoint", ",", "bucket", "=", "None", ",", "object_name", "=", "None", ")", ":", "# Define our own query parser which can handle the consequences of", "# `?acl` and such (subresources). At its best, parse_qsl doesn't", "# let us differentiate ...
Create a URL based on the given service endpoint and suitable for the given bucket or object. @param service_endpoint: The service endpoint on which to base the resulting URL. @type service_endpoint: L{AWSServiceEndpoint} @param bucket: If given, the name of a bucket to reference. @type bu...
[ "Create", "a", "URL", "based", "on", "the", "given", "service", "endpoint", "and", "suitable", "for", "the", "given", "bucket", "or", "object", "." ]
train
https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/s3/client.py#L824-L887
twisted/txaws
txaws/s3/client.py
S3Client.list_buckets
def list_buckets(self): """ List all buckets. Returns a list of all the buckets owned by the authenticated sender of the request. """ details = self._details( method=b"GET", url_context=self._url_context(), ) query = self._query_fa...
python
def list_buckets(self): """ List all buckets. Returns a list of all the buckets owned by the authenticated sender of the request. """ details = self._details( method=b"GET", url_context=self._url_context(), ) query = self._query_fa...
[ "def", "list_buckets", "(", "self", ")", ":", "details", "=", "self", ".", "_details", "(", "method", "=", "b\"GET\"", ",", "url_context", "=", "self", ".", "_url_context", "(", ")", ",", ")", "query", "=", "self", ".", "_query_factory", "(", "details", ...
List all buckets. Returns a list of all the buckets owned by the authenticated sender of the request.
[ "List", "all", "buckets", "." ]
train
https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/s3/client.py#L140-L154
twisted/txaws
txaws/s3/client.py
S3Client._parse_list_buckets
def _parse_list_buckets(self, (response, xml_bytes)): """ Parse XML bucket list response. """ root = XML(xml_bytes) buckets = [] for bucket_data in root.find("Buckets"): name = bucket_data.findtext("Name") date_text = bucket_data.findtext("Creation...
python
def _parse_list_buckets(self, (response, xml_bytes)): """ Parse XML bucket list response. """ root = XML(xml_bytes) buckets = [] for bucket_data in root.find("Buckets"): name = bucket_data.findtext("Name") date_text = bucket_data.findtext("Creation...
[ "def", "_parse_list_buckets", "(", "self", ",", "(", "response", ",", "xml_bytes", ")", ")", ":", "root", "=", "XML", "(", "xml_bytes", ")", "buckets", "=", "[", "]", "for", "bucket_data", "in", "root", ".", "find", "(", "\"Buckets\"", ")", ":", "name"...
Parse XML bucket list response.
[ "Parse", "XML", "bucket", "list", "response", "." ]
train
https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/s3/client.py#L156-L168
twisted/txaws
txaws/s3/client.py
S3Client.create_bucket
def create_bucket(self, bucket): """ Create a new bucket. """ details = self._details( method=b"PUT", url_context=self._url_context(bucket=bucket), ) query = self._query_factory(details) return self._submit(query)
python
def create_bucket(self, bucket): """ Create a new bucket. """ details = self._details( method=b"PUT", url_context=self._url_context(bucket=bucket), ) query = self._query_factory(details) return self._submit(query)
[ "def", "create_bucket", "(", "self", ",", "bucket", ")", ":", "details", "=", "self", ".", "_details", "(", "method", "=", "b\"PUT\"", ",", "url_context", "=", "self", ".", "_url_context", "(", "bucket", "=", "bucket", ")", ",", ")", "query", "=", "sel...
Create a new bucket.
[ "Create", "a", "new", "bucket", "." ]
train
https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/s3/client.py#L170-L179
twisted/txaws
txaws/s3/client.py
S3Client.delete_bucket
def delete_bucket(self, bucket): """ Delete a bucket. The bucket must be empty before it can be deleted. """ details = self._details( method=b"DELETE", url_context=self._url_context(bucket=bucket), ) query = self._query_factory(details) ...
python
def delete_bucket(self, bucket): """ Delete a bucket. The bucket must be empty before it can be deleted. """ details = self._details( method=b"DELETE", url_context=self._url_context(bucket=bucket), ) query = self._query_factory(details) ...
[ "def", "delete_bucket", "(", "self", ",", "bucket", ")", ":", "details", "=", "self", ".", "_details", "(", "method", "=", "b\"DELETE\"", ",", "url_context", "=", "self", ".", "_url_context", "(", "bucket", "=", "bucket", ")", ",", ")", "query", "=", "...
Delete a bucket. The bucket must be empty before it can be deleted.
[ "Delete", "a", "bucket", "." ]
train
https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/s3/client.py#L181-L192
twisted/txaws
txaws/s3/client.py
S3Client.get_bucket
def get_bucket(self, bucket, marker=None, max_keys=None, prefix=None): """ Get a list of all the objects in a bucket. @param bucket: The name of the bucket from which to retrieve objects. @type bucket: L{unicode} @param marker: If given, indicate a position in the overall ...
python
def get_bucket(self, bucket, marker=None, max_keys=None, prefix=None): """ Get a list of all the objects in a bucket. @param bucket: The name of the bucket from which to retrieve objects. @type bucket: L{unicode} @param marker: If given, indicate a position in the overall ...
[ "def", "get_bucket", "(", "self", ",", "bucket", ",", "marker", "=", "None", ",", "max_keys", "=", "None", ",", "prefix", "=", "None", ")", ":", "args", "=", "[", "]", "if", "marker", "is", "not", "None", ":", "args", ".", "append", "(", "(", "\"...
Get a list of all the objects in a bucket. @param bucket: The name of the bucket from which to retrieve objects. @type bucket: L{unicode} @param marker: If given, indicate a position in the overall results where the results of this call should begin. The first result i...
[ "Get", "a", "list", "of", "all", "the", "objects", "in", "a", "bucket", "." ]
train
https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/s3/client.py#L194-L237
twisted/txaws
txaws/s3/client.py
S3Client.get_bucket_location
def get_bucket_location(self, bucket): """ Get the location (region) of a bucket. @param bucket: The name of the bucket. @return: A C{Deferred} that will fire with the bucket's region. """ details = self._details( method=b"GET", url_context=self._...
python
def get_bucket_location(self, bucket): """ Get the location (region) of a bucket. @param bucket: The name of the bucket. @return: A C{Deferred} that will fire with the bucket's region. """ details = self._details( method=b"GET", url_context=self._...
[ "def", "get_bucket_location", "(", "self", ",", "bucket", ")", ":", "details", "=", "self", ".", "_details", "(", "method", "=", "b\"GET\"", ",", "url_context", "=", "self", ".", "_url_context", "(", "bucket", "=", "bucket", ",", "object_name", "=", "\"?lo...
Get the location (region) of a bucket. @param bucket: The name of the bucket. @return: A C{Deferred} that will fire with the bucket's region.
[ "Get", "the", "location", "(", "region", ")", "of", "a", "bucket", "." ]
train
https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/s3/client.py#L269-L282
twisted/txaws
txaws/s3/client.py
S3Client.get_bucket_lifecycle
def get_bucket_lifecycle(self, bucket): """ Get the lifecycle configuration of a bucket. @param bucket: The name of the bucket. @return: A C{Deferred} that will fire with the bucket's lifecycle configuration. """ details = self._details( method=b"GET"...
python
def get_bucket_lifecycle(self, bucket): """ Get the lifecycle configuration of a bucket. @param bucket: The name of the bucket. @return: A C{Deferred} that will fire with the bucket's lifecycle configuration. """ details = self._details( method=b"GET"...
[ "def", "get_bucket_lifecycle", "(", "self", ",", "bucket", ")", ":", "details", "=", "self", ".", "_details", "(", "method", "=", "b\"GET\"", ",", "url_context", "=", "self", ".", "_url_context", "(", "bucket", "=", "bucket", ",", "object_name", "=", "\"?l...
Get the lifecycle configuration of a bucket. @param bucket: The name of the bucket. @return: A C{Deferred} that will fire with the bucket's lifecycle configuration.
[ "Get", "the", "lifecycle", "configuration", "of", "a", "bucket", "." ]
train
https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/s3/client.py#L289-L303
twisted/txaws
txaws/s3/client.py
S3Client._parse_lifecycle_config
def _parse_lifecycle_config(self, (response, xml_bytes)): """Parse a C{LifecycleConfiguration} XML document.""" root = XML(xml_bytes) rules = [] for content_data in root.findall("Rule"): id = content_data.findtext("ID") prefix = content_data.findtext("Prefix") ...
python
def _parse_lifecycle_config(self, (response, xml_bytes)): """Parse a C{LifecycleConfiguration} XML document.""" root = XML(xml_bytes) rules = [] for content_data in root.findall("Rule"): id = content_data.findtext("ID") prefix = content_data.findtext("Prefix") ...
[ "def", "_parse_lifecycle_config", "(", "self", ",", "(", "response", ",", "xml_bytes", ")", ")", ":", "root", "=", "XML", "(", "xml_bytes", ")", "rules", "=", "[", "]", "for", "content_data", "in", "root", ".", "findall", "(", "\"Rule\"", ")", ":", "id...
Parse a C{LifecycleConfiguration} XML document.
[ "Parse", "a", "C", "{", "LifecycleConfiguration", "}", "XML", "document", "." ]
train
https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/s3/client.py#L305-L318
twisted/txaws
txaws/s3/client.py
S3Client.get_bucket_website_config
def get_bucket_website_config(self, bucket): """ Get the website configuration of a bucket. @param bucket: The name of the bucket. @return: A C{Deferred} that will fire with the bucket's website configuration. """ details = self._details( method=b"GET...
python
def get_bucket_website_config(self, bucket): """ Get the website configuration of a bucket. @param bucket: The name of the bucket. @return: A C{Deferred} that will fire with the bucket's website configuration. """ details = self._details( method=b"GET...
[ "def", "get_bucket_website_config", "(", "self", ",", "bucket", ")", ":", "details", "=", "self", ".", "_details", "(", "method", "=", "b\"GET\"", ",", "url_context", "=", "self", ".", "_url_context", "(", "bucket", "=", "bucket", ",", "object_name", "=", ...
Get the website configuration of a bucket. @param bucket: The name of the bucket. @return: A C{Deferred} that will fire with the bucket's website configuration.
[ "Get", "the", "website", "configuration", "of", "a", "bucket", "." ]
train
https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/s3/client.py#L320-L334
twisted/txaws
txaws/s3/client.py
S3Client._parse_website_config
def _parse_website_config(self, (response, xml_bytes)): """Parse a C{WebsiteConfiguration} XML document.""" root = XML(xml_bytes) index_suffix = root.findtext("IndexDocument/Suffix") error_key = root.findtext("ErrorDocument/Key") return WebsiteConfiguration(index_suffix, error_k...
python
def _parse_website_config(self, (response, xml_bytes)): """Parse a C{WebsiteConfiguration} XML document.""" root = XML(xml_bytes) index_suffix = root.findtext("IndexDocument/Suffix") error_key = root.findtext("ErrorDocument/Key") return WebsiteConfiguration(index_suffix, error_k...
[ "def", "_parse_website_config", "(", "self", ",", "(", "response", ",", "xml_bytes", ")", ")", ":", "root", "=", "XML", "(", "xml_bytes", ")", "index_suffix", "=", "root", ".", "findtext", "(", "\"IndexDocument/Suffix\"", ")", "error_key", "=", "root", ".", ...
Parse a C{WebsiteConfiguration} XML document.
[ "Parse", "a", "C", "{", "WebsiteConfiguration", "}", "XML", "document", "." ]
train
https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/s3/client.py#L336-L342
twisted/txaws
txaws/s3/client.py
S3Client.get_bucket_notification_config
def get_bucket_notification_config(self, bucket): """ Get the notification configuration of a bucket. @param bucket: The name of the bucket. @return: A C{Deferred} that will request the bucket's notification configuration. """ details = self._details( ...
python
def get_bucket_notification_config(self, bucket): """ Get the notification configuration of a bucket. @param bucket: The name of the bucket. @return: A C{Deferred} that will request the bucket's notification configuration. """ details = self._details( ...
[ "def", "get_bucket_notification_config", "(", "self", ",", "bucket", ")", ":", "details", "=", "self", ".", "_details", "(", "method", "=", "b\"GET\"", ",", "url_context", "=", "self", ".", "_url_context", "(", "bucket", "=", "bucket", ",", "object_name", "=...
Get the notification configuration of a bucket. @param bucket: The name of the bucket. @return: A C{Deferred} that will request the bucket's notification configuration.
[ "Get", "the", "notification", "configuration", "of", "a", "bucket", "." ]
train
https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/s3/client.py#L344-L358
twisted/txaws
txaws/s3/client.py
S3Client._parse_notification_config
def _parse_notification_config(self, (response, xml_bytes)): """Parse a C{NotificationConfiguration} XML document.""" root = XML(xml_bytes) topic = root.findtext("TopicConfiguration/Topic") event = root.findtext("TopicConfiguration/Event") return NotificationConfiguration(topic,...
python
def _parse_notification_config(self, (response, xml_bytes)): """Parse a C{NotificationConfiguration} XML document.""" root = XML(xml_bytes) topic = root.findtext("TopicConfiguration/Topic") event = root.findtext("TopicConfiguration/Event") return NotificationConfiguration(topic,...
[ "def", "_parse_notification_config", "(", "self", ",", "(", "response", ",", "xml_bytes", ")", ")", ":", "root", "=", "XML", "(", "xml_bytes", ")", "topic", "=", "root", ".", "findtext", "(", "\"TopicConfiguration/Topic\"", ")", "event", "=", "root", ".", ...
Parse a C{NotificationConfiguration} XML document.
[ "Parse", "a", "C", "{", "NotificationConfiguration", "}", "XML", "document", "." ]
train
https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/s3/client.py#L360-L366
twisted/txaws
txaws/s3/client.py
S3Client.get_bucket_versioning_config
def get_bucket_versioning_config(self, bucket): """ Get the versioning configuration of a bucket. @param bucket: The name of the bucket. @return: A C{Deferred} that will request the bucket's versioning configuration. """ details = self._details( method=b"GET...
python
def get_bucket_versioning_config(self, bucket): """ Get the versioning configuration of a bucket. @param bucket: The name of the bucket. @return: A C{Deferred} that will request the bucket's versioning configuration. """ details = self._details( method=b"GET...
[ "def", "get_bucket_versioning_config", "(", "self", ",", "bucket", ")", ":", "details", "=", "self", ".", "_details", "(", "method", "=", "b\"GET\"", ",", "url_context", "=", "self", ".", "_url_context", "(", "bucket", "=", "bucket", ",", "object_name", "=",...
Get the versioning configuration of a bucket. @param bucket: The name of the bucket. @return: A C{Deferred} that will request the bucket's versioning configuration.
[ "Get", "the", "versioning", "configuration", "of", "a", "bucket", "." ]
train
https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/s3/client.py#L368-L381
twisted/txaws
txaws/s3/client.py
S3Client._parse_versioning_config
def _parse_versioning_config(self, (response, xml_bytes)): """Parse a C{VersioningConfiguration} XML document.""" root = XML(xml_bytes) mfa_delete = root.findtext("MfaDelete") status = root.findtext("Status") return VersioningConfiguration(mfa_delete=mfa_delete, status=status)
python
def _parse_versioning_config(self, (response, xml_bytes)): """Parse a C{VersioningConfiguration} XML document.""" root = XML(xml_bytes) mfa_delete = root.findtext("MfaDelete") status = root.findtext("Status") return VersioningConfiguration(mfa_delete=mfa_delete, status=status)
[ "def", "_parse_versioning_config", "(", "self", ",", "(", "response", ",", "xml_bytes", ")", ")", ":", "root", "=", "XML", "(", "xml_bytes", ")", "mfa_delete", "=", "root", ".", "findtext", "(", "\"MfaDelete\"", ")", "status", "=", "root", ".", "findtext",...
Parse a C{VersioningConfiguration} XML document.
[ "Parse", "a", "C", "{", "VersioningConfiguration", "}", "XML", "document", "." ]
train
https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/s3/client.py#L383-L389
twisted/txaws
txaws/s3/client.py
S3Client.get_bucket_acl
def get_bucket_acl(self, bucket): """ Get the access control policy for a bucket. """ details = self._details( method=b"GET", url_context=self._url_context(bucket=bucket, object_name="?acl"), ) d = self._submit(self._query_factory(details)) ...
python
def get_bucket_acl(self, bucket): """ Get the access control policy for a bucket. """ details = self._details( method=b"GET", url_context=self._url_context(bucket=bucket, object_name="?acl"), ) d = self._submit(self._query_factory(details)) ...
[ "def", "get_bucket_acl", "(", "self", ",", "bucket", ")", ":", "details", "=", "self", ".", "_details", "(", "method", "=", "b\"GET\"", ",", "url_context", "=", "self", ".", "_url_context", "(", "bucket", "=", "bucket", ",", "object_name", "=", "\"?acl\"",...
Get the access control policy for a bucket.
[ "Get", "the", "access", "control", "policy", "for", "a", "bucket", "." ]
train
https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/s3/client.py#L391-L401
twisted/txaws
txaws/s3/client.py
S3Client.put_object
def put_object(self, bucket, object_name, data=None, content_type=None, metadata={}, amz_headers={}, body_producer=None): """ Put an object in a bucket. An existing object with the same name will be replaced. @param bucket: The name of the bucket. @param obje...
python
def put_object(self, bucket, object_name, data=None, content_type=None, metadata={}, amz_headers={}, body_producer=None): """ Put an object in a bucket. An existing object with the same name will be replaced. @param bucket: The name of the bucket. @param obje...
[ "def", "put_object", "(", "self", ",", "bucket", ",", "object_name", ",", "data", "=", "None", ",", "content_type", "=", "None", ",", "metadata", "=", "{", "}", ",", "amz_headers", "=", "{", "}", ",", "body_producer", "=", "None", ")", ":", "details", ...
Put an object in a bucket. An existing object with the same name will be replaced. @param bucket: The name of the bucket. @param object_name: The name of the object. @type object_name: L{unicode} @param data: The data to write. @param content_type: The type of data bein...
[ "Put", "an", "object", "in", "a", "bucket", "." ]
train
https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/s3/client.py#L424-L451
twisted/txaws
txaws/s3/client.py
S3Client.copy_object
def copy_object(self, source_bucket, source_object_name, dest_bucket=None, dest_object_name=None, metadata={}, amz_headers={}): """ Copy an object stored in S3 from a source bucket to a destination bucket. @param source_bucket: The S3 bucket to copy the object from. ...
python
def copy_object(self, source_bucket, source_object_name, dest_bucket=None, dest_object_name=None, metadata={}, amz_headers={}): """ Copy an object stored in S3 from a source bucket to a destination bucket. @param source_bucket: The S3 bucket to copy the object from. ...
[ "def", "copy_object", "(", "self", ",", "source_bucket", ",", "source_object_name", ",", "dest_bucket", "=", "None", ",", "dest_object_name", "=", "None", ",", "metadata", "=", "{", "}", ",", "amz_headers", "=", "{", "}", ")", ":", "dest_bucket", "=", "des...
Copy an object stored in S3 from a source bucket to a destination bucket. @param source_bucket: The S3 bucket to copy the object from. @param source_object_name: The name of the object to copy. @param dest_bucket: Optionally, the S3 bucket to copy the object to. Defaults to ...
[ "Copy", "an", "object", "stored", "in", "S3", "from", "a", "source", "bucket", "to", "a", "destination", "bucket", "." ]
train
https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/s3/client.py#L453-L482
twisted/txaws
txaws/s3/client.py
S3Client.get_object
def get_object(self, bucket, object_name): """ Get an object from a bucket. """ details = self._details( method=b"GET", url_context=self._url_context(bucket=bucket, object_name=object_name), ) d = self._submit(self._query_factory(details)) ...
python
def get_object(self, bucket, object_name): """ Get an object from a bucket. """ details = self._details( method=b"GET", url_context=self._url_context(bucket=bucket, object_name=object_name), ) d = self._submit(self._query_factory(details)) ...
[ "def", "get_object", "(", "self", ",", "bucket", ",", "object_name", ")", ":", "details", "=", "self", ".", "_details", "(", "method", "=", "b\"GET\"", ",", "url_context", "=", "self", ".", "_url_context", "(", "bucket", "=", "bucket", ",", "object_name", ...
Get an object from a bucket.
[ "Get", "an", "object", "from", "a", "bucket", "." ]
train
https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/s3/client.py#L484-L494
twisted/txaws
txaws/s3/client.py
S3Client.head_object
def head_object(self, bucket, object_name): """ Retrieve object metadata only. """ details = self._details( method=b"HEAD", url_context=self._url_context(bucket=bucket, object_name=object_name), ) d = self._submit(self._query_factory(details)) ...
python
def head_object(self, bucket, object_name): """ Retrieve object metadata only. """ details = self._details( method=b"HEAD", url_context=self._url_context(bucket=bucket, object_name=object_name), ) d = self._submit(self._query_factory(details)) ...
[ "def", "head_object", "(", "self", ",", "bucket", ",", "object_name", ")", ":", "details", "=", "self", ".", "_details", "(", "method", "=", "b\"HEAD\"", ",", "url_context", "=", "self", ".", "_url_context", "(", "bucket", "=", "bucket", ",", "object_name"...
Retrieve object metadata only.
[ "Retrieve", "object", "metadata", "only", "." ]
train
https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/s3/client.py#L496-L506
twisted/txaws
txaws/s3/client.py
S3Client.delete_object
def delete_object(self, bucket, object_name): """ Delete an object from a bucket. Once deleted, there is no method to restore or undelete an object. """ details = self._details( method=b"DELETE", url_context=self._url_context(bucket=bucket, object_name=ob...
python
def delete_object(self, bucket, object_name): """ Delete an object from a bucket. Once deleted, there is no method to restore or undelete an object. """ details = self._details( method=b"DELETE", url_context=self._url_context(bucket=bucket, object_name=ob...
[ "def", "delete_object", "(", "self", ",", "bucket", ",", "object_name", ")", ":", "details", "=", "self", ".", "_details", "(", "method", "=", "b\"DELETE\"", ",", "url_context", "=", "self", ".", "_url_context", "(", "bucket", "=", "bucket", ",", "object_n...
Delete an object from a bucket. Once deleted, there is no method to restore or undelete an object.
[ "Delete", "an", "object", "from", "a", "bucket", "." ]
train
https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/s3/client.py#L508-L519
twisted/txaws
txaws/s3/client.py
S3Client.put_object_acl
def put_object_acl(self, bucket, object_name, access_control_policy): """ Set access control policy on an object. """ data = access_control_policy.to_xml() details = self._details( method=b"PUT", url_context=self._url_context( bucket=bucket...
python
def put_object_acl(self, bucket, object_name, access_control_policy): """ Set access control policy on an object. """ data = access_control_policy.to_xml() details = self._details( method=b"PUT", url_context=self._url_context( bucket=bucket...
[ "def", "put_object_acl", "(", "self", ",", "bucket", ",", "object_name", ",", "access_control_policy", ")", ":", "data", "=", "access_control_policy", ".", "to_xml", "(", ")", "details", "=", "self", ".", "_details", "(", "method", "=", "b\"PUT\"", ",", "url...
Set access control policy on an object.
[ "Set", "access", "control", "policy", "on", "an", "object", "." ]
train
https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/s3/client.py#L521-L536
twisted/txaws
txaws/s3/client.py
S3Client.put_request_payment
def put_request_payment(self, bucket, payer): """ Set request payment configuration on bucket to payer. @param bucket: The name of the bucket. @param payer: The name of the payer. @return: A C{Deferred} that will fire with the result of the request. """ data = Re...
python
def put_request_payment(self, bucket, payer): """ Set request payment configuration on bucket to payer. @param bucket: The name of the bucket. @param payer: The name of the payer. @return: A C{Deferred} that will fire with the result of the request. """ data = Re...
[ "def", "put_request_payment", "(", "self", ",", "bucket", ",", "payer", ")", ":", "data", "=", "RequestPayment", "(", "payer", ")", ".", "to_xml", "(", ")", "details", "=", "self", ".", "_details", "(", "method", "=", "b\"PUT\"", ",", "url_context", "=",...
Set request payment configuration on bucket to payer. @param bucket: The name of the bucket. @param payer: The name of the payer. @return: A C{Deferred} that will fire with the result of the request.
[ "Set", "request", "payment", "configuration", "on", "bucket", "to", "payer", "." ]
train
https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/s3/client.py#L550-L565
twisted/txaws
txaws/s3/client.py
S3Client.get_request_payment
def get_request_payment(self, bucket): """ Get the request payment configuration on a bucket. @param bucket: The name of the bucket. @return: A C{Deferred} that will fire with the name of the payer. """ details = self._details( method=b"GET", url_...
python
def get_request_payment(self, bucket): """ Get the request payment configuration on a bucket. @param bucket: The name of the bucket. @return: A C{Deferred} that will fire with the name of the payer. """ details = self._details( method=b"GET", url_...
[ "def", "get_request_payment", "(", "self", ",", "bucket", ")", ":", "details", "=", "self", ".", "_details", "(", "method", "=", "b\"GET\"", ",", "url_context", "=", "self", ".", "_url_context", "(", "bucket", "=", "bucket", ",", "object_name", "=", "\"?re...
Get the request payment configuration on a bucket. @param bucket: The name of the bucket. @return: A C{Deferred} that will fire with the name of the payer.
[ "Get", "the", "request", "payment", "configuration", "on", "a", "bucket", "." ]
train
https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/s3/client.py#L567-L580
twisted/txaws
txaws/s3/client.py
S3Client.init_multipart_upload
def init_multipart_upload(self, bucket, object_name, content_type=None, amz_headers={}, metadata={}): """ Initiate a multipart upload to a bucket. @param bucket: The name of the bucket @param object_name: The object name @param content_type: The Con...
python
def init_multipart_upload(self, bucket, object_name, content_type=None, amz_headers={}, metadata={}): """ Initiate a multipart upload to a bucket. @param bucket: The name of the bucket @param object_name: The object name @param content_type: The Con...
[ "def", "init_multipart_upload", "(", "self", ",", "bucket", ",", "object_name", ",", "content_type", "=", "None", ",", "amz_headers", "=", "{", "}", ",", "metadata", "=", "{", "}", ")", ":", "objectname_plus", "=", "'%s?uploads'", "%", "object_name", "detail...
Initiate a multipart upload to a bucket. @param bucket: The name of the bucket @param object_name: The object name @param content_type: The Content-Type for the object @param metadata: C{dict} containing additional metadata @param amz_headers: A C{dict} used to build C{x-amz-*} ...
[ "Initiate", "a", "multipart", "upload", "to", "a", "bucket", "." ]
train
https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/s3/client.py#L589-L613
twisted/txaws
txaws/s3/client.py
S3Client.upload_part
def upload_part(self, bucket, object_name, upload_id, part_number, data=None, content_type=None, metadata={}, body_producer=None): """ Upload a part of data corresponding to a multipart upload. @param bucket: The bucket name @param object_name: Th...
python
def upload_part(self, bucket, object_name, upload_id, part_number, data=None, content_type=None, metadata={}, body_producer=None): """ Upload a part of data corresponding to a multipart upload. @param bucket: The bucket name @param object_name: Th...
[ "def", "upload_part", "(", "self", ",", "bucket", ",", "object_name", ",", "upload_id", ",", "part_number", ",", "data", "=", "None", ",", "content_type", "=", "None", ",", "metadata", "=", "{", "}", ",", "body_producer", "=", "None", ")", ":", "parms", ...
Upload a part of data corresponding to a multipart upload. @param bucket: The bucket name @param object_name: The object name @param upload_id: The multipart upload id @param part_number: The part number @param data: Data (optional, requires body_producer if not specified) ...
[ "Upload", "a", "part", "of", "data", "corresponding", "to", "a", "multipart", "upload", "." ]
train
https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/s3/client.py#L615-L643
twisted/txaws
txaws/s3/client.py
S3Client.complete_multipart_upload
def complete_multipart_upload(self, bucket, object_name, upload_id, parts_list, content_type=None, metadata={}): """ Complete a multipart upload. N.B. This can be possibly be a slow operation. @param bucket: The bucket name @param object_name: ...
python
def complete_multipart_upload(self, bucket, object_name, upload_id, parts_list, content_type=None, metadata={}): """ Complete a multipart upload. N.B. This can be possibly be a slow operation. @param bucket: The bucket name @param object_name: ...
[ "def", "complete_multipart_upload", "(", "self", ",", "bucket", ",", "object_name", ",", "upload_id", ",", "parts_list", ",", "content_type", "=", "None", ",", "metadata", "=", "{", "}", ")", ":", "data", "=", "self", ".", "_build_complete_multipart_upload_xml",...
Complete a multipart upload. N.B. This can be possibly be a slow operation. @param bucket: The bucket name @param object_name: The object name @param upload_id: The multipart upload id @param parts_list: A List of all the parts (2-tuples of part sequence number and ...
[ "Complete", "a", "multipart", "upload", "." ]
train
https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/s3/client.py#L645-L675
twisted/txaws
txaws/s3/client.py
Query.set_content_type
def set_content_type(self): """ Set the content type based on the file extension used in the object name. """ if self.object_name and not self.content_type: # XXX nothing is currently done with the encoding... we may # need to in the future sel...
python
def set_content_type(self): """ Set the content type based on the file extension used in the object name. """ if self.object_name and not self.content_type: # XXX nothing is currently done with the encoding... we may # need to in the future sel...
[ "def", "set_content_type", "(", "self", ")", ":", "if", "self", ".", "object_name", "and", "not", "self", ".", "content_type", ":", "# XXX nothing is currently done with the encoding... we may", "# need to in the future", "self", ".", "content_type", ",", "encoding", "=...
Set the content type based on the file extension used in the object name.
[ "Set", "the", "content", "type", "based", "on", "the", "file", "extension", "used", "in", "the", "object", "name", "." ]
train
https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/s3/client.py#L734-L743
twisted/txaws
txaws/s3/client.py
Query.get_headers
def get_headers(self, instant): """ Build the list of headers needed in order to perform S3 operations. """ headers = {'x-amz-date': _auth_v4.makeAMZDate(instant)} if self.body_producer is None: data = self.data if data is None: data = b"" ...
python
def get_headers(self, instant): """ Build the list of headers needed in order to perform S3 operations. """ headers = {'x-amz-date': _auth_v4.makeAMZDate(instant)} if self.body_producer is None: data = self.data if data is None: data = b"" ...
[ "def", "get_headers", "(", "self", ",", "instant", ")", ":", "headers", "=", "{", "'x-amz-date'", ":", "_auth_v4", ".", "makeAMZDate", "(", "instant", ")", "}", "if", "self", ".", "body_producer", "is", "None", ":", "data", "=", "self", ".", "data", "i...
Build the list of headers needed in order to perform S3 operations.
[ "Build", "the", "list", "of", "headers", "needed", "in", "order", "to", "perform", "S3", "operations", "." ]
train
https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/s3/client.py#L745-L775
twisted/txaws
txaws/s3/client.py
Query.sign
def sign(self, headers, data, url_context, instant, method, region=REGION_US_EAST_1): """Sign this query using its built in credentials.""" headers["host"] = url_context.get_encoded_host() if data is None: request = _auth_v4._CanonicalRequest.from_request_components( ...
python
def sign(self, headers, data, url_context, instant, method, region=REGION_US_EAST_1): """Sign this query using its built in credentials.""" headers["host"] = url_context.get_encoded_host() if data is None: request = _auth_v4._CanonicalRequest.from_request_components( ...
[ "def", "sign", "(", "self", ",", "headers", ",", "data", ",", "url_context", ",", "instant", ",", "method", ",", "region", "=", "REGION_US_EAST_1", ")", ":", "headers", "[", "\"host\"", "]", "=", "url_context", ".", "get_encoded_host", "(", ")", "if", "d...
Sign this query using its built in credentials.
[ "Sign", "this", "query", "using", "its", "built", "in", "credentials", "." ]
train
https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/s3/client.py#L777-L804
twisted/txaws
txaws/s3/client.py
Query.submit
def submit(self, url_context=None, utcnow=datetime.datetime.utcnow): """Submit this query. @return: A deferred from get_page """ if not url_context: url_context = s3_url_context( self.endpoint, self.bucket, self.object_name) d = self.get_page( ...
python
def submit(self, url_context=None, utcnow=datetime.datetime.utcnow): """Submit this query. @return: A deferred from get_page """ if not url_context: url_context = s3_url_context( self.endpoint, self.bucket, self.object_name) d = self.get_page( ...
[ "def", "submit", "(", "self", ",", "url_context", "=", "None", ",", "utcnow", "=", "datetime", ".", "datetime", ".", "utcnow", ")", ":", "if", "not", "url_context", ":", "url_context", "=", "s3_url_context", "(", "self", ".", "endpoint", ",", "self", "."...
Submit this query. @return: A deferred from get_page
[ "Submit", "this", "query", "." ]
train
https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/s3/client.py#L806-L821
UUDigitalHumanitieslab/tei_reader
tei_reader/models/element.py
Element.attributes
def attributes(self): if 'id' in self.node.attrib: yield PlaceholderAttribute('id', self.node.attrib['id']) if 'tei-tag' in self.node.attrib: yield PlaceholderAttribute('tei-tag', self.node.attrib['tei-tag']) """Contain attributes applicable to this element""" f...
python
def attributes(self): if 'id' in self.node.attrib: yield PlaceholderAttribute('id', self.node.attrib['id']) if 'tei-tag' in self.node.attrib: yield PlaceholderAttribute('tei-tag', self.node.attrib['tei-tag']) """Contain attributes applicable to this element""" f...
[ "def", "attributes", "(", "self", ")", ":", "if", "'id'", "in", "self", ".", "node", ".", "attrib", ":", "yield", "PlaceholderAttribute", "(", "'id'", ",", "self", ".", "node", ".", "attrib", "[", "'id'", "]", ")", "if", "'tei-tag'", "in", "self", "....
Contain attributes applicable to this element
[ "Contain", "attributes", "applicable", "to", "this", "element" ]
train
https://github.com/UUDigitalHumanitieslab/tei_reader/blob/7b19c34a9d7cc941a36ecdcf6f361e26c6488697/tei_reader/models/element.py#L14-L24
UUDigitalHumanitieslab/tei_reader
tei_reader/models/element.py
Element.divisions
def divisions(self): """ Recursively get all the text divisions directly part of this element. If an element contains parts or text without tag. Those will be returned in order and wrapped with a TextDivision. """ from .placeholder_division import PlaceholderDivision pl...
python
def divisions(self): """ Recursively get all the text divisions directly part of this element. If an element contains parts or text without tag. Those will be returned in order and wrapped with a TextDivision. """ from .placeholder_division import PlaceholderDivision pl...
[ "def", "divisions", "(", "self", ")", ":", "from", ".", "placeholder_division", "import", "PlaceholderDivision", "placeholder", "=", "None", "for", "item", "in", "self", ".", "__parts_and_divisions", ":", "if", "item", ".", "tag", "==", "'part'", ":", "if", ...
Recursively get all the text divisions directly part of this element. If an element contains parts or text without tag. Those will be returned in order and wrapped with a TextDivision.
[ "Recursively", "get", "all", "the", "text", "divisions", "directly", "part", "of", "this", "element", ".", "If", "an", "element", "contains", "parts", "or", "text", "without", "tag", ".", "Those", "will", "be", "returned", "in", "order", "and", "wrapped", ...
train
https://github.com/UUDigitalHumanitieslab/tei_reader/blob/7b19c34a9d7cc941a36ecdcf6f361e26c6488697/tei_reader/models/element.py#L32-L51
UUDigitalHumanitieslab/tei_reader
tei_reader/models/element.py
Element.all_parts
def all_parts(self): """ Recursively get the parts flattened and in document order constituting the entire text e.g. if something has emphasis, a footnote or is marked as foreign. Text without a container element will be returned in order and wrapped with a TextPart. """ for item in sel...
python
def all_parts(self): """ Recursively get the parts flattened and in document order constituting the entire text e.g. if something has emphasis, a footnote or is marked as foreign. Text without a container element will be returned in order and wrapped with a TextPart. """ for item in sel...
[ "def", "all_parts", "(", "self", ")", ":", "for", "item", "in", "self", ".", "__parts_and_divisions", ":", "if", "item", ".", "tag", "==", "'part'", "and", "item", ".", "is_placeholder", ":", "# A real part will always return a placeholder containing", "# its conten...
Recursively get the parts flattened and in document order constituting the entire text e.g. if something has emphasis, a footnote or is marked as foreign. Text without a container element will be returned in order and wrapped with a TextPart.
[ "Recursively", "get", "the", "parts", "flattened", "and", "in", "document", "order", "constituting", "the", "entire", "text", "e", ".", "g", ".", "if", "something", "has", "emphasis", "a", "footnote", "or", "is", "marked", "as", "foreign", ".", "Text", "wi...
train
https://github.com/UUDigitalHumanitieslab/tei_reader/blob/7b19c34a9d7cc941a36ecdcf6f361e26c6488697/tei_reader/models/element.py#L54-L66
UUDigitalHumanitieslab/tei_reader
tei_reader/models/element.py
Element.parts
def parts(self): """ Get the parts directly below this element. """ for item in self.__parts_and_divisions: if item.tag == 'part': yield item else: # Divisions shouldn't be beneath a part, but here's a fallback # fo...
python
def parts(self): """ Get the parts directly below this element. """ for item in self.__parts_and_divisions: if item.tag == 'part': yield item else: # Divisions shouldn't be beneath a part, but here's a fallback # fo...
[ "def", "parts", "(", "self", ")", ":", "for", "item", "in", "self", ".", "__parts_and_divisions", ":", "if", "item", ".", "tag", "==", "'part'", ":", "yield", "item", "else", ":", "# Divisions shouldn't be beneath a part, but here's a fallback", "# for if this does ...
Get the parts directly below this element.
[ "Get", "the", "parts", "directly", "below", "this", "element", "." ]
train
https://github.com/UUDigitalHumanitieslab/tei_reader/blob/7b19c34a9d7cc941a36ecdcf6f361e26c6488697/tei_reader/models/element.py#L69-L81
UUDigitalHumanitieslab/tei_reader
tei_reader/models/element.py
Element.__parts_and_divisions
def __parts_and_divisions(self): """ The parts and divisions directly part of this element. """ from .division import Division from .part import Part from .placeholder_part import PlaceholderPart text = self.node.text if text: stripped_text =...
python
def __parts_and_divisions(self): """ The parts and divisions directly part of this element. """ from .division import Division from .part import Part from .placeholder_part import PlaceholderPart text = self.node.text if text: stripped_text =...
[ "def", "__parts_and_divisions", "(", "self", ")", ":", "from", ".", "division", "import", "Division", "from", ".", "part", "import", "Part", "from", ".", "placeholder_part", "import", "PlaceholderPart", "text", "=", "self", ".", "node", ".", "text", "if", "t...
The parts and divisions directly part of this element.
[ "The", "parts", "and", "divisions", "directly", "part", "of", "this", "element", "." ]
train
https://github.com/UUDigitalHumanitieslab/tei_reader/blob/7b19c34a9d7cc941a36ecdcf6f361e26c6488697/tei_reader/models/element.py#L88-L112
UUDigitalHumanitieslab/tei_reader
tei_reader/models/element.py
Element.tostring
def tostring(self, inject): """ Convert an element to a single string and allow the passed inject method to place content before any element. """ return inject(self, '\n'.join(f'{division.tostring(inject)}' for division in self.divisions))
python
def tostring(self, inject): """ Convert an element to a single string and allow the passed inject method to place content before any element. """ return inject(self, '\n'.join(f'{division.tostring(inject)}' for division in self.divisions))
[ "def", "tostring", "(", "self", ",", "inject", ")", ":", "return", "inject", "(", "self", ",", "'\\n'", ".", "join", "(", "f'{division.tostring(inject)}'", "for", "division", "in", "self", ".", "divisions", ")", ")" ]
Convert an element to a single string and allow the passed inject method to place content before any element.
[ "Convert", "an", "element", "to", "a", "single", "string", "and", "allow", "the", "passed", "inject", "method", "to", "place", "content", "before", "any", "element", "." ]
train
https://github.com/UUDigitalHumanitieslab/tei_reader/blob/7b19c34a9d7cc941a36ecdcf6f361e26c6488697/tei_reader/models/element.py#L128-L134
pdkit/pdkit
pdkit/models.py
RCL
def RCL(input_shape, rec_conv_layers, dense_layers, output_layer=[1, 'sigmoid'], padding='same', optimizer='adam', loss='binary_crossentropy'): """Summary Args: input_shape (tuple): The shape of the input layer. output_nodes (int): Number of...
python
def RCL(input_shape, rec_conv_layers, dense_layers, output_layer=[1, 'sigmoid'], padding='same', optimizer='adam', loss='binary_crossentropy'): """Summary Args: input_shape (tuple): The shape of the input layer. output_nodes (int): Number of...
[ "def", "RCL", "(", "input_shape", ",", "rec_conv_layers", ",", "dense_layers", ",", "output_layer", "=", "[", "1", ",", "'sigmoid'", "]", ",", "padding", "=", "'same'", ",", "optimizer", "=", "'adam'", ",", "loss", "=", "'binary_crossentropy'", ")", ":", "...
Summary Args: input_shape (tuple): The shape of the input layer. output_nodes (int): Number of nodes in the output layer. It depends on the loss function used. rec_conv_layers (list): RCL descriptor [ [ ...
[ "Summary", "Args", ":", "input_shape", "(", "tuple", ")", ":", "The", "shape", "of", "the", "input", "layer", ".", "output_nodes", "(", "int", ")", ":", "Number", "of", "nodes", "in", "the", "output", "layer", ".", "It", "depends", "on", "the", "loss",...
train
https://github.com/pdkit/pdkit/blob/c7120263da2071bb139815fbdb56ca77b544f340/pdkit/models.py#L52-L113
pdkit/pdkit
pdkit/models.py
VOICE
def VOICE(input_shape, conv_layers, dense_layers, output_layer=[1, 'sigmoid'], padding='same', optimizer='adam', loss='binary_crossentropy'): """Conv1D CNN used primarily for voice data. Args: input_shape (tuple): The shape of the i...
python
def VOICE(input_shape, conv_layers, dense_layers, output_layer=[1, 'sigmoid'], padding='same', optimizer='adam', loss='binary_crossentropy'): """Conv1D CNN used primarily for voice data. Args: input_shape (tuple): The shape of the i...
[ "def", "VOICE", "(", "input_shape", ",", "conv_layers", ",", "dense_layers", ",", "output_layer", "=", "[", "1", ",", "'sigmoid'", "]", ",", "padding", "=", "'same'", ",", "optimizer", "=", "'adam'", ",", "loss", "=", "'binary_crossentropy'", ")", ":", "in...
Conv1D CNN used primarily for voice data. Args: input_shape (tuple): The shape of the input layer targets (int): Number of targets conv_layers (list): Conv layer descriptor [[(filter, kernel), (pool_size, stride), leak, drop], ... []] dense_layers (TYPE): Dense layer descriptor ...
[ "Conv1D", "CNN", "used", "primarily", "for", "voice", "data", ".", "Args", ":", "input_shape", "(", "tuple", ")", ":", "The", "shape", "of", "the", "input", "layer", "targets", "(", "int", ")", ":", "Number", "of", "targets", "conv_layers", "(", "list", ...
train
https://github.com/pdkit/pdkit/blob/c7120263da2071bb139815fbdb56ca77b544f340/pdkit/models.py#L116-L162
pdkit/pdkit
pdkit/models.py
DNN
def DNN(input_shape, dense_layers, output_layer=[1, 'sigmoid'], optimizer='adam', loss='binary_crossentropy'): """Summary Args: input_shape (list): The shape of the input layer targets (int): Number of targets dense_layers (list): Dense la...
python
def DNN(input_shape, dense_layers, output_layer=[1, 'sigmoid'], optimizer='adam', loss='binary_crossentropy'): """Summary Args: input_shape (list): The shape of the input layer targets (int): Number of targets dense_layers (list): Dense la...
[ "def", "DNN", "(", "input_shape", ",", "dense_layers", ",", "output_layer", "=", "[", "1", ",", "'sigmoid'", "]", ",", "optimizer", "=", "'adam'", ",", "loss", "=", "'binary_crossentropy'", ")", ":", "inputs", "=", "Input", "(", "shape", "=", "input_shape"...
Summary Args: input_shape (list): The shape of the input layer targets (int): Number of targets dense_layers (list): Dense layer descriptor [fully_connected] optimizer (str or object optional): Keras optimizer as string or keras optimizer Returns: TYPE: model, b...
[ "Summary", "Args", ":", "input_shape", "(", "list", ")", ":", "The", "shape", "of", "the", "input", "layer", "targets", "(", "int", ")", ":", "Number", "of", "targets", "dense_layers", "(", "list", ")", ":", "Dense", "layer", "descriptor", "[", "fully_co...
train
https://github.com/pdkit/pdkit/blob/c7120263da2071bb139815fbdb56ca77b544f340/pdkit/models.py#L165-L196
T-002/pycast
pycast/errors/baseerrormeasure.py
BaseErrorMeasure.initialize
def initialize(self, originalTimeSeries, calculatedTimeSeries): """Initializes the ErrorMeasure. During initialization, all :py:meth:`BaseErrorMeasure.local_errors` are calculated. :param TimeSeries originalTimeSeries: TimeSeries containing the original data. :param TimeSeries calcu...
python
def initialize(self, originalTimeSeries, calculatedTimeSeries): """Initializes the ErrorMeasure. During initialization, all :py:meth:`BaseErrorMeasure.local_errors` are calculated. :param TimeSeries originalTimeSeries: TimeSeries containing the original data. :param TimeSeries calcu...
[ "def", "initialize", "(", "self", ",", "originalTimeSeries", ",", "calculatedTimeSeries", ")", ":", "# ErrorMeasure was already initialized.", "if", "0", "<", "len", "(", "self", ".", "_errorValues", ")", ":", "raise", "StandardError", "(", "\"An ErrorMeasure can only...
Initializes the ErrorMeasure. During initialization, all :py:meth:`BaseErrorMeasure.local_errors` are calculated. :param TimeSeries originalTimeSeries: TimeSeries containing the original data. :param TimeSeries calculatedTimeSeries: TimeSeries containing calculated data. Calc...
[ "Initializes", "the", "ErrorMeasure", "." ]
train
https://github.com/T-002/pycast/blob/8a53505c6d8367e0ea572e8af768e80b29e1cc41/pycast/errors/baseerrormeasure.py#L54-L105
T-002/pycast
pycast/errors/baseerrormeasure.py
BaseErrorMeasure._get_error_values
def _get_error_values(self, startingPercentage, endPercentage, startDate, endDate): """Gets the defined subset of self._errorValues. Both parameters will be correct at this time. :param float startingPercentage: Defines the start of the interval. This has to be a value in [0.0, 100.0]. ...
python
def _get_error_values(self, startingPercentage, endPercentage, startDate, endDate): """Gets the defined subset of self._errorValues. Both parameters will be correct at this time. :param float startingPercentage: Defines the start of the interval. This has to be a value in [0.0, 100.0]. ...
[ "def", "_get_error_values", "(", "self", ",", "startingPercentage", ",", "endPercentage", ",", "startDate", ",", "endDate", ")", ":", "if", "startDate", "is", "not", "None", ":", "possibleDates", "=", "filter", "(", "lambda", "date", ":", "date", ">=", "star...
Gets the defined subset of self._errorValues. Both parameters will be correct at this time. :param float startingPercentage: Defines the start of the interval. This has to be a value in [0.0, 100.0]. It represents the value, where the error calculation should be started. 25.0 f...
[ "Gets", "the", "defined", "subset", "of", "self", ".", "_errorValues", "." ]
train
https://github.com/T-002/pycast/blob/8a53505c6d8367e0ea572e8af768e80b29e1cc41/pycast/errors/baseerrormeasure.py#L107-L144
T-002/pycast
pycast/errors/baseerrormeasure.py
BaseErrorMeasure.get_error
def get_error(self, startingPercentage=0.0, endPercentage=100.0, startDate=None, endDate=None): """Calculates the error for the given interval (startingPercentage, endPercentage) between the TimeSeries given during :py:meth:`BaseErrorMeasure.initialize`. :param float startingPercentage: Defines...
python
def get_error(self, startingPercentage=0.0, endPercentage=100.0, startDate=None, endDate=None): """Calculates the error for the given interval (startingPercentage, endPercentage) between the TimeSeries given during :py:meth:`BaseErrorMeasure.initialize`. :param float startingPercentage: Defines...
[ "def", "get_error", "(", "self", ",", "startingPercentage", "=", "0.0", ",", "endPercentage", "=", "100.0", ",", "startDate", "=", "None", ",", "endDate", "=", "None", ")", ":", "# not initialized:", "if", "len", "(", "self", ".", "_errorValues", ")", "=="...
Calculates the error for the given interval (startingPercentage, endPercentage) between the TimeSeries given during :py:meth:`BaseErrorMeasure.initialize`. :param float startingPercentage: Defines the start of the interval. This has to be a value in [0.0, 100.0]. It represents the value, wh...
[ "Calculates", "the", "error", "for", "the", "given", "interval", "(", "startingPercentage", "endPercentage", ")", "between", "the", "TimeSeries", "given", "during", ":", "py", ":", "meth", ":", "BaseErrorMeasure", ".", "initialize", "." ]
train
https://github.com/T-002/pycast/blob/8a53505c6d8367e0ea572e8af768e80b29e1cc41/pycast/errors/baseerrormeasure.py#L146-L182
T-002/pycast
pycast/errors/baseerrormeasure.py
BaseErrorMeasure.confidence_interval
def confidence_interval(self, confidenceLevel): """Calculates for which value confidenceLevel% of the errors are closer to 0. :param float confidenceLevel: percentage of the errors that should be smaller than the returned value for overestimations and larger than the returned va...
python
def confidence_interval(self, confidenceLevel): """Calculates for which value confidenceLevel% of the errors are closer to 0. :param float confidenceLevel: percentage of the errors that should be smaller than the returned value for overestimations and larger than the returned va...
[ "def", "confidence_interval", "(", "self", ",", "confidenceLevel", ")", ":", "if", "not", "(", "confidenceLevel", ">=", "0", "and", "confidenceLevel", "<=", "1", ")", ":", "raise", "ValueError", "(", "\"Parameter percentage has to be in [0,1]\"", ")", "underestimati...
Calculates for which value confidenceLevel% of the errors are closer to 0. :param float confidenceLevel: percentage of the errors that should be smaller than the returned value for overestimations and larger than the returned value for underestimations. confidenceLevel has t...
[ "Calculates", "for", "which", "value", "confidenceLevel%", "of", "the", "errors", "are", "closer", "to", "0", "." ]
train
https://github.com/T-002/pycast/blob/8a53505c6d8367e0ea572e8af768e80b29e1cc41/pycast/errors/baseerrormeasure.py#L220-L268
pdkit/pdkit
pdkit/utils.py
load_cloudupdrs_data
def load_cloudupdrs_data(filename, convert_times=1000000000.0): """ This method loads data in the cloudupdrs format Usually the data will be saved in a csv file and it should look like this: .. code-block:: json timestamp_0, x_0, y_0, z_0 timestamp_1, x_1...
python
def load_cloudupdrs_data(filename, convert_times=1000000000.0): """ This method loads data in the cloudupdrs format Usually the data will be saved in a csv file and it should look like this: .. code-block:: json timestamp_0, x_0, y_0, z_0 timestamp_1, x_1...
[ "def", "load_cloudupdrs_data", "(", "filename", ",", "convert_times", "=", "1000000000.0", ")", ":", "# data_m = pd.read_table(filename, sep=',', header=None)", "try", ":", "data_m", "=", "np", ".", "genfromtxt", "(", "filename", ",", "delimiter", "=", "','", ",", "...
This method loads data in the cloudupdrs format Usually the data will be saved in a csv file and it should look like this: .. code-block:: json timestamp_0, x_0, y_0, z_0 timestamp_1, x_1, y_1, z_1 timestamp_2, x_2, y_2, z_2 . . ....
[ "This", "method", "loads", "data", "in", "the", "cloudupdrs", "format", "Usually", "the", "data", "will", "be", "saved", "in", "a", "csv", "file", "and", "it", "should", "look", "like", "this", ":", "..", "code", "-", "block", "::", "json", "timestamp_0"...
train
https://github.com/pdkit/pdkit/blob/c7120263da2071bb139815fbdb56ca77b544f340/pdkit/utils.py#L26-L66
pdkit/pdkit
pdkit/utils.py
load_segmented_data
def load_segmented_data(filename): """ Helper function to load segmented gait time series data. :param filename: The full path of the file that contais our data. This should be a comma separated value (csv file). :type filename: str :return: The gait time series segmented data, wit...
python
def load_segmented_data(filename): """ Helper function to load segmented gait time series data. :param filename: The full path of the file that contais our data. This should be a comma separated value (csv file). :type filename: str :return: The gait time series segmented data, wit...
[ "def", "load_segmented_data", "(", "filename", ")", ":", "data", "=", "pd", ".", "read_csv", "(", "filename", ",", "index_col", "=", "0", ")", "data", ".", "index", "=", "data", ".", "index", ".", "astype", "(", "np", ".", "datetime64", ")", "return", ...
Helper function to load segmented gait time series data. :param filename: The full path of the file that contais our data. This should be a comma separated value (csv file). :type filename: str :return: The gait time series segmented data, with a x, y, z, mag_acc_sum and segmented columns. ...
[ "Helper", "function", "to", "load", "segmented", "gait", "time", "series", "data", "." ]
train
https://github.com/pdkit/pdkit/blob/c7120263da2071bb139815fbdb56ca77b544f340/pdkit/utils.py#L81-L94
pdkit/pdkit
pdkit/utils.py
load_mpower_data
def load_mpower_data(filename, convert_times=1000000000.0): """ This method loads data in the `mpower <https://www.synapse.org/#!Synapse:syn4993293/wiki/247859>`_ format The format is like: .. code-block:: json [ { "timestamp":...
python
def load_mpower_data(filename, convert_times=1000000000.0): """ This method loads data in the `mpower <https://www.synapse.org/#!Synapse:syn4993293/wiki/247859>`_ format The format is like: .. code-block:: json [ { "timestamp":...
[ "def", "load_mpower_data", "(", "filename", ",", "convert_times", "=", "1000000000.0", ")", ":", "raw_data", "=", "pd", ".", "read_json", "(", "filename", ")", "date_times", "=", "pd", ".", "to_datetime", "(", "raw_data", ".", "timestamp", "*", "convert_times"...
This method loads data in the `mpower <https://www.synapse.org/#!Synapse:syn4993293/wiki/247859>`_ format The format is like: .. code-block:: json [ { "timestamp":19298.67999479167, "x": ... , "y": ..., ...
[ "This", "method", "loads", "data", "in", "the", "mpower", "<https", ":", "//", "www", ".", "synapse", ".", "org", "/", "#!Synapse", ":", "syn4993293", "/", "wiki", "/", "247859", ">", "_", "format", "The", "format", "is", "like", ":", "..", "code", "...
train
https://github.com/pdkit/pdkit/blob/c7120263da2071bb139815fbdb56ca77b544f340/pdkit/utils.py#L175-L208
pdkit/pdkit
pdkit/utils.py
load_finger_tapping_cloudupdrs_data
def load_finger_tapping_cloudupdrs_data(filename, convert_times=1000.0): """ This method loads data in the cloudupdrs format for the finger tapping processor Usually the data will be saved in a csv file and it should look like this: .. code-block:: json timestamp_0, . , action_ty...
python
def load_finger_tapping_cloudupdrs_data(filename, convert_times=1000.0): """ This method loads data in the cloudupdrs format for the finger tapping processor Usually the data will be saved in a csv file and it should look like this: .. code-block:: json timestamp_0, . , action_ty...
[ "def", "load_finger_tapping_cloudupdrs_data", "(", "filename", ",", "convert_times", "=", "1000.0", ")", ":", "data_m", "=", "np", ".", "genfromtxt", "(", "filename", ",", "delimiter", "=", "','", ",", "invalid_raise", "=", "False", ",", "skip_footer", "=", "1...
This method loads data in the cloudupdrs format for the finger tapping processor Usually the data will be saved in a csv file and it should look like this: .. code-block:: json timestamp_0, . , action_type_0, x_0, y_0, . , . , x_target_0, y_target_0 timestamp_1, . , action_type_1, x...
[ "This", "method", "loads", "data", "in", "the", "cloudupdrs", "format", "for", "the", "finger", "tapping", "processor" ]
train
https://github.com/pdkit/pdkit/blob/c7120263da2071bb139815fbdb56ca77b544f340/pdkit/utils.py#L211-L242
pdkit/pdkit
pdkit/utils.py
load_finger_tapping_mpower_data
def load_finger_tapping_mpower_data(filename, button_left_rect, button_right_rect, convert_times=1000.0): """ This method loads data in the `mpower <https://www.synapse.org/#!Synapse:syn4993293/wiki/247859>`_ format """ raw_data = pd.read_json(filename) date_times = pd.to_datetime(raw_data.TapTi...
python
def load_finger_tapping_mpower_data(filename, button_left_rect, button_right_rect, convert_times=1000.0): """ This method loads data in the `mpower <https://www.synapse.org/#!Synapse:syn4993293/wiki/247859>`_ format """ raw_data = pd.read_json(filename) date_times = pd.to_datetime(raw_data.TapTi...
[ "def", "load_finger_tapping_mpower_data", "(", "filename", ",", "button_left_rect", ",", "button_right_rect", ",", "convert_times", "=", "1000.0", ")", ":", "raw_data", "=", "pd", ".", "read_json", "(", "filename", ")", "date_times", "=", "pd", ".", "to_datetime",...
This method loads data in the `mpower <https://www.synapse.org/#!Synapse:syn4993293/wiki/247859>`_ format
[ "This", "method", "loads", "data", "in", "the", "mpower", "<https", ":", "//", "www", ".", "synapse", ".", "org", "/", "#!Synapse", ":", "syn4993293", "/", "wiki", "/", "247859", ">", "_", "format" ]
train
https://github.com/pdkit/pdkit/blob/c7120263da2071bb139815fbdb56ca77b544f340/pdkit/utils.py#L245-L281
pdkit/pdkit
pdkit/utils.py
load_data
def load_data(filename, format_file='cloudupdrs', button_left_rect=None, button_right_rect=None): """ This is a general load data method where the format of data to load can be passed as a parameter, :param filename: The path to load data from :type filename: str :param format_file:...
python
def load_data(filename, format_file='cloudupdrs', button_left_rect=None, button_right_rect=None): """ This is a general load data method where the format of data to load can be passed as a parameter, :param filename: The path to load data from :type filename: str :param format_file:...
[ "def", "load_data", "(", "filename", ",", "format_file", "=", "'cloudupdrs'", ",", "button_left_rect", "=", "None", ",", "button_right_rect", "=", "None", ")", ":", "if", "format_file", "==", "'mpower'", ":", "return", "load_mpower_data", "(", "filename", ")", ...
This is a general load data method where the format of data to load can be passed as a parameter, :param filename: The path to load data from :type filename: str :param format_file: format of the file. Default is CloudUPDRS. Set to mpower for mpower data. :type format_file: str ...
[ "This", "is", "a", "general", "load", "data", "method", "where", "the", "format", "of", "data", "to", "load", "can", "be", "passed", "as", "a", "parameter" ]
train
https://github.com/pdkit/pdkit/blob/c7120263da2071bb139815fbdb56ca77b544f340/pdkit/utils.py#L284-L324
pdkit/pdkit
pdkit/utils.py
numerical_integration
def numerical_integration(signal, sampling_frequency): """ Numerically integrate a signal with it's sampling frequency. :param signal: A 1-dimensional array or list (the signal). :type signal: array :param sampling_frequency: The sampling frequency for the signal. :type samp...
python
def numerical_integration(signal, sampling_frequency): """ Numerically integrate a signal with it's sampling frequency. :param signal: A 1-dimensional array or list (the signal). :type signal: array :param sampling_frequency: The sampling frequency for the signal. :type samp...
[ "def", "numerical_integration", "(", "signal", ",", "sampling_frequency", ")", ":", "integrate", "=", "sum", "(", "signal", "[", "1", ":", "]", ")", "/", "sampling_frequency", "+", "sum", "(", "signal", "[", ":", "-", "1", "]", ")", "integrate", "/=", ...
Numerically integrate a signal with it's sampling frequency. :param signal: A 1-dimensional array or list (the signal). :type signal: array :param sampling_frequency: The sampling frequency for the signal. :type sampling_frequency: float :return: The integrated signal. :...
[ "Numerically", "integrate", "a", "signal", "with", "it", "s", "sampling", "frequency", "." ]
train
https://github.com/pdkit/pdkit/blob/c7120263da2071bb139815fbdb56ca77b544f340/pdkit/utils.py#L327-L342
pdkit/pdkit
pdkit/utils.py
autocorrelation
def autocorrelation(signal): """ The `correlation <https://en.wikipedia.org/wiki/Autocorrelation#Estimation>`_ of a signal with a delayed copy of itself. :param signal: A 1-dimensional array or list (the signal). :type signal: array :return: The autocorrelated signal. :rtyp...
python
def autocorrelation(signal): """ The `correlation <https://en.wikipedia.org/wiki/Autocorrelation#Estimation>`_ of a signal with a delayed copy of itself. :param signal: A 1-dimensional array or list (the signal). :type signal: array :return: The autocorrelated signal. :rtyp...
[ "def", "autocorrelation", "(", "signal", ")", ":", "signal", "=", "np", ".", "array", "(", "signal", ")", "n", "=", "len", "(", "signal", ")", "variance", "=", "signal", ".", "var", "(", ")", "signal", "-=", "signal", ".", "mean", "(", ")", "r", ...
The `correlation <https://en.wikipedia.org/wiki/Autocorrelation#Estimation>`_ of a signal with a delayed copy of itself. :param signal: A 1-dimensional array or list (the signal). :type signal: array :return: The autocorrelated signal. :rtype: numpy.ndarray
[ "The", "correlation", "<https", ":", "//", "en", ".", "wikipedia", ".", "org", "/", "wiki", "/", "Autocorrelation#Estimation", ">", "_", "of", "a", "signal", "with", "a", "delayed", "copy", "of", "itself", "." ]
train
https://github.com/pdkit/pdkit/blob/c7120263da2071bb139815fbdb56ca77b544f340/pdkit/utils.py#L345-L363
pdkit/pdkit
pdkit/utils.py
peakdet
def peakdet(signal, delta, x=None): """ Find the local maxima and minima (peaks) in a 1-dimensional signal. Converted from MATLAB script <http://billauer.co.il/peakdet.html> :param array signal: A 1-dimensional array or list (the signal). :type signal: array :param delta: Th...
python
def peakdet(signal, delta, x=None): """ Find the local maxima and minima (peaks) in a 1-dimensional signal. Converted from MATLAB script <http://billauer.co.il/peakdet.html> :param array signal: A 1-dimensional array or list (the signal). :type signal: array :param delta: Th...
[ "def", "peakdet", "(", "signal", ",", "delta", ",", "x", "=", "None", ")", ":", "maxtab", "=", "[", "]", "mintab", "=", "[", "]", "if", "x", "is", "None", ":", "x", "=", "np", ".", "arange", "(", "len", "(", "signal", ")", ")", "v", "=", "n...
Find the local maxima and minima (peaks) in a 1-dimensional signal. Converted from MATLAB script <http://billauer.co.il/peakdet.html> :param array signal: A 1-dimensional array or list (the signal). :type signal: array :param delta: The peak threashold. A point is considered a maximum p...
[ "Find", "the", "local", "maxima", "and", "minima", "(", "peaks", ")", "in", "a", "1", "-", "dimensional", "signal", ".", "Converted", "from", "MATLAB", "script", "<http", ":", "//", "billauer", ".", "co", ".", "il", "/", "peakdet", ".", "html", ">" ]
train
https://github.com/pdkit/pdkit/blob/c7120263da2071bb139815fbdb56ca77b544f340/pdkit/utils.py#L366-L427
pdkit/pdkit
pdkit/utils.py
compute_interpeak
def compute_interpeak(data, sample_rate): """ Compute number of samples between signal peaks using the real part of FFT. :param data: 1-dimensional time series data. :type data: array :param sample_rate: Sample rate of accelerometer reading (Hz) :type sample_rate: float ...
python
def compute_interpeak(data, sample_rate): """ Compute number of samples between signal peaks using the real part of FFT. :param data: 1-dimensional time series data. :type data: array :param sample_rate: Sample rate of accelerometer reading (Hz) :type sample_rate: float ...
[ "def", "compute_interpeak", "(", "data", ",", "sample_rate", ")", ":", "# Real part of FFT:", "freqs", "=", "fftfreq", "(", "data", ".", "size", ",", "d", "=", "1.0", "/", "sample_rate", ")", "f_signal", "=", "rfft", "(", "data", ")", "# Maximum non-zero fre...
Compute number of samples between signal peaks using the real part of FFT. :param data: 1-dimensional time series data. :type data: array :param sample_rate: Sample rate of accelerometer reading (Hz) :type sample_rate: float :return interpeak: Number of samples between peaks ...
[ "Compute", "number", "of", "samples", "between", "signal", "peaks", "using", "the", "real", "part", "of", "FFT", "." ]
train
https://github.com/pdkit/pdkit/blob/c7120263da2071bb139815fbdb56ca77b544f340/pdkit/utils.py#L430-L461
pdkit/pdkit
pdkit/utils.py
butter_lowpass_filter
def butter_lowpass_filter(data, sample_rate, cutoff=10, order=4, plot=False): """ `Low-pass filter <http://stackoverflow.com/questions/25191620/ creating-lowpass-filter-in-scipy-understanding-methods-and-units>`_ data by the [order]th order zero lag Butterworth filter whose cut frequency is ...
python
def butter_lowpass_filter(data, sample_rate, cutoff=10, order=4, plot=False): """ `Low-pass filter <http://stackoverflow.com/questions/25191620/ creating-lowpass-filter-in-scipy-understanding-methods-and-units>`_ data by the [order]th order zero lag Butterworth filter whose cut frequency is ...
[ "def", "butter_lowpass_filter", "(", "data", ",", "sample_rate", ",", "cutoff", "=", "10", ",", "order", "=", "4", ",", "plot", "=", "False", ")", ":", "nyquist", "=", "0.5", "*", "sample_rate", "normal_cutoff", "=", "cutoff", "/", "nyquist", "b", ",", ...
`Low-pass filter <http://stackoverflow.com/questions/25191620/ creating-lowpass-filter-in-scipy-understanding-methods-and-units>`_ data by the [order]th order zero lag Butterworth filter whose cut frequency is set to [cutoff] Hz. :param data: time-series data, :type data: numpy array of...
[ "Low", "-", "pass", "filter", "<http", ":", "//", "stackoverflow", ".", "com", "/", "questions", "/", "25191620", "/", "creating", "-", "lowpass", "-", "filter", "-", "in", "-", "scipy", "-", "understanding", "-", "methods", "-", "and", "-", "units", "...
train
https://github.com/pdkit/pdkit/blob/c7120263da2071bb139815fbdb56ca77b544f340/pdkit/utils.py#L464-L511
pdkit/pdkit
pdkit/utils.py
crossings_nonzero_pos2neg
def crossings_nonzero_pos2neg(data): """ Find `indices of zero crossings from positive to negative values <http://stackoverflow.com/questions/3843017/efficiently-detect-sign-changes-in-python>`_. :param data: numpy array of floats :type data: numpy array of floats :return crossings:...
python
def crossings_nonzero_pos2neg(data): """ Find `indices of zero crossings from positive to negative values <http://stackoverflow.com/questions/3843017/efficiently-detect-sign-changes-in-python>`_. :param data: numpy array of floats :type data: numpy array of floats :return crossings:...
[ "def", "crossings_nonzero_pos2neg", "(", "data", ")", ":", "import", "numpy", "as", "np", "if", "isinstance", "(", "data", ",", "np", ".", "ndarray", ")", ":", "pass", "elif", "isinstance", "(", "data", ",", "list", ")", ":", "data", "=", "np", ".", ...
Find `indices of zero crossings from positive to negative values <http://stackoverflow.com/questions/3843017/efficiently-detect-sign-changes-in-python>`_. :param data: numpy array of floats :type data: numpy array of floats :return crossings: crossing indices to data :rtype crossings: n...
[ "Find", "indices", "of", "zero", "crossings", "from", "positive", "to", "negative", "values", "<http", ":", "//", "stackoverflow", ".", "com", "/", "questions", "/", "3843017", "/", "efficiently", "-", "detect", "-", "sign", "-", "changes", "-", "in", "-",...
train
https://github.com/pdkit/pdkit/blob/c7120263da2071bb139815fbdb56ca77b544f340/pdkit/utils.py#L514-L544
pdkit/pdkit
pdkit/utils.py
autocorrelate
def autocorrelate(data, unbias=2, normalize=2): """ Compute the autocorrelation coefficients for time series data. Here we use scipy.signal.correlate, but the results are the same as in Yang, et al., 2012 for unbias=1: "The autocorrelation coefficient refers to the correlation of a...
python
def autocorrelate(data, unbias=2, normalize=2): """ Compute the autocorrelation coefficients for time series data. Here we use scipy.signal.correlate, but the results are the same as in Yang, et al., 2012 for unbias=1: "The autocorrelation coefficient refers to the correlation of a...
[ "def", "autocorrelate", "(", "data", ",", "unbias", "=", "2", ",", "normalize", "=", "2", ")", ":", "# Autocorrelation:", "coefficients", "=", "correlate", "(", "data", ",", "data", ",", "'full'", ")", "size", "=", "np", ".", "int", "(", "coefficients", ...
Compute the autocorrelation coefficients for time series data. Here we use scipy.signal.correlate, but the results are the same as in Yang, et al., 2012 for unbias=1: "The autocorrelation coefficient refers to the correlation of a time series with its own past or future values. iGAIT u...
[ "Compute", "the", "autocorrelation", "coefficients", "for", "time", "series", "data", ".", "Here", "we", "use", "scipy", ".", "signal", ".", "correlate", "but", "the", "results", "are", "the", "same", "as", "in", "Yang", "et", "al", ".", "2012", "for", "...
train
https://github.com/pdkit/pdkit/blob/c7120263da2071bb139815fbdb56ca77b544f340/pdkit/utils.py#L547-L617
pdkit/pdkit
pdkit/utils.py
get_signal_peaks_and_prominences
def get_signal_peaks_and_prominences(data): """ Get the signal peaks and peak prominences. :param data array: One-dimensional array. :return peaks array: The peaks of our signal. :return prominences array: The prominences of the peaks. """ peaks, _ = sig.find_peaks(...
python
def get_signal_peaks_and_prominences(data): """ Get the signal peaks and peak prominences. :param data array: One-dimensional array. :return peaks array: The peaks of our signal. :return prominences array: The prominences of the peaks. """ peaks, _ = sig.find_peaks(...
[ "def", "get_signal_peaks_and_prominences", "(", "data", ")", ":", "peaks", ",", "_", "=", "sig", ".", "find_peaks", "(", "data", ")", "prominences", "=", "sig", ".", "peak_prominences", "(", "data", ",", "peaks", ")", "[", "0", "]", "return", "peaks", ",...
Get the signal peaks and peak prominences. :param data array: One-dimensional array. :return peaks array: The peaks of our signal. :return prominences array: The prominences of the peaks.
[ "Get", "the", "signal", "peaks", "and", "peak", "prominences", ".", ":", "param", "data", "array", ":", "One", "-", "dimensional", "array", ".", ":", "return", "peaks", "array", ":", "The", "peaks", "of", "our", "signal", ".", ":", "return", "prominences...
train
https://github.com/pdkit/pdkit/blob/c7120263da2071bb139815fbdb56ca77b544f340/pdkit/utils.py#L620-L631
pdkit/pdkit
pdkit/utils.py
smoothing_window
def smoothing_window(data, window=[1, 1, 1]): """ This is a smoothing functionality so we can fix misclassifications. It will run a sliding window of form [border, smoothing, border] on the signal and if the border elements are the same it will change the smooth elements to match the border...
python
def smoothing_window(data, window=[1, 1, 1]): """ This is a smoothing functionality so we can fix misclassifications. It will run a sliding window of form [border, smoothing, border] on the signal and if the border elements are the same it will change the smooth elements to match the border...
[ "def", "smoothing_window", "(", "data", ",", "window", "=", "[", "1", ",", "1", ",", "1", "]", ")", ":", "for", "i", "in", "range", "(", "len", "(", "data", ")", "-", "sum", "(", "window", ")", ")", ":", "start_window_from", "=", "i", "start_wind...
This is a smoothing functionality so we can fix misclassifications. It will run a sliding window of form [border, smoothing, border] on the signal and if the border elements are the same it will change the smooth elements to match the border. An example would be for a window of [2, 1, 2...
[ "This", "is", "a", "smoothing", "functionality", "so", "we", "can", "fix", "misclassifications", ".", "It", "will", "run", "a", "sliding", "window", "of", "form", "[", "border", "smoothing", "border", "]", "on", "the", "signal", "and", "if", "the", "border...
train
https://github.com/pdkit/pdkit/blob/c7120263da2071bb139815fbdb56ca77b544f340/pdkit/utils.py#L633-L660
pdkit/pdkit
pdkit/utils.py
plot_segmentation
def plot_segmentation(data, peaks, segment_indexes, figsize=(10, 5)): """ Will plot the data and segmentation based on the peaks and segment indexes. :param 1d-array data: The orginal axis of the data that was segmented into sections. :param 1d-array peaks: Peaks of the data. :param 1d-...
python
def plot_segmentation(data, peaks, segment_indexes, figsize=(10, 5)): """ Will plot the data and segmentation based on the peaks and segment indexes. :param 1d-array data: The orginal axis of the data that was segmented into sections. :param 1d-array peaks: Peaks of the data. :param 1d-...
[ "def", "plot_segmentation", "(", "data", ",", "peaks", ",", "segment_indexes", ",", "figsize", "=", "(", "10", ",", "5", ")", ")", ":", "fig", ",", "ax", "=", "plt", ".", "subplots", "(", "figsize", "=", "figsize", ")", "plt", ".", "plot", "(", "da...
Will plot the data and segmentation based on the peaks and segment indexes. :param 1d-array data: The orginal axis of the data that was segmented into sections. :param 1d-array peaks: Peaks of the data. :param 1d-array segment_indexes: These are the different classes, corresponding to each ...
[ "Will", "plot", "the", "data", "and", "segmentation", "based", "on", "the", "peaks", "and", "segment", "indexes", ".", ":", "param", "1d", "-", "array", "data", ":", "The", "orginal", "axis", "of", "the", "data", "that", "was", "segmented", "into", "sect...
train
https://github.com/pdkit/pdkit/blob/c7120263da2071bb139815fbdb56ca77b544f340/pdkit/utils.py#L717-L733
pdkit/pdkit
pdkit/utils.py
separate_walks_turns
def separate_walks_turns(data, window=[1, 1, 1]): """ Will separate peaks into the clusters by following the trend in the clusters array. This is usedful because scipy's k-mean clustering will give us a continous clusters array. :param clusters array: A continous array representing ...
python
def separate_walks_turns(data, window=[1, 1, 1]): """ Will separate peaks into the clusters by following the trend in the clusters array. This is usedful because scipy's k-mean clustering will give us a continous clusters array. :param clusters array: A continous array representing ...
[ "def", "separate_walks_turns", "(", "data", ",", "window", "=", "[", "1", ",", "1", ",", "1", "]", ")", ":", "clusters", ",", "peaks", ",", "promi", "=", "cluster_walk_turn", "(", "data", ",", "window", "=", "window", ")", "group_one", "=", "[", "]",...
Will separate peaks into the clusters by following the trend in the clusters array. This is usedful because scipy's k-mean clustering will give us a continous clusters array. :param clusters array: A continous array representing different classes. :param peaks array: The peaks t...
[ "Will", "separate", "peaks", "into", "the", "clusters", "by", "following", "the", "trend", "in", "the", "clusters", "array", ".", "This", "is", "usedful", "because", "scipy", "s", "k", "-", "mean", "clustering", "will", "give", "us", "a", "continous", "clu...
train
https://github.com/pdkit/pdkit/blob/c7120263da2071bb139815fbdb56ca77b544f340/pdkit/utils.py#L753-L802
pdkit/pdkit
pdkit/utils.py
centroid_sort
def centroid_sort(centroids): """ Sort centroids. This is required so that the same cluster centroid is always the 0th one. It should also be the \ most negative. Order defined by the Euclidean distance between the centroid and an arbitrary "small" point \ [-100, -100] (in each dimension) to...
python
def centroid_sort(centroids): """ Sort centroids. This is required so that the same cluster centroid is always the 0th one. It should also be the \ most negative. Order defined by the Euclidean distance between the centroid and an arbitrary "small" point \ [-100, -100] (in each dimension) to...
[ "def", "centroid_sort", "(", "centroids", ")", ":", "dimensions", "=", "len", "(", "centroids", "[", "0", "]", ")", "negative_base_point", "=", "array", "(", "dimensions", "*", "[", "-", "100", "]", ")", "decorated", "=", "[", "(", "euclidean", "(", "c...
Sort centroids. This is required so that the same cluster centroid is always the 0th one. It should also be the \ most negative. Order defined by the Euclidean distance between the centroid and an arbitrary "small" point \ [-100, -100] (in each dimension) to account for possible negatives. Cluster 0 is ...
[ "Sort", "centroids", ".", "This", "is", "required", "so", "that", "the", "same", "cluster", "centroid", "is", "always", "the", "0th", "one", ".", "It", "should", "also", "be", "the", "\\", "most", "negative", ".", "Order", "defined", "by", "the", "Euclid...
train
https://github.com/pdkit/pdkit/blob/c7120263da2071bb139815fbdb56ca77b544f340/pdkit/utils.py#L825-L895
pdkit/pdkit
pdkit/utils.py
non_zero_index
def non_zero_index(arr): """ Raises: ValueError: If no-non-zero rows can be found. 0. Empty array raises. >>> arr = array([]) >>> non_zero_index(arr) 1. Array with zero values raises. >>> arr = array([ ... [0, 0], ...
python
def non_zero_index(arr): """ Raises: ValueError: If no-non-zero rows can be found. 0. Empty array raises. >>> arr = array([]) >>> non_zero_index(arr) 1. Array with zero values raises. >>> arr = array([ ... [0, 0], ...
[ "def", "non_zero_index", "(", "arr", ")", ":", "for", "index", ",", "row", "in", "enumerate", "(", "arr", ")", ":", "if", "non_zero_row", "(", "row", ")", ":", "return", "index", "raise", "ValueError", "(", "'No non-zero values'", ")" ]
Raises: ValueError: If no-non-zero rows can be found. 0. Empty array raises. >>> arr = array([]) >>> non_zero_index(arr) 1. Array with zero values raises. >>> arr = array([ ... [0, 0], ... [0, 0], ... [0, 0...
[ "Raises", ":", "ValueError", ":", "If", "no", "-", "non", "-", "zero", "rows", "can", "be", "found", "." ]
train
https://github.com/pdkit/pdkit/blob/c7120263da2071bb139815fbdb56ca77b544f340/pdkit/utils.py#L898-L941
pdkit/pdkit
pdkit/utils.py
non_zero_row
def non_zero_row(arr): """ 0. Empty row returns False. >>> arr = array([]) >>> non_zero_row(arr) False 1. Row with a zero returns False. >>> arr = array([1, 4, 3, 0, 5, -1, -2]) >>> non_zero_row(arr) False 2. Row...
python
def non_zero_row(arr): """ 0. Empty row returns False. >>> arr = array([]) >>> non_zero_row(arr) False 1. Row with a zero returns False. >>> arr = array([1, 4, 3, 0, 5, -1, -2]) >>> non_zero_row(arr) False 2. Row...
[ "def", "non_zero_row", "(", "arr", ")", ":", "if", "len", "(", "arr", ")", "==", "0", ":", "return", "False", "for", "item", "in", "arr", ":", "if", "item", "==", "0", ":", "return", "False", "return", "True" ]
0. Empty row returns False. >>> arr = array([]) >>> non_zero_row(arr) False 1. Row with a zero returns False. >>> arr = array([1, 4, 3, 0, 5, -1, -2]) >>> non_zero_row(arr) False 2. Row with no zeros returns True. ...
[ "0", ".", "Empty", "row", "returns", "False", "." ]
train
https://github.com/pdkit/pdkit/blob/c7120263da2071bb139815fbdb56ca77b544f340/pdkit/utils.py#L944-L979
pdkit/pdkit
pdkit/utils.py
window_features
def window_features(idx, window_size=100, overlap=10): """ Generate indexes for a sliding window with overlap :param array idx: The indexes that need to be windowed. :param int window_size: The size of the window. :param int overlap: How much should each window overlap. ...
python
def window_features(idx, window_size=100, overlap=10): """ Generate indexes for a sliding window with overlap :param array idx: The indexes that need to be windowed. :param int window_size: The size of the window. :param int overlap: How much should each window overlap. ...
[ "def", "window_features", "(", "idx", ",", "window_size", "=", "100", ",", "overlap", "=", "10", ")", ":", "overlap", "=", "window_size", "-", "overlap", "sh", "=", "(", "idx", ".", "size", "-", "window_size", "+", "1", ",", "window_size", ")", "st", ...
Generate indexes for a sliding window with overlap :param array idx: The indexes that need to be windowed. :param int window_size: The size of the window. :param int overlap: How much should each window overlap. :return array view: The indexes for the windows with overlap.
[ "Generate", "indexes", "for", "a", "sliding", "window", "with", "overlap", ":", "param", "array", "idx", ":", "The", "indexes", "that", "need", "to", "be", "windowed", ".", ":", "param", "int", "window_size", ":", "The", "size", "of", "the", "window", "....
train
https://github.com/pdkit/pdkit/blob/c7120263da2071bb139815fbdb56ca77b544f340/pdkit/utils.py#L982-L996
Duke-GCB/DukeDSClient
ddsc/versioncheck.py
get_pypi_version
def get_pypi_version(): """ Returns the version info from pypi for this app. """ try: response = requests.get(PYPI_URL, timeout=HALF_SECOND_TIMEOUT) response.raise_for_status() data = response.json() version_str = data["info"]["version"] return _parse_version_str(...
python
def get_pypi_version(): """ Returns the version info from pypi for this app. """ try: response = requests.get(PYPI_URL, timeout=HALF_SECOND_TIMEOUT) response.raise_for_status() data = response.json() version_str = data["info"]["version"] return _parse_version_str(...
[ "def", "get_pypi_version", "(", ")", ":", "try", ":", "response", "=", "requests", ".", "get", "(", "PYPI_URL", ",", "timeout", "=", "HALF_SECOND_TIMEOUT", ")", "response", ".", "raise_for_status", "(", ")", "data", "=", "response", ".", "json", "(", ")", ...
Returns the version info from pypi for this app.
[ "Returns", "the", "version", "info", "from", "pypi", "for", "this", "app", "." ]
train
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/versioncheck.py#L18-L31
Duke-GCB/DukeDSClient
ddsc/sdk/client.py
DDSConnection.get_project_by_id
def get_project_by_id(self, project_id): """ Get details about project with the specified uuid :param project_id: str: uuid of the project to fetch :return: Project """ return self._create_item_response( self.data_service.get_project_by_id(project_id), ...
python
def get_project_by_id(self, project_id): """ Get details about project with the specified uuid :param project_id: str: uuid of the project to fetch :return: Project """ return self._create_item_response( self.data_service.get_project_by_id(project_id), ...
[ "def", "get_project_by_id", "(", "self", ",", "project_id", ")", ":", "return", "self", ".", "_create_item_response", "(", "self", ".", "data_service", ".", "get_project_by_id", "(", "project_id", ")", ",", "Project", ")" ]
Get details about project with the specified uuid :param project_id: str: uuid of the project to fetch :return: Project
[ "Get", "details", "about", "project", "with", "the", "specified", "uuid", ":", "param", "project_id", ":", "str", ":", "uuid", "of", "the", "project", "to", "fetch", ":", "return", ":", "Project" ]
train
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/sdk/client.py#L92-L100
Duke-GCB/DukeDSClient
ddsc/sdk/client.py
DDSConnection.create_project
def create_project(self, name, description): """ Create a new project with the specified name and description :param name: str: name of the project to create :param description: str: description of the project to create :return: Project """ return self._create_ite...
python
def create_project(self, name, description): """ Create a new project with the specified name and description :param name: str: name of the project to create :param description: str: description of the project to create :return: Project """ return self._create_ite...
[ "def", "create_project", "(", "self", ",", "name", ",", "description", ")", ":", "return", "self", ".", "_create_item_response", "(", "self", ".", "data_service", ".", "create_project", "(", "name", ",", "description", ")", ",", "Project", ")" ]
Create a new project with the specified name and description :param name: str: name of the project to create :param description: str: description of the project to create :return: Project
[ "Create", "a", "new", "project", "with", "the", "specified", "name", "and", "description", ":", "param", "name", ":", "str", ":", "name", "of", "the", "project", "to", "create", ":", "param", "description", ":", "str", ":", "description", "of", "the", "p...
train
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/sdk/client.py#L102-L111
Duke-GCB/DukeDSClient
ddsc/sdk/client.py
DDSConnection.create_folder
def create_folder(self, folder_name, parent_kind_str, parent_uuid): """ Create a folder under a particular parent :param folder_name: str: name of the folder to create :param parent_kind_str: str: kind of the parent of this folder :param parent_uuid: str: uuid of the parent of th...
python
def create_folder(self, folder_name, parent_kind_str, parent_uuid): """ Create a folder under a particular parent :param folder_name: str: name of the folder to create :param parent_kind_str: str: kind of the parent of this folder :param parent_uuid: str: uuid of the parent of th...
[ "def", "create_folder", "(", "self", ",", "folder_name", ",", "parent_kind_str", ",", "parent_uuid", ")", ":", "return", "self", ".", "_create_item_response", "(", "self", ".", "data_service", ".", "create_folder", "(", "folder_name", ",", "parent_kind_str", ",", ...
Create a folder under a particular parent :param folder_name: str: name of the folder to create :param parent_kind_str: str: kind of the parent of this folder :param parent_uuid: str: uuid of the parent of this folder (project or another folder) :return: Folder: folder metadata
[ "Create", "a", "folder", "under", "a", "particular", "parent", ":", "param", "folder_name", ":", "str", ":", "name", "of", "the", "folder", "to", "create", ":", "param", "parent_kind_str", ":", "str", ":", "kind", "of", "the", "parent", "of", "this", "fo...
train
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/sdk/client.py#L120-L131
Duke-GCB/DukeDSClient
ddsc/sdk/client.py
DDSConnection.get_project_children
def get_project_children(self, project_id, name_contains=None): """ Get direct files and folders of a project. :param project_id: str: uuid of the project to list contents :param name_contains: str: filter children based on a pattern :return: [File|Folder]: list of Files/Folders ...
python
def get_project_children(self, project_id, name_contains=None): """ Get direct files and folders of a project. :param project_id: str: uuid of the project to list contents :param name_contains: str: filter children based on a pattern :return: [File|Folder]: list of Files/Folders ...
[ "def", "get_project_children", "(", "self", ",", "project_id", ",", "name_contains", "=", "None", ")", ":", "return", "self", ".", "_create_array_response", "(", "self", ".", "data_service", ".", "get_project_children", "(", "project_id", ",", "name_contains", ")"...
Get direct files and folders of a project. :param project_id: str: uuid of the project to list contents :param name_contains: str: filter children based on a pattern :return: [File|Folder]: list of Files/Folders contained by the project
[ "Get", "direct", "files", "and", "folders", "of", "a", "project", ".", ":", "param", "project_id", ":", "str", ":", "uuid", "of", "the", "project", "to", "list", "contents", ":", "param", "name_contains", ":", "str", ":", "filter", "children", "based", "...
train
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/sdk/client.py#L140-L152
Duke-GCB/DukeDSClient
ddsc/sdk/client.py
DDSConnection.get_folder_children
def get_folder_children(self, folder_id, name_contains=None): """ Get direct files and folders of a folder. :param folder_id: str: uuid of the folder :param name_contains: str: filter children based on a pattern :return: File|Folder """ return self._create_array_r...
python
def get_folder_children(self, folder_id, name_contains=None): """ Get direct files and folders of a folder. :param folder_id: str: uuid of the folder :param name_contains: str: filter children based on a pattern :return: File|Folder """ return self._create_array_r...
[ "def", "get_folder_children", "(", "self", ",", "folder_id", ",", "name_contains", "=", "None", ")", ":", "return", "self", ".", "_create_array_response", "(", "self", ".", "data_service", ".", "get_folder_children", "(", "folder_id", ",", "name_contains", ")", ...
Get direct files and folders of a folder. :param folder_id: str: uuid of the folder :param name_contains: str: filter children based on a pattern :return: File|Folder
[ "Get", "direct", "files", "and", "folders", "of", "a", "folder", ".", ":", "param", "folder_id", ":", "str", ":", "uuid", "of", "the", "folder", ":", "param", "name_contains", ":", "str", ":", "filter", "children", "based", "on", "a", "pattern", ":", "...
train
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/sdk/client.py#L154-L166
Duke-GCB/DukeDSClient
ddsc/sdk/client.py
DDSConnection.get_file_download
def get_file_download(self, file_id): """ Get a file download object that contains temporary url settings needed to download the contents of a file. :param file_id: str: uuid of the file :return: FileDownload """ return self._create_item_response( self.data_se...
python
def get_file_download(self, file_id): """ Get a file download object that contains temporary url settings needed to download the contents of a file. :param file_id: str: uuid of the file :return: FileDownload """ return self._create_item_response( self.data_se...
[ "def", "get_file_download", "(", "self", ",", "file_id", ")", ":", "return", "self", ".", "_create_item_response", "(", "self", ".", "data_service", ".", "get_file_url", "(", "file_id", ")", ",", "FileDownload", ")" ]
Get a file download object that contains temporary url settings needed to download the contents of a file. :param file_id: str: uuid of the file :return: FileDownload
[ "Get", "a", "file", "download", "object", "that", "contains", "temporary", "url", "settings", "needed", "to", "download", "the", "contents", "of", "a", "file", ".", ":", "param", "file_id", ":", "str", ":", "uuid", "of", "the", "file", ":", "return", ":"...
train
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/sdk/client.py#L168-L177
Duke-GCB/DukeDSClient
ddsc/sdk/client.py
DDSConnection.upload_file
def upload_file(self, local_path, project_id, parent_data, existing_file_id=None, remote_filename=None): """ Upload a file under a specific location in DDSConnection possibly replacing an existing file. :param local_path: str: path to a local file to upload :param project_id: str: uuid o...
python
def upload_file(self, local_path, project_id, parent_data, existing_file_id=None, remote_filename=None): """ Upload a file under a specific location in DDSConnection possibly replacing an existing file. :param local_path: str: path to a local file to upload :param project_id: str: uuid o...
[ "def", "upload_file", "(", "self", ",", "local_path", ",", "project_id", ",", "parent_data", ",", "existing_file_id", "=", "None", ",", "remote_filename", "=", "None", ")", ":", "path_data", "=", "PathData", "(", "local_path", ")", "hash_data", "=", "path_data...
Upload a file under a specific location in DDSConnection possibly replacing an existing file. :param local_path: str: path to a local file to upload :param project_id: str: uuid of the project to add this file to :param parent_data: ParentData: info about the parent of this file :param e...
[ "Upload", "a", "file", "under", "a", "specific", "location", "in", "DDSConnection", "possibly", "replacing", "an", "existing", "file", ".", ":", "param", "local_path", ":", "str", ":", "path", "to", "a", "local", "file", "to", "upload", ":", "param", "proj...
train
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/sdk/client.py#L179-L198
Duke-GCB/DukeDSClient
ddsc/sdk/client.py
DDSConnection._folder_or_file_constructor
def _folder_or_file_constructor(dds_connection, data_dict): """ Create a File or Folder based on the kind value in data_dict :param dds_connection: DDSConnection :param data_dict: dict: payload received from DDSConnection API :return: File|Folder """ kind = data_d...
python
def _folder_or_file_constructor(dds_connection, data_dict): """ Create a File or Folder based on the kind value in data_dict :param dds_connection: DDSConnection :param data_dict: dict: payload received from DDSConnection API :return: File|Folder """ kind = data_d...
[ "def", "_folder_or_file_constructor", "(", "dds_connection", ",", "data_dict", ")", ":", "kind", "=", "data_dict", "[", "'kind'", "]", "if", "kind", "==", "KindType", ".", "folder_str", ":", "return", "Folder", "(", "dds_connection", ",", "data_dict", ")", "el...
Create a File or Folder based on the kind value in data_dict :param dds_connection: DDSConnection :param data_dict: dict: payload received from DDSConnection API :return: File|Folder
[ "Create", "a", "File", "or", "Folder", "based", "on", "the", "kind", "value", "in", "data_dict", ":", "param", "dds_connection", ":", "DDSConnection", ":", "param", "data_dict", ":", "dict", ":", "payload", "received", "from", "DDSConnection", "API", ":", "r...
train
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/sdk/client.py#L201-L212
Duke-GCB/DukeDSClient
ddsc/sdk/client.py
DDSConnection.get_folder_by_id
def get_folder_by_id(self, folder_id): """ Get folder details for a folder id. :param folder_id: str: uuid of the folder :return: Folder """ return self._create_item_response( self.data_service.get_folder(folder_id), Folder )
python
def get_folder_by_id(self, folder_id): """ Get folder details for a folder id. :param folder_id: str: uuid of the folder :return: Folder """ return self._create_item_response( self.data_service.get_folder(folder_id), Folder )
[ "def", "get_folder_by_id", "(", "self", ",", "folder_id", ")", ":", "return", "self", ".", "_create_item_response", "(", "self", ".", "data_service", ".", "get_folder", "(", "folder_id", ")", ",", "Folder", ")" ]
Get folder details for a folder id. :param folder_id: str: uuid of the folder :return: Folder
[ "Get", "folder", "details", "for", "a", "folder", "id", ".", ":", "param", "folder_id", ":", "str", ":", "uuid", "of", "the", "folder", ":", "return", ":", "Folder" ]
train
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/sdk/client.py#L214-L223
Duke-GCB/DukeDSClient
ddsc/sdk/client.py
DDSConnection.get_file_by_id
def get_file_by_id(self, file_id): """ Get folder details for a file id. :param file_id: str: uuid of the file :return: File """ return self._create_item_response( self.data_service.get_file(file_id), File )
python
def get_file_by_id(self, file_id): """ Get folder details for a file id. :param file_id: str: uuid of the file :return: File """ return self._create_item_response( self.data_service.get_file(file_id), File )
[ "def", "get_file_by_id", "(", "self", ",", "file_id", ")", ":", "return", "self", ".", "_create_item_response", "(", "self", ".", "data_service", ".", "get_file", "(", "file_id", ")", ",", "File", ")" ]
Get folder details for a file id. :param file_id: str: uuid of the file :return: File
[ "Get", "folder", "details", "for", "a", "file", "id", ".", ":", "param", "file_id", ":", "str", ":", "uuid", "of", "the", "file", ":", "return", ":", "File" ]
train
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/sdk/client.py#L225-L234
Duke-GCB/DukeDSClient
ddsc/sdk/client.py
FileDownload.save_to_path
def save_to_path(self, file_path, chunk_size=DOWNLOAD_FILE_CHUNK_SIZE): """ Save the contents of the remote file to a local path. :param file_path: str: file path :param chunk_size: chunk size used to write local file """ response = self._get_download_response() w...
python
def save_to_path(self, file_path, chunk_size=DOWNLOAD_FILE_CHUNK_SIZE): """ Save the contents of the remote file to a local path. :param file_path: str: file path :param chunk_size: chunk size used to write local file """ response = self._get_download_response() w...
[ "def", "save_to_path", "(", "self", ",", "file_path", ",", "chunk_size", "=", "DOWNLOAD_FILE_CHUNK_SIZE", ")", ":", "response", "=", "self", ".", "_get_download_response", "(", ")", "with", "open", "(", "file_path", ",", "'wb'", ")", "as", "f", ":", "for", ...
Save the contents of the remote file to a local path. :param file_path: str: file path :param chunk_size: chunk size used to write local file
[ "Save", "the", "contents", "of", "the", "remote", "file", "to", "a", "local", "path", ".", ":", "param", "file_path", ":", "str", ":", "file", "path", ":", "param", "chunk_size", ":", "chunk", "size", "used", "to", "write", "local", "file" ]
train
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/sdk/client.py#L427-L437
Duke-GCB/DukeDSClient
ddsc/sdk/client.py
ChildFinder.get_child
def get_child(self): """ Find file or folder at the remote_path :return: File|Folder """ path_parts = self.remote_path.split(os.sep) return self._get_child_recurse(path_parts, self.node)
python
def get_child(self): """ Find file or folder at the remote_path :return: File|Folder """ path_parts = self.remote_path.split(os.sep) return self._get_child_recurse(path_parts, self.node)
[ "def", "get_child", "(", "self", ")", ":", "path_parts", "=", "self", ".", "remote_path", ".", "split", "(", "os", ".", "sep", ")", "return", "self", ".", "_get_child_recurse", "(", "path_parts", ",", "self", ".", "node", ")" ]
Find file or folder at the remote_path :return: File|Folder
[ "Find", "file", "or", "folder", "at", "the", "remote_path", ":", "return", ":", "File|Folder" ]
train
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/sdk/client.py#L490-L496
Duke-GCB/DukeDSClient
ddsc/core/parallel.py
execute_task_async
def execute_task_async(task_func, task_id, context): """ Global function run for Task. multiprocessing requires a top level function. :param task_func: function: function to run (must be pickle-able) :param task_id: int: unique id of this task :param context: object: single argument to task_func (mu...
python
def execute_task_async(task_func, task_id, context): """ Global function run for Task. multiprocessing requires a top level function. :param task_func: function: function to run (must be pickle-able) :param task_id: int: unique id of this task :param context: object: single argument to task_func (mu...
[ "def", "execute_task_async", "(", "task_func", ",", "task_id", ",", "context", ")", ":", "try", ":", "result", "=", "task_func", "(", "context", ")", "return", "task_id", ",", "result", "except", ":", "# Put all exception text into an exception and raise that so main ...
Global function run for Task. multiprocessing requires a top level function. :param task_func: function: function to run (must be pickle-able) :param task_id: int: unique id of this task :param context: object: single argument to task_func (must be pickle-able) :return: (task_id, object): return passed ...
[ "Global", "function", "run", "for", "Task", ".", "multiprocessing", "requires", "a", "top", "level", "function", ".", ":", "param", "task_func", ":", "function", ":", "function", "to", "run", "(", "must", "be", "pickle", "-", "able", ")", ":", "param", "...
train
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/parallel.py#L266-L279
Duke-GCB/DukeDSClient
ddsc/core/parallel.py
WaitingTaskList.add
def add(self, task): """ Add this task to the lookup based on it's wait_for_task_id property. :param task: Task: task to add to the list """ wait_id = task.wait_for_task_id task_list = self.wait_id_to_task.get(wait_id, []) task_list.append(task) self.wait_...
python
def add(self, task): """ Add this task to the lookup based on it's wait_for_task_id property. :param task: Task: task to add to the list """ wait_id = task.wait_for_task_id task_list = self.wait_id_to_task.get(wait_id, []) task_list.append(task) self.wait_...
[ "def", "add", "(", "self", ",", "task", ")", ":", "wait_id", "=", "task", ".", "wait_for_task_id", "task_list", "=", "self", ".", "wait_id_to_task", ".", "get", "(", "wait_id", ",", "[", "]", ")", "task_list", ".", "append", "(", "task", ")", "self", ...
Add this task to the lookup based on it's wait_for_task_id property. :param task: Task: task to add to the list
[ "Add", "this", "task", "to", "the", "lookup", "based", "on", "it", "s", "wait_for_task_id", "property", ".", ":", "param", "task", ":", "Task", ":", "task", "to", "add", "to", "the", "list" ]
train
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/parallel.py#L70-L78
Duke-GCB/DukeDSClient
ddsc/core/parallel.py
TaskRunner.add
def add(self, parent_task_id, command): """ Create a task for the command that will wait for parent_task_id before starting. :param parent_task_id: int: id of task to wait for or None if it can start immediately :param command: TaskCommand: contains data function to run :return: ...
python
def add(self, parent_task_id, command): """ Create a task for the command that will wait for parent_task_id before starting. :param parent_task_id: int: id of task to wait for or None if it can start immediately :param command: TaskCommand: contains data function to run :return: ...
[ "def", "add", "(", "self", ",", "parent_task_id", ",", "command", ")", ":", "task_id", "=", "self", ".", "_claim_next_id", "(", ")", "self", ".", "waiting_task_list", ".", "add", "(", "Task", "(", "task_id", ",", "parent_task_id", ",", "command", ")", ")...
Create a task for the command that will wait for parent_task_id before starting. :param parent_task_id: int: id of task to wait for or None if it can start immediately :param command: TaskCommand: contains data function to run :return: int: task id we created for this command
[ "Create", "a", "task", "for", "the", "command", "that", "will", "wait", "for", "parent_task_id", "before", "starting", ".", ":", "param", "parent_task_id", ":", "int", ":", "id", "of", "task", "to", "wait", "for", "or", "None", "if", "it", "can", "start"...
train
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/parallel.py#L111-L120
Duke-GCB/DukeDSClient
ddsc/core/parallel.py
TaskRunner.run
def run(self): """ Runs all tasks in this runner on the executor. Blocks until all tasks have been completed. :return: """ for task in self.get_next_tasks(None): self.executor.add_task(task, None) while not self.executor.is_done(): done_tas...
python
def run(self): """ Runs all tasks in this runner on the executor. Blocks until all tasks have been completed. :return: """ for task in self.get_next_tasks(None): self.executor.add_task(task, None) while not self.executor.is_done(): done_tas...
[ "def", "run", "(", "self", ")", ":", "for", "task", "in", "self", ".", "get_next_tasks", "(", "None", ")", ":", "self", ".", "executor", ".", "add_task", "(", "task", ",", "None", ")", "while", "not", "self", ".", "executor", ".", "is_done", "(", "...
Runs all tasks in this runner on the executor. Blocks until all tasks have been completed. :return:
[ "Runs", "all", "tasks", "in", "this", "runner", "on", "the", "executor", ".", "Blocks", "until", "all", "tasks", "have", "been", "completed", ".", ":", "return", ":" ]
train
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/parallel.py#L130-L141