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
robotframework/Rammbock
src/Rammbock/core.py
RammbockCore.client_receives_without_validation
def client_receives_without_validation(self, *parameters): """Receive a message with template defined using `New Message`. Message template has to be defined with `New Message` before calling this. Optional parameters: - `name` the client name (default is the latest used) examp...
python
def client_receives_without_validation(self, *parameters): """Receive a message with template defined using `New Message`. Message template has to be defined with `New Message` before calling this. Optional parameters: - `name` the client name (default is the latest used) examp...
[ "def", "client_receives_without_validation", "(", "self", ",", "*", "parameters", ")", ":", "with", "self", ".", "_receive", "(", "self", ".", "_clients", ",", "*", "parameters", ")", "as", "(", "msg", ",", "_", ",", "_", ")", ":", "return", "msg" ]
Receive a message with template defined using `New Message`. Message template has to be defined with `New Message` before calling this. Optional parameters: - `name` the client name (default is the latest used) example: `name=Client 1` - `timeout` for receiving message. example...
[ "Receive", "a", "message", "with", "template", "defined", "using", "New", "Message", "." ]
train
https://github.com/robotframework/Rammbock/blob/c906058d055a6f7c68fe1a6096d78c2e3f642b1c/src/Rammbock/core.py#L573-L589
robotframework/Rammbock
src/Rammbock/core.py
RammbockCore.server_receives_message
def server_receives_message(self, *parameters): """Receive a message with template defined using `New Message` and validate field values. Message template has to be defined with `New Message` before calling this. Optional parameters: - `name` the client name (default is...
python
def server_receives_message(self, *parameters): """Receive a message with template defined using `New Message` and validate field values. Message template has to be defined with `New Message` before calling this. Optional parameters: - `name` the client name (default is...
[ "def", "server_receives_message", "(", "self", ",", "*", "parameters", ")", ":", "with", "self", ".", "_receive", "(", "self", ".", "_servers", ",", "*", "parameters", ")", "as", "(", "msg", ",", "message_fields", ",", "header_fields", ")", ":", "self", ...
Receive a message with template defined using `New Message` and validate field values. Message template has to be defined with `New Message` before calling this. Optional parameters: - `name` the client name (default is the latest used) example: `name=Client 1` - `conne...
[ "Receive", "a", "message", "with", "template", "defined", "using", "New", "Message", "and", "validate", "field", "values", "." ]
train
https://github.com/robotframework/Rammbock/blob/c906058d055a6f7c68fe1a6096d78c2e3f642b1c/src/Rammbock/core.py#L591-L616
robotframework/Rammbock
src/Rammbock/core.py
RammbockCore.server_receives_without_validation
def server_receives_without_validation(self, *parameters): """Receive a message with template defined using `New Message`. Message template has to be defined with `New Message` before calling this. Optional parameters: - `name` the client name (default is the latest used) examp...
python
def server_receives_without_validation(self, *parameters): """Receive a message with template defined using `New Message`. Message template has to be defined with `New Message` before calling this. Optional parameters: - `name` the client name (default is the latest used) examp...
[ "def", "server_receives_without_validation", "(", "self", ",", "*", "parameters", ")", ":", "with", "self", ".", "_receive", "(", "self", ".", "_servers", ",", "*", "parameters", ")", "as", "(", "msg", ",", "_", ",", "_", ")", ":", "return", "msg" ]
Receive a message with template defined using `New Message`. Message template has to be defined with `New Message` before calling this. Optional parameters: - `name` the client name (default is the latest used) example: `name=Client 1` - `connection` alias. example: `connection...
[ "Receive", "a", "message", "with", "template", "defined", "using", "New", "Message", "." ]
train
https://github.com/robotframework/Rammbock/blob/c906058d055a6f7c68fe1a6096d78c2e3f642b1c/src/Rammbock/core.py#L618-L635
robotframework/Rammbock
src/Rammbock/core.py
RammbockCore.validate_message
def validate_message(self, msg, *parameters): """Validates given message using template defined with `New Message` and field values given as optional arguments. Examples: | Validate message | ${msg} | | Validate message | ${msg} | status:0 | """ _, message_fields...
python
def validate_message(self, msg, *parameters): """Validates given message using template defined with `New Message` and field values given as optional arguments. Examples: | Validate message | ${msg} | | Validate message | ${msg} | status:0 | """ _, message_fields...
[ "def", "validate_message", "(", "self", ",", "msg", ",", "*", "parameters", ")", ":", "_", ",", "message_fields", ",", "header_fields", "=", "self", ".", "_get_parameters_with_defaults", "(", "parameters", ")", "self", ".", "_validate_message", "(", "msg", ","...
Validates given message using template defined with `New Message` and field values given as optional arguments. Examples: | Validate message | ${msg} | | Validate message | ${msg} | status:0 |
[ "Validates", "given", "message", "using", "template", "defined", "with", "New", "Message", "and", "field", "values", "given", "as", "optional", "arguments", "." ]
train
https://github.com/robotframework/Rammbock/blob/c906058d055a6f7c68fe1a6096d78c2e3f642b1c/src/Rammbock/core.py#L637-L646
robotframework/Rammbock
src/Rammbock/core.py
RammbockCore.uint
def uint(self, length, name, value=None, align=None): """Add an unsigned integer to template. `length` is given in bytes and `value` is optional. `align` can be used to align the field to longer byte length. Examples: | uint | 2 | foo | | uint | 2 | foo | 42 | |...
python
def uint(self, length, name, value=None, align=None): """Add an unsigned integer to template. `length` is given in bytes and `value` is optional. `align` can be used to align the field to longer byte length. Examples: | uint | 2 | foo | | uint | 2 | foo | 42 | |...
[ "def", "uint", "(", "self", ",", "length", ",", "name", ",", "value", "=", "None", ",", "align", "=", "None", ")", ":", "self", ".", "_add_field", "(", "UInt", "(", "length", ",", "name", ",", "value", ",", "align", "=", "align", ")", ")" ]
Add an unsigned integer to template. `length` is given in bytes and `value` is optional. `align` can be used to align the field to longer byte length. Examples: | uint | 2 | foo | | uint | 2 | foo | 42 | | uint | 2 | fourByteFoo | 42 | align=4 |
[ "Add", "an", "unsigned", "integer", "to", "template", "." ]
train
https://github.com/robotframework/Rammbock/blob/c906058d055a6f7c68fe1a6096d78c2e3f642b1c/src/Rammbock/core.py#L668-L679
robotframework/Rammbock
src/Rammbock/core.py
RammbockCore.int
def int(self, length, name, value=None, align=None): """Add an signed integer to template. `length` is given in bytes and `value` is optional. `align` can be used to align the field to longer byte length. Signed integer uses twos-complement with bits numbered in big-endian. Exa...
python
def int(self, length, name, value=None, align=None): """Add an signed integer to template. `length` is given in bytes and `value` is optional. `align` can be used to align the field to longer byte length. Signed integer uses twos-complement with bits numbered in big-endian. Exa...
[ "def", "int", "(", "self", ",", "length", ",", "name", ",", "value", "=", "None", ",", "align", "=", "None", ")", ":", "self", ".", "_add_field", "(", "Int", "(", "length", ",", "name", ",", "value", ",", "align", "=", "align", ")", ")" ]
Add an signed integer to template. `length` is given in bytes and `value` is optional. `align` can be used to align the field to longer byte length. Signed integer uses twos-complement with bits numbered in big-endian. Examples: | int | 2 | foo | | int | 2 | foo | 42 | ...
[ "Add", "an", "signed", "integer", "to", "template", "." ]
train
https://github.com/robotframework/Rammbock/blob/c906058d055a6f7c68fe1a6096d78c2e3f642b1c/src/Rammbock/core.py#L681-L693
robotframework/Rammbock
src/Rammbock/core.py
RammbockCore.chars
def chars(self, length, name, value=None, terminator=None): """Add a char array to template. `length` is given in bytes and can refer to earlier numeric fields in template. Special value '*' in length means that length is encoded to length of value and decoded as all available bytes. ...
python
def chars(self, length, name, value=None, terminator=None): """Add a char array to template. `length` is given in bytes and can refer to earlier numeric fields in template. Special value '*' in length means that length is encoded to length of value and decoded as all available bytes. ...
[ "def", "chars", "(", "self", ",", "length", ",", "name", ",", "value", "=", "None", ",", "terminator", "=", "None", ")", ":", "self", ".", "_add_field", "(", "Char", "(", "length", ",", "name", ",", "value", ",", "terminator", ")", ")" ]
Add a char array to template. `length` is given in bytes and can refer to earlier numeric fields in template. Special value '*' in length means that length is encoded to length of value and decoded as all available bytes. `value` is optional. `value` could be either a "String" ...
[ "Add", "a", "char", "array", "to", "template", "." ]
train
https://github.com/robotframework/Rammbock/blob/c906058d055a6f7c68fe1a6096d78c2e3f642b1c/src/Rammbock/core.py#L695-L716
robotframework/Rammbock
src/Rammbock/core.py
RammbockCore.new_struct
def new_struct(self, type, name, *parameters): """Defines a new struct to template. You must call `End Struct` to end struct definition. `type` is the name for generic type and `name` is the field name in containing structure. Possible parameters are values for struct fields separated w...
python
def new_struct(self, type, name, *parameters): """Defines a new struct to template. You must call `End Struct` to end struct definition. `type` is the name for generic type and `name` is the field name in containing structure. Possible parameters are values for struct fields separated w...
[ "def", "new_struct", "(", "self", ",", "type", ",", "name", ",", "*", "parameters", ")", ":", "configs", ",", "parameters", ",", "_", "=", "self", ".", "_get_parameters_with_defaults", "(", "parameters", ")", "self", ".", "_add_struct_name_to_params", "(", "...
Defines a new struct to template. You must call `End Struct` to end struct definition. `type` is the name for generic type and `name` is the field name in containing structure. Possible parameters are values for struct fields separated with colon and optional struct length defined with ...
[ "Defines", "a", "new", "struct", "to", "template", "." ]
train
https://github.com/robotframework/Rammbock/blob/c906058d055a6f7c68fe1a6096d78c2e3f642b1c/src/Rammbock/core.py#L723-L742
robotframework/Rammbock
src/Rammbock/core.py
RammbockCore._new_list
def _new_list(self, size, name): """Defines a new list to template of `size` and with `name`. List type must be given after this keyword by defining one field. Then the list definition has to be closed using `End List`. Special value '*' in size means that list will decode values as lo...
python
def _new_list(self, size, name): """Defines a new list to template of `size` and with `name`. List type must be given after this keyword by defining one field. Then the list definition has to be closed using `End List`. Special value '*' in size means that list will decode values as lo...
[ "def", "_new_list", "(", "self", ",", "size", ",", "name", ")", ":", "self", ".", "_message_stack", ".", "append", "(", "ListTemplate", "(", "size", ",", "name", ",", "self", ".", "_current_container", ")", ")" ]
Defines a new list to template of `size` and with `name`. List type must be given after this keyword by defining one field. Then the list definition has to be closed using `End List`. Special value '*' in size means that list will decode values as long as data is available. This free l...
[ "Defines", "a", "new", "list", "to", "template", "of", "size", "and", "with", "name", "." ]
train
https://github.com/robotframework/Rammbock/blob/c906058d055a6f7c68fe1a6096d78c2e3f642b1c/src/Rammbock/core.py#L753-L776
robotframework/Rammbock
src/Rammbock/core.py
RammbockCore.new_binary_container
def new_binary_container(self, name): """Defines a new binary container to template. Binary container can only contain binary fields defined with `Bin` keyword. Examples: | New binary container | flags | | bin | 2 | foo | | bin | 6 | bar | | End binary c...
python
def new_binary_container(self, name): """Defines a new binary container to template. Binary container can only contain binary fields defined with `Bin` keyword. Examples: | New binary container | flags | | bin | 2 | foo | | bin | 6 | bar | | End binary c...
[ "def", "new_binary_container", "(", "self", ",", "name", ")", ":", "self", ".", "_message_stack", ".", "append", "(", "BinaryContainerTemplate", "(", "name", ",", "self", ".", "_current_container", ")", ")" ]
Defines a new binary container to template. Binary container can only contain binary fields defined with `Bin` keyword. Examples: | New binary container | flags | | bin | 2 | foo | | bin | 6 | bar | | End binary container |
[ "Defines", "a", "new", "binary", "container", "to", "template", "." ]
train
https://github.com/robotframework/Rammbock/blob/c906058d055a6f7c68fe1a6096d78c2e3f642b1c/src/Rammbock/core.py#L784-L796
robotframework/Rammbock
src/Rammbock/core.py
RammbockCore.end_binary_container
def end_binary_container(self): """End binary container. See `New Binary Container`. """ binary_container = self._message_stack.pop() binary_container.verify() self._add_field(binary_container)
python
def end_binary_container(self): """End binary container. See `New Binary Container`. """ binary_container = self._message_stack.pop() binary_container.verify() self._add_field(binary_container)
[ "def", "end_binary_container", "(", "self", ")", ":", "binary_container", "=", "self", ".", "_message_stack", ".", "pop", "(", ")", "binary_container", ".", "verify", "(", ")", "self", ".", "_add_field", "(", "binary_container", ")" ]
End binary container. See `New Binary Container`.
[ "End", "binary", "container", ".", "See", "New", "Binary", "Container", "." ]
train
https://github.com/robotframework/Rammbock/blob/c906058d055a6f7c68fe1a6096d78c2e3f642b1c/src/Rammbock/core.py#L801-L806
robotframework/Rammbock
src/Rammbock/core.py
RammbockCore.bin
def bin(self, size, name, value=None): """Add new binary field to template. This keyword has to be called within a binary container. See `New Binary Container`. """ self._add_field(Binary(size, name, value))
python
def bin(self, size, name, value=None): """Add new binary field to template. This keyword has to be called within a binary container. See `New Binary Container`. """ self._add_field(Binary(size, name, value))
[ "def", "bin", "(", "self", ",", "size", ",", "name", ",", "value", "=", "None", ")", ":", "self", ".", "_add_field", "(", "Binary", "(", "size", ",", "name", ",", "value", ")", ")" ]
Add new binary field to template. This keyword has to be called within a binary container. See `New Binary Container`.
[ "Add", "new", "binary", "field", "to", "template", "." ]
train
https://github.com/robotframework/Rammbock/blob/c906058d055a6f7c68fe1a6096d78c2e3f642b1c/src/Rammbock/core.py#L812-L818
robotframework/Rammbock
src/Rammbock/core.py
RammbockCore.new_union
def new_union(self, type, name): """Defines a new union to template of `type` and `name`. Fields inside the union are alternatives and the length of the union is the length of its longest field. Example: | New union | IntOrAddress | foo | | Chars | 16 | ipAddress | ...
python
def new_union(self, type, name): """Defines a new union to template of `type` and `name`. Fields inside the union are alternatives and the length of the union is the length of its longest field. Example: | New union | IntOrAddress | foo | | Chars | 16 | ipAddress | ...
[ "def", "new_union", "(", "self", ",", "type", ",", "name", ")", ":", "self", ".", "_message_stack", ".", "append", "(", "UnionTemplate", "(", "type", ",", "name", ",", "self", ".", "_current_container", ")", ")" ]
Defines a new union to template of `type` and `name`. Fields inside the union are alternatives and the length of the union is the length of its longest field. Example: | New union | IntOrAddress | foo | | Chars | 16 | ipAddress | | u32 | int | | End union |
[ "Defines", "a", "new", "union", "to", "template", "of", "type", "and", "name", "." ]
train
https://github.com/robotframework/Rammbock/blob/c906058d055a6f7c68fe1a6096d78c2e3f642b1c/src/Rammbock/core.py#L823-L835
robotframework/Rammbock
src/Rammbock/core.py
RammbockCore.start_bag
def start_bag(self, name): """Bags are sets of optional elements with an optional count. The optional elements are given each as a `Case` with the accepted count as first argument. The received elements are matched from the list of cases in order. If the the received value does not vali...
python
def start_bag(self, name): """Bags are sets of optional elements with an optional count. The optional elements are given each as a `Case` with the accepted count as first argument. The received elements are matched from the list of cases in order. If the the received value does not vali...
[ "def", "start_bag", "(", "self", ",", "name", ")", ":", "self", ".", "_message_stack", ".", "append", "(", "BagTemplate", "(", "name", ",", "self", ".", "_current_container", ")", ")" ]
Bags are sets of optional elements with an optional count. The optional elements are given each as a `Case` with the accepted count as first argument. The received elements are matched from the list of cases in order. If the the received value does not validate against the case (for exa...
[ "Bags", "are", "sets", "of", "optional", "elements", "with", "an", "optional", "count", "." ]
train
https://github.com/robotframework/Rammbock/blob/c906058d055a6f7c68fe1a6096d78c2e3f642b1c/src/Rammbock/core.py#L843-L878
robotframework/Rammbock
src/Rammbock/core.py
RammbockCore.value
def value(self, name, value): """Defines a default `value` for a template field identified by `name`. Default values for header fields can be set with header:field syntax. Examples: | Value | foo | 42 | | Value | struct.sub_field | 0xcafe | | Value | header:version | 0x...
python
def value(self, name, value): """Defines a default `value` for a template field identified by `name`. Default values for header fields can be set with header:field syntax. Examples: | Value | foo | 42 | | Value | struct.sub_field | 0xcafe | | Value | header:version | 0x...
[ "def", "value", "(", "self", ",", "name", ",", "value", ")", ":", "if", "isinstance", "(", "value", ",", "_StructuredElement", ")", ":", "self", ".", "_struct_fields_as_values", "(", "name", ",", "value", ")", "elif", "name", ".", "startswith", "(", "'he...
Defines a default `value` for a template field identified by `name`. Default values for header fields can be set with header:field syntax. Examples: | Value | foo | 42 | | Value | struct.sub_field | 0xcafe | | Value | header:version | 0x02 |
[ "Defines", "a", "default", "value", "for", "a", "template", "field", "identified", "by", "name", "." ]
train
https://github.com/robotframework/Rammbock/blob/c906058d055a6f7c68fe1a6096d78c2e3f642b1c/src/Rammbock/core.py#L935-L950
robotframework/Rammbock
src/Rammbock/core.py
RammbockCore.conditional
def conditional(self, condition, name): """Defines a 'condition' when conditional element of 'name' exists if `condition` is true. `condition` can contain multiple conditions combined together using Logical Expressions(&&,||). Example: | Conditional | mycondition == 1 | foo | |...
python
def conditional(self, condition, name): """Defines a 'condition' when conditional element of 'name' exists if `condition` is true. `condition` can contain multiple conditions combined together using Logical Expressions(&&,||). Example: | Conditional | mycondition == 1 | foo | |...
[ "def", "conditional", "(", "self", ",", "condition", ",", "name", ")", ":", "self", ".", "_message_stack", ".", "append", "(", "ConditionalTemplate", "(", "condition", ",", "name", ",", "self", ".", "_current_container", ")", ")" ]
Defines a 'condition' when conditional element of 'name' exists if `condition` is true. `condition` can contain multiple conditions combined together using Logical Expressions(&&,||). Example: | Conditional | mycondition == 1 | foo | | u8 | myelement | 42 | | End conditional ...
[ "Defines", "a", "condition", "when", "conditional", "element", "of", "name", "exists", "if", "condition", "is", "true", "." ]
train
https://github.com/robotframework/Rammbock/blob/c906058d055a6f7c68fe1a6096d78c2e3f642b1c/src/Rammbock/core.py#L999-L1013
robotframework/Rammbock
src/Rammbock/core.py
RammbockCore.get_client_unread_messages_count
def get_client_unread_messages_count(self, client_name=None): """Gets count of unread messages from client """ client = self._clients.get_with_name(client_name)[0] return client.get_messages_count_in_buffer()
python
def get_client_unread_messages_count(self, client_name=None): """Gets count of unread messages from client """ client = self._clients.get_with_name(client_name)[0] return client.get_messages_count_in_buffer()
[ "def", "get_client_unread_messages_count", "(", "self", ",", "client_name", "=", "None", ")", ":", "client", "=", "self", ".", "_clients", ".", "get_with_name", "(", "client_name", ")", "[", "0", "]", "return", "client", ".", "get_messages_count_in_buffer", "(",...
Gets count of unread messages from client
[ "Gets", "count", "of", "unread", "messages", "from", "client" ]
train
https://github.com/robotframework/Rammbock/blob/c906058d055a6f7c68fe1a6096d78c2e3f642b1c/src/Rammbock/core.py#L1021-L1025
robotframework/Rammbock
src/Rammbock/core.py
RammbockCore.get_server_unread_messages_count
def get_server_unread_messages_count(self, server_name=None): """Gets count of unread messages from server """ server = self._servers.get(server_name) return server.get_messages_count_in_buffer()
python
def get_server_unread_messages_count(self, server_name=None): """Gets count of unread messages from server """ server = self._servers.get(server_name) return server.get_messages_count_in_buffer()
[ "def", "get_server_unread_messages_count", "(", "self", ",", "server_name", "=", "None", ")", ":", "server", "=", "self", ".", "_servers", ".", "get", "(", "server_name", ")", "return", "server", ".", "get_messages_count_in_buffer", "(", ")" ]
Gets count of unread messages from server
[ "Gets", "count", "of", "unread", "messages", "from", "server" ]
train
https://github.com/robotframework/Rammbock/blob/c906058d055a6f7c68fe1a6096d78c2e3f642b1c/src/Rammbock/core.py#L1027-L1031
robotframework/Rammbock
src/Rammbock/binary_tools.py
to_twos_comp
def to_twos_comp(val, bits): """compute the 2's compliment of int value val""" if not val.startswith('-'): return to_int(val) value = _invert(to_bin_str_from_int_string(bits, bin(to_int(val[1:])))) return int(value, 2) + 1
python
def to_twos_comp(val, bits): """compute the 2's compliment of int value val""" if not val.startswith('-'): return to_int(val) value = _invert(to_bin_str_from_int_string(bits, bin(to_int(val[1:])))) return int(value, 2) + 1
[ "def", "to_twos_comp", "(", "val", ",", "bits", ")", ":", "if", "not", "val", ".", "startswith", "(", "'-'", ")", ":", "return", "to_int", "(", "val", ")", "value", "=", "_invert", "(", "to_bin_str_from_int_string", "(", "bits", ",", "bin", "(", "to_in...
compute the 2's compliment of int value val
[ "compute", "the", "2", "s", "compliment", "of", "int", "value", "val" ]
train
https://github.com/robotframework/Rammbock/blob/c906058d055a6f7c68fe1a6096d78c2e3f642b1c/src/Rammbock/binary_tools.py#L119-L124
robotframework/Rammbock
src/Rammbock/rammbock.py
Rammbock.u8
def u8(self, name, value=None, align=None): """Add an unsigned 1 byte integer field to template. This is an convenience method that simply calls `Uint` keyword with predefined length.""" self.uint(1, name, value, align)
python
def u8(self, name, value=None, align=None): """Add an unsigned 1 byte integer field to template. This is an convenience method that simply calls `Uint` keyword with predefined length.""" self.uint(1, name, value, align)
[ "def", "u8", "(", "self", ",", "name", ",", "value", "=", "None", ",", "align", "=", "None", ")", ":", "self", ".", "uint", "(", "1", ",", "name", ",", "value", ",", "align", ")" ]
Add an unsigned 1 byte integer field to template. This is an convenience method that simply calls `Uint` keyword with predefined length.
[ "Add", "an", "unsigned", "1", "byte", "integer", "field", "to", "template", "." ]
train
https://github.com/robotframework/Rammbock/blob/c906058d055a6f7c68fe1a6096d78c2e3f642b1c/src/Rammbock/rammbock.py#L68-L72
robotframework/Rammbock
src/Rammbock/rammbock.py
Rammbock.u16
def u16(self, name, value=None, align=None): """Add an unsigned 2 byte integer field to template. This is an convenience method that simply calls `Uint` keyword with predefined length.""" self.uint(2, name, value, align)
python
def u16(self, name, value=None, align=None): """Add an unsigned 2 byte integer field to template. This is an convenience method that simply calls `Uint` keyword with predefined length.""" self.uint(2, name, value, align)
[ "def", "u16", "(", "self", ",", "name", ",", "value", "=", "None", ",", "align", "=", "None", ")", ":", "self", ".", "uint", "(", "2", ",", "name", ",", "value", ",", "align", ")" ]
Add an unsigned 2 byte integer field to template. This is an convenience method that simply calls `Uint` keyword with predefined length.
[ "Add", "an", "unsigned", "2", "byte", "integer", "field", "to", "template", "." ]
train
https://github.com/robotframework/Rammbock/blob/c906058d055a6f7c68fe1a6096d78c2e3f642b1c/src/Rammbock/rammbock.py#L74-L78
robotframework/Rammbock
src/Rammbock/rammbock.py
Rammbock.u24
def u24(self, name, value=None, align=None): """Add an unsigned 3 byte integer field to template. This is an convenience method that simply calls `Uint` keyword with predefined length.""" self.uint(3, name, value, align)
python
def u24(self, name, value=None, align=None): """Add an unsigned 3 byte integer field to template. This is an convenience method that simply calls `Uint` keyword with predefined length.""" self.uint(3, name, value, align)
[ "def", "u24", "(", "self", ",", "name", ",", "value", "=", "None", ",", "align", "=", "None", ")", ":", "self", ".", "uint", "(", "3", ",", "name", ",", "value", ",", "align", ")" ]
Add an unsigned 3 byte integer field to template. This is an convenience method that simply calls `Uint` keyword with predefined length.
[ "Add", "an", "unsigned", "3", "byte", "integer", "field", "to", "template", "." ]
train
https://github.com/robotframework/Rammbock/blob/c906058d055a6f7c68fe1a6096d78c2e3f642b1c/src/Rammbock/rammbock.py#L80-L84
robotframework/Rammbock
src/Rammbock/rammbock.py
Rammbock.u32
def u32(self, name, value=None, align=None): """Add an unsigned 4 byte integer field to template. This is an convenience method that simply calls `Uint` keyword with predefined length.""" self.uint(4, name, value, align)
python
def u32(self, name, value=None, align=None): """Add an unsigned 4 byte integer field to template. This is an convenience method that simply calls `Uint` keyword with predefined length.""" self.uint(4, name, value, align)
[ "def", "u32", "(", "self", ",", "name", ",", "value", "=", "None", ",", "align", "=", "None", ")", ":", "self", ".", "uint", "(", "4", ",", "name", ",", "value", ",", "align", ")" ]
Add an unsigned 4 byte integer field to template. This is an convenience method that simply calls `Uint` keyword with predefined length.
[ "Add", "an", "unsigned", "4", "byte", "integer", "field", "to", "template", "." ]
train
https://github.com/robotframework/Rammbock/blob/c906058d055a6f7c68fe1a6096d78c2e3f642b1c/src/Rammbock/rammbock.py#L86-L90
robotframework/Rammbock
src/Rammbock/rammbock.py
Rammbock.u40
def u40(self, name, value=None, align=None): """Add an unsigned 5 byte integer field to template. This is an convenience method that simply calls `Uint` keyword with predefined length.""" self.uint(5, name, value, align)
python
def u40(self, name, value=None, align=None): """Add an unsigned 5 byte integer field to template. This is an convenience method that simply calls `Uint` keyword with predefined length.""" self.uint(5, name, value, align)
[ "def", "u40", "(", "self", ",", "name", ",", "value", "=", "None", ",", "align", "=", "None", ")", ":", "self", ".", "uint", "(", "5", ",", "name", ",", "value", ",", "align", ")" ]
Add an unsigned 5 byte integer field to template. This is an convenience method that simply calls `Uint` keyword with predefined length.
[ "Add", "an", "unsigned", "5", "byte", "integer", "field", "to", "template", "." ]
train
https://github.com/robotframework/Rammbock/blob/c906058d055a6f7c68fe1a6096d78c2e3f642b1c/src/Rammbock/rammbock.py#L92-L96
robotframework/Rammbock
src/Rammbock/rammbock.py
Rammbock.u64
def u64(self, name, value=None, align=None): """Add an unsigned 8 byte integer field to template. This is an convenience method that simply calls `Uint` keyword with predefined length.""" self.uint(8, name, value, align)
python
def u64(self, name, value=None, align=None): """Add an unsigned 8 byte integer field to template. This is an convenience method that simply calls `Uint` keyword with predefined length.""" self.uint(8, name, value, align)
[ "def", "u64", "(", "self", ",", "name", ",", "value", "=", "None", ",", "align", "=", "None", ")", ":", "self", ".", "uint", "(", "8", ",", "name", ",", "value", ",", "align", ")" ]
Add an unsigned 8 byte integer field to template. This is an convenience method that simply calls `Uint` keyword with predefined length.
[ "Add", "an", "unsigned", "8", "byte", "integer", "field", "to", "template", "." ]
train
https://github.com/robotframework/Rammbock/blob/c906058d055a6f7c68fe1a6096d78c2e3f642b1c/src/Rammbock/rammbock.py#L98-L102
robotframework/Rammbock
src/Rammbock/rammbock.py
Rammbock.u128
def u128(self, name, value=None, align=None): """Add an unsigned 16 byte integer field to template. This is an convenience method that simply calls `Uint` keyword with predefined length.""" self.uint(16, name, value, align)
python
def u128(self, name, value=None, align=None): """Add an unsigned 16 byte integer field to template. This is an convenience method that simply calls `Uint` keyword with predefined length.""" self.uint(16, name, value, align)
[ "def", "u128", "(", "self", ",", "name", ",", "value", "=", "None", ",", "align", "=", "None", ")", ":", "self", ".", "uint", "(", "16", ",", "name", ",", "value", ",", "align", ")" ]
Add an unsigned 16 byte integer field to template. This is an convenience method that simply calls `Uint` keyword with predefined length.
[ "Add", "an", "unsigned", "16", "byte", "integer", "field", "to", "template", "." ]
train
https://github.com/robotframework/Rammbock/blob/c906058d055a6f7c68fe1a6096d78c2e3f642b1c/src/Rammbock/rammbock.py#L104-L108
robotframework/Rammbock
src/Rammbock/rammbock.py
Rammbock.i8
def i8(self, name, value=None, align=None): """Add an 1 byte integer field to template. This is an convenience method that simply calls `Int` keyword with predefined length.""" self.int(1, name, value, align)
python
def i8(self, name, value=None, align=None): """Add an 1 byte integer field to template. This is an convenience method that simply calls `Int` keyword with predefined length.""" self.int(1, name, value, align)
[ "def", "i8", "(", "self", ",", "name", ",", "value", "=", "None", ",", "align", "=", "None", ")", ":", "self", ".", "int", "(", "1", ",", "name", ",", "value", ",", "align", ")" ]
Add an 1 byte integer field to template. This is an convenience method that simply calls `Int` keyword with predefined length.
[ "Add", "an", "1", "byte", "integer", "field", "to", "template", "." ]
train
https://github.com/robotframework/Rammbock/blob/c906058d055a6f7c68fe1a6096d78c2e3f642b1c/src/Rammbock/rammbock.py#L110-L114
robotframework/Rammbock
src/Rammbock/rammbock.py
Rammbock.i32
def i32(self, name, value=None, align=None): """Add an 32 byte integer field to template. This is an convenience method that simply calls `Int` keyword with predefined length.""" self.int(4, name, value, align)
python
def i32(self, name, value=None, align=None): """Add an 32 byte integer field to template. This is an convenience method that simply calls `Int` keyword with predefined length.""" self.int(4, name, value, align)
[ "def", "i32", "(", "self", ",", "name", ",", "value", "=", "None", ",", "align", "=", "None", ")", ":", "self", ".", "int", "(", "4", ",", "name", ",", "value", ",", "align", ")" ]
Add an 32 byte integer field to template. This is an convenience method that simply calls `Int` keyword with predefined length.
[ "Add", "an", "32", "byte", "integer", "field", "to", "template", "." ]
train
https://github.com/robotframework/Rammbock/blob/c906058d055a6f7c68fe1a6096d78c2e3f642b1c/src/Rammbock/rammbock.py#L116-L120
robotframework/Rammbock
src/Rammbock/rammbock.py
Rammbock.array
def array(self, size, type, name, *parameters): """Define a new array of given `size` and containing fields of type `type`. `name` if the name of this array element. The `type` is the name of keyword that is executed as the contents of the array and optional extra parameters are passed as argum...
python
def array(self, size, type, name, *parameters): """Define a new array of given `size` and containing fields of type `type`. `name` if the name of this array element. The `type` is the name of keyword that is executed as the contents of the array and optional extra parameters are passed as argum...
[ "def", "array", "(", "self", ",", "size", ",", "type", ",", "name", ",", "*", "parameters", ")", ":", "self", ".", "_new_list", "(", "size", ",", "name", ")", "BuiltIn", "(", ")", ".", "run_keyword", "(", "type", ",", "''", ",", "*", "parameters", ...
Define a new array of given `size` and containing fields of type `type`. `name` if the name of this array element. The `type` is the name of keyword that is executed as the contents of the array and optional extra parameters are passed as arguments to this keyword. Examples: | Array | ...
[ "Define", "a", "new", "array", "of", "given", "size", "and", "containing", "fields", "of", "type", "type", "." ]
train
https://github.com/robotframework/Rammbock/blob/c906058d055a6f7c68fe1a6096d78c2e3f642b1c/src/Rammbock/rammbock.py#L122-L136
robotframework/Rammbock
src/Rammbock/rammbock.py
Rammbock.container
def container(self, name, length, type, *parameters): """Define a container with given length. This is a convenience method creating a `Struct` with `length` containing fields defined in `type`. """ self.new_struct('Container', name, 'length=%s' % length) BuiltIn().run_keyword(t...
python
def container(self, name, length, type, *parameters): """Define a container with given length. This is a convenience method creating a `Struct` with `length` containing fields defined in `type`. """ self.new_struct('Container', name, 'length=%s' % length) BuiltIn().run_keyword(t...
[ "def", "container", "(", "self", ",", "name", ",", "length", ",", "type", ",", "*", "parameters", ")", ":", "self", ".", "new_struct", "(", "'Container'", ",", "name", ",", "'length=%s'", "%", "length", ")", "BuiltIn", "(", ")", ".", "run_keyword", "("...
Define a container with given length. This is a convenience method creating a `Struct` with `length` containing fields defined in `type`.
[ "Define", "a", "container", "with", "given", "length", "." ]
train
https://github.com/robotframework/Rammbock/blob/c906058d055a6f7c68fe1a6096d78c2e3f642b1c/src/Rammbock/rammbock.py#L138-L145
robotframework/Rammbock
src/Rammbock/rammbock.py
Rammbock.case
def case(self, size, kw, *parameters): """An element inside a bag started with `Start Bag`. The first argument is size which can be absolute value like `1`, a range like `0-3`, or just `*` to accept any number of elements. Examples: | Start bag | intBag | | case | 0-1 |...
python
def case(self, size, kw, *parameters): """An element inside a bag started with `Start Bag`. The first argument is size which can be absolute value like `1`, a range like `0-3`, or just `*` to accept any number of elements. Examples: | Start bag | intBag | | case | 0-1 |...
[ "def", "case", "(", "self", ",", "size", ",", "kw", ",", "*", "parameters", ")", ":", "# TODO: check we are inside a bag!", "self", ".", "_start_bag_case", "(", "size", ")", "BuiltIn", "(", ")", ".", "run_keyword", "(", "kw", ",", "*", "parameters", ")", ...
An element inside a bag started with `Start Bag`. The first argument is size which can be absolute value like `1`, a range like `0-3`, or just `*` to accept any number of elements. Examples: | Start bag | intBag | | case | 0-1 | u8 | foo | 42 | | case | 0-2 | u8 | bar |...
[ "An", "element", "inside", "a", "bag", "started", "with", "Start", "Bag", "." ]
train
https://github.com/robotframework/Rammbock/blob/c906058d055a6f7c68fe1a6096d78c2e3f642b1c/src/Rammbock/rammbock.py#L147-L162
robotframework/Rammbock
src/Rammbock/rammbock.py
Rammbock.embed_seqdiag_sequence
def embed_seqdiag_sequence(self): """Create a message sequence diagram png file to output folder and embed the image to log file. You need to have seqdiag installed to create the sequence diagram. See http://blockdiag.com/en/seqdiag/ """ test_name = BuiltIn().replace_variables('${TEST N...
python
def embed_seqdiag_sequence(self): """Create a message sequence diagram png file to output folder and embed the image to log file. You need to have seqdiag installed to create the sequence diagram. See http://blockdiag.com/en/seqdiag/ """ test_name = BuiltIn().replace_variables('${TEST N...
[ "def", "embed_seqdiag_sequence", "(", "self", ")", ":", "test_name", "=", "BuiltIn", "(", ")", ".", "replace_variables", "(", "'${TEST NAME}'", ")", "outputdir", "=", "BuiltIn", "(", ")", ".", "replace_variables", "(", "'${OUTPUTDIR}'", ")", "path", "=", "os",...
Create a message sequence diagram png file to output folder and embed the image to log file. You need to have seqdiag installed to create the sequence diagram. See http://blockdiag.com/en/seqdiag/
[ "Create", "a", "message", "sequence", "diagram", "png", "file", "to", "output", "folder", "and", "embed", "the", "image", "to", "log", "file", "." ]
train
https://github.com/robotframework/Rammbock/blob/c906058d055a6f7c68fe1a6096d78c2e3f642b1c/src/Rammbock/rammbock.py#L164-L172
T-002/pycast
pycast/errors/symmetricmeanabsolutepercentageerror.py
SymmetricMeanAbsolutePercentageError.local_error
def local_error(self, originalValue, calculatedValue): """Calculates the error between the two given values. :param list originalValue: List containing the values of the original data. :param list calculatedValue: List containing the values of the calculated TimeSeries that co...
python
def local_error(self, originalValue, calculatedValue): """Calculates the error between the two given values. :param list originalValue: List containing the values of the original data. :param list calculatedValue: List containing the values of the calculated TimeSeries that co...
[ "def", "local_error", "(", "self", ",", "originalValue", ",", "calculatedValue", ")", ":", "originalValue", "=", "originalValue", "[", "0", "]", "calculatedValue", "=", "calculatedValue", "[", "0", "]", "# error is zero", "if", "not", "originalValue", "and", "no...
Calculates the error between the two given values. :param list originalValue: List containing the values of the original data. :param list calculatedValue: List containing the values of the calculated TimeSeries that corresponds to originalValue. :return: Returns the error...
[ "Calculates", "the", "error", "between", "the", "two", "given", "values", "." ]
train
https://github.com/T-002/pycast/blob/8a53505c6d8367e0ea572e8af768e80b29e1cc41/pycast/errors/symmetricmeanabsolutepercentageerror.py#L60-L77
UUDigitalHumanitieslab/tei_reader
tei_reader/models/placeholder_division.py
PlaceholderDivision.tostring
def tostring(self, inject): """ Convert an element to a single string and allow the passed inject method to place content before any element. """ injected_parts = '' for part in self.parts: injected = part.tostring(inject) tei_tag = next( ...
python
def tostring(self, inject): """ Convert an element to a single string and allow the passed inject method to place content before any element. """ injected_parts = '' for part in self.parts: injected = part.tostring(inject) tei_tag = next( ...
[ "def", "tostring", "(", "self", ",", "inject", ")", ":", "injected_parts", "=", "''", "for", "part", "in", "self", ".", "parts", ":", "injected", "=", "part", ".", "tostring", "(", "inject", ")", "tei_tag", "=", "next", "(", "(", "attribute", "for", ...
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/placeholder_division.py#L22-L40
Duke-GCB/DukeDSClient
ddsc/ddsclient.py
DDSClient._create_parser
def _create_parser(self): """ Create a parser hooking up the command methods below to be run when chosen. :return: CommandParser parser with commands attached. """ parser = CommandParser(get_internal_version_str()) parser.register_list_command(self._setup_run_command(List...
python
def _create_parser(self): """ Create a parser hooking up the command methods below to be run when chosen. :return: CommandParser parser with commands attached. """ parser = CommandParser(get_internal_version_str()) parser.register_list_command(self._setup_run_command(List...
[ "def", "_create_parser", "(", "self", ")", ":", "parser", "=", "CommandParser", "(", "get_internal_version_str", "(", ")", ")", "parser", ".", "register_list_command", "(", "self", ".", "_setup_run_command", "(", "ListCommand", ")", ")", "parser", ".", "register...
Create a parser hooking up the command methods below to be run when chosen. :return: CommandParser parser with commands attached.
[ "Create", "a", "parser", "hooking", "up", "the", "command", "methods", "below", "to", "be", "run", "when", "chosen", ".", ":", "return", ":", "CommandParser", "parser", "with", "commands", "attached", "." ]
train
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/ddsclient.py#L36-L51
Duke-GCB/DukeDSClient
ddsc/ddsclient.py
DDSClient._check_pypi_version
def _check_pypi_version(self): """ When the version is out of date or we have trouble retrieving it print a error to stderr and pause. """ try: check_version() except VersionException as err: print(str(err), file=sys.stderr) time.sleep(TWO_SECO...
python
def _check_pypi_version(self): """ When the version is out of date or we have trouble retrieving it print a error to stderr and pause. """ try: check_version() except VersionException as err: print(str(err), file=sys.stderr) time.sleep(TWO_SECO...
[ "def", "_check_pypi_version", "(", "self", ")", ":", "try", ":", "check_version", "(", ")", "except", "VersionException", "as", "err", ":", "print", "(", "str", "(", "err", ")", ",", "file", "=", "sys", ".", "stderr", ")", "time", ".", "sleep", "(", ...
When the version is out of date or we have trouble retrieving it print a error to stderr and pause.
[ "When", "the", "version", "is", "out", "of", "date", "or", "we", "have", "trouble", "retrieving", "it", "print", "a", "error", "to", "stderr", "and", "pause", "." ]
train
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/ddsclient.py#L63-L71
Duke-GCB/DukeDSClient
ddsc/ddsclient.py
DDSClient._run_command
def _run_command(self, command_constructor, args): """ Run command_constructor and call run(args) on the resulting object :param command_constructor: class of an object that implements run(args) :param args: object arguments for specific command created by CommandParser """ ...
python
def _run_command(self, command_constructor, args): """ Run command_constructor and call run(args) on the resulting object :param command_constructor: class of an object that implements run(args) :param args: object arguments for specific command created by CommandParser """ ...
[ "def", "_run_command", "(", "self", ",", "command_constructor", ",", "args", ")", ":", "verify_terminal_encoding", "(", "sys", ".", "stdout", ".", "encoding", ")", "self", ".", "_check_pypi_version", "(", ")", "config", "=", "create_config", "(", "allow_insecure...
Run command_constructor and call run(args) on the resulting object :param command_constructor: class of an object that implements run(args) :param args: object arguments for specific command created by CommandParser
[ "Run", "command_constructor", "and", "call", "run", "(", "args", ")", "on", "the", "resulting", "object", ":", "param", "command_constructor", ":", "class", "of", "an", "object", "that", "implements", "run", "(", "args", ")", ":", "param", "args", ":", "ob...
train
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/ddsclient.py#L73-L84
Duke-GCB/DukeDSClient
ddsc/ddsclient.py
BaseCommand.make_user_list
def make_user_list(self, emails, usernames): """ Given a list of emails and usernames fetch DukeDS user info. Parameters that are None will be skipped. :param emails: [str]: list of emails (can be null) :param usernames: [str]: list of usernames(netid) :return: [RemoteUs...
python
def make_user_list(self, emails, usernames): """ Given a list of emails and usernames fetch DukeDS user info. Parameters that are None will be skipped. :param emails: [str]: list of emails (can be null) :param usernames: [str]: list of usernames(netid) :return: [RemoteUs...
[ "def", "make_user_list", "(", "self", ",", "emails", ",", "usernames", ")", ":", "to_users", "=", "[", "]", "remaining_emails", "=", "[", "]", "if", "not", "emails", "else", "list", "(", "emails", ")", "remaining_usernames", "=", "[", "]", "if", "not", ...
Given a list of emails and usernames fetch DukeDS user info. Parameters that are None will be skipped. :param emails: [str]: list of emails (can be null) :param usernames: [str]: list of usernames(netid) :return: [RemoteUser]: details about any users referenced the two parameters
[ "Given", "a", "list", "of", "emails", "and", "usernames", "fetch", "DukeDS", "user", "info", ".", "Parameters", "that", "are", "None", "will", "be", "skipped", ".", ":", "param", "emails", ":", "[", "str", "]", ":", "list", "of", "emails", "(", "can", ...
train
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/ddsclient.py#L117-L139
Duke-GCB/DukeDSClient
ddsc/ddsclient.py
UploadCommand.run
def run(self, args): """ Upload contents of folders to a project with project_name on remote store. If follow_symlinks we will traverse symlinked directories. If content is already on remote site it will not be sent. :param args: Namespace arguments parsed from the command line. ...
python
def run(self, args): """ Upload contents of folders to a project with project_name on remote store. If follow_symlinks we will traverse symlinked directories. If content is already on remote site it will not be sent. :param args: Namespace arguments parsed from the command line. ...
[ "def", "run", "(", "self", ",", "args", ")", ":", "project_name_or_id", "=", "self", ".", "create_project_name_or_id_from_args", "(", "args", ")", "folders", "=", "args", ".", "folders", "# list of local files/folders to upload into the project", "follow_symlinks", "=",...
Upload contents of folders to a project with project_name on remote store. If follow_symlinks we will traverse symlinked directories. If content is already on remote site it will not be sent. :param args: Namespace arguments parsed from the command line.
[ "Upload", "contents", "of", "folders", "to", "a", "project", "with", "project_name", "on", "remote", "store", ".", "If", "follow_symlinks", "we", "will", "traverse", "symlinked", "directories", ".", "If", "content", "is", "already", "on", "remote", "site", "it...
train
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/ddsclient.py#L153-L175
Duke-GCB/DukeDSClient
ddsc/ddsclient.py
DownloadCommand.run
def run(self, args): """ Download a project based on passed in args. :param args: Namespace arguments parsed from the command line. """ project_name_or_id = self.create_project_name_or_id_from_args(args) folder = args.folder # path to a folder to download d...
python
def run(self, args): """ Download a project based on passed in args. :param args: Namespace arguments parsed from the command line. """ project_name_or_id = self.create_project_name_or_id_from_args(args) folder = args.folder # path to a folder to download d...
[ "def", "run", "(", "self", ",", "args", ")", ":", "project_name_or_id", "=", "self", ".", "create_project_name_or_id_from_args", "(", "args", ")", "folder", "=", "args", ".", "folder", "# path to a folder to download data into", "# Default to project name with spaces repl...
Download a project based on passed in args. :param args: Namespace arguments parsed from the command line.
[ "Download", "a", "project", "based", "on", "passed", "in", "args", ".", ":", "param", "args", ":", "Namespace", "arguments", "parsed", "from", "the", "command", "line", "." ]
train
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/ddsclient.py#L189-L203
Duke-GCB/DukeDSClient
ddsc/ddsclient.py
AddUserCommand.run
def run(self, args): """ Give the user with user_full_name the auth_role permissions on the remote project with project_name. :param args Namespace arguments parsed from the command line """ email = args.email # email of person to give permissions, will be None i...
python
def run(self, args): """ Give the user with user_full_name the auth_role permissions on the remote project with project_name. :param args Namespace arguments parsed from the command line """ email = args.email # email of person to give permissions, will be None i...
[ "def", "run", "(", "self", ",", "args", ")", ":", "email", "=", "args", ".", "email", "# email of person to give permissions, will be None if username is specified", "username", "=", "args", ".", "username", "# username of person to give permissions, will be None if email is sp...
Give the user with user_full_name the auth_role permissions on the remote project with project_name. :param args Namespace arguments parsed from the command line
[ "Give", "the", "user", "with", "user_full_name", "the", "auth_role", "permissions", "on", "the", "remote", "project", "with", "project_name", ".", ":", "param", "args", "Namespace", "arguments", "parsed", "from", "the", "command", "line" ]
train
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/ddsclient.py#L217-L228
Duke-GCB/DukeDSClient
ddsc/ddsclient.py
RemoveUserCommand.run
def run(self, args): """ Remove permissions from the user with user_full_name or email on the remote project with project_name. :param args Namespace arguments parsed from the command line """ email = args.email # email of person to remove permissions from (None if...
python
def run(self, args): """ Remove permissions from the user with user_full_name or email on the remote project with project_name. :param args Namespace arguments parsed from the command line """ email = args.email # email of person to remove permissions from (None if...
[ "def", "run", "(", "self", ",", "args", ")", ":", "email", "=", "args", ".", "email", "# email of person to remove permissions from (None if username specified)", "username", "=", "args", ".", "username", "# username of person to remove permissions from (None if email is specif...
Remove permissions from the user with user_full_name or email on the remote project with project_name. :param args Namespace arguments parsed from the command line
[ "Remove", "permissions", "from", "the", "user", "with", "user_full_name", "or", "email", "on", "the", "remote", "project", "with", "project_name", ".", ":", "param", "args", "Namespace", "arguments", "parsed", "from", "the", "command", "line" ]
train
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/ddsclient.py#L242-L252
Duke-GCB/DukeDSClient
ddsc/ddsclient.py
ShareCommand.run
def run(self, args): """ Gives user permission based on auth_role arg and sends email to that user. :param args Namespace arguments parsed from the command line """ email = args.email # email of person to send email to username = args.username ...
python
def run(self, args): """ Gives user permission based on auth_role arg and sends email to that user. :param args Namespace arguments parsed from the command line """ email = args.email # email of person to send email to username = args.username ...
[ "def", "run", "(", "self", ",", "args", ")", ":", "email", "=", "args", ".", "email", "# email of person to send email to", "username", "=", "args", ".", "username", "# username of person to send email to, will be None if email is specified", "force_send", "=", "args", ...
Gives user permission based on auth_role arg and sends email to that user. :param args Namespace arguments parsed from the command line
[ "Gives", "user", "permission", "based", "on", "auth_role", "arg", "and", "sends", "email", "to", "that", "user", ".", ":", "param", "args", "Namespace", "arguments", "parsed", "from", "the", "command", "line" ]
train
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/ddsclient.py#L267-L288
Duke-GCB/DukeDSClient
ddsc/ddsclient.py
DeliverCommand.run
def run(self, args): """ Begins process that will transfer the project to another user. Send delivery message to D4S2 service specifying a project and a user. When user accepts delivery they receive access and we lose admin privileges. :param args Namespace arguments parsed from ...
python
def run(self, args): """ Begins process that will transfer the project to another user. Send delivery message to D4S2 service specifying a project and a user. When user accepts delivery they receive access and we lose admin privileges. :param args Namespace arguments parsed from ...
[ "def", "run", "(", "self", ",", "args", ")", ":", "email", "=", "args", ".", "email", "# email of person to deliver to, will be None if username is specified", "username", "=", "args", ".", "username", "# username of person to deliver to, will be None if email is specified", ...
Begins process that will transfer the project to another user. Send delivery message to D4S2 service specifying a project and a user. When user accepts delivery they receive access and we lose admin privileges. :param args Namespace arguments parsed from the command line
[ "Begins", "process", "that", "will", "transfer", "the", "project", "to", "another", "user", ".", "Send", "delivery", "message", "to", "D4S2", "service", "specifying", "a", "project", "and", "a", "user", ".", "When", "user", "accepts", "delivery", "they", "re...
train
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/ddsclient.py#L303-L334
Duke-GCB/DukeDSClient
ddsc/ddsclient.py
DeliverCommand.get_new_project_name
def get_new_project_name(self, project_name): """ Return a unique project name for the copy. :param project_name: str: name of project we will copy :return: str """ timestamp_str = datetime.datetime.utcnow().strftime('%Y-%m-%d %H:%M') return "{} {}".format(project...
python
def get_new_project_name(self, project_name): """ Return a unique project name for the copy. :param project_name: str: name of project we will copy :return: str """ timestamp_str = datetime.datetime.utcnow().strftime('%Y-%m-%d %H:%M') return "{} {}".format(project...
[ "def", "get_new_project_name", "(", "self", ",", "project_name", ")", ":", "timestamp_str", "=", "datetime", ".", "datetime", ".", "utcnow", "(", ")", ".", "strftime", "(", "'%Y-%m-%d %H:%M'", ")", "return", "\"{} {}\"", ".", "format", "(", "project_name", ","...
Return a unique project name for the copy. :param project_name: str: name of project we will copy :return: str
[ "Return", "a", "unique", "project", "name", "for", "the", "copy", ".", ":", "param", "project_name", ":", "str", ":", "name", "of", "project", "we", "will", "copy", ":", "return", ":", "str" ]
train
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/ddsclient.py#L336-L343
Duke-GCB/DukeDSClient
ddsc/ddsclient.py
ListCommand.run
def run(self, args): """ Lists project names. :param args Namespace arguments parsed from the command line """ long_format = args.long_format # project_name and auth_role args are mutually exclusive if args.project_name or args.project_id: project = se...
python
def run(self, args): """ Lists project names. :param args Namespace arguments parsed from the command line """ long_format = args.long_format # project_name and auth_role args are mutually exclusive if args.project_name or args.project_id: project = se...
[ "def", "run", "(", "self", ",", "args", ")", ":", "long_format", "=", "args", ".", "long_format", "# project_name and auth_role args are mutually exclusive", "if", "args", ".", "project_name", "or", "args", ".", "project_id", ":", "project", "=", "self", ".", "f...
Lists project names. :param args Namespace arguments parsed from the command line
[ "Lists", "project", "names", ".", ":", "param", "args", "Namespace", "arguments", "parsed", "from", "the", "command", "line" ]
train
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/ddsclient.py#L358-L369
Duke-GCB/DukeDSClient
ddsc/ddsclient.py
ListCommand.print_project_list_details
def print_project_list_details(self, filter_auth_role, long_format): """ Prints project names to stdout for all projects or just those with the specified auth_role :param filter_auth_role: str: optional auth_role to filter project list """ if filter_auth_role: project...
python
def print_project_list_details(self, filter_auth_role, long_format): """ Prints project names to stdout for all projects or just those with the specified auth_role :param filter_auth_role: str: optional auth_role to filter project list """ if filter_auth_role: project...
[ "def", "print_project_list_details", "(", "self", ",", "filter_auth_role", ",", "long_format", ")", ":", "if", "filter_auth_role", ":", "projects_details", "=", "self", ".", "remote_store", ".", "get_projects_with_auth_role", "(", "auth_role", "=", "filter_auth_role", ...
Prints project names to stdout for all projects or just those with the specified auth_role :param filter_auth_role: str: optional auth_role to filter project list
[ "Prints", "project", "names", "to", "stdout", "for", "all", "projects", "or", "just", "those", "with", "the", "specified", "auth_role", ":", "param", "filter_auth_role", ":", "str", ":", "optional", "auth_role", "to", "filter", "project", "list" ]
train
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/ddsclient.py#L378-L391
Duke-GCB/DukeDSClient
ddsc/ddsclient.py
DeleteCommand.run
def run(self, args): """ Deletes a single project specified by project_name in args. :param args Namespace arguments parsed from the command line """ project = self.fetch_project(args, must_exist=True, include_children=False) if not args.force: delete_prompt =...
python
def run(self, args): """ Deletes a single project specified by project_name in args. :param args Namespace arguments parsed from the command line """ project = self.fetch_project(args, must_exist=True, include_children=False) if not args.force: delete_prompt =...
[ "def", "run", "(", "self", ",", "args", ")", ":", "project", "=", "self", ".", "fetch_project", "(", "args", ",", "must_exist", "=", "True", ",", "include_children", "=", "False", ")", "if", "not", "args", ".", "force", ":", "delete_prompt", "=", "\"Ar...
Deletes a single project specified by project_name in args. :param args Namespace arguments parsed from the command line
[ "Deletes", "a", "single", "project", "specified", "by", "project_name", "in", "args", ".", ":", "param", "args", "Namespace", "arguments", "parsed", "from", "the", "command", "line" ]
train
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/ddsclient.py#L413-L423
Duke-GCB/DukeDSClient
ddsc/ddsclient.py
ListAuthRolesCommand.run
def run(self, args): """ Prints out non deprecated project-type auth roles. :param args Namespace arguments parsed from the command line """ auth_roles = self.remote_store.get_active_auth_roles(RemoteAuthRole.PROJECT_CONTEXT) if auth_roles: for auth_role in au...
python
def run(self, args): """ Prints out non deprecated project-type auth roles. :param args Namespace arguments parsed from the command line """ auth_roles = self.remote_store.get_active_auth_roles(RemoteAuthRole.PROJECT_CONTEXT) if auth_roles: for auth_role in au...
[ "def", "run", "(", "self", ",", "args", ")", ":", "auth_roles", "=", "self", ".", "remote_store", ".", "get_active_auth_roles", "(", "RemoteAuthRole", ".", "PROJECT_CONTEXT", ")", "if", "auth_roles", ":", "for", "auth_role", "in", "auth_roles", ":", "print", ...
Prints out non deprecated project-type auth roles. :param args Namespace arguments parsed from the command line
[ "Prints", "out", "non", "deprecated", "project", "-", "type", "auth", "roles", ".", ":", "param", "args", "Namespace", "arguments", "parsed", "from", "the", "command", "line" ]
train
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/ddsclient.py#L438-L448
twisted/txaws
txaws/client/ssl.py
get_ca_certs
def get_ca_certs(environ=os.environ): """ Retrieve a list of CAs at either the DEFAULT_CERTS_PATH or the env override, TXAWS_CERTS_PATH. In order to find .pem files, this function checks first for presence of the TXAWS_CERTS_PATH environment variable that should point to a directory containing ...
python
def get_ca_certs(environ=os.environ): """ Retrieve a list of CAs at either the DEFAULT_CERTS_PATH or the env override, TXAWS_CERTS_PATH. In order to find .pem files, this function checks first for presence of the TXAWS_CERTS_PATH environment variable that should point to a directory containing ...
[ "def", "get_ca_certs", "(", "environ", "=", "os", ".", "environ", ")", ":", "cert_paths", "=", "environ", ".", "get", "(", "\"TXAWS_CERTS_PATH\"", ",", "DEFAULT_CERTS_PATH", ")", ".", "split", "(", "\":\"", ")", "certificate_authority_map", "=", "{", "}", "f...
Retrieve a list of CAs at either the DEFAULT_CERTS_PATH or the env override, TXAWS_CERTS_PATH. In order to find .pem files, this function checks first for presence of the TXAWS_CERTS_PATH environment variable that should point to a directory containing cert files. In the absense of this variable, the m...
[ "Retrieve", "a", "list", "of", "CAs", "at", "either", "the", "DEFAULT_CERTS_PATH", "or", "the", "env", "override", "TXAWS_CERTS_PATH", "." ]
train
https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/client/ssl.py#L86-L119
T-002/pycast
pycast/errors/geometricmeanabsolutepercentageerror.py
GeometricMeanAbsolutePercentageError._calculate
def _calculate(self, startingPercentage, endPercentage, startDate, endDate): """This is the error calculation function that gets called by :py:meth:`BaseErrorMeasure.get_error`. Both parameters will be correct at this time. :param float startingPercentage: Defines the start of the interval. Th...
python
def _calculate(self, startingPercentage, endPercentage, startDate, endDate): """This is the error calculation function that gets called by :py:meth:`BaseErrorMeasure.get_error`. Both parameters will be correct at this time. :param float startingPercentage: Defines the start of the interval. Th...
[ "def", "_calculate", "(", "self", ",", "startingPercentage", ",", "endPercentage", ",", "startDate", ",", "endDate", ")", ":", "# get the defined subset of error values", "errorValues", "=", "self", ".", "_get_error_values", "(", "startingPercentage", ",", "endPercentag...
This is the error calculation function that gets called by :py:meth:`BaseErrorMeasure.get_error`. 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 err...
[ "This", "is", "the", "error", "calculation", "function", "that", "gets", "called", "by", ":", "py", ":", "meth", ":", "BaseErrorMeasure", ".", "get_error", "." ]
train
https://github.com/T-002/pycast/blob/8a53505c6d8367e0ea572e8af768e80b29e1cc41/pycast/errors/geometricmeanabsolutepercentageerror.py#L31-L65
twisted/txaws
txaws/util.py
iso8601time
def iso8601time(time_tuple): """Format time_tuple as a ISO8601 time string. :param time_tuple: Either None, to use the current time, or a tuple tuple. """ if time_tuple: return time.strftime("%Y-%m-%dT%H:%M:%SZ", time_tuple) else: return time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmti...
python
def iso8601time(time_tuple): """Format time_tuple as a ISO8601 time string. :param time_tuple: Either None, to use the current time, or a tuple tuple. """ if time_tuple: return time.strftime("%Y-%m-%dT%H:%M:%SZ", time_tuple) else: return time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmti...
[ "def", "iso8601time", "(", "time_tuple", ")", ":", "if", "time_tuple", ":", "return", "time", ".", "strftime", "(", "\"%Y-%m-%dT%H:%M:%SZ\"", ",", "time_tuple", ")", "else", ":", "return", "time", ".", "strftime", "(", "\"%Y-%m-%dT%H:%M:%SZ\"", ",", "time", "....
Format time_tuple as a ISO8601 time string. :param time_tuple: Either None, to use the current time, or a tuple tuple.
[ "Format", "time_tuple", "as", "a", "ISO8601", "time", "string", "." ]
train
https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/util.py#L39-L47
twisted/txaws
txaws/util.py
parse
def parse(url, defaultPort=True): """ Split the given URL into the scheme, host, port, and path. @type url: C{str} @param url: An URL to parse. @type defaultPort: C{bool} @param defaultPort: Whether to return the default port associated with the scheme in the given url, when the url do...
python
def parse(url, defaultPort=True): """ Split the given URL into the scheme, host, port, and path. @type url: C{str} @param url: An URL to parse. @type defaultPort: C{bool} @param defaultPort: Whether to return the default port associated with the scheme in the given url, when the url do...
[ "def", "parse", "(", "url", ",", "defaultPort", "=", "True", ")", ":", "url", "=", "url", ".", "strip", "(", ")", "parsed", "=", "urlparse", "(", "url", ")", "scheme", "=", "parsed", "[", "0", "]", "path", "=", "urlunparse", "(", "(", "\"\"", ","...
Split the given URL into the scheme, host, port, and path. @type url: C{str} @param url: An URL to parse. @type defaultPort: C{bool} @param defaultPort: Whether to return the default port associated with the scheme in the given url, when the url doesn't specify one. @return: A four-tuple ...
[ "Split", "the", "given", "URL", "into", "the", "scheme", "host", "port", "and", "path", "." ]
train
https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/util.py#L64-L103
UUDigitalHumanitieslab/tei_reader
tei_reader/models/corpora.py
Corpora.tostring
def tostring(self, inject): """Get the entire text content as str""" return inject(self, '\n'.join(document.tostring(inject) for document in self.documents))
python
def tostring(self, inject): """Get the entire text content as str""" return inject(self, '\n'.join(document.tostring(inject) for document in self.documents))
[ "def", "tostring", "(", "self", ",", "inject", ")", ":", "return", "inject", "(", "self", ",", "'\\n'", ".", "join", "(", "document", ".", "tostring", "(", "inject", ")", "for", "document", "in", "self", ".", "documents", ")", ")" ]
Get the entire text content as str
[ "Get", "the", "entire", "text", "content", "as", "str" ]
train
https://github.com/UUDigitalHumanitieslab/tei_reader/blob/7b19c34a9d7cc941a36ecdcf6f361e26c6488697/tei_reader/models/corpora.py#L20-L22
Duke-GCB/DukeDSClient
ddsc/core/ddsapi.py
retry_when_service_down
def retry_when_service_down(func): """ Decorator that will retry a function while it fails with status code 503 Assumes the first argument to the fuction will be an object with a set_status_message method. :param func: function: will be called until it doesn't fail with DataServiceError status 503 :...
python
def retry_when_service_down(func): """ Decorator that will retry a function while it fails with status code 503 Assumes the first argument to the fuction will be an object with a set_status_message method. :param func: function: will be called until it doesn't fail with DataServiceError status 503 :...
[ "def", "retry_when_service_down", "(", "func", ")", ":", "def", "retry_function", "(", "*", "args", ",", "*", "*", "kwds", ")", ":", "showed_status_msg", "=", "False", "status_watcher", "=", "args", "[", "0", "]", "while", "True", ":", "try", ":", "resul...
Decorator that will retry a function while it fails with status code 503 Assumes the first argument to the fuction will be an object with a set_status_message method. :param func: function: will be called until it doesn't fail with DataServiceError status 503 :return: value returned by func
[ "Decorator", "that", "will", "retry", "a", "function", "while", "it", "fails", "with", "status", "code", "503", "Assumes", "the", "first", "argument", "to", "the", "fuction", "will", "be", "an", "object", "with", "a", "set_status_message", "method", ".", ":"...
train
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/ddsapi.py#L29-L54
Duke-GCB/DukeDSClient
ddsc/core/ddsapi.py
retry_until_resource_is_consistent
def retry_until_resource_is_consistent(func, monitor): """ Runs func, if func raises DSResourceNotConsistentError will retry func indefinitely. Notifies monitor if we have to wait(only happens if DukeDS API raises DSResourceNotConsistentError. :param func: func(): function to run :param monitor: obj...
python
def retry_until_resource_is_consistent(func, monitor): """ Runs func, if func raises DSResourceNotConsistentError will retry func indefinitely. Notifies monitor if we have to wait(only happens if DukeDS API raises DSResourceNotConsistentError. :param func: func(): function to run :param monitor: obj...
[ "def", "retry_until_resource_is_consistent", "(", "func", ",", "monitor", ")", ":", "waiting", "=", "False", "while", "True", ":", "try", ":", "resp", "=", "func", "(", ")", "if", "waiting", "and", "monitor", ":", "monitor", ".", "done_waiting", "(", ")", ...
Runs func, if func raises DSResourceNotConsistentError will retry func indefinitely. Notifies monitor if we have to wait(only happens if DukeDS API raises DSResourceNotConsistentError. :param func: func(): function to run :param monitor: object: has start_waiting() and done_waiting() methods when waiting fo...
[ "Runs", "func", "if", "func", "raises", "DSResourceNotConsistentError", "will", "retry", "func", "indefinitely", ".", "Notifies", "monitor", "if", "we", "have", "to", "wait", "(", "only", "happens", "if", "DukeDS", "API", "raises", "DSResourceNotConsistentError", ...
train
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/ddsapi.py#L1114-L1133
Duke-GCB/DukeDSClient
ddsc/core/ddsapi.py
DataServiceAuth.get_auth
def get_auth(self): """ Gets an active token refreshing it if necessary. :return: str valid active authentication token. """ if self.legacy_auth(): return self._auth if not self.auth_expired(): return self._auth self.claim_new_token() ...
python
def get_auth(self): """ Gets an active token refreshing it if necessary. :return: str valid active authentication token. """ if self.legacy_auth(): return self._auth if not self.auth_expired(): return self._auth self.claim_new_token() ...
[ "def", "get_auth", "(", "self", ")", ":", "if", "self", ".", "legacy_auth", "(", ")", ":", "return", "self", ".", "_auth", "if", "not", "self", ".", "auth_expired", "(", ")", ":", "return", "self", ".", "_auth", "self", ".", "claim_new_token", "(", "...
Gets an active token refreshing it if necessary. :return: str valid active authentication token.
[ "Gets", "an", "active", "token", "refreshing", "it", "if", "necessary", ".", ":", "return", ":", "str", "valid", "active", "authentication", "token", "." ]
train
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/ddsapi.py#L81-L91
Duke-GCB/DukeDSClient
ddsc/core/ddsapi.py
DataServiceAuth.claim_new_token
def claim_new_token(self): """ Update internal state to have a new token using a no authorization data service. """ # Intentionally doing this manually so we don't have a chicken and egg problem with DataServiceApi. headers = { 'Content-Type': ContentType.json, ...
python
def claim_new_token(self): """ Update internal state to have a new token using a no authorization data service. """ # Intentionally doing this manually so we don't have a chicken and egg problem with DataServiceApi. headers = { 'Content-Type': ContentType.json, ...
[ "def", "claim_new_token", "(", "self", ")", ":", "# Intentionally doing this manually so we don't have a chicken and egg problem with DataServiceApi.", "headers", "=", "{", "'Content-Type'", ":", "ContentType", ".", "json", ",", "'User-Agent'", ":", "self", ".", "user_agent_s...
Update internal state to have a new token using a no authorization data service.
[ "Update", "internal", "state", "to", "have", "a", "new", "token", "using", "a", "no", "authorization", "data", "service", "." ]
train
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/ddsapi.py#L94-L121
Duke-GCB/DukeDSClient
ddsc/core/ddsapi.py
DataServiceAuth.auth_expired
def auth_expired(self): """ Compare the expiration value of our current token including a CLOCK_SKEW. :return: true if the token has expired """ if self._auth and self._expires: now_with_skew = time.time() + AUTH_TOKEN_CLOCK_SKEW_MAX return now_with_skew >...
python
def auth_expired(self): """ Compare the expiration value of our current token including a CLOCK_SKEW. :return: true if the token has expired """ if self._auth and self._expires: now_with_skew = time.time() + AUTH_TOKEN_CLOCK_SKEW_MAX return now_with_skew >...
[ "def", "auth_expired", "(", "self", ")", ":", "if", "self", ".", "_auth", "and", "self", ".", "_expires", ":", "now_with_skew", "=", "time", ".", "time", "(", ")", "+", "AUTH_TOKEN_CLOCK_SKEW_MAX", "return", "now_with_skew", ">", "self", ".", "_expires", "...
Compare the expiration value of our current token including a CLOCK_SKEW. :return: true if the token has expired
[ "Compare", "the", "expiration", "value", "of", "our", "current", "token", "including", "a", "CLOCK_SKEW", ".", ":", "return", ":", "true", "if", "the", "token", "has", "expired" ]
train
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/ddsapi.py#L145-L153
Duke-GCB/DukeDSClient
ddsc/core/ddsapi.py
DataServiceApi._url_parts
def _url_parts(self, url_suffix, data, content_type): """ Format the url data based on config_type. :param url_suffix: str URL path we are sending a GET/POST/PUT to :param data: object data we are sending :param content_type: str from ContentType that determines how we format the...
python
def _url_parts(self, url_suffix, data, content_type): """ Format the url data based on config_type. :param url_suffix: str URL path we are sending a GET/POST/PUT to :param data: object data we are sending :param content_type: str from ContentType that determines how we format the...
[ "def", "_url_parts", "(", "self", ",", "url_suffix", ",", "data", ",", "content_type", ")", ":", "url", "=", "self", ".", "base_url", "+", "url_suffix", "send_data", "=", "data", "if", "content_type", "==", "ContentType", ".", "json", ":", "send_data", "="...
Format the url data based on config_type. :param url_suffix: str URL path we are sending a GET/POST/PUT to :param data: object data we are sending :param content_type: str from ContentType that determines how we format the data :return: complete url, formatted data, and headers for sendi...
[ "Format", "the", "url", "data", "based", "on", "config_type", ".", ":", "param", "url_suffix", ":", "str", "URL", "path", "we", "are", "sending", "a", "GET", "/", "POST", "/", "PUT", "to", ":", "param", "data", ":", "object", "data", "we", "are", "se...
train
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/ddsapi.py#L220-L238
Duke-GCB/DukeDSClient
ddsc/core/ddsapi.py
DataServiceApi._post
def _post(self, url_suffix, data, content_type=ContentType.json): """ Send POST request to API at url_suffix with post_data. Raises error if x-total-pages is contained in the response. :param url_suffix: str URL path we are sending a POST to :param data: object data we are sendin...
python
def _post(self, url_suffix, data, content_type=ContentType.json): """ Send POST request to API at url_suffix with post_data. Raises error if x-total-pages is contained in the response. :param url_suffix: str URL path we are sending a POST to :param data: object data we are sendin...
[ "def", "_post", "(", "self", ",", "url_suffix", ",", "data", ",", "content_type", "=", "ContentType", ".", "json", ")", ":", "(", "url", ",", "data_str", ",", "headers", ")", "=", "self", ".", "_url_parts", "(", "url_suffix", ",", "data", ",", "content...
Send POST request to API at url_suffix with post_data. Raises error if x-total-pages is contained in the response. :param url_suffix: str URL path we are sending a POST to :param data: object data we are sending :param content_type: str from ContentType that determines how we format the ...
[ "Send", "POST", "request", "to", "API", "at", "url_suffix", "with", "post_data", ".", "Raises", "error", "if", "x", "-", "total", "-", "pages", "is", "contained", "in", "the", "response", ".", ":", "param", "url_suffix", ":", "str", "URL", "path", "we", ...
train
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/ddsapi.py#L241-L252
Duke-GCB/DukeDSClient
ddsc/core/ddsapi.py
DataServiceApi._put
def _put(self, url_suffix, data, content_type=ContentType.json): """ Send PUT request to API at url_suffix with post_data. Raises error if x-total-pages is contained in the response. :param url_suffix: str URL path we are sending a PUT to :param data: object data we are sending ...
python
def _put(self, url_suffix, data, content_type=ContentType.json): """ Send PUT request to API at url_suffix with post_data. Raises error if x-total-pages is contained in the response. :param url_suffix: str URL path we are sending a PUT to :param data: object data we are sending ...
[ "def", "_put", "(", "self", ",", "url_suffix", ",", "data", ",", "content_type", "=", "ContentType", ".", "json", ")", ":", "(", "url", ",", "data_str", ",", "headers", ")", "=", "self", ".", "_url_parts", "(", "url_suffix", ",", "data", ",", "content_...
Send PUT request to API at url_suffix with post_data. Raises error if x-total-pages is contained in the response. :param url_suffix: str URL path we are sending a PUT to :param data: object data we are sending :param content_type: str from ContentType that determines how we format the da...
[ "Send", "PUT", "request", "to", "API", "at", "url_suffix", "with", "post_data", ".", "Raises", "error", "if", "x", "-", "total", "-", "pages", "is", "contained", "in", "the", "response", ".", ":", "param", "url_suffix", ":", "str", "URL", "path", "we", ...
train
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/ddsapi.py#L255-L266
Duke-GCB/DukeDSClient
ddsc/core/ddsapi.py
DataServiceApi._get_single_item
def _get_single_item(self, url_suffix, data, content_type=ContentType.json): """ Send GET request to API at url_suffix with post_data. Raises error if x-total-pages is contained in the response. :param url_suffix: str URL path we are sending a GET to :param url_data: object data ...
python
def _get_single_item(self, url_suffix, data, content_type=ContentType.json): """ Send GET request to API at url_suffix with post_data. Raises error if x-total-pages is contained in the response. :param url_suffix: str URL path we are sending a GET to :param url_data: object data ...
[ "def", "_get_single_item", "(", "self", ",", "url_suffix", ",", "data", ",", "content_type", "=", "ContentType", ".", "json", ")", ":", "(", "url", ",", "data_str", ",", "headers", ")", "=", "self", ".", "_url_parts", "(", "url_suffix", ",", "data", ",",...
Send GET request to API at url_suffix with post_data. Raises error if x-total-pages is contained in the response. :param url_suffix: str URL path we are sending a GET to :param url_data: object data we are sending :param content_type: str from ContentType that determines how we format th...
[ "Send", "GET", "request", "to", "API", "at", "url_suffix", "with", "post_data", ".", "Raises", "error", "if", "x", "-", "total", "-", "pages", "is", "contained", "in", "the", "response", ".", ":", "param", "url_suffix", ":", "str", "URL", "path", "we", ...
train
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/ddsapi.py#L269-L280
Duke-GCB/DukeDSClient
ddsc/core/ddsapi.py
DataServiceApi._get_single_page
def _get_single_page(self, url_suffix, data, page_num): """ Send GET request to API at url_suffix with post_data adding page and per_page parameters to retrieve a single page. Page size is determined by config.page_size. :param url_suffix: str URL path we are sending a GET to :pa...
python
def _get_single_page(self, url_suffix, data, page_num): """ Send GET request to API at url_suffix with post_data adding page and per_page parameters to retrieve a single page. Page size is determined by config.page_size. :param url_suffix: str URL path we are sending a GET to :pa...
[ "def", "_get_single_page", "(", "self", ",", "url_suffix", ",", "data", ",", "page_num", ")", ":", "data_with_per_page", "=", "dict", "(", "data", ")", "data_with_per_page", "[", "'page'", "]", "=", "page_num", "data_with_per_page", "[", "'per_page'", "]", "="...
Send GET request to API at url_suffix with post_data adding page and per_page parameters to retrieve a single page. Page size is determined by config.page_size. :param url_suffix: str URL path we are sending a GET to :param data: object data we are sending :param page_num: int: page numb...
[ "Send", "GET", "request", "to", "API", "at", "url_suffix", "with", "post_data", "adding", "page", "and", "per_page", "parameters", "to", "retrieve", "a", "single", "page", ".", "Page", "size", "is", "determined", "by", "config", ".", "page_size", ".", ":", ...
train
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/ddsapi.py#L283-L298
Duke-GCB/DukeDSClient
ddsc/core/ddsapi.py
DataServiceApi._get_collection
def _get_collection(self, url_suffix, data): """ Performs GET for all pages based on x-total-pages in first response headers. Merges the json() 'results' arrays. If x-total-pages is missing or 1 just returns the response without fetching multiple pages. :param url_suffix: str URL...
python
def _get_collection(self, url_suffix, data): """ Performs GET for all pages based on x-total-pages in first response headers. Merges the json() 'results' arrays. If x-total-pages is missing or 1 just returns the response without fetching multiple pages. :param url_suffix: str URL...
[ "def", "_get_collection", "(", "self", ",", "url_suffix", ",", "data", ")", ":", "response", "=", "self", ".", "_get_single_page", "(", "url_suffix", ",", "data", ",", "page_num", "=", "1", ")", "total_pages_str", "=", "response", ".", "headers", ".", "get...
Performs GET for all pages based on x-total-pages in first response headers. Merges the json() 'results' arrays. If x-total-pages is missing or 1 just returns the response without fetching multiple pages. :param url_suffix: str URL path we are sending a GET to :param data: object data we...
[ "Performs", "GET", "for", "all", "pages", "based", "on", "x", "-", "total", "-", "pages", "in", "first", "response", "headers", ".", "Merges", "the", "json", "()", "results", "arrays", ".", "If", "x", "-", "total", "-", "pages", "is", "missing", "or", ...
train
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/ddsapi.py#L300-L319
Duke-GCB/DukeDSClient
ddsc/core/ddsapi.py
DataServiceApi._check_err
def _check_err(resp, url_suffix, data, allow_pagination): """ Raise DataServiceError if the response wasn't successful. :param resp: requests.Response back from the request :param url_suffix: str url to include in an error message :param data: data payload we sent :param ...
python
def _check_err(resp, url_suffix, data, allow_pagination): """ Raise DataServiceError if the response wasn't successful. :param resp: requests.Response back from the request :param url_suffix: str url to include in an error message :param data: data payload we sent :param ...
[ "def", "_check_err", "(", "resp", ",", "url_suffix", ",", "data", ",", "allow_pagination", ")", ":", "total_pages", "=", "resp", ".", "headers", ".", "get", "(", "'x-total-pages'", ")", "if", "not", "allow_pagination", "and", "total_pages", ":", "raise", "Un...
Raise DataServiceError if the response wasn't successful. :param resp: requests.Response back from the request :param url_suffix: str url to include in an error message :param data: data payload we sent :param allow_pagination: when False and response headers contains 'x-total-pages' rai...
[ "Raise", "DataServiceError", "if", "the", "response", "wasn", "t", "successful", ".", ":", "param", "resp", ":", "requests", ".", "Response", "back", "from", "the", "request", ":", "param", "url_suffix", ":", "str", "url", "to", "include", "in", "an", "err...
train
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/ddsapi.py#L336-L353
Duke-GCB/DukeDSClient
ddsc/core/ddsapi.py
DataServiceApi.create_project
def create_project(self, project_name, desc): """ Send POST to /projects creating a new project with the specified name and desc. Raises DataServiceError on error. :param project_name: str name of the project :param desc: str description of the project :return: requests.R...
python
def create_project(self, project_name, desc): """ Send POST to /projects creating a new project with the specified name and desc. Raises DataServiceError on error. :param project_name: str name of the project :param desc: str description of the project :return: requests.R...
[ "def", "create_project", "(", "self", ",", "project_name", ",", "desc", ")", ":", "data", "=", "{", "\"name\"", ":", "project_name", ",", "\"description\"", ":", "desc", "}", "return", "self", ".", "_post", "(", "\"/projects\"", ",", "data", ")" ]
Send POST to /projects creating a new project with the specified name and desc. Raises DataServiceError on error. :param project_name: str name of the project :param desc: str description of the project :return: requests.Response containing the successful result
[ "Send", "POST", "to", "/", "projects", "creating", "a", "new", "project", "with", "the", "specified", "name", "and", "desc", ".", "Raises", "DataServiceError", "on", "error", ".", ":", "param", "project_name", ":", "str", "name", "of", "the", "project", ":...
train
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/ddsapi.py#L355-L367
Duke-GCB/DukeDSClient
ddsc/core/ddsapi.py
DataServiceApi.create_folder
def create_folder(self, folder_name, parent_kind_str, parent_uuid): """ Send POST to /folders to create a new folder with specified name and parent. :param folder_name: str name of the new folder :param parent_kind_str: str type of parent folder has(dds-folder,dds-project) :param...
python
def create_folder(self, folder_name, parent_kind_str, parent_uuid): """ Send POST to /folders to create a new folder with specified name and parent. :param folder_name: str name of the new folder :param parent_kind_str: str type of parent folder has(dds-folder,dds-project) :param...
[ "def", "create_folder", "(", "self", ",", "folder_name", ",", "parent_kind_str", ",", "parent_uuid", ")", ":", "data", "=", "{", "'name'", ":", "folder_name", ",", "'parent'", ":", "{", "'kind'", ":", "parent_kind_str", ",", "'id'", ":", "parent_uuid", "}", ...
Send POST to /folders to create a new folder with specified name and parent. :param folder_name: str name of the new folder :param parent_kind_str: str type of parent folder has(dds-folder,dds-project) :param parent_uuid: str uuid of the parent object :return: requests.Response containin...
[ "Send", "POST", "to", "/", "folders", "to", "create", "a", "new", "folder", "with", "specified", "name", "and", "parent", ".", ":", "param", "folder_name", ":", "str", "name", "of", "the", "new", "folder", ":", "param", "parent_kind_str", ":", "str", "ty...
train
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/ddsapi.py#L394-L409
Duke-GCB/DukeDSClient
ddsc/core/ddsapi.py
DataServiceApi.get_project_children
def get_project_children(self, project_id, name_contains, exclude_response_fields=None): """ Send GET to /projects/{project_id}/children filtering by a name. :param project_id: str uuid of the project :param name_contains: str name to filter folders by (if not None this method works recu...
python
def get_project_children(self, project_id, name_contains, exclude_response_fields=None): """ Send GET to /projects/{project_id}/children filtering by a name. :param project_id: str uuid of the project :param name_contains: str name to filter folders by (if not None this method works recu...
[ "def", "get_project_children", "(", "self", ",", "project_id", ",", "name_contains", ",", "exclude_response_fields", "=", "None", ")", ":", "return", "self", ".", "_get_children", "(", "'projects'", ",", "project_id", ",", "name_contains", ",", "exclude_response_fie...
Send GET to /projects/{project_id}/children filtering by a name. :param project_id: str uuid of the project :param name_contains: str name to filter folders by (if not None this method works recursively) :param exclude_response_fields: [str]: list of fields to exclude in the response items ...
[ "Send", "GET", "to", "/", "projects", "/", "{", "project_id", "}", "/", "children", "filtering", "by", "a", "name", ".", ":", "param", "project_id", ":", "str", "uuid", "of", "the", "project", ":", "param", "name_contains", ":", "str", "name", "to", "f...
train
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/ddsapi.py#L427-L435
Duke-GCB/DukeDSClient
ddsc/core/ddsapi.py
DataServiceApi._get_children
def _get_children(self, parent_name, parent_id, name_contains, exclude_response_fields=None): """ Send GET message to /<parent_name>/<parent_id>/children to fetch info about children(files and folders) :param parent_name: str 'projects' or 'folders' :param parent_id: str uuid of project ...
python
def _get_children(self, parent_name, parent_id, name_contains, exclude_response_fields=None): """ Send GET message to /<parent_name>/<parent_id>/children to fetch info about children(files and folders) :param parent_name: str 'projects' or 'folders' :param parent_id: str uuid of project ...
[ "def", "_get_children", "(", "self", ",", "parent_name", ",", "parent_id", ",", "name_contains", ",", "exclude_response_fields", "=", "None", ")", ":", "data", "=", "{", "}", "if", "name_contains", "is", "not", "None", ":", "data", "[", "'name_contains'", "]...
Send GET message to /<parent_name>/<parent_id>/children to fetch info about children(files and folders) :param parent_name: str 'projects' or 'folders' :param parent_id: str uuid of project or folder :param name_contains: name filtering (if not None this method works recursively) :param ...
[ "Send", "GET", "message", "to", "/", "<parent_name", ">", "/", "<parent_id", ">", "/", "children", "to", "fetch", "info", "about", "children", "(", "files", "and", "folders", ")", ":", "param", "parent_name", ":", "str", "projects", "or", "folders", ":", ...
train
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/ddsapi.py#L455-L470
Duke-GCB/DukeDSClient
ddsc/core/ddsapi.py
DataServiceApi.create_upload
def create_upload(self, project_id, filename, content_type, size, hash_value, hash_alg, storage_provider_id=None, chunked=True): """ Post to /projects/{project_id}/uploads to create a uuid for uploading chunks. NOTE: The optional hash_value and hash_alg parameters are being...
python
def create_upload(self, project_id, filename, content_type, size, hash_value, hash_alg, storage_provider_id=None, chunked=True): """ Post to /projects/{project_id}/uploads to create a uuid for uploading chunks. NOTE: The optional hash_value and hash_alg parameters are being...
[ "def", "create_upload", "(", "self", ",", "project_id", ",", "filename", ",", "content_type", ",", "size", ",", "hash_value", ",", "hash_alg", ",", "storage_provider_id", "=", "None", ",", "chunked", "=", "True", ")", ":", "data", "=", "{", "\"name\"", ":"...
Post to /projects/{project_id}/uploads to create a uuid for uploading chunks. NOTE: The optional hash_value and hash_alg parameters are being removed from the DukeDS API. :param project_id: str uuid of the project we are uploading data for. :param filename: str name of the file we want to upload...
[ "Post", "to", "/", "projects", "/", "{", "project_id", "}", "/", "uploads", "to", "create", "a", "uuid", "for", "uploading", "chunks", ".", "NOTE", ":", "The", "optional", "hash_value", "and", "hash_alg", "parameters", "are", "being", "removed", "from", "t...
train
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/ddsapi.py#L472-L500
Duke-GCB/DukeDSClient
ddsc/core/ddsapi.py
DataServiceApi.create_upload_url
def create_upload_url(self, upload_id, number, size, hash_value, hash_alg): """ Given an upload created by create_upload retrieve a url where we can upload a chunk. :param upload_id: uuid of the upload :param number: int incrementing number of the upload (1-based index) :param si...
python
def create_upload_url(self, upload_id, number, size, hash_value, hash_alg): """ Given an upload created by create_upload retrieve a url where we can upload a chunk. :param upload_id: uuid of the upload :param number: int incrementing number of the upload (1-based index) :param si...
[ "def", "create_upload_url", "(", "self", ",", "upload_id", ",", "number", ",", "size", ",", "hash_value", ",", "hash_alg", ")", ":", "if", "number", "<", "1", ":", "raise", "ValueError", "(", "\"Chunk number must be > 0\"", ")", "data", "=", "{", "\"number\"...
Given an upload created by create_upload retrieve a url where we can upload a chunk. :param upload_id: uuid of the upload :param number: int incrementing number of the upload (1-based index) :param size: int size of the chunk in bytes :param hash_value: str hash value of chunk :p...
[ "Given", "an", "upload", "created", "by", "create_upload", "retrieve", "a", "url", "where", "we", "can", "upload", "a", "chunk", ".", ":", "param", "upload_id", ":", "uuid", "of", "the", "upload", ":", "param", "number", ":", "int", "incrementing", "number...
train
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/ddsapi.py#L502-L522
Duke-GCB/DukeDSClient
ddsc/core/ddsapi.py
DataServiceApi.complete_upload
def complete_upload(self, upload_id, hash_value, hash_alg): """ Mark the upload we created in create_upload complete. :param upload_id: str uuid of the upload to complete. :param hash_value: str hash value of chunk :param hash_alg: str algorithm used to create hash :retur...
python
def complete_upload(self, upload_id, hash_value, hash_alg): """ Mark the upload we created in create_upload complete. :param upload_id: str uuid of the upload to complete. :param hash_value: str hash value of chunk :param hash_alg: str algorithm used to create hash :retur...
[ "def", "complete_upload", "(", "self", ",", "upload_id", ",", "hash_value", ",", "hash_alg", ")", ":", "data", "=", "{", "\"hash[value]\"", ":", "hash_value", ",", "\"hash[algorithm]\"", ":", "hash_alg", "}", "return", "self", ".", "_put", "(", "\"/uploads/\""...
Mark the upload we created in create_upload complete. :param upload_id: str uuid of the upload to complete. :param hash_value: str hash value of chunk :param hash_alg: str algorithm used to create hash :return: requests.Response containing the successful result
[ "Mark", "the", "upload", "we", "created", "in", "create_upload", "complete", ".", ":", "param", "upload_id", ":", "str", "uuid", "of", "the", "upload", "to", "complete", ".", ":", "param", "hash_value", ":", "str", "hash", "value", "of", "chunk", ":", "p...
train
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/ddsapi.py#L524-L536
Duke-GCB/DukeDSClient
ddsc/core/ddsapi.py
DataServiceApi.create_file
def create_file(self, parent_kind, parent_id, upload_id): """ Create a new file after completing an upload. :param parent_kind: str kind of parent(dds-folder,dds-project) :param parent_id: str uuid of parent :param upload_id: str uuid of complete upload :return: requests....
python
def create_file(self, parent_kind, parent_id, upload_id): """ Create a new file after completing an upload. :param parent_kind: str kind of parent(dds-folder,dds-project) :param parent_id: str uuid of parent :param upload_id: str uuid of complete upload :return: requests....
[ "def", "create_file", "(", "self", ",", "parent_kind", ",", "parent_id", ",", "upload_id", ")", ":", "data", "=", "{", "\"parent\"", ":", "{", "\"kind\"", ":", "parent_kind", ",", "\"id\"", ":", "parent_id", "}", ",", "\"upload\"", ":", "{", "\"id\"", ":...
Create a new file after completing an upload. :param parent_kind: str kind of parent(dds-folder,dds-project) :param parent_id: str uuid of parent :param upload_id: str uuid of complete upload :return: requests.Response containing the successful result
[ "Create", "a", "new", "file", "after", "completing", "an", "upload", ".", ":", "param", "parent_kind", ":", "str", "kind", "of", "parent", "(", "dds", "-", "folder", "dds", "-", "project", ")", ":", "param", "parent_id", ":", "str", "uuid", "of", "pare...
train
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/ddsapi.py#L538-L555
Duke-GCB/DukeDSClient
ddsc/core/ddsapi.py
DataServiceApi.update_file
def update_file(self, file_id, upload_id): """ Send PUT request to /files/{file_id} to update the file contents to upload_id and sets a label. :param file_id: str uuid of file :param upload_id: str uuid of the upload where all the file chunks where uploaded :param label: str shor...
python
def update_file(self, file_id, upload_id): """ Send PUT request to /files/{file_id} to update the file contents to upload_id and sets a label. :param file_id: str uuid of file :param upload_id: str uuid of the upload where all the file chunks where uploaded :param label: str shor...
[ "def", "update_file", "(", "self", ",", "file_id", ",", "upload_id", ")", ":", "put_data", "=", "{", "\"upload[id]\"", ":", "upload_id", ",", "}", "return", "self", ".", "_put", "(", "\"/files/\"", "+", "file_id", ",", "put_data", ",", "content_type", "=",...
Send PUT request to /files/{file_id} to update the file contents to upload_id and sets a label. :param file_id: str uuid of file :param upload_id: str uuid of the upload where all the file chunks where uploaded :param label: str short display label for the file :return: requests.Response...
[ "Send", "PUT", "request", "to", "/", "files", "/", "{", "file_id", "}", "to", "update", "the", "file", "contents", "to", "upload_id", "and", "sets", "a", "label", ".", ":", "param", "file_id", ":", "str", "uuid", "of", "file", ":", "param", "upload_id"...
train
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/ddsapi.py#L565-L576
Duke-GCB/DukeDSClient
ddsc/core/ddsapi.py
DataServiceApi.send_external
def send_external(self, http_verb, host, url, http_headers, chunk): """ Used with create_upload_url to send a chunk the the possibly external object store. :param http_verb: str PUT or POST :param host: str host we are sending the chunk to :param url: str url to use when sending ...
python
def send_external(self, http_verb, host, url, http_headers, chunk): """ Used with create_upload_url to send a chunk the the possibly external object store. :param http_verb: str PUT or POST :param host: str host we are sending the chunk to :param url: str url to use when sending ...
[ "def", "send_external", "(", "self", ",", "http_verb", ",", "host", ",", "url", ",", "http_headers", ",", "chunk", ")", ":", "if", "http_verb", "==", "'PUT'", ":", "return", "self", ".", "http", ".", "put", "(", "host", "+", "url", ",", "data", "=", ...
Used with create_upload_url to send a chunk the the possibly external object store. :param http_verb: str PUT or POST :param host: str host we are sending the chunk to :param url: str url to use when sending :param http_headers: object headers to send with the request :param chun...
[ "Used", "with", "create_upload_url", "to", "send", "a", "chunk", "the", "the", "possibly", "external", "object", "store", ".", ":", "param", "http_verb", ":", "str", "PUT", "or", "POST", ":", "param", "host", ":", "str", "host", "we", "are", "sending", "...
train
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/ddsapi.py#L578-L593
Duke-GCB/DukeDSClient
ddsc/core/ddsapi.py
DataServiceApi.receive_external
def receive_external(self, http_verb, host, url, http_headers): """ Retrieve a streaming request for a file. :param http_verb: str GET is only supported right now :param host: str host we are requesting the file from :param url: str url to ask the host for :param http_hea...
python
def receive_external(self, http_verb, host, url, http_headers): """ Retrieve a streaming request for a file. :param http_verb: str GET is only supported right now :param host: str host we are requesting the file from :param url: str url to ask the host for :param http_hea...
[ "def", "receive_external", "(", "self", ",", "http_verb", ",", "host", ",", "url", ",", "http_headers", ")", ":", "if", "http_verb", "==", "'GET'", ":", "return", "self", ".", "http", ".", "get", "(", "host", "+", "url", ",", "headers", "=", "http_head...
Retrieve a streaming request for a file. :param http_verb: str GET is only supported right now :param host: str host we are requesting the file from :param url: str url to ask the host for :param http_headers: object headers to send with the request :return: requests.Response con...
[ "Retrieve", "a", "streaming", "request", "for", "a", "file", ".", ":", "param", "http_verb", ":", "str", "GET", "is", "only", "supported", "right", "now", ":", "param", "host", ":", "str", "host", "we", "are", "requesting", "the", "file", "from", ":", ...
train
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/ddsapi.py#L595-L607
Duke-GCB/DukeDSClient
ddsc/core/ddsapi.py
DataServiceApi.get_users
def get_users(self, full_name=None, email=None, username=None): """ Send GET request to /users for users with optional full_name, email, and/or username filtering. :param full_name: str name of the user we are searching for :param email: str: optional email to filter by :param us...
python
def get_users(self, full_name=None, email=None, username=None): """ Send GET request to /users for users with optional full_name, email, and/or username filtering. :param full_name: str name of the user we are searching for :param email: str: optional email to filter by :param us...
[ "def", "get_users", "(", "self", ",", "full_name", "=", "None", ",", "email", "=", "None", ",", "username", "=", "None", ")", ":", "data", "=", "{", "}", "if", "full_name", ":", "data", "[", "'full_name_contains'", "]", "=", "full_name", "if", "email",...
Send GET request to /users for users with optional full_name, email, and/or username filtering. :param full_name: str name of the user we are searching for :param email: str: optional email to filter by :param username: str: optional username to filter by :return: requests.Response conta...
[ "Send", "GET", "request", "to", "/", "users", "for", "users", "with", "optional", "full_name", "email", "and", "/", "or", "username", "filtering", ".", ":", "param", "full_name", ":", "str", "name", "of", "the", "user", "we", "are", "searching", "for", "...
train
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/ddsapi.py#L620-L635
Duke-GCB/DukeDSClient
ddsc/core/ddsapi.py
DataServiceApi.set_user_project_permission
def set_user_project_permission(self, project_id, user_id, auth_role): """ Send PUT request to /projects/{project_id}/permissions/{user_id/ with auth_role value. :param project_id: str uuid of the project :param user_id: str uuid of the user :param auth_role: str project role eg ...
python
def set_user_project_permission(self, project_id, user_id, auth_role): """ Send PUT request to /projects/{project_id}/permissions/{user_id/ with auth_role value. :param project_id: str uuid of the project :param user_id: str uuid of the user :param auth_role: str project role eg ...
[ "def", "set_user_project_permission", "(", "self", ",", "project_id", ",", "user_id", ",", "auth_role", ")", ":", "put_data", "=", "{", "\"auth_role[id]\"", ":", "auth_role", "}", "return", "self", ".", "_put", "(", "\"/projects/\"", "+", "project_id", "+", "\...
Send PUT request to /projects/{project_id}/permissions/{user_id/ with auth_role value. :param project_id: str uuid of the project :param user_id: str uuid of the user :param auth_role: str project role eg 'project_admin' :return: requests.Response containing the successful result
[ "Send", "PUT", "request", "to", "/", "projects", "/", "{", "project_id", "}", "/", "permissions", "/", "{", "user_id", "/", "with", "auth_role", "value", ".", ":", "param", "project_id", ":", "str", "uuid", "of", "the", "project", ":", "param", "user_id"...
train
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/ddsapi.py#L645-L657
Duke-GCB/DukeDSClient
ddsc/core/ddsapi.py
DataServiceApi.get_api_token
def get_api_token(self, agent_key, user_key): """ Send POST request to get an auth token. This method doesn't require auth obviously. :param agent_key: str agent key (who is acting on behalf of the user) :param user_key: str secret user key :return: requests.Response cont...
python
def get_api_token(self, agent_key, user_key): """ Send POST request to get an auth token. This method doesn't require auth obviously. :param agent_key: str agent key (who is acting on behalf of the user) :param user_key: str secret user key :return: requests.Response cont...
[ "def", "get_api_token", "(", "self", ",", "agent_key", ",", "user_key", ")", ":", "data", "=", "{", "\"agent_key\"", ":", "agent_key", ",", "\"user_key\"", ":", "user_key", ",", "}", "return", "self", ".", "_post", "(", "\"/software_agents/api_token\"", ",", ...
Send POST request to get an auth token. This method doesn't require auth obviously. :param agent_key: str agent key (who is acting on behalf of the user) :param user_key: str secret user key :return: requests.Response containing the successful result
[ "Send", "POST", "request", "to", "get", "an", "auth", "token", ".", "This", "method", "doesn", "t", "require", "auth", "obviously", ".", ":", "param", "agent_key", ":", "str", "agent", "key", "(", "who", "is", "acting", "on", "behalf", "of", "the", "us...
train
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/ddsapi.py#L693-L705
Duke-GCB/DukeDSClient
ddsc/core/ddsapi.py
DataServiceApi.create_project_transfer
def create_project_transfer(self, project_id, to_user_ids): """ Send POST request to initiate transfer of a project to the specified user ids :param project_id: str uuid of the project :param to_users: list of user uuids to receive the project :return: requests.Response containin...
python
def create_project_transfer(self, project_id, to_user_ids): """ Send POST request to initiate transfer of a project to the specified user ids :param project_id: str uuid of the project :param to_users: list of user uuids to receive the project :return: requests.Response containin...
[ "def", "create_project_transfer", "(", "self", ",", "project_id", ",", "to_user_ids", ")", ":", "data", "=", "{", "\"to_users[][id]\"", ":", "to_user_ids", ",", "}", "return", "self", ".", "_post", "(", "\"/projects/\"", "+", "project_id", "+", "\"/transfers\"",...
Send POST request to initiate transfer of a project to the specified user ids :param project_id: str uuid of the project :param to_users: list of user uuids to receive the project :return: requests.Response containing the successful result
[ "Send", "POST", "request", "to", "initiate", "transfer", "of", "a", "project", "to", "the", "specified", "user", "ids", ":", "param", "project_id", ":", "str", "uuid", "of", "the", "project", ":", "param", "to_users", ":", "list", "of", "user", "uuids", ...
train
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/ddsapi.py#L738-L749
Duke-GCB/DukeDSClient
ddsc/core/ddsapi.py
DataServiceApi._process_project_transfer
def _process_project_transfer(self, action, transfer_id, status_comment): """ Send PUT request to one of the project transfer action endpoints :param action: str name of the action (reject/accept/cancel) :param transfer_id: str uuid of the project_transfer :param status_comment: ...
python
def _process_project_transfer(self, action, transfer_id, status_comment): """ Send PUT request to one of the project transfer action endpoints :param action: str name of the action (reject/accept/cancel) :param transfer_id: str uuid of the project_transfer :param status_comment: ...
[ "def", "_process_project_transfer", "(", "self", ",", "action", ",", "transfer_id", ",", "status_comment", ")", ":", "data", "=", "{", "}", "if", "status_comment", ":", "data", "[", "\"status_comment\"", "]", "=", "status_comment", "path", "=", "\"/project_trans...
Send PUT request to one of the project transfer action endpoints :param action: str name of the action (reject/accept/cancel) :param transfer_id: str uuid of the project_transfer :param status_comment: str comment about the action, optional :return: requests.Response containing the succe...
[ "Send", "PUT", "request", "to", "one", "of", "the", "project", "transfer", "action", "endpoints", ":", "param", "action", ":", "str", "name", "of", "the", "action", "(", "reject", "/", "accept", "/", "cancel", ")", ":", "param", "transfer_id", ":", "str"...
train
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/ddsapi.py#L766-L778
Duke-GCB/DukeDSClient
ddsc/core/ddsapi.py
DataServiceApi.create_activity
def create_activity(self, activity_name, desc=None, started_on=None, ended_on=None): """ Send POST to /activities creating a new activity with the specified name and desc. Raises DataServiceError on error. :param activity_name: str name of the activity :param desc: str descriptio...
python
def create_activity(self, activity_name, desc=None, started_on=None, ended_on=None): """ Send POST to /activities creating a new activity with the specified name and desc. Raises DataServiceError on error. :param activity_name: str name of the activity :param desc: str descriptio...
[ "def", "create_activity", "(", "self", ",", "activity_name", ",", "desc", "=", "None", ",", "started_on", "=", "None", ",", "ended_on", "=", "None", ")", ":", "data", "=", "{", "\"name\"", ":", "activity_name", ",", "\"description\"", ":", "desc", ",", "...
Send POST to /activities creating a new activity with the specified name and desc. Raises DataServiceError on error. :param activity_name: str name of the activity :param desc: str description of the activity (optional) :param started_on: str datetime when the activity started (optional)...
[ "Send", "POST", "to", "/", "activities", "creating", "a", "new", "activity", "with", "the", "specified", "name", "and", "desc", ".", "Raises", "DataServiceError", "on", "error", ".", ":", "param", "activity_name", ":", "str", "name", "of", "the", "activity",...
train
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/ddsapi.py#L815-L831
Duke-GCB/DukeDSClient
ddsc/core/ddsapi.py
DataServiceApi.update_activity
def update_activity(self, activity_id, activity_name=None, desc=None, started_on=None, ended_on=None): """ Send PUT request to /activities/{activity_id} to update the activity metadata. Raises ValueError if at least one field is not updated. :param activity_id: st...
python
def update_activity(self, activity_id, activity_name=None, desc=None, started_on=None, ended_on=None): """ Send PUT request to /activities/{activity_id} to update the activity metadata. Raises ValueError if at least one field is not updated. :param activity_id: st...
[ "def", "update_activity", "(", "self", ",", "activity_id", ",", "activity_name", "=", "None", ",", "desc", "=", "None", ",", "started_on", "=", "None", ",", "ended_on", "=", "None", ")", ":", "put_data", "=", "{", "\"name\"", ":", "activity_name", ",", "...
Send PUT request to /activities/{activity_id} to update the activity metadata. Raises ValueError if at least one field is not updated. :param activity_id: str uuid of activity :param activity_name: str new name of the activity (optional) :param desc: str description of the activity (opti...
[ "Send", "PUT", "request", "to", "/", "activities", "/", "{", "activity_id", "}", "to", "update", "the", "activity", "metadata", ".", "Raises", "ValueError", "if", "at", "least", "one", "field", "is", "not", "updated", ".", ":", "param", "activity_id", ":",...
train
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/ddsapi.py#L849-L867
Duke-GCB/DukeDSClient
ddsc/core/ddsapi.py
DataServiceApi.create_used_relation
def create_used_relation(self, activity_id, entity_kind, entity_id): """ Create a was used by relationship between an activity and a entity(file). :param activity_id: str: uuid of the activity :param entity_kind: str: kind of entity('dds-file') :param entity_id: str: uuid of the ...
python
def create_used_relation(self, activity_id, entity_kind, entity_id): """ Create a was used by relationship between an activity and a entity(file). :param activity_id: str: uuid of the activity :param entity_kind: str: kind of entity('dds-file') :param entity_id: str: uuid of the ...
[ "def", "create_used_relation", "(", "self", ",", "activity_id", ",", "entity_kind", ",", "entity_id", ")", ":", "return", "self", ".", "_create_activity_relation", "(", "activity_id", ",", "entity_kind", ",", "entity_id", ",", "ActivityRelationTypes", ".", "USED", ...
Create a was used by relationship between an activity and a entity(file). :param activity_id: str: uuid of the activity :param entity_kind: str: kind of entity('dds-file') :param entity_id: str: uuid of the entity :return: requests.Response containing the successful result
[ "Create", "a", "was", "used", "by", "relationship", "between", "an", "activity", "and", "a", "entity", "(", "file", ")", ".", ":", "param", "activity_id", ":", "str", ":", "uuid", "of", "the", "activity", ":", "param", "entity_kind", ":", "str", ":", "...
train
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/ddsapi.py#L887-L895
Duke-GCB/DukeDSClient
ddsc/core/ddsapi.py
DataServiceApi.create_was_generated_by_relation
def create_was_generated_by_relation(self, activity_id, entity_kind, entity_id): """ Create a was generated by relationship between an activity and a entity(file). :param activity_id: str: uuid of the activity :param entity_kind: str: kind of entity('dds-file') :param entity_id: ...
python
def create_was_generated_by_relation(self, activity_id, entity_kind, entity_id): """ Create a was generated by relationship between an activity and a entity(file). :param activity_id: str: uuid of the activity :param entity_kind: str: kind of entity('dds-file') :param entity_id: ...
[ "def", "create_was_generated_by_relation", "(", "self", ",", "activity_id", ",", "entity_kind", ",", "entity_id", ")", ":", "return", "self", ".", "_create_activity_relation", "(", "activity_id", ",", "entity_kind", ",", "entity_id", ",", "ActivityRelationTypes", ".",...
Create a was generated by relationship between an activity and a entity(file). :param activity_id: str: uuid of the activity :param entity_kind: str: kind of entity('dds-file') :param entity_id: str: uuid of the entity :return: requests.Response containing the successful result
[ "Create", "a", "was", "generated", "by", "relationship", "between", "an", "activity", "and", "a", "entity", "(", "file", ")", ".", ":", "param", "activity_id", ":", "str", ":", "uuid", "of", "the", "activity", ":", "param", "entity_kind", ":", "str", ":"...
train
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/ddsapi.py#L897-L905
Duke-GCB/DukeDSClient
ddsc/core/ddsapi.py
DataServiceApi.create_was_invalidated_by_relation
def create_was_invalidated_by_relation(self, activity_id, entity_kind, entity_id): """ Create a was invalidated by relationship between an activity and a entity(file). :param activity_id: str: uuid of the activity :param entity_kind: str: kind of entity('dds-file') :param entity_...
python
def create_was_invalidated_by_relation(self, activity_id, entity_kind, entity_id): """ Create a was invalidated by relationship between an activity and a entity(file). :param activity_id: str: uuid of the activity :param entity_kind: str: kind of entity('dds-file') :param entity_...
[ "def", "create_was_invalidated_by_relation", "(", "self", ",", "activity_id", ",", "entity_kind", ",", "entity_id", ")", ":", "return", "self", ".", "_create_activity_relation", "(", "activity_id", ",", "entity_kind", ",", "entity_id", ",", "ActivityRelationTypes", "....
Create a was invalidated by relationship between an activity and a entity(file). :param activity_id: str: uuid of the activity :param entity_kind: str: kind of entity('dds-file') :param entity_id: str: uuid of the entity :return: requests.Response containing the successful result
[ "Create", "a", "was", "invalidated", "by", "relationship", "between", "an", "activity", "and", "a", "entity", "(", "file", ")", ".", ":", "param", "activity_id", ":", "str", ":", "uuid", "of", "the", "activity", ":", "param", "entity_kind", ":", "str", "...
train
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/ddsapi.py#L907-L915
Duke-GCB/DukeDSClient
ddsc/core/ddsapi.py
DataServiceApi.create_was_derived_from_relation
def create_was_derived_from_relation(self, used_entity_id, used_entity_kind, generated_entity_id, generated_entity_kind): """ Create a was derived from relation. :param used_entity_id: str: uuid of the used entity (file_version_id) :param used_ent...
python
def create_was_derived_from_relation(self, used_entity_id, used_entity_kind, generated_entity_id, generated_entity_kind): """ Create a was derived from relation. :param used_entity_id: str: uuid of the used entity (file_version_id) :param used_ent...
[ "def", "create_was_derived_from_relation", "(", "self", ",", "used_entity_id", ",", "used_entity_kind", ",", "generated_entity_id", ",", "generated_entity_kind", ")", ":", "data", "=", "{", "\"used_entity\"", ":", "{", "\"id\"", ":", "used_entity_id", ",", "\"kind\"",...
Create a was derived from relation. :param used_entity_id: str: uuid of the used entity (file_version_id) :param used_entity_kind: str: kind of entity ('dds-file') :param generated_entity_id: uuid of the generated entity (file_version_id) :param generated_entity_kind: str: kind of entity...
[ "Create", "a", "was", "derived", "from", "relation", ".", ":", "param", "used_entity_id", ":", "str", ":", "uuid", "of", "the", "used", "entity", "(", "file_version_id", ")", ":", "param", "used_entity_kind", ":", "str", ":", "kind", "of", "entity", "(", ...
train
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/ddsapi.py#L929-L949
Duke-GCB/DukeDSClient
ddsc/core/ddsapi.py
DataServiceApi.get_auth_provider_affiliates
def get_auth_provider_affiliates(self, auth_provider_id, full_name_contains=None, email=None, username=None): """ List affiliates for a specific auth provider. :param auth_provider_id: str: uuid of the auth provider to list affiliates of :param full_name_contains: str: filters affiliates...
python
def get_auth_provider_affiliates(self, auth_provider_id, full_name_contains=None, email=None, username=None): """ List affiliates for a specific auth provider. :param auth_provider_id: str: uuid of the auth provider to list affiliates of :param full_name_contains: str: filters affiliates...
[ "def", "get_auth_provider_affiliates", "(", "self", ",", "auth_provider_id", ",", "full_name_contains", "=", "None", ",", "email", "=", "None", ",", "username", "=", "None", ")", ":", "data", "=", "{", "}", "if", "full_name_contains", ":", "data", "[", "'ful...
List affiliates for a specific auth provider. :param auth_provider_id: str: uuid of the auth provider to list affiliates of :param full_name_contains: str: filters affiliates for this name :param email: str: filters affiliates for this email address :param username: str: filters affiliat...
[ "List", "affiliates", "for", "a", "specific", "auth", "provider", ".", ":", "param", "auth_provider_id", ":", "str", ":", "uuid", "of", "the", "auth", "provider", "to", "list", "affiliates", "of", ":", "param", "full_name_contains", ":", "str", ":", "filters...
train
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/ddsapi.py#L975-L991
Duke-GCB/DukeDSClient
ddsc/core/ddsapi.py
DataServiceApi.auth_provider_add_user
def auth_provider_add_user(self, auth_provider_id, username): """ Transform an institutional affiliates UID, such as a Duke NetID, to a DDS specific user identity; can be used by clients prior to calling DDS APIs that require a DDS user in the request payload. Returns user details. Can b...
python
def auth_provider_add_user(self, auth_provider_id, username): """ Transform an institutional affiliates UID, such as a Duke NetID, to a DDS specific user identity; can be used by clients prior to calling DDS APIs that require a DDS user in the request payload. Returns user details. Can b...
[ "def", "auth_provider_add_user", "(", "self", ",", "auth_provider_id", ",", "username", ")", ":", "url", "=", "\"/auth_providers/{}/affiliates/{}/dds_user/\"", ".", "format", "(", "auth_provider_id", ",", "username", ")", "return", "self", ".", "_post", "(", "url", ...
Transform an institutional affiliates UID, such as a Duke NetID, to a DDS specific user identity; can be used by clients prior to calling DDS APIs that require a DDS user in the request payload. Returns user details. Can be safely called multiple times. :param auth_provider_id: str: auth provide...
[ "Transform", "an", "institutional", "affiliates", "UID", "such", "as", "a", "Duke", "NetID", "to", "a", "DDS", "specific", "user", "identity", ";", "can", "be", "used", "by", "clients", "prior", "to", "calling", "DDS", "APIs", "that", "require", "a", "DDS"...
train
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/ddsapi.py#L1002-L1012
Duke-GCB/DukeDSClient
ddsc/core/ddsapi.py
MultiJSONResponse.add_response
def add_response(self, response): """ Add data from json() to data returned by json() :param response: requests.Response containing the successful JSON result to be merged """ key = self.merge_array_field_name response_json = response.json() value = self.combined_...
python
def add_response(self, response): """ Add data from json() to data returned by json() :param response: requests.Response containing the successful JSON result to be merged """ key = self.merge_array_field_name response_json = response.json() value = self.combined_...
[ "def", "add_response", "(", "self", ",", "response", ")", ":", "key", "=", "self", ".", "merge_array_field_name", "response_json", "=", "response", ".", "json", "(", ")", "value", "=", "self", ".", "combined_json", "[", "key", "]", "self", ".", "combined_j...
Add data from json() to data returned by json() :param response: requests.Response containing the successful JSON result to be merged
[ "Add", "data", "from", "json", "()", "to", "data", "returned", "by", "json", "()", ":", "param", "response", ":", "requests", ".", "Response", "containing", "the", "successful", "JSON", "result", "to", "be", "merged" ]
train
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/ddsapi.py#L1053-L1061
pdkit/pdkit
pdkit/tremor_time_series.py
TremorTimeSeries.load
def load(self, filename, format_file='cloudupdrs'): """ This is a general load data method where the format of data to load can be passed as a parameter, :param str filename: The path to load data from :param str format_file: format of the file. Default is CloudUPDRS. Set to...
python
def load(self, filename, format_file='cloudupdrs'): """ This is a general load data method where the format of data to load can be passed as a parameter, :param str filename: The path to load data from :param str format_file: format of the file. Default is CloudUPDRS. Set to...
[ "def", "load", "(", "self", ",", "filename", ",", "format_file", "=", "'cloudupdrs'", ")", ":", "try", ":", "ts", "=", "load_data", "(", "filename", ",", "format_file", ")", "validator", "=", "CloudUPDRSDataFrameValidator", "(", ")", "if", "validator", ".", ...
This is a general load data method where the format of data to load can be passed as a parameter, :param str filename: The path to load data from :param str format_file: format of the file. Default is CloudUPDRS. Set to mpower for mpower data. :return dataframe: data_frame.x, data_f...
[ "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/tremor_time_series.py#L31-L55
twisted/txaws
txaws/server/resource.py
QueryAPI.get_method
def get_method(self, call, *args, **kwargs): """Return the L{Method} instance to invoke for the given L{Call}. @param args: Positional arguments to pass to the method constructor. @param kwargs: Keyword arguments to pass to the method constructor. """ method_class = self.registr...
python
def get_method(self, call, *args, **kwargs): """Return the L{Method} instance to invoke for the given L{Call}. @param args: Positional arguments to pass to the method constructor. @param kwargs: Keyword arguments to pass to the method constructor. """ method_class = self.registr...
[ "def", "get_method", "(", "self", ",", "call", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "method_class", "=", "self", ".", "registry", ".", "get", "(", "call", ".", "action", ",", "call", ".", "version", ")", "method", "=", "method_class",...
Return the L{Method} instance to invoke for the given L{Call}. @param args: Positional arguments to pass to the method constructor. @param kwargs: Keyword arguments to pass to the method constructor.
[ "Return", "the", "L", "{", "Method", "}", "instance", "to", "invoke", "for", "the", "given", "L", "{", "Call", "}", "." ]
train
https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/server/resource.py#L57-L69
twisted/txaws
txaws/server/resource.py
QueryAPI.handle
def handle(self, request): """Handle an HTTP request for executing an API call. This method authenticates the request checking its signature, and then calls the C{execute} method, passing it a L{Call} object set with the principal for the authenticated user and the generic parameters ...
python
def handle(self, request): """Handle an HTTP request for executing an API call. This method authenticates the request checking its signature, and then calls the C{execute} method, passing it a L{Call} object set with the principal for the authenticated user and the generic parameters ...
[ "def", "handle", "(", "self", ",", "request", ")", ":", "request", ".", "id", "=", "str", "(", "uuid4", "(", ")", ")", "deferred", "=", "maybeDeferred", "(", "self", ".", "_validate", ",", "request", ")", "deferred", ".", "addCallback", "(", "self", ...
Handle an HTTP request for executing an API call. This method authenticates the request checking its signature, and then calls the C{execute} method, passing it a L{Call} object set with the principal for the authenticated user and the generic parameters extracted from the request. ...
[ "Handle", "an", "HTTP", "request", "for", "executing", "an", "API", "call", "." ]
train
https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/server/resource.py#L80-L130
twisted/txaws
txaws/server/resource.py
QueryAPI.execute
def execute(self, call): """Execute an API L{Call}. At this point the request has been authenticated and C{call.principal} is set with the L{Principal} for the L{User} requesting the call. @return: The response to write in the request for the given L{Call}. @raises: An L{APIErr...
python
def execute(self, call): """Execute an API L{Call}. At this point the request has been authenticated and C{call.principal} is set with the L{Principal} for the L{User} requesting the call. @return: The response to write in the request for the given L{Call}. @raises: An L{APIErr...
[ "def", "execute", "(", "self", ",", "call", ")", ":", "method", "=", "self", ".", "get_method", "(", "call", ")", "deferred", "=", "maybeDeferred", "(", "self", ".", "authorize", ",", "method", ",", "call", ")", "deferred", ".", "addCallback", "(", "la...
Execute an API L{Call}. At this point the request has been authenticated and C{call.principal} is set with the L{Principal} for the L{User} requesting the call. @return: The response to write in the request for the given L{Call}. @raises: An L{APIError} in case the execution fails, spo...
[ "Execute", "an", "API", "L", "{", "Call", "}", "." ]
train
https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/server/resource.py#L150-L163
twisted/txaws
txaws/server/resource.py
QueryAPI.get_call_arguments
def get_call_arguments(self, request): """ Get call arguments from a request. Override this if you want to use a wire format different from AWS's. The return value is a dictionary with three keys: 'transport_args', 'handler_args', and 'raw_args'. The value of 'transport...
python
def get_call_arguments(self, request): """ Get call arguments from a request. Override this if you want to use a wire format different from AWS's. The return value is a dictionary with three keys: 'transport_args', 'handler_args', and 'raw_args'. The value of 'transport...
[ "def", "get_call_arguments", "(", "self", ",", "request", ")", ":", "params", "=", "dict", "(", "(", "k", ",", "v", "[", "-", "1", "]", ")", "for", "k", ",", "v", "in", "request", ".", "args", ".", "iteritems", "(", ")", ")", "args", ",", "rest...
Get call arguments from a request. Override this if you want to use a wire format different from AWS's. The return value is a dictionary with three keys: 'transport_args', 'handler_args', and 'raw_args'. The value of 'transport_args' must be a dictionary with the following keys...
[ "Get", "call", "arguments", "from", "a", "request", ".", "Override", "this", "if", "you", "want", "to", "use", "a", "wire", "format", "different", "from", "AWS", "s", "." ]
train
https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/server/resource.py#L169-L214
twisted/txaws
txaws/server/resource.py
QueryAPI._validate
def _validate(self, request): """Validate an L{HTTPRequest} before executing it. The following conditions are checked: - The request contains all the generic parameters. - The action specified in the request is a supported one. - The signature mechanism is a supported one. ...
python
def _validate(self, request): """Validate an L{HTTPRequest} before executing it. The following conditions are checked: - The request contains all the generic parameters. - The action specified in the request is a supported one. - The signature mechanism is a supported one. ...
[ "def", "_validate", "(", "self", ",", "request", ")", ":", "call_arguments", "=", "self", ".", "get_call_arguments", "(", "request", ")", "args", "=", "call_arguments", "[", "\"transport_args\"", "]", "rest", "=", "call_arguments", "[", "\"handler_args\"", "]", ...
Validate an L{HTTPRequest} before executing it. The following conditions are checked: - The request contains all the generic parameters. - The action specified in the request is a supported one. - The signature mechanism is a supported one. - The provided signature matches the ...
[ "Validate", "an", "L", "{", "HTTPRequest", "}", "before", "executing", "it", "." ]
train
https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/server/resource.py#L216-L249
twisted/txaws
txaws/server/resource.py
QueryAPI._validate_generic_parameters
def _validate_generic_parameters(self, args): """Validate the generic request parameters. @param args: Parsed schema arguments. @raises APIError: In the following cases: - Action is not included in C{self.actions} - SignatureVersion is not included in C{self.signature_ve...
python
def _validate_generic_parameters(self, args): """Validate the generic request parameters. @param args: Parsed schema arguments. @raises APIError: In the following cases: - Action is not included in C{self.actions} - SignatureVersion is not included in C{self.signature_ve...
[ "def", "_validate_generic_parameters", "(", "self", ",", "args", ")", ":", "utc_now", "=", "self", ".", "get_utc_time", "(", ")", "if", "getattr", "(", "self", ",", "\"actions\"", ",", "None", ")", "is", "not", "None", ":", "# Check the deprecated 'actions' at...
Validate the generic request parameters. @param args: Parsed schema arguments. @raises APIError: In the following cases: - Action is not included in C{self.actions} - SignatureVersion is not included in C{self.signature_versions} - Expires and Timestamp are present ...
[ "Validate", "the", "generic", "request", "parameters", "." ]
train
https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/server/resource.py#L251-L290
twisted/txaws
txaws/server/resource.py
QueryAPI._validate_signature
def _validate_signature(self, request, principal, args, params): """Validate the signature.""" creds = AWSCredentials(principal.access_key, principal.secret_key) endpoint = AWSServiceEndpoint() endpoint.set_method(request.method) endpoint.set_canonical_host(request.getHeader("Hos...
python
def _validate_signature(self, request, principal, args, params): """Validate the signature.""" creds = AWSCredentials(principal.access_key, principal.secret_key) endpoint = AWSServiceEndpoint() endpoint.set_method(request.method) endpoint.set_canonical_host(request.getHeader("Hos...
[ "def", "_validate_signature", "(", "self", ",", "request", ",", "principal", ",", "args", ",", "params", ")", ":", "creds", "=", "AWSCredentials", "(", "principal", ".", "access_key", ",", "principal", ".", "secret_key", ")", "endpoint", "=", "AWSServiceEndpoi...
Validate the signature.
[ "Validate", "the", "signature", "." ]
train
https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/server/resource.py#L299-L317
twisted/txaws
txaws/server/resource.py
QueryAPI.render_GET
def render_GET(self, request): """Handle a GET request.""" if not request.args: request.setHeader("Content-Type", "text/plain") return self.get_status_text() else: self.handle(request) return NOT_DONE_YET
python
def render_GET(self, request): """Handle a GET request.""" if not request.args: request.setHeader("Content-Type", "text/plain") return self.get_status_text() else: self.handle(request) return NOT_DONE_YET
[ "def", "render_GET", "(", "self", ",", "request", ")", ":", "if", "not", "request", ".", "args", ":", "request", ".", "setHeader", "(", "\"Content-Type\"", ",", "\"text/plain\"", ")", "return", "self", ".", "get_status_text", "(", ")", "else", ":", "self",...
Handle a GET request.
[ "Handle", "a", "GET", "request", "." ]
train
https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/server/resource.py#L323-L330