repository_name stringlengths 7 55 | func_path_in_repository stringlengths 4 223 | func_name stringlengths 1 134 | whole_func_string stringlengths 75 104k | language stringclasses 1
value | func_code_string stringlengths 75 104k | func_code_tokens listlengths 19 28.4k | func_documentation_string stringlengths 1 46.9k | func_documentation_tokens listlengths 1 1.97k | split_name stringclasses 1
value | func_code_url stringlengths 87 315 |
|---|---|---|---|---|---|---|---|---|---|---|
twisted/txaws | txaws/reactor.py | get_exitcode_reactor | def get_exitcode_reactor():
"""
This is only neccesary until a fix like the one outlined here is
implemented for Twisted:
http://twistedmatrix.com/trac/ticket/2182
"""
from twisted.internet.main import installReactor
from twisted.internet.selectreactor import SelectReactor
class Exi... | python | def get_exitcode_reactor():
"""
This is only neccesary until a fix like the one outlined here is
implemented for Twisted:
http://twistedmatrix.com/trac/ticket/2182
"""
from twisted.internet.main import installReactor
from twisted.internet.selectreactor import SelectReactor
class Exi... | [
"def",
"get_exitcode_reactor",
"(",
")",
":",
"from",
"twisted",
".",
"internet",
".",
"main",
"import",
"installReactor",
"from",
"twisted",
".",
"internet",
".",
"selectreactor",
"import",
"SelectReactor",
"class",
"ExitCodeReactor",
"(",
"SelectReactor",
")",
"... | This is only neccesary until a fix like the one outlined here is
implemented for Twisted:
http://twistedmatrix.com/trac/ticket/2182 | [
"This",
"is",
"only",
"neccesary",
"until",
"a",
"fix",
"like",
"the",
"one",
"outlined",
"here",
"is",
"implemented",
"for",
"Twisted",
":",
"http",
":",
"//",
"twistedmatrix",
".",
"com",
"/",
"trac",
"/",
"ticket",
"/",
"2182"
] | train | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/reactor.py#L4-L25 |
twisted/txaws | txaws/_auth_v4.py | getSignatureKey | def getSignatureKey(key, dateStamp, regionName, serviceName):
"""
Generate the signing key for AWS V4 requests.
@param key: The secret key to use.
@type key: L{bytes}
@param dateStamp: The UTC date and time, serialized as an AWS date
stamp.
@type dateStamp: L{bytes}
@param regionN... | python | def getSignatureKey(key, dateStamp, regionName, serviceName):
"""
Generate the signing key for AWS V4 requests.
@param key: The secret key to use.
@type key: L{bytes}
@param dateStamp: The UTC date and time, serialized as an AWS date
stamp.
@type dateStamp: L{bytes}
@param regionN... | [
"def",
"getSignatureKey",
"(",
"key",
",",
"dateStamp",
",",
"regionName",
",",
"serviceName",
")",
":",
"kDate",
"=",
"sign",
"(",
"(",
"b'AWS4'",
"+",
"key",
")",
",",
"dateStamp",
")",
"kRegion",
"=",
"sign",
"(",
"kDate",
",",
"regionName",
")",
"k... | Generate the signing key for AWS V4 requests.
@param key: The secret key to use.
@type key: L{bytes}
@param dateStamp: The UTC date and time, serialized as an AWS date
stamp.
@type dateStamp: L{bytes}
@param regionName: The name of the region.
@type regionName: L{bytes}
@param se... | [
"Generate",
"the",
"signing",
"key",
"for",
"AWS",
"V4",
"requests",
"."
] | train | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/_auth_v4.py#L29-L54 |
twisted/txaws | txaws/_auth_v4.py | _make_canonical_uri | def _make_canonical_uri(parsed):
"""
Return the canonical URI for a parsed URL.
@param parsed: The parsed URL from which to extract the canonical
URI
@type parsed: L{urlparse.ParseResult}
@return: The canonical URI.
@rtype: L{str}
"""
path = urllib.quote(parsed.path)
canoni... | python | def _make_canonical_uri(parsed):
"""
Return the canonical URI for a parsed URL.
@param parsed: The parsed URL from which to extract the canonical
URI
@type parsed: L{urlparse.ParseResult}
@return: The canonical URI.
@rtype: L{str}
"""
path = urllib.quote(parsed.path)
canoni... | [
"def",
"_make_canonical_uri",
"(",
"parsed",
")",
":",
"path",
"=",
"urllib",
".",
"quote",
"(",
"parsed",
".",
"path",
")",
"canonical_parsed",
"=",
"parsed",
".",
"_replace",
"(",
"path",
"=",
"path",
",",
"params",
"=",
"''",
",",
"query",
"=",
"''"... | Return the canonical URI for a parsed URL.
@param parsed: The parsed URL from which to extract the canonical
URI
@type parsed: L{urlparse.ParseResult}
@return: The canonical URI.
@rtype: L{str} | [
"Return",
"the",
"canonical",
"URI",
"for",
"a",
"parsed",
"URL",
"."
] | train | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/_auth_v4.py#L86-L100 |
twisted/txaws | txaws/_auth_v4.py | _make_canonical_query_string | def _make_canonical_query_string(parsed):
"""
Return the canonical query string for a parsed URL.
@param parsed: The parsed URL from which to extract the canonical
query string.
@type parsed: L{urlparse.ParseResult}
@return: The canonical query string.
@rtype: L{str}
"""
query_... | python | def _make_canonical_query_string(parsed):
"""
Return the canonical query string for a parsed URL.
@param parsed: The parsed URL from which to extract the canonical
query string.
@type parsed: L{urlparse.ParseResult}
@return: The canonical query string.
@rtype: L{str}
"""
query_... | [
"def",
"_make_canonical_query_string",
"(",
"parsed",
")",
":",
"query_params",
"=",
"urlparse",
".",
"parse_qs",
"(",
"parsed",
".",
"query",
",",
"keep_blank_values",
"=",
"True",
")",
"sorted_query_params",
"=",
"sorted",
"(",
"(",
"k",
",",
"v",
")",
"fo... | Return the canonical query string for a parsed URL.
@param parsed: The parsed URL from which to extract the canonical
query string.
@type parsed: L{urlparse.ParseResult}
@return: The canonical query string.
@rtype: L{str} | [
"Return",
"the",
"canonical",
"query",
"string",
"for",
"a",
"parsed",
"URL",
"."
] | train | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/_auth_v4.py#L103-L118 |
twisted/txaws | txaws/_auth_v4.py | _make_canonical_headers | def _make_canonical_headers(headers, headers_to_sign):
"""
Return canonicalized headers.
@param headers: The request headers.
@type headers: L{dict}
@param headers_to_sign: A sequence of header names that should be
signed.
@type headers_to_sign: A sequence of L{bytes}
@return: The... | python | def _make_canonical_headers(headers, headers_to_sign):
"""
Return canonicalized headers.
@param headers: The request headers.
@type headers: L{dict}
@param headers_to_sign: A sequence of header names that should be
signed.
@type headers_to_sign: A sequence of L{bytes}
@return: The... | [
"def",
"_make_canonical_headers",
"(",
"headers",
",",
"headers_to_sign",
")",
":",
"pairs",
"=",
"[",
"]",
"for",
"name",
"in",
"headers_to_sign",
":",
"if",
"name",
"not",
"in",
"headers",
":",
"continue",
"values",
"=",
"headers",
"[",
"name",
"]",
"if"... | Return canonicalized headers.
@param headers: The request headers.
@type headers: L{dict}
@param headers_to_sign: A sequence of header names that should be
signed.
@type headers_to_sign: A sequence of L{bytes}
@return: The canonicalized headers.
@rtype: L{bytes} | [
"Return",
"canonicalized",
"headers",
"."
] | train | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/_auth_v4.py#L121-L149 |
twisted/txaws | txaws/_auth_v4.py | _make_signed_headers | def _make_signed_headers(headers, headers_to_sign):
"""
Return a semicolon-delimited list of headers to sign.
@param headers: The request headers.
@type headers: L{dict}
@param headers_to_sign: A sequence of header names that should be
signed.
@type headers_to_sign: L{bytes}
@retu... | python | def _make_signed_headers(headers, headers_to_sign):
"""
Return a semicolon-delimited list of headers to sign.
@param headers: The request headers.
@type headers: L{dict}
@param headers_to_sign: A sequence of header names that should be
signed.
@type headers_to_sign: L{bytes}
@retu... | [
"def",
"_make_signed_headers",
"(",
"headers",
",",
"headers_to_sign",
")",
":",
"return",
"b\";\"",
".",
"join",
"(",
"header",
".",
"lower",
"(",
")",
"for",
"header",
"in",
"sorted",
"(",
"headers_to_sign",
")",
"if",
"header",
"in",
"headers",
")"
] | Return a semicolon-delimited list of headers to sign.
@param headers: The request headers.
@type headers: L{dict}
@param headers_to_sign: A sequence of header names that should be
signed.
@type headers_to_sign: L{bytes}
@return: The semicolon-delimited list of headers.
@rtype: L{bytes... | [
"Return",
"a",
"semicolon",
"-",
"delimited",
"list",
"of",
"headers",
"to",
"sign",
"."
] | train | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/_auth_v4.py#L152-L167 |
twisted/txaws | txaws/_auth_v4.py | _make_authorization_header | def _make_authorization_header(region,
service,
canonical_request,
credentials,
instant):
"""
Construct an AWS version 4 authorization value for use in an
C{Authorization} header.
... | python | def _make_authorization_header(region,
service,
canonical_request,
credentials,
instant):
"""
Construct an AWS version 4 authorization value for use in an
C{Authorization} header.
... | [
"def",
"_make_authorization_header",
"(",
"region",
",",
"service",
",",
"canonical_request",
",",
"credentials",
",",
"instant",
")",
":",
"date_stamp",
"=",
"makeDateStamp",
"(",
"instant",
")",
"amz_date",
"=",
"makeAMZDate",
"(",
"instant",
")",
"scope",
"="... | Construct an AWS version 4 authorization value for use in an
C{Authorization} header.
@param region: The AWS region name (e.g., C{'us-east-1'}).
@type region: L{str}
@param service: The AWS service's name (e.g., C{'s3'}).
@type service: L{str}
@param canonical_request: The canonical form of t... | [
"Construct",
"an",
"AWS",
"version",
"4",
"authorization",
"value",
"for",
"use",
"in",
"an",
"C",
"{",
"Authorization",
"}",
"header",
"."
] | train | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/_auth_v4.py#L415-L477 |
T-002/pycast | pycast/common/helper.py | linear_interpolation | def linear_interpolation(first, last, steps):
"""Interpolates all missing values using linear interpolation.
:param numeric first: Start value for the interpolation.
:param numeric last: End Value for the interpolation
:param integer steps: Number of missing values that have to be calculated.
... | python | def linear_interpolation(first, last, steps):
"""Interpolates all missing values using linear interpolation.
:param numeric first: Start value for the interpolation.
:param numeric last: End Value for the interpolation
:param integer steps: Number of missing values that have to be calculated.
... | [
"def",
"linear_interpolation",
"(",
"first",
",",
"last",
",",
"steps",
")",
":",
"result",
"=",
"[",
"]",
"for",
"step",
"in",
"xrange",
"(",
"0",
",",
"steps",
")",
":",
"fpart",
"=",
"(",
"steps",
"-",
"step",
")",
"*",
"first",
"lpart",
"=",
... | Interpolates all missing values using linear interpolation.
:param numeric first: Start value for the interpolation.
:param numeric last: End Value for the interpolation
:param integer steps: Number of missing values that have to be calculated.
:return: Returns a list of floats containing ... | [
"Interpolates",
"all",
"missing",
"values",
"using",
"linear",
"interpolation",
"."
] | train | https://github.com/T-002/pycast/blob/8a53505c6d8367e0ea572e8af768e80b29e1cc41/pycast/common/helper.py#L27-L47 |
Duke-GCB/DukeDSClient | ddsc/core/projectuploader.py | upload_project_run | def upload_project_run(upload_context):
"""
Function run by CreateProjectCommand to create the project.
Runs in a background process.
:param upload_context: UploadContext: contains data service setup and project name to create.
"""
data_service = upload_context.make_data_service()
project_na... | python | def upload_project_run(upload_context):
"""
Function run by CreateProjectCommand to create the project.
Runs in a background process.
:param upload_context: UploadContext: contains data service setup and project name to create.
"""
data_service = upload_context.make_data_service()
project_na... | [
"def",
"upload_project_run",
"(",
"upload_context",
")",
":",
"data_service",
"=",
"upload_context",
".",
"make_data_service",
"(",
")",
"project_name",
"=",
"upload_context",
".",
"project_name_or_id",
".",
"get_name_or_raise",
"(",
")",
"result",
"=",
"data_service"... | Function run by CreateProjectCommand to create the project.
Runs in a background process.
:param upload_context: UploadContext: contains data service setup and project name to create. | [
"Function",
"run",
"by",
"CreateProjectCommand",
"to",
"create",
"the",
"project",
".",
"Runs",
"in",
"a",
"background",
"process",
".",
":",
"param",
"upload_context",
":",
"UploadContext",
":",
"contains",
"data",
"service",
"setup",
"and",
"project",
"name",
... | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/projectuploader.py#L270-L279 |
Duke-GCB/DukeDSClient | ddsc/core/projectuploader.py | upload_folder_run | def upload_folder_run(upload_context):
"""
Function run by CreateFolderCommand to create the folder.
Runs in a background process.
:param upload_context: UploadContext: contains data service setup and folder details.
"""
data_service = upload_context.make_data_service()
folder_name, parent_k... | python | def upload_folder_run(upload_context):
"""
Function run by CreateFolderCommand to create the folder.
Runs in a background process.
:param upload_context: UploadContext: contains data service setup and folder details.
"""
data_service = upload_context.make_data_service()
folder_name, parent_k... | [
"def",
"upload_folder_run",
"(",
"upload_context",
")",
":",
"data_service",
"=",
"upload_context",
".",
"make_data_service",
"(",
")",
"folder_name",
",",
"parent_kind",
",",
"parent_remote_id",
"=",
"upload_context",
".",
"params",
"result",
"=",
"data_service",
"... | Function run by CreateFolderCommand to create the folder.
Runs in a background process.
:param upload_context: UploadContext: contains data service setup and folder details. | [
"Function",
"run",
"by",
"CreateFolderCommand",
"to",
"create",
"the",
"folder",
".",
"Runs",
"in",
"a",
"background",
"process",
".",
":",
"param",
"upload_context",
":",
"UploadContext",
":",
"contains",
"data",
"service",
"setup",
"and",
"folder",
"details",
... | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/projectuploader.py#L321-L330 |
Duke-GCB/DukeDSClient | ddsc/core/projectuploader.py | create_small_file | def create_small_file(upload_context):
"""
Function run by CreateSmallFileCommand to create the file.
Runs in a background process.
:param upload_context: UploadContext: contains data service setup and file details.
:return dict: DukeDS file data
"""
data_service = upload_context.make_data_s... | python | def create_small_file(upload_context):
"""
Function run by CreateSmallFileCommand to create the file.
Runs in a background process.
:param upload_context: UploadContext: contains data service setup and file details.
:return dict: DukeDS file data
"""
data_service = upload_context.make_data_s... | [
"def",
"create_small_file",
"(",
"upload_context",
")",
":",
"data_service",
"=",
"upload_context",
".",
"make_data_service",
"(",
")",
"parent_data",
",",
"path_data",
",",
"remote_file_id",
"=",
"upload_context",
".",
"params",
"# The small file will fit into one chunk ... | Function run by CreateSmallFileCommand to create the file.
Runs in a background process.
:param upload_context: UploadContext: contains data service setup and file details.
:return dict: DukeDS file data | [
"Function",
"run",
"by",
"CreateSmallFileCommand",
"to",
"create",
"the",
"file",
".",
"Runs",
"in",
"a",
"background",
"process",
".",
":",
"param",
"upload_context",
":",
"UploadContext",
":",
"contains",
"data",
"service",
"setup",
"and",
"file",
"details",
... | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/projectuploader.py#L394-L413 |
Duke-GCB/DukeDSClient | ddsc/core/projectuploader.py | UploadSettings.rebuild_data_service | def rebuild_data_service(config, data_service_auth_data):
"""
Deserialize value into DataServiceApi object.
:param config:
:param data_service_auth_data:
:return:
"""
auth = DataServiceAuth(config)
auth.set_auth_data(data_service_auth_data)
return ... | python | def rebuild_data_service(config, data_service_auth_data):
"""
Deserialize value into DataServiceApi object.
:param config:
:param data_service_auth_data:
:return:
"""
auth = DataServiceAuth(config)
auth.set_auth_data(data_service_auth_data)
return ... | [
"def",
"rebuild_data_service",
"(",
"config",
",",
"data_service_auth_data",
")",
":",
"auth",
"=",
"DataServiceAuth",
"(",
"config",
")",
"auth",
".",
"set_auth_data",
"(",
"data_service_auth_data",
")",
"return",
"DataServiceApi",
"(",
"auth",
",",
"config",
"."... | Deserialize value into DataServiceApi object.
:param config:
:param data_service_auth_data:
:return: | [
"Deserialize",
"value",
"into",
"DataServiceApi",
"object",
".",
":",
"param",
"config",
":",
":",
"param",
"data_service_auth_data",
":",
":",
"return",
":"
] | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/projectuploader.py#L34-L43 |
Duke-GCB/DukeDSClient | ddsc/core/projectuploader.py | ProjectUploader.run | def run(self, local_project):
"""
Upload a project by uploading project, folders, and small files then uploading the large files.
:param local_project: LocalProject: project to upload
"""
# Walk project adding small items to runner saving large items to large_items
Projec... | python | def run(self, local_project):
"""
Upload a project by uploading project, folders, and small files then uploading the large files.
:param local_project: LocalProject: project to upload
"""
# Walk project adding small items to runner saving large items to large_items
Projec... | [
"def",
"run",
"(",
"self",
",",
"local_project",
")",
":",
"# Walk project adding small items to runner saving large items to large_items",
"ProjectWalker",
".",
"walk_project",
"(",
"local_project",
",",
"self",
")",
"# Run small items in parallel",
"self",
".",
"runner",
... | Upload a project by uploading project, folders, and small files then uploading the large files.
:param local_project: LocalProject: project to upload | [
"Upload",
"a",
"project",
"by",
"uploading",
"project",
"folders",
"and",
"small",
"files",
"then",
"uploading",
"the",
"large",
"files",
".",
":",
"param",
"local_project",
":",
"LocalProject",
":",
"project",
"to",
"upload"
] | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/projectuploader.py#L109-L119 |
Duke-GCB/DukeDSClient | ddsc/core/projectuploader.py | ProjectUploader.visit_file | def visit_file(self, item, parent):
"""
If file is large add it to the large items to be processed after small task list.
else file is small add it to the small task list.
"""
if self.is_large_file(item):
self.large_items.append((item, parent))
else:
... | python | def visit_file(self, item, parent):
"""
If file is large add it to the large items to be processed after small task list.
else file is small add it to the small task list.
"""
if self.is_large_file(item):
self.large_items.append((item, parent))
else:
... | [
"def",
"visit_file",
"(",
"self",
",",
"item",
",",
"parent",
")",
":",
"if",
"self",
".",
"is_large_file",
"(",
"item",
")",
":",
"self",
".",
"large_items",
".",
"append",
"(",
"(",
"item",
",",
"parent",
")",
")",
"else",
":",
"self",
".",
"smal... | If file is large add it to the large items to be processed after small task list.
else file is small add it to the small task list. | [
"If",
"file",
"is",
"large",
"add",
"it",
"to",
"the",
"large",
"items",
"to",
"be",
"processed",
"after",
"small",
"task",
"list",
".",
"else",
"file",
"is",
"small",
"add",
"it",
"to",
"the",
"small",
"task",
"list",
"."
] | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/projectuploader.py#L134-L142 |
Duke-GCB/DukeDSClient | ddsc/core/projectuploader.py | ProjectUploader.upload_large_items | def upload_large_items(self):
"""
Upload files that were too large.
"""
for local_file, parent in self.large_items:
if local_file.need_to_send:
self.process_large_file(local_file, parent) | python | def upload_large_items(self):
"""
Upload files that were too large.
"""
for local_file, parent in self.large_items:
if local_file.need_to_send:
self.process_large_file(local_file, parent) | [
"def",
"upload_large_items",
"(",
"self",
")",
":",
"for",
"local_file",
",",
"parent",
"in",
"self",
".",
"large_items",
":",
"if",
"local_file",
".",
"need_to_send",
":",
"self",
".",
"process_large_file",
"(",
"local_file",
",",
"parent",
")"
] | Upload files that were too large. | [
"Upload",
"files",
"that",
"were",
"too",
"large",
"."
] | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/projectuploader.py#L147-L153 |
Duke-GCB/DukeDSClient | ddsc/core/projectuploader.py | ProjectUploader.process_large_file | def process_large_file(self, local_file, parent):
"""
Upload a single file using multiple processes to upload multiple chunks at the same time.
Updates local_file with it's remote_id when done.
:param local_file: LocalFile: file we are uploading
:param parent: LocalFolder/LocalPr... | python | def process_large_file(self, local_file, parent):
"""
Upload a single file using multiple processes to upload multiple chunks at the same time.
Updates local_file with it's remote_id when done.
:param local_file: LocalFile: file we are uploading
:param parent: LocalFolder/LocalPr... | [
"def",
"process_large_file",
"(",
"self",
",",
"local_file",
",",
"parent",
")",
":",
"file_content_sender",
"=",
"FileUploader",
"(",
"self",
".",
"settings",
".",
"config",
",",
"self",
".",
"settings",
".",
"data_service",
",",
"local_file",
",",
"self",
... | Upload a single file using multiple processes to upload multiple chunks at the same time.
Updates local_file with it's remote_id when done.
:param local_file: LocalFile: file we are uploading
:param parent: LocalFolder/LocalProject: parent of the file | [
"Upload",
"a",
"single",
"file",
"using",
"multiple",
"processes",
"to",
"upload",
"multiple",
"chunks",
"at",
"the",
"same",
"time",
".",
"Updates",
"local_file",
"with",
"it",
"s",
"remote_id",
"when",
"done",
".",
":",
"param",
"local_file",
":",
"LocalFi... | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/projectuploader.py#L155-L165 |
Duke-GCB/DukeDSClient | ddsc/core/projectuploader.py | SmallItemUploadTaskBuilder.visit_project | def visit_project(self, item):
"""
Adds create project command to task runner if project doesn't already exist.
"""
if not item.remote_id:
command = CreateProjectCommand(self.settings, item)
self.task_runner_add(None, item, command)
else:
self.... | python | def visit_project(self, item):
"""
Adds create project command to task runner if project doesn't already exist.
"""
if not item.remote_id:
command = CreateProjectCommand(self.settings, item)
self.task_runner_add(None, item, command)
else:
self.... | [
"def",
"visit_project",
"(",
"self",
",",
"item",
")",
":",
"if",
"not",
"item",
".",
"remote_id",
":",
"command",
"=",
"CreateProjectCommand",
"(",
"self",
".",
"settings",
",",
"item",
")",
"self",
".",
"task_runner_add",
"(",
"None",
",",
"item",
",",... | Adds create project command to task runner if project doesn't already exist. | [
"Adds",
"create",
"project",
"command",
"to",
"task",
"runner",
"if",
"project",
"doesn",
"t",
"already",
"exist",
"."
] | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/projectuploader.py#L186-L194 |
Duke-GCB/DukeDSClient | ddsc/core/projectuploader.py | SmallItemUploadTaskBuilder.visit_folder | def visit_folder(self, item, parent):
"""
Adds create folder command to task runner if folder doesn't already exist.
"""
if not item.remote_id:
command = CreateFolderCommand(self.settings, item, parent)
self.task_runner_add(parent, item, command) | python | def visit_folder(self, item, parent):
"""
Adds create folder command to task runner if folder doesn't already exist.
"""
if not item.remote_id:
command = CreateFolderCommand(self.settings, item, parent)
self.task_runner_add(parent, item, command) | [
"def",
"visit_folder",
"(",
"self",
",",
"item",
",",
"parent",
")",
":",
"if",
"not",
"item",
".",
"remote_id",
":",
"command",
"=",
"CreateFolderCommand",
"(",
"self",
".",
"settings",
",",
"item",
",",
"parent",
")",
"self",
".",
"task_runner_add",
"(... | Adds create folder command to task runner if folder doesn't already exist. | [
"Adds",
"create",
"folder",
"command",
"to",
"task",
"runner",
"if",
"folder",
"doesn",
"t",
"already",
"exist",
"."
] | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/projectuploader.py#L196-L202 |
Duke-GCB/DukeDSClient | ddsc/core/projectuploader.py | SmallItemUploadTaskBuilder.visit_file | def visit_file(self, item, parent):
"""
If file is small add create small file command otherwise raise error.
Large files shouldn't be passed to SmallItemUploadTaskBuilder.
"""
if item.need_to_send:
if item.size > self.settings.config.upload_bytes_per_chunk:
... | python | def visit_file(self, item, parent):
"""
If file is small add create small file command otherwise raise error.
Large files shouldn't be passed to SmallItemUploadTaskBuilder.
"""
if item.need_to_send:
if item.size > self.settings.config.upload_bytes_per_chunk:
... | [
"def",
"visit_file",
"(",
"self",
",",
"item",
",",
"parent",
")",
":",
"if",
"item",
".",
"need_to_send",
":",
"if",
"item",
".",
"size",
">",
"self",
".",
"settings",
".",
"config",
".",
"upload_bytes_per_chunk",
":",
"msg",
"=",
"\"Programmer Error: Try... | If file is small add create small file command otherwise raise error.
Large files shouldn't be passed to SmallItemUploadTaskBuilder. | [
"If",
"file",
"is",
"small",
"add",
"create",
"small",
"file",
"command",
"otherwise",
"raise",
"error",
".",
"Large",
"files",
"shouldn",
"t",
"be",
"passed",
"to",
"SmallItemUploadTaskBuilder",
"."
] | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/projectuploader.py#L204-L216 |
Duke-GCB/DukeDSClient | ddsc/core/projectuploader.py | SmallItemUploadTaskBuilder.task_runner_add | def task_runner_add(self, parent, item, command):
"""
Add command to task runner with parent's task id createing a task id for item/command.
Save this item's id to a lookup.
:param parent: object: parent of item
:param item: object: item we are running command on
:param c... | python | def task_runner_add(self, parent, item, command):
"""
Add command to task runner with parent's task id createing a task id for item/command.
Save this item's id to a lookup.
:param parent: object: parent of item
:param item: object: item we are running command on
:param c... | [
"def",
"task_runner_add",
"(",
"self",
",",
"parent",
",",
"item",
",",
"command",
")",
":",
"parent_task_id",
"=",
"self",
".",
"item_to_id",
".",
"get",
"(",
"parent",
")",
"task_id",
"=",
"self",
".",
"task_runner",
".",
"add",
"(",
"parent_task_id",
... | Add command to task runner with parent's task id createing a task id for item/command.
Save this item's id to a lookup.
:param parent: object: parent of item
:param item: object: item we are running command on
:param command: parallel TaskCommand we want to have run | [
"Add",
"command",
"to",
"task",
"runner",
"with",
"parent",
"s",
"task",
"id",
"createing",
"a",
"task",
"id",
"for",
"item",
"/",
"command",
".",
"Save",
"this",
"item",
"s",
"id",
"to",
"a",
"lookup",
".",
":",
"param",
"parent",
":",
"object",
":"... | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/projectuploader.py#L218-L228 |
Duke-GCB/DukeDSClient | ddsc/core/projectuploader.py | CreateProjectCommand.after_run | def after_run(self, result_id):
"""
Save uuid associated with project we just created.
:param result_id: str: uuid of the project
"""
self.local_project.set_remote_id_after_send(result_id)
self.settings.project_id = result_id | python | def after_run(self, result_id):
"""
Save uuid associated with project we just created.
:param result_id: str: uuid of the project
"""
self.local_project.set_remote_id_after_send(result_id)
self.settings.project_id = result_id | [
"def",
"after_run",
"(",
"self",
",",
"result_id",
")",
":",
"self",
".",
"local_project",
".",
"set_remote_id_after_send",
"(",
"result_id",
")",
"self",
".",
"settings",
".",
"project_id",
"=",
"result_id"
] | Save uuid associated with project we just created.
:param result_id: str: uuid of the project | [
"Save",
"uuid",
"associated",
"with",
"project",
"we",
"just",
"created",
".",
":",
"param",
"result_id",
":",
"str",
":",
"uuid",
"of",
"the",
"project"
] | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/projectuploader.py#L261-L267 |
Duke-GCB/DukeDSClient | ddsc/core/projectuploader.py | CreateFolderCommand.create_context | def create_context(self, message_queue, task_id):
"""
Create values to be used by upload_folder_run function.
:param message_queue: Queue: queue background process can send messages to us on
:param task_id: int: id of this command's task so message will be routed correctly
"""
... | python | def create_context(self, message_queue, task_id):
"""
Create values to be used by upload_folder_run function.
:param message_queue: Queue: queue background process can send messages to us on
:param task_id: int: id of this command's task so message will be routed correctly
"""
... | [
"def",
"create_context",
"(",
"self",
",",
"message_queue",
",",
"task_id",
")",
":",
"params",
"=",
"(",
"self",
".",
"remote_folder",
".",
"name",
",",
"self",
".",
"parent",
".",
"kind",
",",
"self",
".",
"parent",
".",
"remote_id",
")",
"return",
"... | Create values to be used by upload_folder_run function.
:param message_queue: Queue: queue background process can send messages to us on
:param task_id: int: id of this command's task so message will be routed correctly | [
"Create",
"values",
"to",
"be",
"used",
"by",
"upload_folder_run",
"function",
".",
":",
"param",
"message_queue",
":",
"Queue",
":",
"queue",
"background",
"process",
"can",
"send",
"messages",
"to",
"us",
"on",
":",
"param",
"task_id",
":",
"int",
":",
"... | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/projectuploader.py#L304-L311 |
Duke-GCB/DukeDSClient | ddsc/core/projectuploader.py | CreateSmallFileCommand.create_context | def create_context(self, message_queue, task_id):
"""
Create values to be used by create_small_file function.
:param message_queue: Queue: queue background process can send messages to us on
:param task_id: int: id of this command's task so message will be routed correctly
"""
... | python | def create_context(self, message_queue, task_id):
"""
Create values to be used by create_small_file function.
:param message_queue: Queue: queue background process can send messages to us on
:param task_id: int: id of this command's task so message will be routed correctly
"""
... | [
"def",
"create_context",
"(",
"self",
",",
"message_queue",
",",
"task_id",
")",
":",
"parent_data",
"=",
"ParentData",
"(",
"self",
".",
"parent",
".",
"kind",
",",
"self",
".",
"parent",
".",
"remote_id",
")",
"path_data",
"=",
"self",
".",
"local_file",... | Create values to be used by create_small_file function.
:param message_queue: Queue: queue background process can send messages to us on
:param task_id: int: id of this command's task so message will be routed correctly | [
"Create",
"values",
"to",
"be",
"used",
"by",
"create_small_file",
"function",
".",
":",
"param",
"message_queue",
":",
"Queue",
":",
"queue",
"background",
"process",
"can",
"send",
"messages",
"to",
"us",
"on",
":",
"param",
"task_id",
":",
"int",
":",
"... | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/projectuploader.py#L360-L369 |
Duke-GCB/DukeDSClient | ddsc/core/projectuploader.py | CreateSmallFileCommand.after_run | def after_run(self, remote_file_data):
"""
Save uuid of file to our LocalFile
:param remote_file_data: dict: DukeDS file data
"""
if self.file_upload_post_processor:
self.file_upload_post_processor.run(self.settings.data_service, remote_file_data)
remote_file_... | python | def after_run(self, remote_file_data):
"""
Save uuid of file to our LocalFile
:param remote_file_data: dict: DukeDS file data
"""
if self.file_upload_post_processor:
self.file_upload_post_processor.run(self.settings.data_service, remote_file_data)
remote_file_... | [
"def",
"after_run",
"(",
"self",
",",
"remote_file_data",
")",
":",
"if",
"self",
".",
"file_upload_post_processor",
":",
"self",
".",
"file_upload_post_processor",
".",
"run",
"(",
"self",
".",
"settings",
".",
"data_service",
",",
"remote_file_data",
")",
"rem... | Save uuid of file to our LocalFile
:param remote_file_data: dict: DukeDS file data | [
"Save",
"uuid",
"of",
"file",
"to",
"our",
"LocalFile",
":",
"param",
"remote_file_data",
":",
"dict",
":",
"DukeDS",
"file",
"data"
] | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/projectuploader.py#L371-L380 |
Duke-GCB/DukeDSClient | ddsc/core/projectuploader.py | CreateSmallFileCommand.on_message | def on_message(self, started_waiting):
"""
Receives started_waiting boolean from create_small_file method and notifies project_status_monitor in settings.
:param started_waiting: boolean: True when we start waiting, False when done
"""
watcher = self.settings.watcher
if s... | python | def on_message(self, started_waiting):
"""
Receives started_waiting boolean from create_small_file method and notifies project_status_monitor in settings.
:param started_waiting: boolean: True when we start waiting, False when done
"""
watcher = self.settings.watcher
if s... | [
"def",
"on_message",
"(",
"self",
",",
"started_waiting",
")",
":",
"watcher",
"=",
"self",
".",
"settings",
".",
"watcher",
"if",
"started_waiting",
":",
"watcher",
".",
"start_waiting",
"(",
")",
"else",
":",
"watcher",
".",
"done_waiting",
"(",
")"
] | Receives started_waiting boolean from create_small_file method and notifies project_status_monitor in settings.
:param started_waiting: boolean: True when we start waiting, False when done | [
"Receives",
"started_waiting",
"boolean",
"from",
"create_small_file",
"method",
"and",
"notifies",
"project_status_monitor",
"in",
"settings",
".",
":",
"param",
"started_waiting",
":",
"boolean",
":",
"True",
"when",
"we",
"start",
"waiting",
"False",
"when",
"don... | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/projectuploader.py#L382-L391 |
Duke-GCB/DukeDSClient | ddsc/core/projectuploader.py | ProjectUploadDryRun._visit_recur | def _visit_recur(self, item):
"""
Recursively visits children of item.
:param item: object: project, folder or file we will add to upload_items if necessary.
"""
if item.kind == KindType.file_str:
if item.need_to_send:
self.add_upload_item(item.path)
... | python | def _visit_recur(self, item):
"""
Recursively visits children of item.
:param item: object: project, folder or file we will add to upload_items if necessary.
"""
if item.kind == KindType.file_str:
if item.need_to_send:
self.add_upload_item(item.path)
... | [
"def",
"_visit_recur",
"(",
"self",
",",
"item",
")",
":",
"if",
"item",
".",
"kind",
"==",
"KindType",
".",
"file_str",
":",
"if",
"item",
".",
"need_to_send",
":",
"self",
".",
"add_upload_item",
"(",
"item",
".",
"path",
")",
"else",
":",
"if",
"i... | Recursively visits children of item.
:param item: object: project, folder or file we will add to upload_items if necessary. | [
"Recursively",
"visits",
"children",
"of",
"item",
".",
":",
"param",
"item",
":",
"object",
":",
"project",
"folder",
"or",
"file",
"we",
"will",
"add",
"to",
"upload_items",
"if",
"necessary",
"."
] | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/projectuploader.py#L434-L449 |
Duke-GCB/DukeDSClient | ddsc/cmdparser.py | add_project_name_arg | def add_project_name_arg(arg_parser, required, help_text):
"""
Adds project_name parameter to a parser.
:param arg_parser: ArgumentParser parser to add this argument to.
:param help_text: str label displayed in usage
"""
arg_parser.add_argument("-p", '--project-name',
... | python | def add_project_name_arg(arg_parser, required, help_text):
"""
Adds project_name parameter to a parser.
:param arg_parser: ArgumentParser parser to add this argument to.
:param help_text: str label displayed in usage
"""
arg_parser.add_argument("-p", '--project-name',
... | [
"def",
"add_project_name_arg",
"(",
"arg_parser",
",",
"required",
",",
"help_text",
")",
":",
"arg_parser",
".",
"add_argument",
"(",
"\"-p\"",
",",
"'--project-name'",
",",
"metavar",
"=",
"'ProjectName'",
",",
"type",
"=",
"to_unicode",
",",
"dest",
"=",
"'... | Adds project_name parameter to a parser.
:param arg_parser: ArgumentParser parser to add this argument to.
:param help_text: str label displayed in usage | [
"Adds",
"project_name",
"parameter",
"to",
"a",
"parser",
".",
":",
"param",
"arg_parser",
":",
"ArgumentParser",
"parser",
"to",
"add",
"this",
"argument",
"to",
".",
":",
"param",
"help_text",
":",
"str",
"label",
"displayed",
"in",
"usage"
] | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/cmdparser.py#L33-L44 |
Duke-GCB/DukeDSClient | ddsc/cmdparser.py | add_project_name_or_id_arg | def add_project_name_or_id_arg(arg_parser, required=True, help_text_suffix="manage"):
"""
Adds project name or project id argument. These two are mutually exclusive.
:param arg_parser:
:param required:
:param help_text:
:return:
"""
project_name_or_id = arg_parser.add_mutually_exclusive_... | python | def add_project_name_or_id_arg(arg_parser, required=True, help_text_suffix="manage"):
"""
Adds project name or project id argument. These two are mutually exclusive.
:param arg_parser:
:param required:
:param help_text:
:return:
"""
project_name_or_id = arg_parser.add_mutually_exclusive_... | [
"def",
"add_project_name_or_id_arg",
"(",
"arg_parser",
",",
"required",
"=",
"True",
",",
"help_text_suffix",
"=",
"\"manage\"",
")",
":",
"project_name_or_id",
"=",
"arg_parser",
".",
"add_mutually_exclusive_group",
"(",
"required",
"=",
"required",
")",
"name_help_... | Adds project name or project id argument. These two are mutually exclusive.
:param arg_parser:
:param required:
:param help_text:
:return: | [
"Adds",
"project",
"name",
"or",
"project",
"id",
"argument",
".",
"These",
"two",
"are",
"mutually",
"exclusive",
".",
":",
"param",
"arg_parser",
":",
":",
"param",
"required",
":",
":",
"param",
"help_text",
":",
":",
"return",
":"
] | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/cmdparser.py#L61-L73 |
Duke-GCB/DukeDSClient | ddsc/cmdparser.py | _paths_must_exists | def _paths_must_exists(path):
"""
Raises error if path doesn't exist.
:param path: str path to check
:return: str same path passed in
"""
path = to_unicode(path)
if not os.path.exists(path):
raise argparse.ArgumentTypeError("{} is not a valid file/folder.".format(path))
return pa... | python | def _paths_must_exists(path):
"""
Raises error if path doesn't exist.
:param path: str path to check
:return: str same path passed in
"""
path = to_unicode(path)
if not os.path.exists(path):
raise argparse.ArgumentTypeError("{} is not a valid file/folder.".format(path))
return pa... | [
"def",
"_paths_must_exists",
"(",
"path",
")",
":",
"path",
"=",
"to_unicode",
"(",
"path",
")",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"path",
")",
":",
"raise",
"argparse",
".",
"ArgumentTypeError",
"(",
"\"{} is not a valid file/folder.\"",
"... | Raises error if path doesn't exist.
:param path: str path to check
:return: str same path passed in | [
"Raises",
"error",
"if",
"path",
"doesn",
"t",
"exist",
".",
":",
"param",
"path",
":",
"str",
"path",
"to",
"check",
":",
"return",
":",
"str",
"same",
"path",
"passed",
"in"
] | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/cmdparser.py#L76-L85 |
Duke-GCB/DukeDSClient | ddsc/cmdparser.py | _path_has_ok_chars | def _path_has_ok_chars(path):
"""
Validate path for invalid characters.
:param path: str possible filesystem path
:return: path if it was ok otherwise raises error
"""
basename = os.path.basename(path)
if any([bad_char in basename for bad_char in INVALID_PATH_CHARS]):
raise argpa... | python | def _path_has_ok_chars(path):
"""
Validate path for invalid characters.
:param path: str possible filesystem path
:return: path if it was ok otherwise raises error
"""
basename = os.path.basename(path)
if any([bad_char in basename for bad_char in INVALID_PATH_CHARS]):
raise argpa... | [
"def",
"_path_has_ok_chars",
"(",
"path",
")",
":",
"basename",
"=",
"os",
".",
"path",
".",
"basename",
"(",
"path",
")",
"if",
"any",
"(",
"[",
"bad_char",
"in",
"basename",
"for",
"bad_char",
"in",
"INVALID_PATH_CHARS",
"]",
")",
":",
"raise",
"argpar... | Validate path for invalid characters.
:param path: str possible filesystem path
:return: path if it was ok otherwise raises error | [
"Validate",
"path",
"for",
"invalid",
"characters",
".",
":",
"param",
"path",
":",
"str",
"possible",
"filesystem",
"path",
":",
"return",
":",
"path",
"if",
"it",
"was",
"ok",
"otherwise",
"raises",
"error"
] | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/cmdparser.py#L98-L107 |
Duke-GCB/DukeDSClient | ddsc/cmdparser.py | _add_auth_role_arg | def _add_auth_role_arg(arg_parser, default_permissions):
"""
Adds optional auth_role parameter to a parser.
:param arg_parser: ArgumentParser parser to add this argument to.
:param default_permissions: default value to use for this argument
"""
help_text = "Specifies which project permissions to... | python | def _add_auth_role_arg(arg_parser, default_permissions):
"""
Adds optional auth_role parameter to a parser.
:param arg_parser: ArgumentParser parser to add this argument to.
:param default_permissions: default value to use for this argument
"""
help_text = "Specifies which project permissions to... | [
"def",
"_add_auth_role_arg",
"(",
"arg_parser",
",",
"default_permissions",
")",
":",
"help_text",
"=",
"\"Specifies which project permissions to give to the user. Example: 'project_admin'. \"",
"help_text",
"+=",
"\"See command list_auth_roles for AuthRole values.\"",
"arg_parser",
".... | Adds optional auth_role parameter to a parser.
:param arg_parser: ArgumentParser parser to add this argument to.
:param default_permissions: default value to use for this argument | [
"Adds",
"optional",
"auth_role",
"parameter",
"to",
"a",
"parser",
".",
":",
"param",
"arg_parser",
":",
"ArgumentParser",
"parser",
"to",
"add",
"this",
"argument",
"to",
".",
":",
"param",
"default_permissions",
":",
"default",
"value",
"to",
"use",
"for",
... | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/cmdparser.py#L189-L202 |
Duke-GCB/DukeDSClient | ddsc/cmdparser.py | _add_project_filter_auth_role_arg | def _add_project_filter_auth_role_arg(arg_parser):
"""
Adds optional auth_role filtering parameter to a parser.
:param arg_parser: ArgumentParser parser to add this argument to.
"""
help_text = "Filters project listing to just those projects with the specified role. "
help_text += "See command l... | python | def _add_project_filter_auth_role_arg(arg_parser):
"""
Adds optional auth_role filtering parameter to a parser.
:param arg_parser: ArgumentParser parser to add this argument to.
"""
help_text = "Filters project listing to just those projects with the specified role. "
help_text += "See command l... | [
"def",
"_add_project_filter_auth_role_arg",
"(",
"arg_parser",
")",
":",
"help_text",
"=",
"\"Filters project listing to just those projects with the specified role. \"",
"help_text",
"+=",
"\"See command list_auth_roles for AuthRole values.\"",
"arg_parser",
".",
"add_argument",
"(",
... | Adds optional auth_role filtering parameter to a parser.
:param arg_parser: ArgumentParser parser to add this argument to. | [
"Adds",
"optional",
"auth_role",
"filtering",
"parameter",
"to",
"a",
"parser",
".",
":",
"param",
"arg_parser",
":",
"ArgumentParser",
"parser",
"to",
"add",
"this",
"argument",
"to",
"."
] | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/cmdparser.py#L205-L217 |
Duke-GCB/DukeDSClient | ddsc/cmdparser.py | _add_resend_arg | def _add_resend_arg(arg_parser, resend_help):
"""
Adds resend parameter to a parser.
:param arg_parser: ArgumentParser parser to add this argument to.
:param type_str
"""
arg_parser.add_argument("--resend",
action='store_true',
default=Fals... | python | def _add_resend_arg(arg_parser, resend_help):
"""
Adds resend parameter to a parser.
:param arg_parser: ArgumentParser parser to add this argument to.
:param type_str
"""
arg_parser.add_argument("--resend",
action='store_true',
default=Fals... | [
"def",
"_add_resend_arg",
"(",
"arg_parser",
",",
"resend_help",
")",
":",
"arg_parser",
".",
"add_argument",
"(",
"\"--resend\"",
",",
"action",
"=",
"'store_true'",
",",
"default",
"=",
"False",
",",
"dest",
"=",
"'resend'",
",",
"help",
"=",
"resend_help",
... | Adds resend parameter to a parser.
:param arg_parser: ArgumentParser parser to add this argument to.
:param type_str | [
"Adds",
"resend",
"parameter",
"to",
"a",
"parser",
".",
":",
"param",
"arg_parser",
":",
"ArgumentParser",
"parser",
"to",
"add",
"this",
"argument",
"to",
".",
":",
"param",
"type_str"
] | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/cmdparser.py#L232-L242 |
Duke-GCB/DukeDSClient | ddsc/cmdparser.py | _add_include_arg | def _add_include_arg(arg_parser):
"""
Adds optional repeatable include parameter to a parser.
:param arg_parser: ArgumentParser parser to add this argument to.
"""
arg_parser.add_argument("--include",
metavar='Path',
action='append',
... | python | def _add_include_arg(arg_parser):
"""
Adds optional repeatable include parameter to a parser.
:param arg_parser: ArgumentParser parser to add this argument to.
"""
arg_parser.add_argument("--include",
metavar='Path',
action='append',
... | [
"def",
"_add_include_arg",
"(",
"arg_parser",
")",
":",
"arg_parser",
".",
"add_argument",
"(",
"\"--include\"",
",",
"metavar",
"=",
"'Path'",
",",
"action",
"=",
"'append'",
",",
"type",
"=",
"to_unicode",
",",
"dest",
"=",
"'include_paths'",
",",
"help",
... | Adds optional repeatable include parameter to a parser.
:param arg_parser: ArgumentParser parser to add this argument to. | [
"Adds",
"optional",
"repeatable",
"include",
"parameter",
"to",
"a",
"parser",
".",
":",
"param",
"arg_parser",
":",
"ArgumentParser",
"parser",
"to",
"add",
"this",
"argument",
"to",
"."
] | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/cmdparser.py#L257-L268 |
Duke-GCB/DukeDSClient | ddsc/cmdparser.py | _add_message_file | def _add_message_file(arg_parser, help_text):
"""
Add mesage file argument with help_text to arg_parser.
:param arg_parser: ArgumentParser parser to add this argument to.
:param help_text: str: help text for this argument
"""
arg_parser.add_argument('--msg-file',
type... | python | def _add_message_file(arg_parser, help_text):
"""
Add mesage file argument with help_text to arg_parser.
:param arg_parser: ArgumentParser parser to add this argument to.
:param help_text: str: help text for this argument
"""
arg_parser.add_argument('--msg-file',
type... | [
"def",
"_add_message_file",
"(",
"arg_parser",
",",
"help_text",
")",
":",
"arg_parser",
".",
"add_argument",
"(",
"'--msg-file'",
",",
"type",
"=",
"argparse",
".",
"FileType",
"(",
"'r'",
")",
",",
"help",
"=",
"help_text",
")"
] | Add mesage file argument with help_text to arg_parser.
:param arg_parser: ArgumentParser parser to add this argument to.
:param help_text: str: help text for this argument | [
"Add",
"mesage",
"file",
"argument",
"with",
"help_text",
"to",
"arg_parser",
".",
":",
"param",
"arg_parser",
":",
"ArgumentParser",
"parser",
"to",
"add",
"this",
"argument",
"to",
".",
":",
"param",
"help_text",
":",
"str",
":",
"help",
"text",
"for",
"... | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/cmdparser.py#L309-L317 |
Duke-GCB/DukeDSClient | ddsc/cmdparser.py | CommandParser.register_upload_command | def register_upload_command(self, upload_func):
"""
Add the upload command to the parser and call upload_func(project_name, folders, follow_symlinks) when chosen.
:param upload_func: func Called when this option is chosen: upload_func(project_name, folders, follow_symlinks).
"""
... | python | def register_upload_command(self, upload_func):
"""
Add the upload command to the parser and call upload_func(project_name, folders, follow_symlinks) when chosen.
:param upload_func: func Called when this option is chosen: upload_func(project_name, folders, follow_symlinks).
"""
... | [
"def",
"register_upload_command",
"(",
"self",
",",
"upload_func",
")",
":",
"description",
"=",
"\"Uploads local files and folders to a remote host.\"",
"upload_parser",
"=",
"self",
".",
"subparsers",
".",
"add_parser",
"(",
"'upload'",
",",
"description",
"=",
"descr... | Add the upload command to the parser and call upload_func(project_name, folders, follow_symlinks) when chosen.
:param upload_func: func Called when this option is chosen: upload_func(project_name, folders, follow_symlinks). | [
"Add",
"the",
"upload",
"command",
"to",
"the",
"parser",
"and",
"call",
"upload_func",
"(",
"project_name",
"folders",
"follow_symlinks",
")",
"when",
"chosen",
".",
":",
"param",
"upload_func",
":",
"func",
"Called",
"when",
"this",
"option",
"is",
"chosen",... | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/cmdparser.py#L345-L357 |
Duke-GCB/DukeDSClient | ddsc/cmdparser.py | CommandParser.register_add_user_command | def register_add_user_command(self, add_user_func):
"""
Add the add-user command to the parser and call add_user_func(project_name, user_full_name, auth_role)
when chosen.
:param add_user_func: func Called when this option is chosen: upload_func(project_name, user_full_name, auth_role).
... | python | def register_add_user_command(self, add_user_func):
"""
Add the add-user command to the parser and call add_user_func(project_name, user_full_name, auth_role)
when chosen.
:param add_user_func: func Called when this option is chosen: upload_func(project_name, user_full_name, auth_role).
... | [
"def",
"register_add_user_command",
"(",
"self",
",",
"add_user_func",
")",
":",
"description",
"=",
"\"Gives user permission to access a remote project.\"",
"add_user_parser",
"=",
"self",
".",
"subparsers",
".",
"add_parser",
"(",
"'add-user'",
",",
"description",
"=",
... | Add the add-user command to the parser and call add_user_func(project_name, user_full_name, auth_role)
when chosen.
:param add_user_func: func Called when this option is chosen: upload_func(project_name, user_full_name, auth_role). | [
"Add",
"the",
"add",
"-",
"user",
"command",
"to",
"the",
"parser",
"and",
"call",
"add_user_func",
"(",
"project_name",
"user_full_name",
"auth_role",
")",
"when",
"chosen",
".",
":",
"param",
"add_user_func",
":",
"func",
"Called",
"when",
"this",
"option",
... | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/cmdparser.py#L359-L372 |
Duke-GCB/DukeDSClient | ddsc/cmdparser.py | CommandParser.register_remove_user_command | def register_remove_user_command(self, remove_user_func):
"""
Add the remove-user command to the parser and call remove_user_func(project_name, user_full_name) when chosen.
:param remove_user_func: func Called when this option is chosen: remove_user_func(project_name, user_full_name).
""... | python | def register_remove_user_command(self, remove_user_func):
"""
Add the remove-user command to the parser and call remove_user_func(project_name, user_full_name) when chosen.
:param remove_user_func: func Called when this option is chosen: remove_user_func(project_name, user_full_name).
""... | [
"def",
"register_remove_user_command",
"(",
"self",
",",
"remove_user_func",
")",
":",
"description",
"=",
"\"Removes user permission to access a remote project.\"",
"remove_user_parser",
"=",
"self",
".",
"subparsers",
".",
"add_parser",
"(",
"'remove-user'",
",",
"descrip... | Add the remove-user command to the parser and call remove_user_func(project_name, user_full_name) when chosen.
:param remove_user_func: func Called when this option is chosen: remove_user_func(project_name, user_full_name). | [
"Add",
"the",
"remove",
"-",
"user",
"command",
"to",
"the",
"parser",
"and",
"call",
"remove_user_func",
"(",
"project_name",
"user_full_name",
")",
"when",
"chosen",
".",
":",
"param",
"remove_user_func",
":",
"func",
"Called",
"when",
"this",
"option",
"is"... | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/cmdparser.py#L374-L385 |
Duke-GCB/DukeDSClient | ddsc/cmdparser.py | CommandParser.register_download_command | def register_download_command(self, download_func):
"""
Add 'download' command for downloading a project to a directory.
For non empty directories it will download remote files replacing local files.
:param download_func: function to run when user choses this option
"""
d... | python | def register_download_command(self, download_func):
"""
Add 'download' command for downloading a project to a directory.
For non empty directories it will download remote files replacing local files.
:param download_func: function to run when user choses this option
"""
d... | [
"def",
"register_download_command",
"(",
"self",
",",
"download_func",
")",
":",
"description",
"=",
"\"Download the contents of a remote remote project to a local folder.\"",
"download_parser",
"=",
"self",
".",
"subparsers",
".",
"add_parser",
"(",
"'download'",
",",
"des... | Add 'download' command for downloading a project to a directory.
For non empty directories it will download remote files replacing local files.
:param download_func: function to run when user choses this option | [
"Add",
"download",
"command",
"for",
"downloading",
"a",
"project",
"to",
"a",
"directory",
".",
"For",
"non",
"empty",
"directories",
"it",
"will",
"download",
"remote",
"files",
"replacing",
"local",
"files",
".",
":",
"param",
"download_func",
":",
"functio... | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/cmdparser.py#L387-L400 |
Duke-GCB/DukeDSClient | ddsc/cmdparser.py | CommandParser.register_share_command | def register_share_command(self, share_func):
"""
Add 'share' command for adding view only project permissions and sending email via another service.
:param share_func: function to run when user choses this option
"""
description = "Share a project with another user with specifie... | python | def register_share_command(self, share_func):
"""
Add 'share' command for adding view only project permissions and sending email via another service.
:param share_func: function to run when user choses this option
"""
description = "Share a project with another user with specifie... | [
"def",
"register_share_command",
"(",
"self",
",",
"share_func",
")",
":",
"description",
"=",
"\"Share a project with another user with specified permissions. \"",
"\"Sends the other user an email message via D4S2 service. \"",
"\"If not specified this command gives user download permissio... | Add 'share' command for adding view only project permissions and sending email via another service.
:param share_func: function to run when user choses this option | [
"Add",
"share",
"command",
"for",
"adding",
"view",
"only",
"project",
"permissions",
"and",
"sending",
"email",
"via",
"another",
"service",
".",
":",
"param",
"share_func",
":",
"function",
"to",
"run",
"when",
"user",
"choses",
"this",
"option"
] | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/cmdparser.py#L402-L419 |
Duke-GCB/DukeDSClient | ddsc/cmdparser.py | CommandParser.register_deliver_command | def register_deliver_command(self, deliver_func):
"""
Add 'deliver' command for transferring a project to another user.,
:param deliver_func: function to run when user choses this option
"""
description = "Initiate delivery of a project to another user. Removes other user's curre... | python | def register_deliver_command(self, deliver_func):
"""
Add 'deliver' command for transferring a project to another user.,
:param deliver_func: function to run when user choses this option
"""
description = "Initiate delivery of a project to another user. Removes other user's curre... | [
"def",
"register_deliver_command",
"(",
"self",
",",
"deliver_func",
")",
":",
"description",
"=",
"\"Initiate delivery of a project to another user. Removes other user's current permissions. \"",
"\"Send message to D4S2 service to send email and allow access to the project once user \"",
"\... | Add 'deliver' command for transferring a project to another user.,
:param deliver_func: function to run when user choses this option | [
"Add",
"deliver",
"command",
"for",
"transferring",
"a",
"project",
"to",
"another",
"user",
".",
":",
"param",
"deliver_func",
":",
"function",
"to",
"run",
"when",
"user",
"choses",
"this",
"option"
] | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/cmdparser.py#L421-L443 |
Duke-GCB/DukeDSClient | ddsc/cmdparser.py | CommandParser.register_list_command | def register_list_command(self, list_func):
"""
Add 'list' command to get a list of projects or details about one project.
:param list_func: function: run when user choses this option.
"""
description = "Show a list of project names or folders/files of a single project."
... | python | def register_list_command(self, list_func):
"""
Add 'list' command to get a list of projects or details about one project.
:param list_func: function: run when user choses this option.
"""
description = "Show a list of project names or folders/files of a single project."
... | [
"def",
"register_list_command",
"(",
"self",
",",
"list_func",
")",
":",
"description",
"=",
"\"Show a list of project names or folders/files of a single project.\"",
"list_parser",
"=",
"self",
".",
"subparsers",
".",
"add_parser",
"(",
"'list'",
",",
"description",
"=",... | Add 'list' command to get a list of projects or details about one project.
:param list_func: function: run when user choses this option. | [
"Add",
"list",
"command",
"to",
"get",
"a",
"list",
"of",
"projects",
"or",
"details",
"about",
"one",
"project",
".",
":",
"param",
"list_func",
":",
"function",
":",
"run",
"when",
"user",
"choses",
"this",
"option",
"."
] | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/cmdparser.py#L445-L457 |
Duke-GCB/DukeDSClient | ddsc/cmdparser.py | CommandParser.register_delete_command | def register_delete_command(self, delete_func):
"""
Add 'delete' command delete a project from the remote store.
:param delete_func: function: run when user choses this option.
"""
description = "Permanently delete a project."
delete_parser = self.subparsers.add_parser('d... | python | def register_delete_command(self, delete_func):
"""
Add 'delete' command delete a project from the remote store.
:param delete_func: function: run when user choses this option.
"""
description = "Permanently delete a project."
delete_parser = self.subparsers.add_parser('d... | [
"def",
"register_delete_command",
"(",
"self",
",",
"delete_func",
")",
":",
"description",
"=",
"\"Permanently delete a project.\"",
"delete_parser",
"=",
"self",
".",
"subparsers",
".",
"add_parser",
"(",
"'delete'",
",",
"description",
"=",
"description",
")",
"a... | Add 'delete' command delete a project from the remote store.
:param delete_func: function: run when user choses this option. | [
"Add",
"delete",
"command",
"delete",
"a",
"project",
"from",
"the",
"remote",
"store",
".",
":",
"param",
"delete_func",
":",
"function",
":",
"run",
"when",
"user",
"choses",
"this",
"option",
"."
] | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/cmdparser.py#L459-L468 |
Duke-GCB/DukeDSClient | ddsc/cmdparser.py | CommandParser.register_list_auth_roles_command | def register_list_auth_roles_command(self, list_auth_roles_func):
"""
Add 'list_auth_roles' command to list project authorization roles that can be used with add_user.
:param list_auth_roles_func: function: run when user choses this option.
"""
description = "List authorization r... | python | def register_list_auth_roles_command(self, list_auth_roles_func):
"""
Add 'list_auth_roles' command to list project authorization roles that can be used with add_user.
:param list_auth_roles_func: function: run when user choses this option.
"""
description = "List authorization r... | [
"def",
"register_list_auth_roles_command",
"(",
"self",
",",
"list_auth_roles_func",
")",
":",
"description",
"=",
"\"List authorization roles for use with add_user command.\"",
"list_auth_roles_parser",
"=",
"self",
".",
"subparsers",
".",
"add_parser",
"(",
"'list-auth-roles'... | Add 'list_auth_roles' command to list project authorization roles that can be used with add_user.
:param list_auth_roles_func: function: run when user choses this option. | [
"Add",
"list_auth_roles",
"command",
"to",
"list",
"project",
"authorization",
"roles",
"that",
"can",
"be",
"used",
"with",
"add_user",
".",
":",
"param",
"list_auth_roles_func",
":",
"function",
":",
"run",
"when",
"user",
"choses",
"this",
"option",
"."
] | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/cmdparser.py#L470-L477 |
Duke-GCB/DukeDSClient | ddsc/cmdparser.py | CommandParser.run_command | def run_command(self, args):
"""
Parse command line arguments and run function registered for the appropriate command.
:param args: [str] command line arguments
"""
parsed_args = self.parser.parse_args(args)
if hasattr(parsed_args, 'func'):
parsed_args.func(pa... | python | def run_command(self, args):
"""
Parse command line arguments and run function registered for the appropriate command.
:param args: [str] command line arguments
"""
parsed_args = self.parser.parse_args(args)
if hasattr(parsed_args, 'func'):
parsed_args.func(pa... | [
"def",
"run_command",
"(",
"self",
",",
"args",
")",
":",
"parsed_args",
"=",
"self",
".",
"parser",
".",
"parse_args",
"(",
"args",
")",
"if",
"hasattr",
"(",
"parsed_args",
",",
"'func'",
")",
":",
"parsed_args",
".",
"func",
"(",
"parsed_args",
")",
... | Parse command line arguments and run function registered for the appropriate command.
:param args: [str] command line arguments | [
"Parse",
"command",
"line",
"arguments",
"and",
"run",
"function",
"registered",
"for",
"the",
"appropriate",
"command",
".",
":",
"param",
"args",
":",
"[",
"str",
"]",
"command",
"line",
"arguments"
] | train | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/cmdparser.py#L479-L488 |
pdkit/pdkit | pdkit/tremor_processor.py | TremorProcessor.resample_signal | def resample_signal(self, data_frame):
"""
Convenience method for frequency conversion and resampling of data frame.
Object must have a DatetimeIndex. After re-sampling, this methods interpolate the time magnitude sum
acceleration values and the x,y,z values of the data fra... | python | def resample_signal(self, data_frame):
"""
Convenience method for frequency conversion and resampling of data frame.
Object must have a DatetimeIndex. After re-sampling, this methods interpolate the time magnitude sum
acceleration values and the x,y,z values of the data fra... | [
"def",
"resample_signal",
"(",
"self",
",",
"data_frame",
")",
":",
"df_resampled",
"=",
"data_frame",
".",
"resample",
"(",
"str",
"(",
"1",
"/",
"self",
".",
"sampling_frequency",
")",
"+",
"'S'",
")",
".",
"mean",
"(",
")",
"f",
"=",
"interpolate",
... | Convenience method for frequency conversion and resampling of data frame.
Object must have a DatetimeIndex. After re-sampling, this methods interpolate the time magnitude sum
acceleration values and the x,y,z values of the data frame acceleration
:param data_frame: the data frame ... | [
"Convenience",
"method",
"for",
"frequency",
"conversion",
"and",
"resampling",
"of",
"data",
"frame",
".",
"Object",
"must",
"have",
"a",
"DatetimeIndex",
".",
"After",
"re",
"-",
"sampling",
"this",
"methods",
"interpolate",
"the",
"time",
"magnitude",
"sum",
... | train | https://github.com/pdkit/pdkit/blob/c7120263da2071bb139815fbdb56ca77b544f340/pdkit/tremor_processor.py#L73-L92 |
pdkit/pdkit | pdkit/tremor_processor.py | TremorProcessor.filter_signal | def filter_signal(self, data_frame, ts='mag_sum_acc'):
"""
This method filters a data frame signal as suggested in :cite:`Kassavetis2015`. First step is to high \
pass filter the data frame using a \
`Butterworth <https://docs.scipy.org/doc/scipy-0.14.0/reference/generated/sc... | python | def filter_signal(self, data_frame, ts='mag_sum_acc'):
"""
This method filters a data frame signal as suggested in :cite:`Kassavetis2015`. First step is to high \
pass filter the data frame using a \
`Butterworth <https://docs.scipy.org/doc/scipy-0.14.0/reference/generated/sc... | [
"def",
"filter_signal",
"(",
"self",
",",
"data_frame",
",",
"ts",
"=",
"'mag_sum_acc'",
")",
":",
"b",
",",
"a",
"=",
"signal",
".",
"butter",
"(",
"self",
".",
"filter_order",
",",
"2",
"*",
"self",
".",
"cutoff_frequency",
"/",
"self",
".",
"samplin... | This method filters a data frame signal as suggested in :cite:`Kassavetis2015`. First step is to high \
pass filter the data frame using a \
`Butterworth <https://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.signal.butter.html>`_ \
digital and analog filter. Then this me... | [
"This",
"method",
"filters",
"a",
"data",
"frame",
"signal",
"as",
"suggested",
"in",
":",
"cite",
":",
"Kassavetis2015",
".",
"First",
"step",
"is",
"to",
"high",
"\\",
"pass",
"filter",
"the",
"data",
"frame",
"using",
"a",
"\\",
"Butterworth",
"<https",... | train | https://github.com/pdkit/pdkit/blob/c7120263da2071bb139815fbdb56ca77b544f340/pdkit/tremor_processor.py#L94-L115 |
pdkit/pdkit | pdkit/tremor_processor.py | TremorProcessor.fft_signal | def fft_signal(self, data_frame):
"""
This method perform Fast Fourier Transform on the data frame using a \
`hanning window <https://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.signal.hann.html>`_
:param data_frame: the data frame
:type data_frame:... | python | def fft_signal(self, data_frame):
"""
This method perform Fast Fourier Transform on the data frame using a \
`hanning window <https://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.signal.hann.html>`_
:param data_frame: the data frame
:type data_frame:... | [
"def",
"fft_signal",
"(",
"self",
",",
"data_frame",
")",
":",
"signal_length",
"=",
"len",
"(",
"data_frame",
".",
"filtered_signal",
".",
"values",
")",
"ll",
"=",
"int",
"(",
"signal_length",
"/",
"2",
"-",
"self",
".",
"window",
"/",
"2",
")",
"rr"... | This method perform Fast Fourier Transform on the data frame using a \
`hanning window <https://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.signal.hann.html>`_
:param data_frame: the data frame
:type data_frame: pandas.DataFrame
:return: data frame with a '... | [
"This",
"method",
"perform",
"Fast",
"Fourier",
"Transform",
"on",
"the",
"data",
"frame",
"using",
"a",
"\\",
"hanning",
"window",
"<https",
":",
"//",
"docs",
".",
"scipy",
".",
"org",
"/",
"doc",
"/",
"scipy",
"-",
"0",
".",
"14",
".",
"0",
"/",
... | train | https://github.com/pdkit/pdkit/blob/c7120263da2071bb139815fbdb56ca77b544f340/pdkit/tremor_processor.py#L117-L142 |
pdkit/pdkit | pdkit/tremor_processor.py | TremorProcessor.amplitude_by_fft | def amplitude_by_fft(self, data_frame):
"""
This methods extract the fft components and sum the ones from lower to upper freq as per \
:cite:`Kassavetis2015`
:param data_frame: the data frame
:type data_frame: pandas.DataFrame
:return ampl: the ampl
... | python | def amplitude_by_fft(self, data_frame):
"""
This methods extract the fft components and sum the ones from lower to upper freq as per \
:cite:`Kassavetis2015`
:param data_frame: the data frame
:type data_frame: pandas.DataFrame
:return ampl: the ampl
... | [
"def",
"amplitude_by_fft",
"(",
"self",
",",
"data_frame",
")",
":",
"signal_length",
"=",
"len",
"(",
"data_frame",
".",
"filtered_signal",
")",
"normalised_transformed_signal",
"=",
"data_frame",
".",
"transformed_signal",
".",
"values",
"/",
"signal_length",
"k",... | This methods extract the fft components and sum the ones from lower to upper freq as per \
:cite:`Kassavetis2015`
:param data_frame: the data frame
:type data_frame: pandas.DataFrame
:return ampl: the ampl
:rtype ampl: float
:return freq: the freq... | [
"This",
"methods",
"extract",
"the",
"fft",
"components",
"and",
"sum",
"the",
"ones",
"from",
"lower",
"to",
"upper",
"freq",
"as",
"per",
"\\",
":",
"cite",
":",
"Kassavetis2015"
] | train | https://github.com/pdkit/pdkit/blob/c7120263da2071bb139815fbdb56ca77b544f340/pdkit/tremor_processor.py#L144-L170 |
pdkit/pdkit | pdkit/tremor_processor.py | TremorProcessor.amplitude_by_welch | def amplitude_by_welch(self, data_frame):
"""
This methods uses the Welch method :cite:`Welch1967` to obtain the power spectral density, this is a robust
alternative to using fft_signal & amplitude
:param data_frame: the data frame
:type data_frame: pandas.DataF... | python | def amplitude_by_welch(self, data_frame):
"""
This methods uses the Welch method :cite:`Welch1967` to obtain the power spectral density, this is a robust
alternative to using fft_signal & amplitude
:param data_frame: the data frame
:type data_frame: pandas.DataF... | [
"def",
"amplitude_by_welch",
"(",
"self",
",",
"data_frame",
")",
":",
"frq",
",",
"Pxx_den",
"=",
"signal",
".",
"welch",
"(",
"data_frame",
".",
"filtered_signal",
".",
"values",
",",
"self",
".",
"sampling_frequency",
",",
"nperseg",
"=",
"self",
".",
"... | This methods uses the Welch method :cite:`Welch1967` to obtain the power spectral density, this is a robust
alternative to using fft_signal & amplitude
:param data_frame: the data frame
:type data_frame: pandas.DataFrame
:return: the ampl
:rtype ampl: float
... | [
"This",
"methods",
"uses",
"the",
"Welch",
"method",
":",
"cite",
":",
"Welch1967",
"to",
"obtain",
"the",
"power",
"spectral",
"density",
"this",
"is",
"a",
"robust",
"alternative",
"to",
"using",
"fft_signal",
"&",
"amplitude"
] | train | https://github.com/pdkit/pdkit/blob/c7120263da2071bb139815fbdb56ca77b544f340/pdkit/tremor_processor.py#L172-L190 |
pdkit/pdkit | pdkit/tremor_processor.py | TremorProcessor.approximate_entropy | def approximate_entropy(self, x, m=None, r=None):
"""
As in tsfresh \
`approximate_entropy <https://github.com/blue-yonder/tsfresh/blob/master/tsfresh/feature_extraction/\
feature_calculators.py#L1601>`_
Implements a `vectorized approximate entropy algorithm <https://en.wikipedi... | python | def approximate_entropy(self, x, m=None, r=None):
"""
As in tsfresh \
`approximate_entropy <https://github.com/blue-yonder/tsfresh/blob/master/tsfresh/feature_extraction/\
feature_calculators.py#L1601>`_
Implements a `vectorized approximate entropy algorithm <https://en.wikipedi... | [
"def",
"approximate_entropy",
"(",
"self",
",",
"x",
",",
"m",
"=",
"None",
",",
"r",
"=",
"None",
")",
":",
"if",
"m",
"is",
"None",
"or",
"r",
"is",
"None",
":",
"m",
"=",
"2",
"r",
"=",
"0.3",
"entropy",
"=",
"feature_calculators",
".",
"appro... | As in tsfresh \
`approximate_entropy <https://github.com/blue-yonder/tsfresh/blob/master/tsfresh/feature_extraction/\
feature_calculators.py#L1601>`_
Implements a `vectorized approximate entropy algorithm <https://en.wikipedia.org/wiki/Approximate_entropy>`_
For short time-series this ... | [
"As",
"in",
"tsfresh",
"\\",
"approximate_entropy",
"<https",
":",
"//",
"github",
".",
"com",
"/",
"blue",
"-",
"yonder",
"/",
"tsfresh",
"/",
"blob",
"/",
"master",
"/",
"tsfresh",
"/",
"feature_extraction",
"/",
"\\",
"feature_calculators",
".",
"py#L1601... | train | https://github.com/pdkit/pdkit/blob/c7120263da2071bb139815fbdb56ca77b544f340/pdkit/tremor_processor.py#L192-L217 |
pdkit/pdkit | pdkit/tremor_processor.py | TremorProcessor.autocorrelation | def autocorrelation(self, x, lag):
"""
As in tsfresh `autocorrelation <https://github.com/blue-yonder/tsfresh/blob/master/tsfresh/feature_extraction/\
feature_calculators.py#L1457>`_
Calculates the autocorrelation of the specified lag, according to the `formula <https://en.wikipedia.org... | python | def autocorrelation(self, x, lag):
"""
As in tsfresh `autocorrelation <https://github.com/blue-yonder/tsfresh/blob/master/tsfresh/feature_extraction/\
feature_calculators.py#L1457>`_
Calculates the autocorrelation of the specified lag, according to the `formula <https://en.wikipedia.org... | [
"def",
"autocorrelation",
"(",
"self",
",",
"x",
",",
"lag",
")",
":",
"# This is important: If a series is passed, the product below is calculated",
"# based on the index, which corresponds to squaring the series.",
"if",
"lag",
"is",
"None",
":",
"lag",
"=",
"0",
"_autoc",
... | As in tsfresh `autocorrelation <https://github.com/blue-yonder/tsfresh/blob/master/tsfresh/feature_extraction/\
feature_calculators.py#L1457>`_
Calculates the autocorrelation of the specified lag, according to the `formula <https://en.wikipedia.org/wiki/\
Autocorrelation#Estimation>`_:
... | [
"As",
"in",
"tsfresh",
"autocorrelation",
"<https",
":",
"//",
"github",
".",
"com",
"/",
"blue",
"-",
"yonder",
"/",
"tsfresh",
"/",
"blob",
"/",
"master",
"/",
"tsfresh",
"/",
"feature_extraction",
"/",
"\\",
"feature_calculators",
".",
"py#L1457",
">",
... | train | https://github.com/pdkit/pdkit/blob/c7120263da2071bb139815fbdb56ca77b544f340/pdkit/tremor_processor.py#L219-L247 |
pdkit/pdkit | pdkit/tremor_processor.py | TremorProcessor.partial_autocorrelation | def partial_autocorrelation(self, x, param=None):
"""
As in tsfresh `partial_autocorrelation <https://github.com/blue-yonder/tsfresh/blob/master/tsfresh/\
feature_extraction/feature_calculators.py#L308>`_
Calculates the value of the partial autocorrelation function at the given lag. The... | python | def partial_autocorrelation(self, x, param=None):
"""
As in tsfresh `partial_autocorrelation <https://github.com/blue-yonder/tsfresh/blob/master/tsfresh/\
feature_extraction/feature_calculators.py#L308>`_
Calculates the value of the partial autocorrelation function at the given lag. The... | [
"def",
"partial_autocorrelation",
"(",
"self",
",",
"x",
",",
"param",
"=",
"None",
")",
":",
"if",
"param",
"is",
"None",
":",
"param",
"=",
"[",
"{",
"'lag'",
":",
"3",
"}",
",",
"{",
"'lag'",
":",
"5",
"}",
",",
"{",
"'lag'",
":",
"6",
"}",
... | As in tsfresh `partial_autocorrelation <https://github.com/blue-yonder/tsfresh/blob/master/tsfresh/\
feature_extraction/feature_calculators.py#L308>`_
Calculates the value of the partial autocorrelation function at the given lag. The lag `k` partial \
autocorrelation of a time series :math:`\\l... | [
"As",
"in",
"tsfresh",
"partial_autocorrelation",
"<https",
":",
"//",
"github",
".",
"com",
"/",
"blue",
"-",
"yonder",
"/",
"tsfresh",
"/",
"blob",
"/",
"master",
"/",
"tsfresh",
"/",
"\\",
"feature_extraction",
"/",
"feature_calculators",
".",
"py#L308",
... | train | https://github.com/pdkit/pdkit/blob/c7120263da2071bb139815fbdb56ca77b544f340/pdkit/tremor_processor.py#L249-L286 |
pdkit/pdkit | pdkit/tremor_processor.py | TremorProcessor.ratio_value_number_to_time_series_length | def ratio_value_number_to_time_series_length(self, x):
"""
As in tsfresh `ratio_value_number_to_time_series_length <https://github.com/blue-yonder/tsfresh/blob/master\
/tsfresh/feature_extraction/feature_calculators.py#L830>`_
Returns a factor which is 1 if all values in the... | python | def ratio_value_number_to_time_series_length(self, x):
"""
As in tsfresh `ratio_value_number_to_time_series_length <https://github.com/blue-yonder/tsfresh/blob/master\
/tsfresh/feature_extraction/feature_calculators.py#L830>`_
Returns a factor which is 1 if all values in the... | [
"def",
"ratio_value_number_to_time_series_length",
"(",
"self",
",",
"x",
")",
":",
"ratio",
"=",
"feature_calculators",
".",
"ratio_value_number_to_time_series_length",
"(",
"x",
")",
"logging",
".",
"debug",
"(",
"\"ratio value number to time series length by tsfresh calcul... | As in tsfresh `ratio_value_number_to_time_series_length <https://github.com/blue-yonder/tsfresh/blob/master\
/tsfresh/feature_extraction/feature_calculators.py#L830>`_
Returns a factor which is 1 if all values in the time series occur only once,
and below one if this is not the case... | [
"As",
"in",
"tsfresh",
"ratio_value_number_to_time_series_length",
"<https",
":",
"//",
"github",
".",
"com",
"/",
"blue",
"-",
"yonder",
"/",
"tsfresh",
"/",
"blob",
"/",
"master",
"\\",
"/",
"tsfresh",
"/",
"feature_extraction",
"/",
"feature_calculators",
"."... | train | https://github.com/pdkit/pdkit/blob/c7120263da2071bb139815fbdb56ca77b544f340/pdkit/tremor_processor.py#L312-L328 |
pdkit/pdkit | pdkit/tremor_processor.py | TremorProcessor.change_quantiles | def change_quantiles(self, x, ql=None, qh=None, isabs=None, f_agg=None):
"""
As in tsfresh `change_quantiles <https://github.com/blue-yonder/tsfresh/blob/master/tsfresh/\
feature_extraction/feature_calculators.py#L1248>`_
First fixes a corridor given by the quantiles ql and ... | python | def change_quantiles(self, x, ql=None, qh=None, isabs=None, f_agg=None):
"""
As in tsfresh `change_quantiles <https://github.com/blue-yonder/tsfresh/blob/master/tsfresh/\
feature_extraction/feature_calculators.py#L1248>`_
First fixes a corridor given by the quantiles ql and ... | [
"def",
"change_quantiles",
"(",
"self",
",",
"x",
",",
"ql",
"=",
"None",
",",
"qh",
"=",
"None",
",",
"isabs",
"=",
"None",
",",
"f_agg",
"=",
"None",
")",
":",
"if",
"ql",
"is",
"None",
"or",
"qh",
"is",
"None",
"or",
"isabs",
"is",
"None",
"... | As in tsfresh `change_quantiles <https://github.com/blue-yonder/tsfresh/blob/master/tsfresh/\
feature_extraction/feature_calculators.py#L1248>`_
First fixes a corridor given by the quantiles ql and qh of the distribution of x. Then calculates the \
average, absolute value of consecu... | [
"As",
"in",
"tsfresh",
"change_quantiles",
"<https",
":",
"//",
"github",
".",
"com",
"/",
"blue",
"-",
"yonder",
"/",
"tsfresh",
"/",
"blob",
"/",
"master",
"/",
"tsfresh",
"/",
"\\",
"feature_extraction",
"/",
"feature_calculators",
".",
"py#L1248",
">",
... | train | https://github.com/pdkit/pdkit/blob/c7120263da2071bb139815fbdb56ca77b544f340/pdkit/tremor_processor.py#L330-L361 |
pdkit/pdkit | pdkit/tremor_processor.py | TremorProcessor.number_peaks | def number_peaks(self, x, n=None):
"""
As in tsfresh `number_peaks <https://github.com/blue-yonder/tsfresh/blob/master/tsfresh/feature_extraction/\
feature_calculators.py#L1003>`_
Calculates the number of peaks of at least support n in the time series x. A peak o... | python | def number_peaks(self, x, n=None):
"""
As in tsfresh `number_peaks <https://github.com/blue-yonder/tsfresh/blob/master/tsfresh/feature_extraction/\
feature_calculators.py#L1003>`_
Calculates the number of peaks of at least support n in the time series x. A peak o... | [
"def",
"number_peaks",
"(",
"self",
",",
"x",
",",
"n",
"=",
"None",
")",
":",
"if",
"n",
"is",
"None",
":",
"n",
"=",
"5",
"peaks",
"=",
"feature_calculators",
".",
"number_peaks",
"(",
"x",
",",
"n",
")",
"logging",
".",
"debug",
"(",
"\"agg line... | As in tsfresh `number_peaks <https://github.com/blue-yonder/tsfresh/blob/master/tsfresh/feature_extraction/\
feature_calculators.py#L1003>`_
Calculates the number of peaks of at least support n in the time series x. A peak of support n is defined \
as a subsequence of x ... | [
"As",
"in",
"tsfresh",
"number_peaks",
"<https",
":",
"//",
"github",
".",
"com",
"/",
"blue",
"-",
"yonder",
"/",
"tsfresh",
"/",
"blob",
"/",
"master",
"/",
"tsfresh",
"/",
"feature_extraction",
"/",
"\\",
"feature_calculators",
".",
"py#L1003",
">",
"_"... | train | https://github.com/pdkit/pdkit/blob/c7120263da2071bb139815fbdb56ca77b544f340/pdkit/tremor_processor.py#L363-L394 |
pdkit/pdkit | pdkit/tremor_processor.py | TremorProcessor.agg_linear_trend | def agg_linear_trend(self, x, param=None):
"""
As in tsfresh `agg_inear_trend <https://github.com/blue-yonder/tsfresh/blob/master/tsfresh/\
feature_extraction/feature_calculators.py#L1727>`_
Calculates a linear least-squares regression for values of the time seri... | python | def agg_linear_trend(self, x, param=None):
"""
As in tsfresh `agg_inear_trend <https://github.com/blue-yonder/tsfresh/blob/master/tsfresh/\
feature_extraction/feature_calculators.py#L1727>`_
Calculates a linear least-squares regression for values of the time seri... | [
"def",
"agg_linear_trend",
"(",
"self",
",",
"x",
",",
"param",
"=",
"None",
")",
":",
"if",
"param",
"is",
"None",
":",
"param",
"=",
"[",
"{",
"'attr'",
":",
"'intercept'",
",",
"'chunk_len'",
":",
"5",
",",
"'f_agg'",
":",
"'min'",
"}",
",",
"{"... | As in tsfresh `agg_inear_trend <https://github.com/blue-yonder/tsfresh/blob/master/tsfresh/\
feature_extraction/feature_calculators.py#L1727>`_
Calculates a linear least-squares regression for values of the time series that were aggregated over chunks\
versus the sequenc... | [
"As",
"in",
"tsfresh",
"agg_inear_trend",
"<https",
":",
"//",
"github",
".",
"com",
"/",
"blue",
"-",
"yonder",
"/",
"tsfresh",
"/",
"blob",
"/",
"master",
"/",
"tsfresh",
"/",
"\\",
"feature_extraction",
"/",
"feature_calculators",
".",
"py#L1727",
">",
... | train | https://github.com/pdkit/pdkit/blob/c7120263da2071bb139815fbdb56ca77b544f340/pdkit/tremor_processor.py#L396-L427 |
pdkit/pdkit | pdkit/tremor_processor.py | TremorProcessor.spkt_welch_density | def spkt_welch_density(self, x, param=None):
"""
As in tsfresh `spkt_welch_density <https://github.com/blue-yonder/tsfresh/blob/master/tsfresh/\
feature_extraction/feature_calculators.py#L1162>`_ . This feature calculator estimates the cross power \
spectral density of the ti... | python | def spkt_welch_density(self, x, param=None):
"""
As in tsfresh `spkt_welch_density <https://github.com/blue-yonder/tsfresh/blob/master/tsfresh/\
feature_extraction/feature_calculators.py#L1162>`_ . This feature calculator estimates the cross power \
spectral density of the ti... | [
"def",
"spkt_welch_density",
"(",
"self",
",",
"x",
",",
"param",
"=",
"None",
")",
":",
"if",
"param",
"is",
"None",
":",
"param",
"=",
"[",
"{",
"'coeff'",
":",
"2",
"}",
",",
"{",
"'coeff'",
":",
"5",
"}",
",",
"{",
"'coeff'",
":",
"8",
"}",... | As in tsfresh `spkt_welch_density <https://github.com/blue-yonder/tsfresh/blob/master/tsfresh/\
feature_extraction/feature_calculators.py#L1162>`_ . This feature calculator estimates the cross power \
spectral density of the time series x at different frequencies. To do so, the time series is fi... | [
"As",
"in",
"tsfresh",
"spkt_welch_density",
"<https",
":",
"//",
"github",
".",
"com",
"/",
"blue",
"-",
"yonder",
"/",
"tsfresh",
"/",
"blob",
"/",
"master",
"/",
"tsfresh",
"/",
"\\",
"feature_extraction",
"/",
"feature_calculators",
".",
"py#L1162",
">",... | train | https://github.com/pdkit/pdkit/blob/c7120263da2071bb139815fbdb56ca77b544f340/pdkit/tremor_processor.py#L429-L448 |
pdkit/pdkit | pdkit/tremor_processor.py | TremorProcessor.percentage_of_reoccurring_datapoints_to_all_datapoints | def percentage_of_reoccurring_datapoints_to_all_datapoints(self, x):
"""
As in tsfresh `percentage_of_reoccurring_datapoints_to_all_datapoints <https://github.com/blue-yonder/tsfresh/\
blob/master/tsfresh/feature_extraction/feature_calculators.py#L739>`_ \
Returns the percentage of uniq... | python | def percentage_of_reoccurring_datapoints_to_all_datapoints(self, x):
"""
As in tsfresh `percentage_of_reoccurring_datapoints_to_all_datapoints <https://github.com/blue-yonder/tsfresh/\
blob/master/tsfresh/feature_extraction/feature_calculators.py#L739>`_ \
Returns the percentage of uniq... | [
"def",
"percentage_of_reoccurring_datapoints_to_all_datapoints",
"(",
"self",
",",
"x",
")",
":",
"_perc",
"=",
"feature_calculators",
".",
"percentage_of_reoccurring_datapoints_to_all_datapoints",
"(",
"x",
")",
"logging",
".",
"debug",
"(",
"\"percentage of reoccurring data... | As in tsfresh `percentage_of_reoccurring_datapoints_to_all_datapoints <https://github.com/blue-yonder/tsfresh/\
blob/master/tsfresh/feature_extraction/feature_calculators.py#L739>`_ \
Returns the percentage of unique values, that are present in the time series more than once.\
len(different val... | [
"As",
"in",
"tsfresh",
"percentage_of_reoccurring_datapoints_to_all_datapoints",
"<https",
":",
"//",
"github",
".",
"com",
"/",
"blue",
"-",
"yonder",
"/",
"tsfresh",
"/",
"\\",
"blob",
"/",
"master",
"/",
"tsfresh",
"/",
"feature_extraction",
"/",
"feature_calcu... | train | https://github.com/pdkit/pdkit/blob/c7120263da2071bb139815fbdb56ca77b544f340/pdkit/tremor_processor.py#L450-L468 |
pdkit/pdkit | pdkit/tremor_processor.py | TremorProcessor.abs_energy | def abs_energy(self, x):
"""
As in tsfresh `abs_energy <https://github.com/blue-yonder/tsfresh/blob/master/tsfresh/feature_extraction/\
feature_calculators.py#L390>`_ \
Returns the absolute energy of the time series which is the sum over the squared values\
.. math::
... | python | def abs_energy(self, x):
"""
As in tsfresh `abs_energy <https://github.com/blue-yonder/tsfresh/blob/master/tsfresh/feature_extraction/\
feature_calculators.py#L390>`_ \
Returns the absolute energy of the time series which is the sum over the squared values\
.. math::
... | [
"def",
"abs_energy",
"(",
"self",
",",
"x",
")",
":",
"_energy",
"=",
"feature_calculators",
".",
"abs_energy",
"(",
"x",
")",
"logging",
".",
"debug",
"(",
"\"abs energy by tsfresh calculated\"",
")",
"return",
"_energy"
] | As in tsfresh `abs_energy <https://github.com/blue-yonder/tsfresh/blob/master/tsfresh/feature_extraction/\
feature_calculators.py#L390>`_ \
Returns the absolute energy of the time series which is the sum over the squared values\
.. math::
E=\\sum_{i=1,\ldots, n}x_... | [
"As",
"in",
"tsfresh",
"abs_energy",
"<https",
":",
"//",
"github",
".",
"com",
"/",
"blue",
"-",
"yonder",
"/",
"tsfresh",
"/",
"blob",
"/",
"master",
"/",
"tsfresh",
"/",
"feature_extraction",
"/",
"\\",
"feature_calculators",
".",
"py#L390",
">",
"_",
... | train | https://github.com/pdkit/pdkit/blob/c7120263da2071bb139815fbdb56ca77b544f340/pdkit/tremor_processor.py#L470-L489 |
pdkit/pdkit | pdkit/tremor_processor.py | TremorProcessor.fft_aggregated | def fft_aggregated(self, x, param=None):
"""
As in tsfresh `fft_aggregated <https://github.com/blue-yonder/tsfresh/blob/master/tsfresh/feature_extraction/\
feature_calculators.py#L896>`_
Returns the spectral centroid (mean), variance, skew, and kurtosis of the absolute fourier transform... | python | def fft_aggregated(self, x, param=None):
"""
As in tsfresh `fft_aggregated <https://github.com/blue-yonder/tsfresh/blob/master/tsfresh/feature_extraction/\
feature_calculators.py#L896>`_
Returns the spectral centroid (mean), variance, skew, and kurtosis of the absolute fourier transform... | [
"def",
"fft_aggregated",
"(",
"self",
",",
"x",
",",
"param",
"=",
"None",
")",
":",
"if",
"param",
"is",
"None",
":",
"param",
"=",
"[",
"{",
"'aggtype'",
":",
"'centroid'",
"}",
"]",
"_fft_agg",
"=",
"feature_calculators",
".",
"fft_aggregated",
"(",
... | As in tsfresh `fft_aggregated <https://github.com/blue-yonder/tsfresh/blob/master/tsfresh/feature_extraction/\
feature_calculators.py#L896>`_
Returns the spectral centroid (mean), variance, skew, and kurtosis of the absolute fourier transform spectrum.
:param x: the time series to calc... | [
"As",
"in",
"tsfresh",
"fft_aggregated",
"<https",
":",
"//",
"github",
".",
"com",
"/",
"blue",
"-",
"yonder",
"/",
"tsfresh",
"/",
"blob",
"/",
"master",
"/",
"tsfresh",
"/",
"feature_extraction",
"/",
"\\",
"feature_calculators",
".",
"py#L896",
">",
"_... | train | https://github.com/pdkit/pdkit/blob/c7120263da2071bb139815fbdb56ca77b544f340/pdkit/tremor_processor.py#L491-L510 |
pdkit/pdkit | pdkit/tremor_processor.py | TremorProcessor.fft_coefficient | def fft_coefficient(self, x, param=None):
"""
As in tsfresh `fft_coefficient <https://github.com/blue-yonder/tsfresh/blob/master/tsfresh/feature_extraction/\
feature_calculators.py#L852>`_ \
Calculates the fourier coefficients of the one-dimensional discrete Fourier Transform for real in... | python | def fft_coefficient(self, x, param=None):
"""
As in tsfresh `fft_coefficient <https://github.com/blue-yonder/tsfresh/blob/master/tsfresh/feature_extraction/\
feature_calculators.py#L852>`_ \
Calculates the fourier coefficients of the one-dimensional discrete Fourier Transform for real in... | [
"def",
"fft_coefficient",
"(",
"self",
",",
"x",
",",
"param",
"=",
"None",
")",
":",
"if",
"param",
"is",
"None",
":",
"param",
"=",
"[",
"{",
"'attr'",
":",
"'abs'",
",",
"'coeff'",
":",
"44",
"}",
",",
"{",
"'attr'",
":",
"'abs'",
",",
"'coeff... | As in tsfresh `fft_coefficient <https://github.com/blue-yonder/tsfresh/blob/master/tsfresh/feature_extraction/\
feature_calculators.py#L852>`_ \
Calculates the fourier coefficients of the one-dimensional discrete Fourier Transform for real input by fast \
fourier transformation algorithm
... | [
"As",
"in",
"tsfresh",
"fft_coefficient",
"<https",
":",
"//",
"github",
".",
"com",
"/",
"blue",
"-",
"yonder",
"/",
"tsfresh",
"/",
"blob",
"/",
"master",
"/",
"tsfresh",
"/",
"feature_extraction",
"/",
"\\",
"feature_calculators",
".",
"py#L852",
">",
"... | train | https://github.com/pdkit/pdkit/blob/c7120263da2071bb139815fbdb56ca77b544f340/pdkit/tremor_processor.py#L512-L541 |
pdkit/pdkit | pdkit/tremor_processor.py | TremorProcessor.dc_remove_signal | def dc_remove_signal(self, data_frame):
"""
Removes the dc component of the signal as per :cite:`Kassavetis2015`
:param data_frame: the data frame
:type data_frame: pandas.DataFrame
:return: the data frame with dc remove signal field
:rtype: pandas.Da... | python | def dc_remove_signal(self, data_frame):
"""
Removes the dc component of the signal as per :cite:`Kassavetis2015`
:param data_frame: the data frame
:type data_frame: pandas.DataFrame
:return: the data frame with dc remove signal field
:rtype: pandas.Da... | [
"def",
"dc_remove_signal",
"(",
"self",
",",
"data_frame",
")",
":",
"mean_signal",
"=",
"np",
".",
"mean",
"(",
"data_frame",
".",
"mag_sum_acc",
")",
"data_frame",
"[",
"'dc_mag_sum_acc'",
"]",
"=",
"data_frame",
".",
"mag_sum_acc",
"-",
"mean_signal",
"logg... | Removes the dc component of the signal as per :cite:`Kassavetis2015`
:param data_frame: the data frame
:type data_frame: pandas.DataFrame
:return: the data frame with dc remove signal field
:rtype: pandas.DataFrame | [
"Removes",
"the",
"dc",
"component",
"of",
"the",
"signal",
"as",
"per",
":",
"cite",
":",
"Kassavetis2015"
] | train | https://github.com/pdkit/pdkit/blob/c7120263da2071bb139815fbdb56ca77b544f340/pdkit/tremor_processor.py#L556-L569 |
pdkit/pdkit | pdkit/tremor_processor.py | TremorProcessor.bradykinesia | def bradykinesia(self, data_frame, method='fft'):
"""
This method calculates the bradykinesia amplitude of the data frame. It accepts two different methods, \
'fft' and 'welch'. First the signal gets re-sampled, dc removed and then high pass filtered.
:param data_frame: the ... | python | def bradykinesia(self, data_frame, method='fft'):
"""
This method calculates the bradykinesia amplitude of the data frame. It accepts two different methods, \
'fft' and 'welch'. First the signal gets re-sampled, dc removed and then high pass filtered.
:param data_frame: the ... | [
"def",
"bradykinesia",
"(",
"self",
",",
"data_frame",
",",
"method",
"=",
"'fft'",
")",
":",
"try",
":",
"data_frame_resampled",
"=",
"self",
".",
"resample_signal",
"(",
"data_frame",
")",
"data_frame_dc",
"=",
"self",
".",
"dc_remove_signal",
"(",
"data_fra... | This method calculates the bradykinesia amplitude of the data frame. It accepts two different methods, \
'fft' and 'welch'. First the signal gets re-sampled, dc removed and then high pass filtered.
:param data_frame: the data frame
:type data_frame: pandas.DataFrame
:par... | [
"This",
"method",
"calculates",
"the",
"bradykinesia",
"amplitude",
"of",
"the",
"data",
"frame",
".",
"It",
"accepts",
"two",
"different",
"methods",
"\\",
"fft",
"and",
"welch",
".",
"First",
"the",
"signal",
"gets",
"re",
"-",
"sampled",
"dc",
"removed",
... | train | https://github.com/pdkit/pdkit/blob/c7120263da2071bb139815fbdb56ca77b544f340/pdkit/tremor_processor.py#L571-L599 |
pdkit/pdkit | pdkit/tremor_processor.py | TremorProcessor.extract_features | def extract_features(self, data_frame, pre=''):
"""
This method extracts all the features available to the Tremor Processor class.
:param data_frame: the data frame
:type data_frame: pandas.DataFrame
:return: amplitude_by_fft, frequency_by_fft, amplitude_by_welch... | python | def extract_features(self, data_frame, pre=''):
"""
This method extracts all the features available to the Tremor Processor class.
:param data_frame: the data frame
:type data_frame: pandas.DataFrame
:return: amplitude_by_fft, frequency_by_fft, amplitude_by_welch... | [
"def",
"extract_features",
"(",
"self",
",",
"data_frame",
",",
"pre",
"=",
"''",
")",
":",
"try",
":",
"magnitude_partial_autocorrelation",
"=",
"self",
".",
"partial_autocorrelation",
"(",
"data_frame",
".",
"mag_sum_acc",
")",
"magnitude_agg_linear",
"=",
"self... | This method extracts all the features available to the Tremor Processor class.
:param data_frame: the data frame
:type data_frame: pandas.DataFrame
:return: amplitude_by_fft, frequency_by_fft, amplitude_by_welch, frequency_by_fft, bradykinesia_amplitude_by_fft, \
... | [
"This",
"method",
"extracts",
"all",
"the",
"features",
"available",
"to",
"the",
"Tremor",
"Processor",
"class",
"."
] | train | https://github.com/pdkit/pdkit/blob/c7120263da2071bb139815fbdb56ca77b544f340/pdkit/tremor_processor.py#L631-L699 |
twisted/txaws | txaws/client/gui/gtk.py | main | def main(argv, reactor=None):
"""Run the client GUI.
Typical use:
>>> sys.exit(main(sys.argv))
@param argv: The arguments to run it with, e.g. sys.argv.
@param reactor: The reactor to use. Must be compatible with gtk as this
module uses gtk API"s.
@return exitcode: The exit code it ret... | python | def main(argv, reactor=None):
"""Run the client GUI.
Typical use:
>>> sys.exit(main(sys.argv))
@param argv: The arguments to run it with, e.g. sys.argv.
@param reactor: The reactor to use. Must be compatible with gtk as this
module uses gtk API"s.
@return exitcode: The exit code it ret... | [
"def",
"main",
"(",
"argv",
",",
"reactor",
"=",
"None",
")",
":",
"if",
"reactor",
"is",
"None",
":",
"from",
"twisted",
".",
"internet",
"import",
"gtk2reactor",
"gtk2reactor",
".",
"install",
"(",
")",
"from",
"twisted",
".",
"internet",
"import",
"re... | Run the client GUI.
Typical use:
>>> sys.exit(main(sys.argv))
@param argv: The arguments to run it with, e.g. sys.argv.
@param reactor: The reactor to use. Must be compatible with gtk as this
module uses gtk API"s.
@return exitcode: The exit code it returned, as per sys.exit. | [
"Run",
"the",
"client",
"GUI",
"."
] | train | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/client/gui/gtk.py#L233-L254 |
twisted/txaws | txaws/client/discover/entry_point.py | parse_options | def parse_options(arguments):
"""Parse command line arguments.
The parsing logic is fairly simple. It can only parse long-style
parameters of the form::
--key value
Several parameters can be defined in the environment and will be used
unless explicitly overridden with command-line argument... | python | def parse_options(arguments):
"""Parse command line arguments.
The parsing logic is fairly simple. It can only parse long-style
parameters of the form::
--key value
Several parameters can be defined in the environment and will be used
unless explicitly overridden with command-line argument... | [
"def",
"parse_options",
"(",
"arguments",
")",
":",
"arguments",
"=",
"arguments",
"[",
"1",
":",
"]",
"options",
"=",
"{",
"}",
"while",
"arguments",
":",
"key",
"=",
"arguments",
".",
"pop",
"(",
"0",
")",
"if",
"key",
"in",
"(",
"\"-h\"",
",",
"... | Parse command line arguments.
The parsing logic is fairly simple. It can only parse long-style
parameters of the form::
--key value
Several parameters can be defined in the environment and will be used
unless explicitly overridden with command-line arguments. The access key,
secret and en... | [
"Parse",
"command",
"line",
"arguments",
"."
] | train | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/client/discover/entry_point.py#L63-L114 |
twisted/txaws | txaws/client/discover/entry_point.py | get_command | def get_command(arguments, output=None):
"""Parse C{arguments} and configure a L{Command} instance.
An access key, secret key, endpoint and action are required. Additional
parameters included with the request are passed as parameters to the
method call. For example, the following command will create ... | python | def get_command(arguments, output=None):
"""Parse C{arguments} and configure a L{Command} instance.
An access key, secret key, endpoint and action are required. Additional
parameters included with the request are passed as parameters to the
method call. For example, the following command will create ... | [
"def",
"get_command",
"(",
"arguments",
",",
"output",
"=",
"None",
")",
":",
"options",
"=",
"parse_options",
"(",
"arguments",
")",
"key",
"=",
"options",
".",
"pop",
"(",
"\"key\"",
")",
"secret",
"=",
"options",
".",
"pop",
"(",
"\"secret\"",
")",
... | Parse C{arguments} and configure a L{Command} instance.
An access key, secret key, endpoint and action are required. Additional
parameters included with the request are passed as parameters to the
method call. For example, the following command will create a L{Command}
object that can invoke the C{De... | [
"Parse",
"C",
"{",
"arguments",
"}",
"and",
"configure",
"a",
"L",
"{",
"Command",
"}",
"instance",
"."
] | train | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/client/discover/entry_point.py#L117-L139 |
twisted/txaws | txaws/client/discover/entry_point.py | main | def main(arguments, output=None, testing_mode=None):
"""
Entry point parses command-line arguments, runs the specified EC2 API
method and prints the response to the screen.
@param arguments: Command-line arguments, typically retrieved from
C{sys.argv}.
@param output: Optionally, a stream to... | python | def main(arguments, output=None, testing_mode=None):
"""
Entry point parses command-line arguments, runs the specified EC2 API
method and prints the response to the screen.
@param arguments: Command-line arguments, typically retrieved from
C{sys.argv}.
@param output: Optionally, a stream to... | [
"def",
"main",
"(",
"arguments",
",",
"output",
"=",
"None",
",",
"testing_mode",
"=",
"None",
")",
":",
"def",
"run_command",
"(",
"arguments",
",",
"output",
",",
"reactor",
")",
":",
"if",
"output",
"is",
"None",
":",
"output",
"=",
"sys",
".",
"s... | Entry point parses command-line arguments, runs the specified EC2 API
method and prints the response to the screen.
@param arguments: Command-line arguments, typically retrieved from
C{sys.argv}.
@param output: Optionally, a stream to write output to.
@param testing_mode: Optionally, a conditio... | [
"Entry",
"point",
"parses",
"command",
"-",
"line",
"arguments",
"runs",
"the",
"specified",
"EC2",
"API",
"method",
"and",
"prints",
"the",
"response",
"to",
"the",
"screen",
"."
] | train | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/client/discover/entry_point.py#L142-L178 |
T-002/pycast | pycast/methods/exponentialsmoothing.py | ExponentialSmoothing.execute | def execute(self, timeSeries):
"""Creates a new TimeSeries containing the smoothed and forcasted values.
:return: TimeSeries object containing the smoothed TimeSeries,
including the forecasted values.
:rtype: TimeSeries
:note: The first normalized value is chosen a... | python | def execute(self, timeSeries):
"""Creates a new TimeSeries containing the smoothed and forcasted values.
:return: TimeSeries object containing the smoothed TimeSeries,
including the forecasted values.
:rtype: TimeSeries
:note: The first normalized value is chosen a... | [
"def",
"execute",
"(",
"self",
",",
"timeSeries",
")",
":",
"# determine the number of values to forecast, if necessary",
"self",
".",
"_calculate_values_to_forecast",
"(",
"timeSeries",
")",
"# extract the required parameters, performance improvement",
"alpha",
"=",
"self",
".... | Creates a new TimeSeries containing the smoothed and forcasted values.
:return: TimeSeries object containing the smoothed TimeSeries,
including the forecasted values.
:rtype: TimeSeries
:note: The first normalized value is chosen as the starting point. | [
"Creates",
"a",
"new",
"TimeSeries",
"containing",
"the",
"smoothed",
"and",
"forcasted",
"values",
"."
] | train | https://github.com/T-002/pycast/blob/8a53505c6d8367e0ea572e8af768e80b29e1cc41/pycast/methods/exponentialsmoothing.py#L77-L148 |
T-002/pycast | pycast/methods/exponentialsmoothing.py | HoltMethod._get_parameter_intervals | def _get_parameter_intervals(self):
"""Returns the intervals for the methods parameter.
Only parameters with defined intervals can be used for optimization!
:return: Returns a dictionary containing the parameter intervals, using the parameter
name as key, while the value hast th... | python | def _get_parameter_intervals(self):
"""Returns the intervals for the methods parameter.
Only parameters with defined intervals can be used for optimization!
:return: Returns a dictionary containing the parameter intervals, using the parameter
name as key, while the value hast th... | [
"def",
"_get_parameter_intervals",
"(",
"self",
")",
":",
"parameterIntervals",
"=",
"{",
"}",
"parameterIntervals",
"[",
"\"smoothingFactor\"",
"]",
"=",
"[",
"0.0",
",",
"1.0",
",",
"False",
",",
"False",
"]",
"parameterIntervals",
"[",
"\"trendSmoothingFactor\"... | Returns the intervals for the methods parameter.
Only parameters with defined intervals can be used for optimization!
:return: Returns a dictionary containing the parameter intervals, using the parameter
name as key, while the value hast the following format:
[minValue, maxV... | [
"Returns",
"the",
"intervals",
"for",
"the",
"methods",
"parameter",
"."
] | train | https://github.com/T-002/pycast/blob/8a53505c6d8367e0ea572e8af768e80b29e1cc41/pycast/methods/exponentialsmoothing.py#L178-L204 |
T-002/pycast | pycast/methods/exponentialsmoothing.py | HoltMethod.execute | def execute(self, timeSeries):
"""Creates a new TimeSeries containing the smoothed values.
:return: TimeSeries object containing the smoothed TimeSeries,
including the forecasted values.
:rtype: TimeSeries
:note: The first normalized value is chosen as the starting p... | python | def execute(self, timeSeries):
"""Creates a new TimeSeries containing the smoothed values.
:return: TimeSeries object containing the smoothed TimeSeries,
including the forecasted values.
:rtype: TimeSeries
:note: The first normalized value is chosen as the starting p... | [
"def",
"execute",
"(",
"self",
",",
"timeSeries",
")",
":",
"# determine the number of values to forecast, if necessary",
"self",
".",
"_calculate_values_to_forecast",
"(",
"timeSeries",
")",
"# extract the required parameters, performance improvement",
"alpha",
"=",
"self",
".... | Creates a new TimeSeries containing the smoothed values.
:return: TimeSeries object containing the smoothed TimeSeries,
including the forecasted values.
:rtype: TimeSeries
:note: The first normalized value is chosen as the starting point. | [
"Creates",
"a",
"new",
"TimeSeries",
"containing",
"the",
"smoothed",
"values",
"."
] | train | https://github.com/T-002/pycast/blob/8a53505c6d8367e0ea572e8af768e80b29e1cc41/pycast/methods/exponentialsmoothing.py#L206-L278 |
T-002/pycast | pycast/methods/exponentialsmoothing.py | HoltWintersMethod.execute | def execute(self, timeSeries):
"""Creates a new TimeSeries containing the smoothed values.
:param TimeSeries timeSeries: TimeSeries containing hte data.
:return: TimeSeries object containing the exponentially smoothed TimeSeries,
including the forecasted values.
:rtype: ... | python | def execute(self, timeSeries):
"""Creates a new TimeSeries containing the smoothed values.
:param TimeSeries timeSeries: TimeSeries containing hte data.
:return: TimeSeries object containing the exponentially smoothed TimeSeries,
including the forecasted values.
:rtype: ... | [
"def",
"execute",
"(",
"self",
",",
"timeSeries",
")",
":",
"# determine the number of values to forecast, if necessary",
"self",
".",
"_calculate_values_to_forecast",
"(",
"timeSeries",
")",
"seasonLength",
"=",
"self",
".",
"get_parameter",
"(",
"\"seasonLength\"",
")",... | Creates a new TimeSeries containing the smoothed values.
:param TimeSeries timeSeries: TimeSeries containing hte data.
:return: TimeSeries object containing the exponentially smoothed TimeSeries,
including the forecasted values.
:rtype: TimeSeries
:note: Currently t... | [
"Creates",
"a",
"new",
"TimeSeries",
"containing",
"the",
"smoothed",
"values",
"."
] | train | https://github.com/T-002/pycast/blob/8a53505c6d8367e0ea572e8af768e80b29e1cc41/pycast/methods/exponentialsmoothing.py#L347-L393 |
T-002/pycast | pycast/methods/exponentialsmoothing.py | HoltWintersMethod._calculate_forecast | def _calculate_forecast(self, originalTimeSeries, smoothedData, seasonValues, lastSmoothingParams):
"""Calculates the actual forecasted based on the input data.
:param TimeSeries timeSeries: TimeSeries containing hte data.
:param list smoothedData: Contains the smoothed time series data.
... | python | def _calculate_forecast(self, originalTimeSeries, smoothedData, seasonValues, lastSmoothingParams):
"""Calculates the actual forecasted based on the input data.
:param TimeSeries timeSeries: TimeSeries containing hte data.
:param list smoothedData: Contains the smoothed time series data.
... | [
"def",
"_calculate_forecast",
"(",
"self",
",",
"originalTimeSeries",
",",
"smoothedData",
",",
"seasonValues",
",",
"lastSmoothingParams",
")",
":",
"forecastResults",
"=",
"[",
"]",
"lastEstimator",
",",
"lastSeasonValue",
",",
"lastTrend",
"=",
"lastSmoothingParams... | Calculates the actual forecasted based on the input data.
:param TimeSeries timeSeries: TimeSeries containing hte data.
:param list smoothedData: Contains the smoothed time series data.
:param list seasonValues: Contains the seasonal values for the forecast.
:param list lastSmoothingPar... | [
"Calculates",
"the",
"actual",
"forecasted",
"based",
"on",
"the",
"input",
"data",
"."
] | train | https://github.com/T-002/pycast/blob/8a53505c6d8367e0ea572e8af768e80b29e1cc41/pycast/methods/exponentialsmoothing.py#L395-L422 |
T-002/pycast | pycast/methods/exponentialsmoothing.py | HoltWintersMethod.initSeasonFactors | def initSeasonFactors(self, timeSeries):
""" Computes the initial season smoothing factors.
:return: Returns a list of season vectors of length "seasonLength".
:rtype: list
"""
seasonLength = self.get_parameter("seasonLength")
try:
seasonValues = self.get... | python | def initSeasonFactors(self, timeSeries):
""" Computes the initial season smoothing factors.
:return: Returns a list of season vectors of length "seasonLength".
:rtype: list
"""
seasonLength = self.get_parameter("seasonLength")
try:
seasonValues = self.get... | [
"def",
"initSeasonFactors",
"(",
"self",
",",
"timeSeries",
")",
":",
"seasonLength",
"=",
"self",
".",
"get_parameter",
"(",
"\"seasonLength\"",
")",
"try",
":",
"seasonValues",
"=",
"self",
".",
"get_parameter",
"(",
"\"seasonValues\"",
")",
"assert",
"seasonL... | Computes the initial season smoothing factors.
:return: Returns a list of season vectors of length "seasonLength".
:rtype: list | [
"Computes",
"the",
"initial",
"season",
"smoothing",
"factors",
"."
] | train | https://github.com/T-002/pycast/blob/8a53505c6d8367e0ea572e8af768e80b29e1cc41/pycast/methods/exponentialsmoothing.py#L424-L451 |
T-002/pycast | pycast/methods/exponentialsmoothing.py | HoltWintersMethod.initialTrendSmoothingFactors | def initialTrendSmoothingFactors(self, timeSeries):
""" Calculate the initial Trend smoothing Factor b0.
Explanation:
http://en.wikipedia.org/wiki/Exponential_smoothing#Triple_exponential_smoothing
:return: Returns the initial trend smoothing factor b0
"""
result... | python | def initialTrendSmoothingFactors(self, timeSeries):
""" Calculate the initial Trend smoothing Factor b0.
Explanation:
http://en.wikipedia.org/wiki/Exponential_smoothing#Triple_exponential_smoothing
:return: Returns the initial trend smoothing factor b0
"""
result... | [
"def",
"initialTrendSmoothingFactors",
"(",
"self",
",",
"timeSeries",
")",
":",
"result",
"=",
"0.0",
"seasonLength",
"=",
"self",
".",
"get_parameter",
"(",
"\"seasonLength\"",
")",
"k",
"=",
"min",
"(",
"len",
"(",
"timeSeries",
")",
"-",
"seasonLength",
... | Calculate the initial Trend smoothing Factor b0.
Explanation:
http://en.wikipedia.org/wiki/Exponential_smoothing#Triple_exponential_smoothing
:return: Returns the initial trend smoothing factor b0 | [
"Calculate",
"the",
"initial",
"Trend",
"smoothing",
"Factor",
"b0",
"."
] | train | https://github.com/T-002/pycast/blob/8a53505c6d8367e0ea572e8af768e80b29e1cc41/pycast/methods/exponentialsmoothing.py#L453-L467 |
T-002/pycast | pycast/methods/exponentialsmoothing.py | HoltWintersMethod.computeA | def computeA(self, j, timeSeries):
""" Calculates A_j. Aj is the average value of x in the jth cycle of your data
:return: A_j
:rtype: numeric
"""
seasonLength = self.get_parameter("seasonLength")
A_j = 0
for i in range(seasonLength):
A_j += ti... | python | def computeA(self, j, timeSeries):
""" Calculates A_j. Aj is the average value of x in the jth cycle of your data
:return: A_j
:rtype: numeric
"""
seasonLength = self.get_parameter("seasonLength")
A_j = 0
for i in range(seasonLength):
A_j += ti... | [
"def",
"computeA",
"(",
"self",
",",
"j",
",",
"timeSeries",
")",
":",
"seasonLength",
"=",
"self",
".",
"get_parameter",
"(",
"\"seasonLength\"",
")",
"A_j",
"=",
"0",
"for",
"i",
"in",
"range",
"(",
"seasonLength",
")",
":",
"A_j",
"+=",
"timeSeries",
... | Calculates A_j. Aj is the average value of x in the jth cycle of your data
:return: A_j
:rtype: numeric | [
"Calculates",
"A_j",
".",
"Aj",
"is",
"the",
"average",
"value",
"of",
"x",
"in",
"the",
"jth",
"cycle",
"of",
"your",
"data"
] | train | https://github.com/T-002/pycast/blob/8a53505c6d8367e0ea572e8af768e80b29e1cc41/pycast/methods/exponentialsmoothing.py#L470-L480 |
twisted/txaws | txaws/route53/model.py | _split_quoted | def _split_quoted(text):
"""
Split a unicode string on *SPACE* characters.
Splitting is not done at *SPACE* characters occurring within matched
*QUOTATION MARK*s. *REVERSE SOLIDUS* can be used to remove all
interpretation from the following character.
:param unicode text: The string to split.... | python | def _split_quoted(text):
"""
Split a unicode string on *SPACE* characters.
Splitting is not done at *SPACE* characters occurring within matched
*QUOTATION MARK*s. *REVERSE SOLIDUS* can be used to remove all
interpretation from the following character.
:param unicode text: The string to split.... | [
"def",
"_split_quoted",
"(",
"text",
")",
":",
"quoted",
"=",
"False",
"escaped",
"=",
"False",
"result",
"=",
"[",
"]",
"for",
"i",
",",
"ch",
"in",
"enumerate",
"(",
"text",
")",
":",
"if",
"escaped",
":",
"escaped",
"=",
"False",
"result",
".",
... | Split a unicode string on *SPACE* characters.
Splitting is not done at *SPACE* characters occurring within matched
*QUOTATION MARK*s. *REVERSE SOLIDUS* can be used to remove all
interpretation from the following character.
:param unicode text: The string to split.
:return: A two-tuple of unicode... | [
"Split",
"a",
"unicode",
"string",
"on",
"*",
"SPACE",
"*",
"characters",
"."
] | train | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/route53/model.py#L205-L232 |
pdkit/pdkit | pdkit/gait_processor.py | GaitProcessor.freeze_of_gait | def freeze_of_gait(self, x):
"""
This method assess freeze of gait following :cite:`g-BachlinPRMHGT10`.
:param x: The time series to assess freeze of gait on. This could be x, y, z or mag_sum_acc.
:type x: pandas.Series
:return freeze_time: What times do freeze ... | python | def freeze_of_gait(self, x):
"""
This method assess freeze of gait following :cite:`g-BachlinPRMHGT10`.
:param x: The time series to assess freeze of gait on. This could be x, y, z or mag_sum_acc.
:type x: pandas.Series
:return freeze_time: What times do freeze ... | [
"def",
"freeze_of_gait",
"(",
"self",
",",
"x",
")",
":",
"data",
"=",
"self",
".",
"resample_signal",
"(",
"x",
")",
".",
"values",
"f_res",
"=",
"self",
".",
"sampling_frequency",
"/",
"self",
".",
"window",
"f_nr_LBs",
"=",
"int",
"(",
"self",
".",
... | This method assess freeze of gait following :cite:`g-BachlinPRMHGT10`.
:param x: The time series to assess freeze of gait on. This could be x, y, z or mag_sum_acc.
:type x: pandas.Series
:return freeze_time: What times do freeze of gait events occur. [measured in time (h:m:s)]
... | [
"This",
"method",
"assess",
"freeze",
"of",
"gait",
"following",
":",
"cite",
":",
"g",
"-",
"BachlinPRMHGT10",
"."
] | train | https://github.com/pdkit/pdkit/blob/c7120263da2071bb139815fbdb56ca77b544f340/pdkit/gait_processor.py#L120-L175 |
pdkit/pdkit | pdkit/gait_processor.py | GaitProcessor.frequency_of_peaks | def frequency_of_peaks(self, x, start_offset=100, end_offset=100):
"""
This method assess the frequency of the peaks on any given 1-dimensional time series.
:param x: The time series to assess freeze of gait on. This could be x, y, z or mag_sum_acc.
:type x: pandas.Series
... | python | def frequency_of_peaks(self, x, start_offset=100, end_offset=100):
"""
This method assess the frequency of the peaks on any given 1-dimensional time series.
:param x: The time series to assess freeze of gait on. This could be x, y, z or mag_sum_acc.
:type x: pandas.Series
... | [
"def",
"frequency_of_peaks",
"(",
"self",
",",
"x",
",",
"start_offset",
"=",
"100",
",",
"end_offset",
"=",
"100",
")",
":",
"peaks_data",
"=",
"x",
"[",
"start_offset",
":",
"-",
"end_offset",
"]",
".",
"values",
"maxtab",
",",
"mintab",
"=",
"peakdet"... | This method assess the frequency of the peaks on any given 1-dimensional time series.
:param x: The time series to assess freeze of gait on. This could be x, y, z or mag_sum_acc.
:type x: pandas.Series
:param start_offset: Signal to leave out (of calculations) from the begining of t... | [
"This",
"method",
"assess",
"the",
"frequency",
"of",
"the",
"peaks",
"on",
"any",
"given",
"1",
"-",
"dimensional",
"time",
"series",
"."
] | train | https://github.com/pdkit/pdkit/blob/c7120263da2071bb139815fbdb56ca77b544f340/pdkit/gait_processor.py#L178-L199 |
pdkit/pdkit | pdkit/gait_processor.py | GaitProcessor.speed_of_gait | def speed_of_gait(self, x, wavelet_type='db3', wavelet_level=6):
"""
This method assess the speed of gait following :cite:`g-MartinSB11`.
It extracts the gait speed from the energies of the approximation coefficients of wavelet functions.
Prefferably you should use the magn... | python | def speed_of_gait(self, x, wavelet_type='db3', wavelet_level=6):
"""
This method assess the speed of gait following :cite:`g-MartinSB11`.
It extracts the gait speed from the energies of the approximation coefficients of wavelet functions.
Prefferably you should use the magn... | [
"def",
"speed_of_gait",
"(",
"self",
",",
"x",
",",
"wavelet_type",
"=",
"'db3'",
",",
"wavelet_level",
"=",
"6",
")",
":",
"coeffs",
"=",
"wavedec",
"(",
"x",
".",
"values",
",",
"wavelet",
"=",
"wavelet_type",
",",
"level",
"=",
"wavelet_level",
")",
... | This method assess the speed of gait following :cite:`g-MartinSB11`.
It extracts the gait speed from the energies of the approximation coefficients of wavelet functions.
Prefferably you should use the magnitude of x, y and z (mag_acc_sum) here, as the time series.
:param x: The tim... | [
"This",
"method",
"assess",
"the",
"speed",
"of",
"gait",
"following",
":",
"cite",
":",
"g",
"-",
"MartinSB11",
"."
] | train | https://github.com/pdkit/pdkit/blob/c7120263da2071bb139815fbdb56ca77b544f340/pdkit/gait_processor.py#L202-L232 |
pdkit/pdkit | pdkit/gait_processor.py | GaitProcessor.walk_regularity_symmetry | def walk_regularity_symmetry(self, data_frame):
"""
This method extracts the step and stride regularity and also walk symmetry.
:param data_frame: The data frame. It should have x, y, and z columns.
:type data_frame: pandas.DataFrame
:return step_regularity: Reg... | python | def walk_regularity_symmetry(self, data_frame):
"""
This method extracts the step and stride regularity and also walk symmetry.
:param data_frame: The data frame. It should have x, y, and z columns.
:type data_frame: pandas.DataFrame
:return step_regularity: Reg... | [
"def",
"walk_regularity_symmetry",
"(",
"self",
",",
"data_frame",
")",
":",
"def",
"_symmetry",
"(",
"v",
")",
":",
"maxtab",
",",
"_",
"=",
"peakdet",
"(",
"v",
",",
"self",
".",
"delta",
")",
"return",
"maxtab",
"[",
"1",
"]",
"[",
"1",
"]",
","... | This method extracts the step and stride regularity and also walk symmetry.
:param data_frame: The data frame. It should have x, y, and z columns.
:type data_frame: pandas.DataFrame
:return step_regularity: Regularity of steps on [x, y, z] coordinates, defined as the consistency of ... | [
"This",
"method",
"extracts",
"the",
"step",
"and",
"stride",
"regularity",
"and",
"also",
"walk",
"symmetry",
"."
] | train | https://github.com/pdkit/pdkit/blob/c7120263da2071bb139815fbdb56ca77b544f340/pdkit/gait_processor.py#L235-L265 |
pdkit/pdkit | pdkit/gait_processor.py | GaitProcessor.walk_direction_preheel | def walk_direction_preheel(self, data_frame):
"""
Estimate local walk (not cardinal) direction with pre-heel strike phase.
Inspired by Nirupam Roy's B.E. thesis: "WalkCompass: Finding Walking Direction Leveraging Smartphone's Inertial Sensors"
:param data_frame: The data f... | python | def walk_direction_preheel(self, data_frame):
"""
Estimate local walk (not cardinal) direction with pre-heel strike phase.
Inspired by Nirupam Roy's B.E. thesis: "WalkCompass: Finding Walking Direction Leveraging Smartphone's Inertial Sensors"
:param data_frame: The data f... | [
"def",
"walk_direction_preheel",
"(",
"self",
",",
"data_frame",
")",
":",
"# Sum of absolute values across accelerometer axes:",
"data",
"=",
"data_frame",
".",
"x",
".",
"abs",
"(",
")",
"+",
"data_frame",
".",
"y",
".",
"abs",
"(",
")",
"+",
"data_frame",
"... | Estimate local walk (not cardinal) direction with pre-heel strike phase.
Inspired by Nirupam Roy's B.E. thesis: "WalkCompass: Finding Walking Direction Leveraging Smartphone's Inertial Sensors"
:param data_frame: The data frame. It should have x, y, and z columns.
:type data_frame:... | [
"Estimate",
"local",
"walk",
"(",
"not",
"cardinal",
")",
"direction",
"with",
"pre",
"-",
"heel",
"strike",
"phase",
"."
] | train | https://github.com/pdkit/pdkit/blob/c7120263da2071bb139815fbdb56ca77b544f340/pdkit/gait_processor.py#L268-L311 |
pdkit/pdkit | pdkit/gait_processor.py | GaitProcessor.heel_strikes | def heel_strikes(self, x):
""" Estimate heel strike times between sign changes in accelerometer data.
:param x: The time series to assess freeze of gait on. This could be x, y, z or mag_sum_acc.
:type x: pandas.Series
:return strikes: Heel strike timings measured in seconds.... | python | def heel_strikes(self, x):
""" Estimate heel strike times between sign changes in accelerometer data.
:param x: The time series to assess freeze of gait on. This could be x, y, z or mag_sum_acc.
:type x: pandas.Series
:return strikes: Heel strike timings measured in seconds.... | [
"def",
"heel_strikes",
"(",
"self",
",",
"x",
")",
":",
"# Demean data:",
"data",
"=",
"x",
".",
"values",
"data",
"-=",
"data",
".",
"mean",
"(",
")",
"# TODO: fix this",
"# Low-pass filter the AP accelerometer data by the 4th order zero lag",
"# Butterworth filter who... | Estimate heel strike times between sign changes in accelerometer data.
:param x: The time series to assess freeze of gait on. This could be x, y, z or mag_sum_acc.
:type x: pandas.Series
:return strikes: Heel strike timings measured in seconds.
:rtype striles: numpy.ndar... | [
"Estimate",
"heel",
"strike",
"times",
"between",
"sign",
"changes",
"in",
"accelerometer",
"data",
"."
] | train | https://github.com/pdkit/pdkit/blob/c7120263da2071bb139815fbdb56ca77b544f340/pdkit/gait_processor.py#L314-L364 |
pdkit/pdkit | pdkit/gait_processor.py | GaitProcessor.gait_regularity_symmetry | def gait_regularity_symmetry(self, x, average_step_duration='autodetect', average_stride_duration='autodetect', unbias=1, normalize=2):
"""
Compute step and stride regularity and symmetry from accelerometer data with the help of steps and strides.
:param x: The time series to assess fr... | python | def gait_regularity_symmetry(self, x, average_step_duration='autodetect', average_stride_duration='autodetect', unbias=1, normalize=2):
"""
Compute step and stride regularity and symmetry from accelerometer data with the help of steps and strides.
:param x: The time series to assess fr... | [
"def",
"gait_regularity_symmetry",
"(",
"self",
",",
"x",
",",
"average_step_duration",
"=",
"'autodetect'",
",",
"average_stride_duration",
"=",
"'autodetect'",
",",
"unbias",
"=",
"1",
",",
"normalize",
"=",
"2",
")",
":",
"if",
"(",
"average_step_duration",
"... | Compute step and stride regularity and symmetry from accelerometer data with the help of steps and strides.
:param x: The time series to assess freeze of gait on. This could be x, y, z or mag_sum_acc.
:type x: pandas.Series
:param average_step_duration: Average duration of each step... | [
"Compute",
"step",
"and",
"stride",
"regularity",
"and",
"symmetry",
"from",
"accelerometer",
"data",
"with",
"the",
"help",
"of",
"steps",
"and",
"strides",
"."
] | train | https://github.com/pdkit/pdkit/blob/c7120263da2071bb139815fbdb56ca77b544f340/pdkit/gait_processor.py#L366-L428 |
pdkit/pdkit | pdkit/gait_processor.py | GaitProcessor.gait | def gait(self, x):
"""
Extract gait features from estimated heel strikes and accelerometer data.
:param x: The time series to assess freeze of gait on. This could be x, y, z or mag_sum_acc.
:type x: pandas.Series
:return number_of_steps: Estimated number of step... | python | def gait(self, x):
"""
Extract gait features from estimated heel strikes and accelerometer data.
:param x: The time series to assess freeze of gait on. This could be x, y, z or mag_sum_acc.
:type x: pandas.Series
:return number_of_steps: Estimated number of step... | [
"def",
"gait",
"(",
"self",
",",
"x",
")",
":",
"data",
"=",
"x",
"strikes",
",",
"_",
"=",
"self",
".",
"heel_strikes",
"(",
"data",
")",
"step_durations",
"=",
"[",
"]",
"for",
"i",
"in",
"range",
"(",
"1",
",",
"np",
".",
"size",
"(",
"strik... | Extract gait features from estimated heel strikes and accelerometer data.
:param x: The time series to assess freeze of gait on. This could be x, y, z or mag_sum_acc.
:type x: pandas.Series
:return number_of_steps: Estimated number of steps based on heel strikes [number of steps].
... | [
"Extract",
"gait",
"features",
"from",
"estimated",
"heel",
"strikes",
"and",
"accelerometer",
"data",
"."
] | train | https://github.com/pdkit/pdkit/blob/c7120263da2071bb139815fbdb56ca77b544f340/pdkit/gait_processor.py#L431-L539 |
pdkit/pdkit | pdkit/gait_processor.py | GaitProcessor.separate_into_sections | def separate_into_sections(self, data_frame, labels_col='anno', labels_to_keep=[1,2], min_labels_in_sequence=100):
""" Helper function to separate a time series into multiple sections based on a labeled column.
:param data_frame: The data frame. It should have x, y, and z columns.
... | python | def separate_into_sections(self, data_frame, labels_col='anno', labels_to_keep=[1,2], min_labels_in_sequence=100):
""" Helper function to separate a time series into multiple sections based on a labeled column.
:param data_frame: The data frame. It should have x, y, and z columns.
... | [
"def",
"separate_into_sections",
"(",
"self",
",",
"data_frame",
",",
"labels_col",
"=",
"'anno'",
",",
"labels_to_keep",
"=",
"[",
"1",
",",
"2",
"]",
",",
"min_labels_in_sequence",
"=",
"100",
")",
":",
"sections",
"=",
"[",
"[",
"]",
"]",
"mask",
"=",... | Helper function to separate a time series into multiple sections based on a labeled column.
:param data_frame: The data frame. It should have x, y, and z columns.
:type data_frame: pandas.DataFrame
:param labels_col: The column which has the labels we would like to separate ... | [
"Helper",
"function",
"to",
"separate",
"a",
"time",
"series",
"into",
"multiple",
"sections",
"based",
"on",
"a",
"labeled",
"column",
".",
":",
"param",
"data_frame",
":",
"The",
"data",
"frame",
".",
"It",
"should",
"have",
"x",
"y",
"and",
"z",
"colu... | train | https://github.com/pdkit/pdkit/blob/c7120263da2071bb139815fbdb56ca77b544f340/pdkit/gait_processor.py#L541-L571 |
pdkit/pdkit | pdkit/gait_processor.py | GaitProcessor.bellman_segmentation | def bellman_segmentation(self, x, states):
"""
Divide a univariate time-series, data_frame, into states contiguous segments, using Bellman k-segmentation algorithm on the peak prominences of the data.
:param x: The time series to assess freeze of gait on. This could be x, y, z ... | python | def bellman_segmentation(self, x, states):
"""
Divide a univariate time-series, data_frame, into states contiguous segments, using Bellman k-segmentation algorithm on the peak prominences of the data.
:param x: The time series to assess freeze of gait on. This could be x, y, z ... | [
"def",
"bellman_segmentation",
"(",
"self",
",",
"x",
",",
"states",
")",
":",
"peaks",
",",
"prominences",
"=",
"get_signal_peaks_and_prominences",
"(",
"x",
")",
"bellman_idx",
"=",
"BellmanKSegment",
"(",
"prominences",
",",
"states",
")",
"return",
"peaks",
... | Divide a univariate time-series, data_frame, into states contiguous segments, using Bellman k-segmentation algorithm on the peak prominences of the data.
:param x: The time series to assess freeze of gait on. This could be x, y, z or mag_sum_acc.
:type x: pandas.Series
:para... | [
"Divide",
"a",
"univariate",
"time",
"-",
"series",
"data_frame",
"into",
"states",
"contiguous",
"segments",
"using",
"Bellman",
"k",
"-",
"segmentation",
"algorithm",
"on",
"the",
"peak",
"prominences",
"of",
"the",
"data",
".",
":",
"param",
"x",
":",
"Th... | train | https://github.com/pdkit/pdkit/blob/c7120263da2071bb139815fbdb56ca77b544f340/pdkit/gait_processor.py#L573-L591 |
pdkit/pdkit | pdkit/gait_processor.py | GaitProcessor.sklearn_segmentation | def sklearn_segmentation(self, x, cluster_fn):
"""
Divide a univariate time-series, data_frame, into states contiguous segments, using sk-learn clustering algorithms on the peak prominences of the data.
:param x: The time series to assess freeze of gait on. This could be x, y, ... | python | def sklearn_segmentation(self, x, cluster_fn):
"""
Divide a univariate time-series, data_frame, into states contiguous segments, using sk-learn clustering algorithms on the peak prominences of the data.
:param x: The time series to assess freeze of gait on. This could be x, y, ... | [
"def",
"sklearn_segmentation",
"(",
"self",
",",
"x",
",",
"cluster_fn",
")",
":",
"peaks",
",",
"prominences",
"=",
"get_signal_peaks_and_prominences",
"(",
"x",
")",
"# sklearn fix: reshape to (-1, 1)",
"sklearn_idx",
"=",
"cluster_fn",
".",
"fit_predict",
"(",
"p... | Divide a univariate time-series, data_frame, into states contiguous segments, using sk-learn clustering algorithms on the peak prominences of the data.
:param x: The time series to assess freeze of gait on. This could be x, y, z or mag_sum_acc.
:type x: pandas.Series
:param ... | [
"Divide",
"a",
"univariate",
"time",
"-",
"series",
"data_frame",
"into",
"states",
"contiguous",
"segments",
"using",
"sk",
"-",
"learn",
"clustering",
"algorithms",
"on",
"the",
"peak",
"prominences",
"of",
"the",
"data",
".",
":",
"param",
"x",
":",
"The"... | train | https://github.com/pdkit/pdkit/blob/c7120263da2071bb139815fbdb56ca77b544f340/pdkit/gait_processor.py#L593-L613 |
pdkit/pdkit | pdkit/gait_processor.py | GaitProcessor.add_manual_segmentation_to_data_frame | def add_manual_segmentation_to_data_frame(self, data_frame, segmentation_dictionary):
"""
Utility method to store manual segmentation of gait time series.
:param data_frame: The data frame. It should have x, y, and z columns.
:type data_frame: pandas.DataFrame
:... | python | def add_manual_segmentation_to_data_frame(self, data_frame, segmentation_dictionary):
"""
Utility method to store manual segmentation of gait time series.
:param data_frame: The data frame. It should have x, y, and z columns.
:type data_frame: pandas.DataFrame
:... | [
"def",
"add_manual_segmentation_to_data_frame",
"(",
"self",
",",
"data_frame",
",",
"segmentation_dictionary",
")",
":",
"# add some checks to see if dictionary is in the right format!",
"data_frame",
"[",
"'segmentation'",
"]",
"=",
"'unknown'",
"for",
"i",
",",
"(",
"k",... | Utility method to store manual segmentation of gait time series.
:param data_frame: The data frame. It should have x, y, and z columns.
:type data_frame: pandas.DataFrame
:param segmentation_dictionary: A dictionary of the form {'signal_type': [(from, to), (from, to)], ..., 'signal_... | [
"Utility",
"method",
"to",
"store",
"manual",
"segmentation",
"of",
"gait",
"time",
"series",
"."
] | train | https://github.com/pdkit/pdkit/blob/c7120263da2071bb139815fbdb56ca77b544f340/pdkit/gait_processor.py#L615-L642 |
pdkit/pdkit | pdkit/gait_processor.py | GaitProcessor.plot_segmentation_dictionary | def plot_segmentation_dictionary(self, x, segmentation_dictionary, figsize=(10, 5)):
"""
Utility method used to visualize how the segmentation dictionary interacts with the time series.
:param data_frame: The data frame. It should have x, y, and z columns.
:type data_frame:... | python | def plot_segmentation_dictionary(self, x, segmentation_dictionary, figsize=(10, 5)):
"""
Utility method used to visualize how the segmentation dictionary interacts with the time series.
:param data_frame: The data frame. It should have x, y, and z columns.
:type data_frame:... | [
"def",
"plot_segmentation_dictionary",
"(",
"self",
",",
"x",
",",
"segmentation_dictionary",
",",
"figsize",
"=",
"(",
"10",
",",
"5",
")",
")",
":",
"data",
"=",
"x",
"fig",
",",
"ax",
"=",
"plt",
".",
"subplots",
"(",
")",
"fig",
".",
"set_size_inch... | Utility method used to visualize how the segmentation dictionary interacts with the time series.
:param data_frame: The data frame. It should have x, y, and z columns.
:type data_frame: pandas.DataFrame
:param segmentation_dictionary: A dictionary of the form {'signal_type': [(from,... | [
"Utility",
"method",
"used",
"to",
"visualize",
"how",
"the",
"segmentation",
"dictionary",
"interacts",
"with",
"the",
"time",
"series",
"."
] | train | https://github.com/pdkit/pdkit/blob/c7120263da2071bb139815fbdb56ca77b544f340/pdkit/gait_processor.py#L644-L677 |
pdkit/pdkit | pdkit/gait_processor.py | GaitProcessor.plot_segmentation_data_frame | def plot_segmentation_data_frame(self, segmented_data_frame, axis='mag_sum_acc', figsize=(10, 5)):
"""
Utility method used to visualize how the segmentation dictionary interacts with the time series.
:param segmented_data_frame: The segmented data frame. It should have x, y, z and segm... | python | def plot_segmentation_data_frame(self, segmented_data_frame, axis='mag_sum_acc', figsize=(10, 5)):
"""
Utility method used to visualize how the segmentation dictionary interacts with the time series.
:param segmented_data_frame: The segmented data frame. It should have x, y, z and segm... | [
"def",
"plot_segmentation_data_frame",
"(",
"self",
",",
"segmented_data_frame",
",",
"axis",
"=",
"'mag_sum_acc'",
",",
"figsize",
"=",
"(",
"10",
",",
"5",
")",
")",
":",
"# fix this!!",
"colors",
"=",
"'bgrcmykwbgrcmykwbgrcmykw'",
"keys",
"=",
"np",
".",
"u... | Utility method used to visualize how the segmentation dictionary interacts with the time series.
:param segmented_data_frame: The segmented data frame. It should have x, y, z and segmentation columns.
:type segmented_data_frame: pandas.DataFrame
:param axis: The axis which we want t... | [
"Utility",
"method",
"used",
"to",
"visualize",
"how",
"the",
"segmentation",
"dictionary",
"interacts",
"with",
"the",
"time",
"series",
"."
] | train | https://github.com/pdkit/pdkit/blob/c7120263da2071bb139815fbdb56ca77b544f340/pdkit/gait_processor.py#L679-L709 |
twisted/txaws | txaws/client/base.py | error_wrapper | def error_wrapper(error, errorClass):
"""
We want to see all error messages from cloud services. Amazon's EC2 says
that their errors are accompanied either by a 400-series or 500-series HTTP
response code. As such, the first thing we want to do is check to see if
the error is in that range. If it is... | python | def error_wrapper(error, errorClass):
"""
We want to see all error messages from cloud services. Amazon's EC2 says
that their errors are accompanied either by a 400-series or 500-series HTTP
response code. As such, the first thing we want to do is check to see if
the error is in that range. If it is... | [
"def",
"error_wrapper",
"(",
"error",
",",
"errorClass",
")",
":",
"http_status",
"=",
"0",
"if",
"error",
".",
"check",
"(",
"TwistedWebError",
")",
":",
"xml_payload",
"=",
"error",
".",
"value",
".",
"response",
"if",
"error",
".",
"value",
".",
"stat... | We want to see all error messages from cloud services. Amazon's EC2 says
that their errors are accompanied either by a 400-series or 500-series HTTP
response code. As such, the first thing we want to do is check to see if
the error is in that range. If it is, we then need to see if the error
message is ... | [
"We",
"want",
"to",
"see",
"all",
"error",
"messages",
"from",
"cloud",
"services",
".",
"Amazon",
"s",
"EC2",
"says",
"that",
"their",
"errors",
"are",
"accompanied",
"either",
"by",
"a",
"400",
"-",
"series",
"or",
"500",
"-",
"series",
"HTTP",
"respon... | train | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/client/base.py#L46-L79 |
twisted/txaws | txaws/client/base.py | _get_joined_path | def _get_joined_path(ctx):
"""
@type ctx: L{_URLContext}
@param ctx: A URL context.
@return: The path component, un-urlencoded, but joined by slashes.
@rtype: L{bytes}
"""
return b'/' + b'/'.join(seg.encode('utf-8') for seg in ctx.path) | python | def _get_joined_path(ctx):
"""
@type ctx: L{_URLContext}
@param ctx: A URL context.
@return: The path component, un-urlencoded, but joined by slashes.
@rtype: L{bytes}
"""
return b'/' + b'/'.join(seg.encode('utf-8') for seg in ctx.path) | [
"def",
"_get_joined_path",
"(",
"ctx",
")",
":",
"return",
"b'/'",
"+",
"b'/'",
".",
"join",
"(",
"seg",
".",
"encode",
"(",
"'utf-8'",
")",
"for",
"seg",
"in",
"ctx",
".",
"path",
")"
] | @type ctx: L{_URLContext}
@param ctx: A URL context.
@return: The path component, un-urlencoded, but joined by slashes.
@rtype: L{bytes} | [
"@type",
"ctx",
":",
"L",
"{",
"_URLContext",
"}",
"@param",
"ctx",
":",
"A",
"URL",
"context",
"."
] | train | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/client/base.py#L301-L309 |
twisted/txaws | txaws/client/base.py | BaseQuery.get_page | def get_page(self, url, *args, **kwds):
"""
Define our own get_page method so that we can easily override the
factory when we need to. This was copied from the following:
* twisted.web.client.getPage
* twisted.web.client._makeGetterFactory
"""
contextFacto... | python | def get_page(self, url, *args, **kwds):
"""
Define our own get_page method so that we can easily override the
factory when we need to. This was copied from the following:
* twisted.web.client.getPage
* twisted.web.client._makeGetterFactory
"""
contextFacto... | [
"def",
"get_page",
"(",
"self",
",",
"url",
",",
"*",
"args",
",",
"*",
"*",
"kwds",
")",
":",
"contextFactory",
"=",
"None",
"scheme",
",",
"host",
",",
"port",
",",
"path",
"=",
"parse",
"(",
"url",
")",
"data",
"=",
"kwds",
".",
"get",
"(",
... | Define our own get_page method so that we can easily override the
factory when we need to. This was copied from the following:
* twisted.web.client.getPage
* twisted.web.client._makeGetterFactory | [
"Define",
"our",
"own",
"get_page",
"method",
"so",
"that",
"we",
"can",
"easily",
"override",
"the",
"factory",
"when",
"we",
"need",
"to",
".",
"This",
"was",
"copied",
"from",
"the",
"following",
":",
"*",
"twisted",
".",
"web",
".",
"client",
".",
... | train | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/client/base.py#L667-L690 |
twisted/txaws | txaws/client/base.py | BaseQuery._headers | def _headers(self, headers_dict):
"""
Convert dictionary of headers into twisted.web.client.Headers object.
"""
return Headers(dict((k,[v]) for (k,v) in headers_dict.items())) | python | def _headers(self, headers_dict):
"""
Convert dictionary of headers into twisted.web.client.Headers object.
"""
return Headers(dict((k,[v]) for (k,v) in headers_dict.items())) | [
"def",
"_headers",
"(",
"self",
",",
"headers_dict",
")",
":",
"return",
"Headers",
"(",
"dict",
"(",
"(",
"k",
",",
"[",
"v",
"]",
")",
"for",
"(",
"k",
",",
"v",
")",
"in",
"headers_dict",
".",
"items",
"(",
")",
")",
")"
] | Convert dictionary of headers into twisted.web.client.Headers object. | [
"Convert",
"dictionary",
"of",
"headers",
"into",
"twisted",
".",
"web",
".",
"client",
".",
"Headers",
"object",
"."
] | train | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/client/base.py#L692-L696 |
twisted/txaws | txaws/client/base.py | BaseQuery._unpack_headers | def _unpack_headers(self, headers):
"""
Unpack twisted.web.client.Headers object to dict. This is to provide
backwards compatability.
"""
return dict((k,v[0]) for (k,v) in headers.getAllRawHeaders()) | python | def _unpack_headers(self, headers):
"""
Unpack twisted.web.client.Headers object to dict. This is to provide
backwards compatability.
"""
return dict((k,v[0]) for (k,v) in headers.getAllRawHeaders()) | [
"def",
"_unpack_headers",
"(",
"self",
",",
"headers",
")",
":",
"return",
"dict",
"(",
"(",
"k",
",",
"v",
"[",
"0",
"]",
")",
"for",
"(",
"k",
",",
"v",
")",
"in",
"headers",
".",
"getAllRawHeaders",
"(",
")",
")"
] | Unpack twisted.web.client.Headers object to dict. This is to provide
backwards compatability. | [
"Unpack",
"twisted",
".",
"web",
".",
"client",
".",
"Headers",
"object",
"to",
"dict",
".",
"This",
"is",
"to",
"provide",
"backwards",
"compatability",
"."
] | train | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/client/base.py#L698-L703 |
twisted/txaws | txaws/client/base.py | BaseQuery.get_request_headers | def get_request_headers(self, *args, **kwds):
"""
A convenience method for obtaining the headers that were sent to the
S3 server.
The AWS S3 API depends upon setting headers. This method is provided as
a convenience for debugging issues with the S3 communications.
"""
... | python | def get_request_headers(self, *args, **kwds):
"""
A convenience method for obtaining the headers that were sent to the
S3 server.
The AWS S3 API depends upon setting headers. This method is provided as
a convenience for debugging issues with the S3 communications.
"""
... | [
"def",
"get_request_headers",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwds",
")",
":",
"if",
"self",
".",
"request_headers",
":",
"return",
"self",
".",
"_unpack_headers",
"(",
"self",
".",
"request_headers",
")"
] | A convenience method for obtaining the headers that were sent to the
S3 server.
The AWS S3 API depends upon setting headers. This method is provided as
a convenience for debugging issues with the S3 communications. | [
"A",
"convenience",
"method",
"for",
"obtaining",
"the",
"headers",
"that",
"were",
"sent",
"to",
"the",
"S3",
"server",
"."
] | train | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/client/base.py#L705-L714 |
twisted/txaws | txaws/client/base.py | BaseQuery._handle_response | def _handle_response(self, response):
"""
Handle the HTTP response by memoing the headers and then delivering
bytes.
"""
self.client.status = response.code
self.response_headers = response.headers
# XXX This workaround (which needs to be improved at that) for poss... | python | def _handle_response(self, response):
"""
Handle the HTTP response by memoing the headers and then delivering
bytes.
"""
self.client.status = response.code
self.response_headers = response.headers
# XXX This workaround (which needs to be improved at that) for poss... | [
"def",
"_handle_response",
"(",
"self",
",",
"response",
")",
":",
"self",
".",
"client",
".",
"status",
"=",
"response",
".",
"code",
"self",
".",
"response_headers",
"=",
"response",
".",
"headers",
"# XXX This workaround (which needs to be improved at that) for pos... | Handle the HTTP response by memoing the headers and then delivering
bytes. | [
"Handle",
"the",
"HTTP",
"response",
"by",
"memoing",
"the",
"headers",
"and",
"then",
"delivering",
"bytes",
"."
] | train | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/client/base.py#L716-L734 |
twisted/txaws | txaws/client/base.py | BaseQuery.get_response_headers | def get_response_headers(self, *args, **kwargs):
"""
A convenience method for obtaining the headers that were sent from the
S3 server.
The AWS S3 API depends upon setting headers. This method is used by the
head_object API call for getting a S3 object's metadata.
"""
... | python | def get_response_headers(self, *args, **kwargs):
"""
A convenience method for obtaining the headers that were sent from the
S3 server.
The AWS S3 API depends upon setting headers. This method is used by the
head_object API call for getting a S3 object's metadata.
"""
... | [
"def",
"get_response_headers",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"response_headers",
":",
"return",
"self",
".",
"_unpack_headers",
"(",
"self",
".",
"response_headers",
")"
] | A convenience method for obtaining the headers that were sent from the
S3 server.
The AWS S3 API depends upon setting headers. This method is used by the
head_object API call for getting a S3 object's metadata. | [
"A",
"convenience",
"method",
"for",
"obtaining",
"the",
"headers",
"that",
"were",
"sent",
"from",
"the",
"S3",
"server",
"."
] | train | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/client/base.py#L740-L749 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.