repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
twisted/txaws | txaws/ec2/client.py | EC2Client.describe_instances | def describe_instances(self, *instance_ids):
"""Describe current instances."""
instances = {}
for pos, instance_id in enumerate(instance_ids):
instances["InstanceId.%d" % (pos + 1)] = instance_id
query = self.query_factory(
action="DescribeInstances", creds=self.c... | python | def describe_instances(self, *instance_ids):
"""Describe current instances."""
instances = {}
for pos, instance_id in enumerate(instance_ids):
instances["InstanceId.%d" % (pos + 1)] = instance_id
query = self.query_factory(
action="DescribeInstances", creds=self.c... | [
"def",
"describe_instances",
"(",
"self",
",",
"*",
"instance_ids",
")",
":",
"instances",
"=",
"{",
"}",
"for",
"pos",
",",
"instance_id",
"in",
"enumerate",
"(",
"instance_ids",
")",
":",
"instances",
"[",
"\"InstanceId.%d\"",
"%",
"(",
"pos",
"+",
"1",
... | Describe current instances. | [
"Describe",
"current",
"instances",
"."
] | 5c3317376cd47e536625027e38c3b37840175ce0 | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/ec2/client.py#L39-L48 | train |
twisted/txaws | txaws/ec2/client.py | EC2Client.run_instances | def run_instances(self, image_id, min_count, max_count,
security_groups=None, key_name=None, instance_type=None,
user_data=None, availability_zone=None, kernel_id=None,
ramdisk_id=None, subnet_id=None, security_group_ids=None):
"""Run new instances.
TODO: blockDeviceMapping, mon... | python | def run_instances(self, image_id, min_count, max_count,
security_groups=None, key_name=None, instance_type=None,
user_data=None, availability_zone=None, kernel_id=None,
ramdisk_id=None, subnet_id=None, security_group_ids=None):
"""Run new instances.
TODO: blockDeviceMapping, mon... | [
"def",
"run_instances",
"(",
"self",
",",
"image_id",
",",
"min_count",
",",
"max_count",
",",
"security_groups",
"=",
"None",
",",
"key_name",
"=",
"None",
",",
"instance_type",
"=",
"None",
",",
"user_data",
"=",
"None",
",",
"availability_zone",
"=",
"Non... | Run new instances.
TODO: blockDeviceMapping, monitoring, subnetId | [
"Run",
"new",
"instances",
"."
] | 5c3317376cd47e536625027e38c3b37840175ce0 | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/ec2/client.py#L50-L91 | train |
twisted/txaws | txaws/ec2/client.py | EC2Client.get_console_output | def get_console_output(self, instance_id):
"""Get the console output for a single instance."""
InstanceIDParam = {"InstanceId": instance_id}
query = self.query_factory(
action="GetConsoleOutput", creds=self.creds,
endpoint=self.endpoint, other_params=InstanceIDParam)
... | python | def get_console_output(self, instance_id):
"""Get the console output for a single instance."""
InstanceIDParam = {"InstanceId": instance_id}
query = self.query_factory(
action="GetConsoleOutput", creds=self.creds,
endpoint=self.endpoint, other_params=InstanceIDParam)
... | [
"def",
"get_console_output",
"(",
"self",
",",
"instance_id",
")",
":",
"InstanceIDParam",
"=",
"{",
"\"InstanceId\"",
":",
"instance_id",
"}",
"query",
"=",
"self",
".",
"query_factory",
"(",
"action",
"=",
"\"GetConsoleOutput\"",
",",
"creds",
"=",
"self",
"... | Get the console output for a single instance. | [
"Get",
"the",
"console",
"output",
"for",
"a",
"single",
"instance",
"."
] | 5c3317376cd47e536625027e38c3b37840175ce0 | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/ec2/client.py#L109-L116 | train |
twisted/txaws | txaws/ec2/client.py | EC2Client.describe_security_groups | def describe_security_groups(self, *names):
"""Describe security groups.
@param names: Optionally, a list of security group names to describe.
Defaults to all security groups in the account.
@return: A C{Deferred} that will fire with a list of L{SecurityGroup}s
retrieved... | python | def describe_security_groups(self, *names):
"""Describe security groups.
@param names: Optionally, a list of security group names to describe.
Defaults to all security groups in the account.
@return: A C{Deferred} that will fire with a list of L{SecurityGroup}s
retrieved... | [
"def",
"describe_security_groups",
"(",
"self",
",",
"*",
"names",
")",
":",
"group_names",
"=",
"{",
"}",
"if",
"names",
":",
"group_names",
"=",
"dict",
"(",
"[",
"(",
"\"GroupName.%d\"",
"%",
"(",
"i",
"+",
"1",
")",
",",
"name",
")",
"for",
"i",
... | Describe security groups.
@param names: Optionally, a list of security group names to describe.
Defaults to all security groups in the account.
@return: A C{Deferred} that will fire with a list of L{SecurityGroup}s
retrieved from the cloud. | [
"Describe",
"security",
"groups",
"."
] | 5c3317376cd47e536625027e38c3b37840175ce0 | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/ec2/client.py#L118-L134 | train |
twisted/txaws | txaws/ec2/client.py | EC2Client.create_security_group | def create_security_group(self, name, description, vpc_id=None):
"""Create security group.
@param name: Name of the new security group.
@param description: Description of the new security group.
@param vpc_id: ID of the VPC to which the security group will belong.
@return: A C{D... | python | def create_security_group(self, name, description, vpc_id=None):
"""Create security group.
@param name: Name of the new security group.
@param description: Description of the new security group.
@param vpc_id: ID of the VPC to which the security group will belong.
@return: A C{D... | [
"def",
"create_security_group",
"(",
"self",
",",
"name",
",",
"description",
",",
"vpc_id",
"=",
"None",
")",
":",
"parameters",
"=",
"{",
"\"GroupName\"",
":",
"name",
",",
"\"GroupDescription\"",
":",
"description",
"}",
"if",
"vpc_id",
":",
"parameters",
... | Create security group.
@param name: Name of the new security group.
@param description: Description of the new security group.
@param vpc_id: ID of the VPC to which the security group will belong.
@return: A C{Deferred} that will fire with a truth value for the
success of th... | [
"Create",
"security",
"group",
"."
] | 5c3317376cd47e536625027e38c3b37840175ce0 | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/ec2/client.py#L136-L152 | train |
twisted/txaws | txaws/ec2/client.py | EC2Client.describe_volumes | def describe_volumes(self, *volume_ids):
"""Describe available volumes."""
volumeset = {}
for pos, volume_id in enumerate(volume_ids):
volumeset["VolumeId.%d" % (pos + 1)] = volume_id
query = self.query_factory(
action="DescribeVolumes", creds=self.creds, endpoint... | python | def describe_volumes(self, *volume_ids):
"""Describe available volumes."""
volumeset = {}
for pos, volume_id in enumerate(volume_ids):
volumeset["VolumeId.%d" % (pos + 1)] = volume_id
query = self.query_factory(
action="DescribeVolumes", creds=self.creds, endpoint... | [
"def",
"describe_volumes",
"(",
"self",
",",
"*",
"volume_ids",
")",
":",
"volumeset",
"=",
"{",
"}",
"for",
"pos",
",",
"volume_id",
"in",
"enumerate",
"(",
"volume_ids",
")",
":",
"volumeset",
"[",
"\"VolumeId.%d\"",
"%",
"(",
"pos",
"+",
"1",
")",
"... | Describe available volumes. | [
"Describe",
"available",
"volumes",
"."
] | 5c3317376cd47e536625027e38c3b37840175ce0 | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/ec2/client.py#L355-L364 | train |
twisted/txaws | txaws/ec2/client.py | EC2Client.create_volume | def create_volume(self, availability_zone, size=None, snapshot_id=None):
"""Create a new volume."""
params = {"AvailabilityZone": availability_zone}
if ((snapshot_id is None and size is None) or
(snapshot_id is not None and size is not None)):
raise ValueError("Please pro... | python | def create_volume(self, availability_zone, size=None, snapshot_id=None):
"""Create a new volume."""
params = {"AvailabilityZone": availability_zone}
if ((snapshot_id is None and size is None) or
(snapshot_id is not None and size is not None)):
raise ValueError("Please pro... | [
"def",
"create_volume",
"(",
"self",
",",
"availability_zone",
",",
"size",
"=",
"None",
",",
"snapshot_id",
"=",
"None",
")",
":",
"params",
"=",
"{",
"\"AvailabilityZone\"",
":",
"availability_zone",
"}",
"if",
"(",
"(",
"snapshot_id",
"is",
"None",
"and",... | Create a new volume. | [
"Create",
"a",
"new",
"volume",
"."
] | 5c3317376cd47e536625027e38c3b37840175ce0 | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/ec2/client.py#L366-L380 | train |
twisted/txaws | txaws/ec2/client.py | EC2Client.describe_snapshots | def describe_snapshots(self, *snapshot_ids):
"""Describe available snapshots.
TODO: ownerSet, restorableBySet
"""
snapshot_set = {}
for pos, snapshot_id in enumerate(snapshot_ids):
snapshot_set["SnapshotId.%d" % (pos + 1)] = snapshot_id
query = self.query_fac... | python | def describe_snapshots(self, *snapshot_ids):
"""Describe available snapshots.
TODO: ownerSet, restorableBySet
"""
snapshot_set = {}
for pos, snapshot_id in enumerate(snapshot_ids):
snapshot_set["SnapshotId.%d" % (pos + 1)] = snapshot_id
query = self.query_fac... | [
"def",
"describe_snapshots",
"(",
"self",
",",
"*",
"snapshot_ids",
")",
":",
"snapshot_set",
"=",
"{",
"}",
"for",
"pos",
",",
"snapshot_id",
"in",
"enumerate",
"(",
"snapshot_ids",
")",
":",
"snapshot_set",
"[",
"\"SnapshotId.%d\"",
"%",
"(",
"pos",
"+",
... | Describe available snapshots.
TODO: ownerSet, restorableBySet | [
"Describe",
"available",
"snapshots",
"."
] | 5c3317376cd47e536625027e38c3b37840175ce0 | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/ec2/client.py#L389-L401 | train |
twisted/txaws | txaws/ec2/client.py | EC2Client.delete_snapshot | def delete_snapshot(self, snapshot_id):
"""Remove a previously created snapshot."""
query = self.query_factory(
action="DeleteSnapshot", creds=self.creds, endpoint=self.endpoint,
other_params={"SnapshotId": snapshot_id})
d = query.submit()
return d.addCallback(sel... | python | def delete_snapshot(self, snapshot_id):
"""Remove a previously created snapshot."""
query = self.query_factory(
action="DeleteSnapshot", creds=self.creds, endpoint=self.endpoint,
other_params={"SnapshotId": snapshot_id})
d = query.submit()
return d.addCallback(sel... | [
"def",
"delete_snapshot",
"(",
"self",
",",
"snapshot_id",
")",
":",
"query",
"=",
"self",
".",
"query_factory",
"(",
"action",
"=",
"\"DeleteSnapshot\"",
",",
"creds",
"=",
"self",
".",
"creds",
",",
"endpoint",
"=",
"self",
".",
"endpoint",
",",
"other_p... | Remove a previously created snapshot. | [
"Remove",
"a",
"previously",
"created",
"snapshot",
"."
] | 5c3317376cd47e536625027e38c3b37840175ce0 | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/ec2/client.py#L414-L420 | train |
twisted/txaws | txaws/ec2/client.py | EC2Client.describe_keypairs | def describe_keypairs(self, *keypair_names):
"""Returns information about key pairs available."""
keypairs = {}
for index, keypair_name in enumerate(keypair_names):
keypairs["KeyName.%d" % (index + 1)] = keypair_name
query = self.query_factory(
action="DescribeKey... | python | def describe_keypairs(self, *keypair_names):
"""Returns information about key pairs available."""
keypairs = {}
for index, keypair_name in enumerate(keypair_names):
keypairs["KeyName.%d" % (index + 1)] = keypair_name
query = self.query_factory(
action="DescribeKey... | [
"def",
"describe_keypairs",
"(",
"self",
",",
"*",
"keypair_names",
")",
":",
"keypairs",
"=",
"{",
"}",
"for",
"index",
",",
"keypair_name",
"in",
"enumerate",
"(",
"keypair_names",
")",
":",
"keypairs",
"[",
"\"KeyName.%d\"",
"%",
"(",
"index",
"+",
"1",... | Returns information about key pairs available. | [
"Returns",
"information",
"about",
"key",
"pairs",
"available",
"."
] | 5c3317376cd47e536625027e38c3b37840175ce0 | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/ec2/client.py#L431-L440 | train |
twisted/txaws | txaws/ec2/client.py | EC2Client.create_keypair | def create_keypair(self, keypair_name):
"""
Create a new 2048 bit RSA key pair and return a unique ID that can be
used to reference the created key pair when launching new instances.
"""
query = self.query_factory(
action="CreateKeyPair", creds=self.creds, endpoint=se... | python | def create_keypair(self, keypair_name):
"""
Create a new 2048 bit RSA key pair and return a unique ID that can be
used to reference the created key pair when launching new instances.
"""
query = self.query_factory(
action="CreateKeyPair", creds=self.creds, endpoint=se... | [
"def",
"create_keypair",
"(",
"self",
",",
"keypair_name",
")",
":",
"query",
"=",
"self",
".",
"query_factory",
"(",
"action",
"=",
"\"CreateKeyPair\"",
",",
"creds",
"=",
"self",
".",
"creds",
",",
"endpoint",
"=",
"self",
".",
"endpoint",
",",
"other_pa... | Create a new 2048 bit RSA key pair and return a unique ID that can be
used to reference the created key pair when launching new instances. | [
"Create",
"a",
"new",
"2048",
"bit",
"RSA",
"key",
"pair",
"and",
"return",
"a",
"unique",
"ID",
"that",
"can",
"be",
"used",
"to",
"reference",
"the",
"created",
"key",
"pair",
"when",
"launching",
"new",
"instances",
"."
] | 5c3317376cd47e536625027e38c3b37840175ce0 | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/ec2/client.py#L442-L451 | train |
twisted/txaws | txaws/ec2/client.py | EC2Client.allocate_address | def allocate_address(self):
"""
Acquire an elastic IP address to be attached subsequently to EC2
instances.
@return: the IP address allocated.
"""
# XXX remove empty other_params
query = self.query_factory(
action="AllocateAddress", creds=self.creds, ... | python | def allocate_address(self):
"""
Acquire an elastic IP address to be attached subsequently to EC2
instances.
@return: the IP address allocated.
"""
# XXX remove empty other_params
query = self.query_factory(
action="AllocateAddress", creds=self.creds, ... | [
"def",
"allocate_address",
"(",
"self",
")",
":",
"query",
"=",
"self",
".",
"query_factory",
"(",
"action",
"=",
"\"AllocateAddress\"",
",",
"creds",
"=",
"self",
".",
"creds",
",",
"endpoint",
"=",
"self",
".",
"endpoint",
",",
"other_params",
"=",
"{",
... | Acquire an elastic IP address to be attached subsequently to EC2
instances.
@return: the IP address allocated. | [
"Acquire",
"an",
"elastic",
"IP",
"address",
"to",
"be",
"attached",
"subsequently",
"to",
"EC2",
"instances",
"."
] | 5c3317376cd47e536625027e38c3b37840175ce0 | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/ec2/client.py#L485-L497 | train |
twisted/txaws | txaws/ec2/client.py | EC2Client.describe_addresses | def describe_addresses(self, *addresses):
"""
List the elastic IPs allocated in this account.
@param addresses: if specified, the addresses to get information about.
@return: a C{list} of (address, instance_id). If the elastic IP is not
associated currently, C{instance_id} ... | python | def describe_addresses(self, *addresses):
"""
List the elastic IPs allocated in this account.
@param addresses: if specified, the addresses to get information about.
@return: a C{list} of (address, instance_id). If the elastic IP is not
associated currently, C{instance_id} ... | [
"def",
"describe_addresses",
"(",
"self",
",",
"*",
"addresses",
")",
":",
"address_set",
"=",
"{",
"}",
"for",
"pos",
",",
"address",
"in",
"enumerate",
"(",
"addresses",
")",
":",
"address_set",
"[",
"\"PublicIp.%d\"",
"%",
"(",
"pos",
"+",
"1",
")",
... | List the elastic IPs allocated in this account.
@param addresses: if specified, the addresses to get information about.
@return: a C{list} of (address, instance_id). If the elastic IP is not
associated currently, C{instance_id} will be C{None}. | [
"List",
"the",
"elastic",
"IPs",
"allocated",
"in",
"this",
"account",
"."
] | 5c3317376cd47e536625027e38c3b37840175ce0 | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/ec2/client.py#L537-L553 | train |
twisted/txaws | txaws/ec2/client.py | Parser.describe_instances | def describe_instances(self, xml_bytes):
"""
Parse the reservations XML payload that is returned from an AWS
describeInstances API call.
Instead of returning the reservations as the "top-most" object, we
return the object that most developers and their code will be
inter... | python | def describe_instances(self, xml_bytes):
"""
Parse the reservations XML payload that is returned from an AWS
describeInstances API call.
Instead of returning the reservations as the "top-most" object, we
return the object that most developers and their code will be
inter... | [
"def",
"describe_instances",
"(",
"self",
",",
"xml_bytes",
")",
":",
"root",
"=",
"XML",
"(",
"xml_bytes",
")",
"results",
"=",
"[",
"]",
"for",
"reservation_data",
"in",
"root",
".",
"find",
"(",
"\"reservationSet\"",
")",
":",
"reservation",
"=",
"model... | Parse the reservations XML payload that is returned from an AWS
describeInstances API call.
Instead of returning the reservations as the "top-most" object, we
return the object that most developers and their code will be
interested in: the instances. In instances reservation is availabl... | [
"Parse",
"the",
"reservations",
"XML",
"payload",
"that",
"is",
"returned",
"from",
"an",
"AWS",
"describeInstances",
"API",
"call",
"."
] | 5c3317376cd47e536625027e38c3b37840175ce0 | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/ec2/client.py#L626-L658 | train |
twisted/txaws | txaws/ec2/client.py | Parser.run_instances | def run_instances(self, xml_bytes):
"""
Parse the reservations XML payload that is returned from an AWS
RunInstances API call.
@param xml_bytes: raw XML bytes with a C{RunInstancesResponse} root
element.
"""
root = XML(xml_bytes)
# Get the security gr... | python | def run_instances(self, xml_bytes):
"""
Parse the reservations XML payload that is returned from an AWS
RunInstances API call.
@param xml_bytes: raw XML bytes with a C{RunInstancesResponse} root
element.
"""
root = XML(xml_bytes)
# Get the security gr... | [
"def",
"run_instances",
"(",
"self",
",",
"xml_bytes",
")",
":",
"root",
"=",
"XML",
"(",
"xml_bytes",
")",
"groups",
"=",
"[",
"]",
"for",
"group_data",
"in",
"root",
".",
"find",
"(",
"\"groupSet\"",
")",
":",
"group_id",
"=",
"group_data",
".",
"fin... | Parse the reservations XML payload that is returned from an AWS
RunInstances API call.
@param xml_bytes: raw XML bytes with a C{RunInstancesResponse} root
element. | [
"Parse",
"the",
"reservations",
"XML",
"payload",
"that",
"is",
"returned",
"from",
"an",
"AWS",
"RunInstances",
"API",
"call",
"."
] | 5c3317376cd47e536625027e38c3b37840175ce0 | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/ec2/client.py#L660-L681 | train |
twisted/txaws | txaws/ec2/client.py | Signature.compute | def compute(self):
"""Compute and return the signature according to the given data."""
if "Signature" in self.params:
raise RuntimeError("Existing signature in parameters")
if self.signature_version is not None:
version = self.signature_version
else:
v... | python | def compute(self):
"""Compute and return the signature according to the given data."""
if "Signature" in self.params:
raise RuntimeError("Existing signature in parameters")
if self.signature_version is not None:
version = self.signature_version
else:
v... | [
"def",
"compute",
"(",
"self",
")",
":",
"if",
"\"Signature\"",
"in",
"self",
".",
"params",
":",
"raise",
"RuntimeError",
"(",
"\"Existing signature in parameters\"",
")",
"if",
"self",
".",
"signature_version",
"is",
"not",
"None",
":",
"version",
"=",
"self... | Compute and return the signature according to the given data. | [
"Compute",
"and",
"return",
"the",
"signature",
"according",
"to",
"the",
"given",
"data",
"."
] | 5c3317376cd47e536625027e38c3b37840175ce0 | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/ec2/client.py#L1077-L1097 | train |
twisted/txaws | txaws/ec2/client.py | Signature.old_signing_text | def old_signing_text(self):
"""Return the text needed for signing using SignatureVersion 1."""
result = []
lower_cmp = lambda x, y: cmp(x[0].lower(), y[0].lower())
for key, value in sorted(self.params.items(), cmp=lower_cmp):
result.append("%s%s" % (key, value))
retur... | python | def old_signing_text(self):
"""Return the text needed for signing using SignatureVersion 1."""
result = []
lower_cmp = lambda x, y: cmp(x[0].lower(), y[0].lower())
for key, value in sorted(self.params.items(), cmp=lower_cmp):
result.append("%s%s" % (key, value))
retur... | [
"def",
"old_signing_text",
"(",
"self",
")",
":",
"result",
"=",
"[",
"]",
"lower_cmp",
"=",
"lambda",
"x",
",",
"y",
":",
"cmp",
"(",
"x",
"[",
"0",
"]",
".",
"lower",
"(",
")",
",",
"y",
"[",
"0",
"]",
".",
"lower",
"(",
")",
")",
"for",
... | Return the text needed for signing using SignatureVersion 1. | [
"Return",
"the",
"text",
"needed",
"for",
"signing",
"using",
"SignatureVersion",
"1",
"."
] | 5c3317376cd47e536625027e38c3b37840175ce0 | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/ec2/client.py#L1099-L1105 | train |
twisted/txaws | txaws/ec2/client.py | Signature.signing_text | def signing_text(self):
"""Return the text to be signed when signing the query."""
result = "%s\n%s\n%s\n%s" % (self.endpoint.method,
self.endpoint.get_canonical_host(),
self.endpoint.path,
sel... | python | def signing_text(self):
"""Return the text to be signed when signing the query."""
result = "%s\n%s\n%s\n%s" % (self.endpoint.method,
self.endpoint.get_canonical_host(),
self.endpoint.path,
sel... | [
"def",
"signing_text",
"(",
"self",
")",
":",
"result",
"=",
"\"%s\\n%s\\n%s\\n%s\"",
"%",
"(",
"self",
".",
"endpoint",
".",
"method",
",",
"self",
".",
"endpoint",
".",
"get_canonical_host",
"(",
")",
",",
"self",
".",
"endpoint",
".",
"path",
",",
"se... | Return the text to be signed when signing the query. | [
"Return",
"the",
"text",
"to",
"be",
"signed",
"when",
"signing",
"the",
"query",
"."
] | 5c3317376cd47e536625027e38c3b37840175ce0 | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/ec2/client.py#L1107-L1113 | train |
twisted/txaws | txaws/ec2/client.py | Signature.encode | def encode(self, string):
"""Encode a_string as per the canonicalisation encoding rules.
See the AWS dev reference page 186 (2009-11-30 version).
@return: a_string encoded.
"""
if isinstance(string, unicode):
string = string.encode("utf-8")
return quote(strin... | python | def encode(self, string):
"""Encode a_string as per the canonicalisation encoding rules.
See the AWS dev reference page 186 (2009-11-30 version).
@return: a_string encoded.
"""
if isinstance(string, unicode):
string = string.encode("utf-8")
return quote(strin... | [
"def",
"encode",
"(",
"self",
",",
"string",
")",
":",
"if",
"isinstance",
"(",
"string",
",",
"unicode",
")",
":",
"string",
"=",
"string",
".",
"encode",
"(",
"\"utf-8\"",
")",
"return",
"quote",
"(",
"string",
",",
"safe",
"=",
"\"~\"",
")"
] | Encode a_string as per the canonicalisation encoding rules.
See the AWS dev reference page 186 (2009-11-30 version).
@return: a_string encoded. | [
"Encode",
"a_string",
"as",
"per",
"the",
"canonicalisation",
"encoding",
"rules",
"."
] | 5c3317376cd47e536625027e38c3b37840175ce0 | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/ec2/client.py#L1122-L1130 | train |
twisted/txaws | txaws/s3/model.py | MultipartInitiationResponse.from_xml | def from_xml(cls, xml_bytes):
"""
Create an instance of this from XML bytes.
@param xml_bytes: C{str} bytes of XML to parse
@return: an instance of L{MultipartInitiationResponse}
"""
root = XML(xml_bytes)
return cls(root.findtext('Bucket'),
roo... | python | def from_xml(cls, xml_bytes):
"""
Create an instance of this from XML bytes.
@param xml_bytes: C{str} bytes of XML to parse
@return: an instance of L{MultipartInitiationResponse}
"""
root = XML(xml_bytes)
return cls(root.findtext('Bucket'),
roo... | [
"def",
"from_xml",
"(",
"cls",
",",
"xml_bytes",
")",
":",
"root",
"=",
"XML",
"(",
"xml_bytes",
")",
"return",
"cls",
"(",
"root",
".",
"findtext",
"(",
"'Bucket'",
")",
",",
"root",
".",
"findtext",
"(",
"'Key'",
")",
",",
"root",
".",
"findtext",
... | Create an instance of this from XML bytes.
@param xml_bytes: C{str} bytes of XML to parse
@return: an instance of L{MultipartInitiationResponse} | [
"Create",
"an",
"instance",
"of",
"this",
"from",
"XML",
"bytes",
"."
] | 5c3317376cd47e536625027e38c3b37840175ce0 | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/s3/model.py#L178-L188 | train |
T-002/pycast | pycast/common/matrix.py | Matrix._initialize_with_array | def _initialize_with_array(self, data, rowBased=True):
"""Set the matrix values from a two dimensional list."""
if rowBased:
self.matrix = []
if len(data) != self._rows:
raise ValueError("Size of Matrix does not match")
for col in xrange(self._columns)... | python | def _initialize_with_array(self, data, rowBased=True):
"""Set the matrix values from a two dimensional list."""
if rowBased:
self.matrix = []
if len(data) != self._rows:
raise ValueError("Size of Matrix does not match")
for col in xrange(self._columns)... | [
"def",
"_initialize_with_array",
"(",
"self",
",",
"data",
",",
"rowBased",
"=",
"True",
")",
":",
"if",
"rowBased",
":",
"self",
".",
"matrix",
"=",
"[",
"]",
"if",
"len",
"(",
"data",
")",
"!=",
"self",
".",
"_rows",
":",
"raise",
"ValueError",
"("... | Set the matrix values from a two dimensional list. | [
"Set",
"the",
"matrix",
"values",
"from",
"a",
"two",
"dimensional",
"list",
"."
] | 8a53505c6d8367e0ea572e8af768e80b29e1cc41 | https://github.com/T-002/pycast/blob/8a53505c6d8367e0ea572e8af768e80b29e1cc41/pycast/common/matrix.py#L154-L172 | train |
T-002/pycast | pycast/common/matrix.py | Matrix.from_timeseries | def from_timeseries(cls, timeSeries):
"""Create a new Matrix instance from a TimeSeries or MultiDimensionalTimeSeries
:param TimeSeries timeSeries: The TimeSeries, which should be used to
create a new Matrix.
:return: A Matrix with the values of the timeSeries. Each row of
... | python | def from_timeseries(cls, timeSeries):
"""Create a new Matrix instance from a TimeSeries or MultiDimensionalTimeSeries
:param TimeSeries timeSeries: The TimeSeries, which should be used to
create a new Matrix.
:return: A Matrix with the values of the timeSeries. Each row of
... | [
"def",
"from_timeseries",
"(",
"cls",
",",
"timeSeries",
")",
":",
"width",
"=",
"1",
"if",
"isinstance",
"(",
"timeSeries",
",",
"MultiDimensionalTimeSeries",
")",
":",
"width",
"=",
"timeSeries",
".",
"dimension_count",
"(",
")",
"matrixData",
"=",
"[",
"[... | Create a new Matrix instance from a TimeSeries or MultiDimensionalTimeSeries
:param TimeSeries timeSeries: The TimeSeries, which should be used to
create a new Matrix.
:return: A Matrix with the values of the timeSeries. Each row of
the Matrix represents one entry... | [
"Create",
"a",
"new",
"Matrix",
"instance",
"from",
"a",
"TimeSeries",
"or",
"MultiDimensionalTimeSeries"
] | 8a53505c6d8367e0ea572e8af768e80b29e1cc41 | https://github.com/T-002/pycast/blob/8a53505c6d8367e0ea572e8af768e80b29e1cc41/pycast/common/matrix.py#L175-L202 | train |
T-002/pycast | pycast/common/matrix.py | Matrix.from_two_dim_array | def from_two_dim_array(cls, cols, rows, twoDimArray):
"""Create a new Matrix instance from a two dimensional array.
:param integer columns: The number of columns for the Matrix.
:param integer rows: The number of rows for the Matrix.
:param list twoDimArray: A two dimensio... | python | def from_two_dim_array(cls, cols, rows, twoDimArray):
"""Create a new Matrix instance from a two dimensional array.
:param integer columns: The number of columns for the Matrix.
:param integer rows: The number of rows for the Matrix.
:param list twoDimArray: A two dimensio... | [
"def",
"from_two_dim_array",
"(",
"cls",
",",
"cols",
",",
"rows",
",",
"twoDimArray",
")",
":",
"return",
"Matrix",
"(",
"cols",
",",
"rows",
",",
"twoDimArray",
",",
"rowBased",
"=",
"False",
",",
"isOneDimArray",
"=",
"False",
")"
] | Create a new Matrix instance from a two dimensional array.
:param integer columns: The number of columns for the Matrix.
:param integer rows: The number of rows for the Matrix.
:param list twoDimArray: A two dimensional column based array
with t... | [
"Create",
"a",
"new",
"Matrix",
"instance",
"from",
"a",
"two",
"dimensional",
"array",
"."
] | 8a53505c6d8367e0ea572e8af768e80b29e1cc41 | https://github.com/T-002/pycast/blob/8a53505c6d8367e0ea572e8af768e80b29e1cc41/pycast/common/matrix.py#L205-L218 | train |
T-002/pycast | pycast/common/matrix.py | Matrix.get_matrix_from_list | def get_matrix_from_list(self, rows, columns, matrix_list, rowBased=True):
"""Create a new Matrix instance from a matrix_list.
:note: This method is used to create a Matrix instance using cpython.
:param integer rows: The height of the Matrix.
:param integer columns: The widt... | python | def get_matrix_from_list(self, rows, columns, matrix_list, rowBased=True):
"""Create a new Matrix instance from a matrix_list.
:note: This method is used to create a Matrix instance using cpython.
:param integer rows: The height of the Matrix.
:param integer columns: The widt... | [
"def",
"get_matrix_from_list",
"(",
"self",
",",
"rows",
",",
"columns",
",",
"matrix_list",
",",
"rowBased",
"=",
"True",
")",
":",
"resultMatrix",
"=",
"Matrix",
"(",
"columns",
",",
"rows",
",",
"matrix_list",
",",
"rowBased",
")",
"return",
"resultMatrix... | Create a new Matrix instance from a matrix_list.
:note: This method is used to create a Matrix instance using cpython.
:param integer rows: The height of the Matrix.
:param integer columns: The width of the Matrix.
:param matrix_list: A one dimensional list containing... | [
"Create",
"a",
"new",
"Matrix",
"instance",
"from",
"a",
"matrix_list",
"."
] | 8a53505c6d8367e0ea572e8af768e80b29e1cc41 | https://github.com/T-002/pycast/blob/8a53505c6d8367e0ea572e8af768e80b29e1cc41/pycast/common/matrix.py#L274-L290 | train |
T-002/pycast | pycast/common/matrix.py | Matrix.set_value | def set_value(self, column, row, value):
"""Set the value of the Matrix at the specified column and row.
:param integer column: The index for the column (starting at 0)
:param integer row: The index for the row (starting at 0)
:param numeric value: The new value at the given colu... | python | def set_value(self, column, row, value):
"""Set the value of the Matrix at the specified column and row.
:param integer column: The index for the column (starting at 0)
:param integer row: The index for the row (starting at 0)
:param numeric value: The new value at the given colu... | [
"def",
"set_value",
"(",
"self",
",",
"column",
",",
"row",
",",
"value",
")",
":",
"self",
".",
"matrix",
"[",
"column",
"]",
"[",
"row",
"]",
"=",
"value"
] | Set the value of the Matrix at the specified column and row.
:param integer column: The index for the column (starting at 0)
:param integer row: The index for the row (starting at 0)
:param numeric value: The new value at the given column/row
:raise: Raises an :py:exc:`Index... | [
"Set",
"the",
"value",
"of",
"the",
"Matrix",
"at",
"the",
"specified",
"column",
"and",
"row",
"."
] | 8a53505c6d8367e0ea572e8af768e80b29e1cc41 | https://github.com/T-002/pycast/blob/8a53505c6d8367e0ea572e8af768e80b29e1cc41/pycast/common/matrix.py#L292-L301 | train |
T-002/pycast | pycast/common/matrix.py | Matrix.invers | def invers(self):
"""Return the invers matrix, if it can be calculated
:return: Returns a new Matrix containing the invers
:rtype: Matrix
:raise: Raises an :py:exc:`ValueError` if the matrix is not inversible
:note: Only a squared matrix with a determinant != 0... | python | def invers(self):
"""Return the invers matrix, if it can be calculated
:return: Returns a new Matrix containing the invers
:rtype: Matrix
:raise: Raises an :py:exc:`ValueError` if the matrix is not inversible
:note: Only a squared matrix with a determinant != 0... | [
"def",
"invers",
"(",
"self",
")",
":",
"if",
"self",
".",
"_columns",
"!=",
"self",
".",
"_rows",
":",
"raise",
"ValueError",
"(",
"\"A square matrix is needed\"",
")",
"mArray",
"=",
"self",
".",
"get_array",
"(",
"False",
")",
"appList",
"=",
"[",
"0"... | Return the invers matrix, if it can be calculated
:return: Returns a new Matrix containing the invers
:rtype: Matrix
:raise: Raises an :py:exc:`ValueError` if the matrix is not inversible
:note: Only a squared matrix with a determinant != 0 can be inverted.
:to... | [
"Return",
"the",
"invers",
"matrix",
"if",
"it",
"can",
"be",
"calculated"
] | 8a53505c6d8367e0ea572e8af768e80b29e1cc41 | https://github.com/T-002/pycast/blob/8a53505c6d8367e0ea572e8af768e80b29e1cc41/pycast/common/matrix.py#L333-L361 | train |
T-002/pycast | pycast/common/matrix.py | Matrix.flatten | def flatten(self):
"""
If the current Matrix consists of Blockmatrixes as elementes method
flattens the Matrix into one Matrix only consisting of the 2nd level
elements
[[[1 2] [[3 4] to [[1 2 3 4]
[5 6]] [7 8]]] [5 6 7 8]]
"""
blocksize = self.ge... | python | def flatten(self):
"""
If the current Matrix consists of Blockmatrixes as elementes method
flattens the Matrix into one Matrix only consisting of the 2nd level
elements
[[[1 2] [[3 4] to [[1 2 3 4]
[5 6]] [7 8]]] [5 6 7 8]]
"""
blocksize = self.ge... | [
"def",
"flatten",
"(",
"self",
")",
":",
"blocksize",
"=",
"self",
".",
"get_array",
"(",
")",
"[",
"0",
"]",
"[",
"0",
"]",
".",
"get_width",
"(",
")",
"width",
"=",
"self",
".",
"get_width",
"(",
")",
"*",
"blocksize",
"columnsNew",
"=",
"[",
"... | If the current Matrix consists of Blockmatrixes as elementes method
flattens the Matrix into one Matrix only consisting of the 2nd level
elements
[[[1 2] [[3 4] to [[1 2 3 4]
[5 6]] [7 8]]] [5 6 7 8]] | [
"If",
"the",
"current",
"Matrix",
"consists",
"of",
"Blockmatrixes",
"as",
"elementes",
"method",
"flattens",
"the",
"Matrix",
"into",
"one",
"Matrix",
"only",
"consisting",
"of",
"the",
"2nd",
"level",
"elements"
] | 8a53505c6d8367e0ea572e8af768e80b29e1cc41 | https://github.com/T-002/pycast/blob/8a53505c6d8367e0ea572e8af768e80b29e1cc41/pycast/common/matrix.py#L455-L477 | train |
T-002/pycast | pycast/common/matrix.py | Matrix.multiply | def multiply(self, multiplicator):
"""Return a new Matrix with a multiple.
:param Number multiplicator: The number to calculate the multiple
:return: The Matrix with the the multiple.
:rtype: Matrix
"""
result = Matrix(self.get_width(), self.get_height())
... | python | def multiply(self, multiplicator):
"""Return a new Matrix with a multiple.
:param Number multiplicator: The number to calculate the multiple
:return: The Matrix with the the multiple.
:rtype: Matrix
"""
result = Matrix(self.get_width(), self.get_height())
... | [
"def",
"multiply",
"(",
"self",
",",
"multiplicator",
")",
":",
"result",
"=",
"Matrix",
"(",
"self",
".",
"get_width",
"(",
")",
",",
"self",
".",
"get_height",
"(",
")",
")",
"for",
"row",
"in",
"xrange",
"(",
"self",
".",
"get_height",
"(",
")",
... | Return a new Matrix with a multiple.
:param Number multiplicator: The number to calculate the multiple
:return: The Matrix with the the multiple.
:rtype: Matrix | [
"Return",
"a",
"new",
"Matrix",
"with",
"a",
"multiple",
"."
] | 8a53505c6d8367e0ea572e8af768e80b29e1cc41 | https://github.com/T-002/pycast/blob/8a53505c6d8367e0ea572e8af768e80b29e1cc41/pycast/common/matrix.py#L504-L516 | train |
T-002/pycast | pycast/common/matrix.py | Matrix.transform | def transform(self):
"""Return a new transformed matrix.
:return: Returns a new transformed Matrix
:rtype: Matrix
"""
t_matrix = Matrix(self._rows, self._columns)
for col_i, col in enumerate(self.matrix):
for row_i, entry in enumerate(col):
... | python | def transform(self):
"""Return a new transformed matrix.
:return: Returns a new transformed Matrix
:rtype: Matrix
"""
t_matrix = Matrix(self._rows, self._columns)
for col_i, col in enumerate(self.matrix):
for row_i, entry in enumerate(col):
... | [
"def",
"transform",
"(",
"self",
")",
":",
"t_matrix",
"=",
"Matrix",
"(",
"self",
".",
"_rows",
",",
"self",
".",
"_columns",
")",
"for",
"col_i",
",",
"col",
"in",
"enumerate",
"(",
"self",
".",
"matrix",
")",
":",
"for",
"row_i",
",",
"entry",
"... | Return a new transformed matrix.
:return: Returns a new transformed Matrix
:rtype: Matrix | [
"Return",
"a",
"new",
"transformed",
"matrix",
"."
] | 8a53505c6d8367e0ea572e8af768e80b29e1cc41 | https://github.com/T-002/pycast/blob/8a53505c6d8367e0ea572e8af768e80b29e1cc41/pycast/common/matrix.py#L518-L528 | train |
T-002/pycast | pycast/common/matrix.py | Vector.initialize_from_matrix | def initialize_from_matrix(cls, matrix, column):
"""Create vector from matrix
:param Matrix matrix: The Matrix, which should be used to create the vector.
:param integer column: The column of the matrix, which should be used
to create the new vector.
:rai... | python | def initialize_from_matrix(cls, matrix, column):
"""Create vector from matrix
:param Matrix matrix: The Matrix, which should be used to create the vector.
:param integer column: The column of the matrix, which should be used
to create the new vector.
:rai... | [
"def",
"initialize_from_matrix",
"(",
"cls",
",",
"matrix",
",",
"column",
")",
":",
"vec",
"=",
"Vector",
"(",
"matrix",
".",
"get_height",
"(",
")",
")",
"for",
"row",
"in",
"xrange",
"(",
"matrix",
".",
"get_height",
"(",
")",
")",
":",
"vec",
"."... | Create vector from matrix
:param Matrix matrix: The Matrix, which should be used to create the vector.
:param integer column: The column of the matrix, which should be used
to create the new vector.
:raise: Raises an :py:exc:`IndexError` if the matrix does not ha... | [
"Create",
"vector",
"from",
"matrix"
] | 8a53505c6d8367e0ea572e8af768e80b29e1cc41 | https://github.com/T-002/pycast/blob/8a53505c6d8367e0ea572e8af768e80b29e1cc41/pycast/common/matrix.py#L974-L985 | train |
T-002/pycast | pycast/common/matrix.py | Vector.unify | def unify(self):
"""Unifies the vector. The length of the vector will be 1.
:return: Return the instance itself
:rtype: Vector
"""
length = float(self.norm())
for row in xrange(self.get_height()):
self.set_value(0, row, self.get_value(0, row) / length)
... | python | def unify(self):
"""Unifies the vector. The length of the vector will be 1.
:return: Return the instance itself
:rtype: Vector
"""
length = float(self.norm())
for row in xrange(self.get_height()):
self.set_value(0, row, self.get_value(0, row) / length)
... | [
"def",
"unify",
"(",
"self",
")",
":",
"length",
"=",
"float",
"(",
"self",
".",
"norm",
"(",
")",
")",
"for",
"row",
"in",
"xrange",
"(",
"self",
".",
"get_height",
"(",
")",
")",
":",
"self",
".",
"set_value",
"(",
"0",
",",
"row",
",",
"self... | Unifies the vector. The length of the vector will be 1.
:return: Return the instance itself
:rtype: Vector | [
"Unifies",
"the",
"vector",
".",
"The",
"length",
"of",
"the",
"vector",
"will",
"be",
"1",
"."
] | 8a53505c6d8367e0ea572e8af768e80b29e1cc41 | https://github.com/T-002/pycast/blob/8a53505c6d8367e0ea572e8af768e80b29e1cc41/pycast/common/matrix.py#L995-L1004 | train |
pdkit/pdkit | pdkit/finger_tapping_processor.py | FingerTappingProcessor.moving_frequency | def moving_frequency(self, data_frame):
"""
This method returns moving frequency
:param data_frame: the data frame
:type data_frame: pandas.DataFrame
:return diff_mov_freq: frequency
:rtype diff_mov_freq: float
"""
f = []
for ... | python | def moving_frequency(self, data_frame):
"""
This method returns moving frequency
:param data_frame: the data frame
:type data_frame: pandas.DataFrame
:return diff_mov_freq: frequency
:rtype diff_mov_freq: float
"""
f = []
for ... | [
"def",
"moving_frequency",
"(",
"self",
",",
"data_frame",
")",
":",
"f",
"=",
"[",
"]",
"for",
"i",
"in",
"range",
"(",
"0",
",",
"(",
"data_frame",
".",
"td",
"[",
"-",
"1",
"]",
".",
"astype",
"(",
"'int'",
")",
"-",
"self",
".",
"window",
"... | This method returns moving frequency
:param data_frame: the data frame
:type data_frame: pandas.DataFrame
:return diff_mov_freq: frequency
:rtype diff_mov_freq: float | [
"This",
"method",
"returns",
"moving",
"frequency"
] | c7120263da2071bb139815fbdb56ca77b544f340 | https://github.com/pdkit/pdkit/blob/c7120263da2071bb139815fbdb56ca77b544f340/pdkit/finger_tapping_processor.py#L65-L84 | train |
pdkit/pdkit | pdkit/finger_tapping_processor.py | FingerTappingProcessor.continuous_frequency | def continuous_frequency(self, data_frame):
"""
This method returns continuous frequency
:param data_frame: the data frame
:type data_frame: pandas.DataFrame
:return cont_freq: frequency
:rtype cont_freq: float
"""
tap_timestamps = da... | python | def continuous_frequency(self, data_frame):
"""
This method returns continuous frequency
:param data_frame: the data frame
:type data_frame: pandas.DataFrame
:return cont_freq: frequency
:rtype cont_freq: float
"""
tap_timestamps = da... | [
"def",
"continuous_frequency",
"(",
"self",
",",
"data_frame",
")",
":",
"tap_timestamps",
"=",
"data_frame",
".",
"td",
"[",
"data_frame",
".",
"action_type",
"==",
"1",
"]",
"cont_freq",
"=",
"1.0",
"/",
"(",
"np",
".",
"array",
"(",
"tap_timestamps",
"[... | This method returns continuous frequency
:param data_frame: the data frame
:type data_frame: pandas.DataFrame
:return cont_freq: frequency
:rtype cont_freq: float | [
"This",
"method",
"returns",
"continuous",
"frequency"
] | c7120263da2071bb139815fbdb56ca77b544f340 | https://github.com/pdkit/pdkit/blob/c7120263da2071bb139815fbdb56ca77b544f340/pdkit/finger_tapping_processor.py#L86-L100 | train |
pdkit/pdkit | pdkit/finger_tapping_processor.py | FingerTappingProcessor.incoordination_score | def incoordination_score(self, data_frame):
"""
This method calculates the variance of the time interval in msec between taps
:param data_frame: the data frame
:type data_frame: pandas.DataFrame
:return is: incoordination score
:rtype is: float
... | python | def incoordination_score(self, data_frame):
"""
This method calculates the variance of the time interval in msec between taps
:param data_frame: the data frame
:type data_frame: pandas.DataFrame
:return is: incoordination score
:rtype is: float
... | [
"def",
"incoordination_score",
"(",
"self",
",",
"data_frame",
")",
":",
"diff",
"=",
"data_frame",
".",
"td",
"[",
"1",
":",
"-",
"1",
"]",
".",
"values",
"-",
"data_frame",
".",
"td",
"[",
"0",
":",
"-",
"2",
"]",
".",
"values",
"inc_s",
"=",
"... | This method calculates the variance of the time interval in msec between taps
:param data_frame: the data frame
:type data_frame: pandas.DataFrame
:return is: incoordination score
:rtype is: float | [
"This",
"method",
"calculates",
"the",
"variance",
"of",
"the",
"time",
"interval",
"in",
"msec",
"between",
"taps"
] | c7120263da2071bb139815fbdb56ca77b544f340 | https://github.com/pdkit/pdkit/blob/c7120263da2071bb139815fbdb56ca77b544f340/pdkit/finger_tapping_processor.py#L118-L131 | train |
pdkit/pdkit | pdkit/finger_tapping_processor.py | FingerTappingProcessor.kinesia_scores | def kinesia_scores(self, data_frame):
"""
This method calculates the number of key taps
:param data_frame: the data frame
:type data_frame: pandas.DataFrame
:return ks: key taps
:rtype ks: float
:return duration: test duration (seconds)
... | python | def kinesia_scores(self, data_frame):
"""
This method calculates the number of key taps
:param data_frame: the data frame
:type data_frame: pandas.DataFrame
:return ks: key taps
:rtype ks: float
:return duration: test duration (seconds)
... | [
"def",
"kinesia_scores",
"(",
"self",
",",
"data_frame",
")",
":",
"ks",
"=",
"sum",
"(",
"data_frame",
".",
"action_type",
"==",
"1",
")",
"duration",
"=",
"math",
".",
"ceil",
"(",
"data_frame",
".",
"td",
"[",
"-",
"1",
"]",
")",
"return",
"ks",
... | This method calculates the number of key taps
:param data_frame: the data frame
:type data_frame: pandas.DataFrame
:return ks: key taps
:rtype ks: float
:return duration: test duration (seconds)
:rtype duration: float | [
"This",
"method",
"calculates",
"the",
"number",
"of",
"key",
"taps"
] | c7120263da2071bb139815fbdb56ca77b544f340 | https://github.com/pdkit/pdkit/blob/c7120263da2071bb139815fbdb56ca77b544f340/pdkit/finger_tapping_processor.py#L149-L166 | train |
pdkit/pdkit | pdkit/finger_tapping_processor.py | FingerTappingProcessor.akinesia_times | def akinesia_times(self, data_frame):
"""
This method calculates akinesia times, mean dwell time on each key in milliseconds
:param data_frame: the data frame
:type data_frame: pandas.DataFrame
:return at: akinesia times
:rtype at: float
:... | python | def akinesia_times(self, data_frame):
"""
This method calculates akinesia times, mean dwell time on each key in milliseconds
:param data_frame: the data frame
:type data_frame: pandas.DataFrame
:return at: akinesia times
:rtype at: float
:... | [
"def",
"akinesia_times",
"(",
"self",
",",
"data_frame",
")",
":",
"raise_timestamps",
"=",
"data_frame",
".",
"td",
"[",
"data_frame",
".",
"action_type",
"==",
"1",
"]",
"down_timestamps",
"=",
"data_frame",
".",
"td",
"[",
"data_frame",
".",
"action_type",
... | This method calculates akinesia times, mean dwell time on each key in milliseconds
:param data_frame: the data frame
:type data_frame: pandas.DataFrame
:return at: akinesia times
:rtype at: float
:return duration: test duration (seconds)
:rtype du... | [
"This",
"method",
"calculates",
"akinesia",
"times",
"mean",
"dwell",
"time",
"on",
"each",
"key",
"in",
"milliseconds"
] | c7120263da2071bb139815fbdb56ca77b544f340 | https://github.com/pdkit/pdkit/blob/c7120263da2071bb139815fbdb56ca77b544f340/pdkit/finger_tapping_processor.py#L168-L192 | train |
pdkit/pdkit | pdkit/finger_tapping_processor.py | FingerTappingProcessor.dysmetria_score | def dysmetria_score(self, data_frame):
"""
This method calculates accuracy of target taps in pixels
:param data_frame: the data frame
:type data_frame: pandas.DataFrame
:return ds: dysmetria score in pixels
:rtype ds: float
"""
tap_da... | python | def dysmetria_score(self, data_frame):
"""
This method calculates accuracy of target taps in pixels
:param data_frame: the data frame
:type data_frame: pandas.DataFrame
:return ds: dysmetria score in pixels
:rtype ds: float
"""
tap_da... | [
"def",
"dysmetria_score",
"(",
"self",
",",
"data_frame",
")",
":",
"tap_data",
"=",
"data_frame",
"[",
"data_frame",
".",
"action_type",
"==",
"0",
"]",
"ds",
"=",
"np",
".",
"mean",
"(",
"np",
".",
"sqrt",
"(",
"(",
"tap_data",
".",
"x",
"-",
"tap_... | This method calculates accuracy of target taps in pixels
:param data_frame: the data frame
:type data_frame: pandas.DataFrame
:return ds: dysmetria score in pixels
:rtype ds: float | [
"This",
"method",
"calculates",
"accuracy",
"of",
"target",
"taps",
"in",
"pixels"
] | c7120263da2071bb139815fbdb56ca77b544f340 | https://github.com/pdkit/pdkit/blob/c7120263da2071bb139815fbdb56ca77b544f340/pdkit/finger_tapping_processor.py#L194-L207 | train |
pdkit/pdkit | pdkit/finger_tapping_processor.py | FingerTappingProcessor.extract_features | def extract_features(self, data_frame, pre=''):
"""
This method extracts all the features available to the Finger Tapping Processor class.
:param data_frame: the data frame
:type data_frame: pandas.DataFrame
:return: 'frequency', 'moving_frequency','continuous_fr... | python | def extract_features(self, data_frame, pre=''):
"""
This method extracts all the features available to the Finger Tapping Processor class.
:param data_frame: the data frame
:type data_frame: pandas.DataFrame
:return: 'frequency', 'moving_frequency','continuous_fr... | [
"def",
"extract_features",
"(",
"self",
",",
"data_frame",
",",
"pre",
"=",
"''",
")",
":",
"try",
":",
"return",
"{",
"pre",
"+",
"'frequency'",
":",
"self",
".",
"frequency",
"(",
"data_frame",
")",
"[",
"0",
"]",
",",
"pre",
"+",
"'mean_moving_time'... | This method extracts all the features available to the Finger Tapping Processor class.
:param data_frame: the data frame
:type data_frame: pandas.DataFrame
:return: 'frequency', 'moving_frequency','continuous_frequency','mean_moving_time','incoordination_score', \
... | [
"This",
"method",
"extracts",
"all",
"the",
"features",
"available",
"to",
"the",
"Finger",
"Tapping",
"Processor",
"class",
"."
] | c7120263da2071bb139815fbdb56ca77b544f340 | https://github.com/pdkit/pdkit/blob/c7120263da2071bb139815fbdb56ca77b544f340/pdkit/finger_tapping_processor.py#L209-L229 | train |
pdkit/pdkit | pdkit/clinical_updrs.py | Clinical_UPDRS.__get_features_for_observation | def __get_features_for_observation(self, data_frame=None, observation='LA-LL',
skip_id=None, last_column_is_id=False):
"""
Extract the features for a given observation from a data frame
:param data_frame: data frame to get features from
... | python | def __get_features_for_observation(self, data_frame=None, observation='LA-LL',
skip_id=None, last_column_is_id=False):
"""
Extract the features for a given observation from a data frame
:param data_frame: data frame to get features from
... | [
"def",
"__get_features_for_observation",
"(",
"self",
",",
"data_frame",
"=",
"None",
",",
"observation",
"=",
"'LA-LL'",
",",
"skip_id",
"=",
"None",
",",
"last_column_is_id",
"=",
"False",
")",
":",
"try",
":",
"features",
"=",
"np",
".",
"array",
"(",
"... | Extract the features for a given observation from a data frame
:param data_frame: data frame to get features from
:type data_frame: pandas.DataFrame
:param observation: observation name
:type observation: string
:param skip_id: skip any test with a given id (... | [
"Extract",
"the",
"features",
"for",
"a",
"given",
"observation",
"from",
"a",
"data",
"frame"
] | c7120263da2071bb139815fbdb56ca77b544f340 | https://github.com/pdkit/pdkit/blob/c7120263da2071bb139815fbdb56ca77b544f340/pdkit/clinical_updrs.py#L140-L179 | train |
pdkit/pdkit | pdkit/clinical_updrs.py | Clinical_UPDRS.predict | def predict(self, measurement, output_format='array'):
"""
Method to predict the class labels for the provided data
:param measurement: the point to classify
:type measurement: pandas.DataFrame
:param output_format: the format to return the scores ('array' or 'st... | python | def predict(self, measurement, output_format='array'):
"""
Method to predict the class labels for the provided data
:param measurement: the point to classify
:type measurement: pandas.DataFrame
:param output_format: the format to return the scores ('array' or 'st... | [
"def",
"predict",
"(",
"self",
",",
"measurement",
",",
"output_format",
"=",
"'array'",
")",
":",
"scores",
"=",
"np",
".",
"array",
"(",
"[",
"]",
")",
"for",
"obs",
"in",
"self",
".",
"observations",
":",
"knn",
"=",
"self",
".",
"__get_knn_by_obser... | Method to predict the class labels for the provided data
:param measurement: the point to classify
:type measurement: pandas.DataFrame
:param output_format: the format to return the scores ('array' or 'str')
:type output_format: string
:return prediction: the... | [
"Method",
"to",
"predict",
"the",
"class",
"labels",
"for",
"the",
"provided",
"data"
] | c7120263da2071bb139815fbdb56ca77b544f340 | https://github.com/pdkit/pdkit/blob/c7120263da2071bb139815fbdb56ca77b544f340/pdkit/clinical_updrs.py#L186-L209 | train |
twisted/txaws | txaws/server/schema.py | _namify_arguments | def _namify_arguments(mapping):
"""
Ensure that a mapping of names to parameters has the parameters set to the
correct name.
"""
result = []
for name, parameter in mapping.iteritems():
parameter.name = name
result.append(parameter)
return result | python | def _namify_arguments(mapping):
"""
Ensure that a mapping of names to parameters has the parameters set to the
correct name.
"""
result = []
for name, parameter in mapping.iteritems():
parameter.name = name
result.append(parameter)
return result | [
"def",
"_namify_arguments",
"(",
"mapping",
")",
":",
"result",
"=",
"[",
"]",
"for",
"name",
",",
"parameter",
"in",
"mapping",
".",
"iteritems",
"(",
")",
":",
"parameter",
".",
"name",
"=",
"name",
"result",
".",
"append",
"(",
"parameter",
")",
"re... | Ensure that a mapping of names to parameters has the parameters set to the
correct name. | [
"Ensure",
"that",
"a",
"mapping",
"of",
"names",
"to",
"parameters",
"has",
"the",
"parameters",
"set",
"to",
"the",
"correct",
"name",
"."
] | 5c3317376cd47e536625027e38c3b37840175ce0 | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/server/schema.py#L517-L526 | train |
twisted/txaws | txaws/server/schema.py | Parameter.coerce | def coerce(self, value):
"""Coerce a single value according to this parameter's settings.
@param value: A L{str}, or L{None}. If L{None} is passed - meaning no
value is avalable at all, not even the empty string - and this
parameter is optional, L{self.default} will be returned.... | python | def coerce(self, value):
"""Coerce a single value according to this parameter's settings.
@param value: A L{str}, or L{None}. If L{None} is passed - meaning no
value is avalable at all, not even the empty string - and this
parameter is optional, L{self.default} will be returned.... | [
"def",
"coerce",
"(",
"self",
",",
"value",
")",
":",
"if",
"value",
"is",
"None",
":",
"if",
"self",
".",
"optional",
":",
"return",
"self",
".",
"default",
"else",
":",
"value",
"=",
"\"\"",
"if",
"value",
"==",
"\"\"",
":",
"if",
"not",
"self",
... | Coerce a single value according to this parameter's settings.
@param value: A L{str}, or L{None}. If L{None} is passed - meaning no
value is avalable at all, not even the empty string - and this
parameter is optional, L{self.default} will be returned. | [
"Coerce",
"a",
"single",
"value",
"according",
"to",
"this",
"parameter",
"s",
"settings",
"."
] | 5c3317376cd47e536625027e38c3b37840175ce0 | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/server/schema.py#L107-L135 | train |
twisted/txaws | txaws/server/schema.py | Structure.parse | def parse(self, value):
"""
Convert a dictionary of raw values to a dictionary of processed values.
"""
result = {}
rest = {}
for k, v in value.iteritems():
if k in self.fields:
if (isinstance(v, dict)
and not self.field... | python | def parse(self, value):
"""
Convert a dictionary of raw values to a dictionary of processed values.
"""
result = {}
rest = {}
for k, v in value.iteritems():
if k in self.fields:
if (isinstance(v, dict)
and not self.field... | [
"def",
"parse",
"(",
"self",
",",
"value",
")",
":",
"result",
"=",
"{",
"}",
"rest",
"=",
"{",
"}",
"for",
"k",
",",
"v",
"in",
"value",
".",
"iteritems",
"(",
")",
":",
"if",
"k",
"in",
"self",
".",
"fields",
":",
"if",
"(",
"isinstance",
"... | Convert a dictionary of raw values to a dictionary of processed values. | [
"Convert",
"a",
"dictionary",
"of",
"raw",
"values",
"to",
"a",
"dictionary",
"of",
"processed",
"values",
"."
] | 5c3317376cd47e536625027e38c3b37840175ce0 | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/server/schema.py#L428-L452 | train |
twisted/txaws | txaws/server/schema.py | Structure.format | def format(self, value):
"""
Convert a dictionary of processed values to a dictionary of raw values.
"""
if not isinstance(value, Arguments):
value = value.iteritems()
return dict((k, self.fields[k].format(v)) for k, v in value) | python | def format(self, value):
"""
Convert a dictionary of processed values to a dictionary of raw values.
"""
if not isinstance(value, Arguments):
value = value.iteritems()
return dict((k, self.fields[k].format(v)) for k, v in value) | [
"def",
"format",
"(",
"self",
",",
"value",
")",
":",
"if",
"not",
"isinstance",
"(",
"value",
",",
"Arguments",
")",
":",
"value",
"=",
"value",
".",
"iteritems",
"(",
")",
"return",
"dict",
"(",
"(",
"k",
",",
"self",
".",
"fields",
"[",
"k",
"... | Convert a dictionary of processed values to a dictionary of raw values. | [
"Convert",
"a",
"dictionary",
"of",
"processed",
"values",
"to",
"a",
"dictionary",
"of",
"raw",
"values",
"."
] | 5c3317376cd47e536625027e38c3b37840175ce0 | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/server/schema.py#L454-L460 | train |
twisted/txaws | txaws/server/schema.py | Schema.extend | def extend(self, *schema_items, **kwargs):
"""
Add any number of schema items to a new schema.
Takes the same arguments as the constructor, and returns a new
L{Schema} instance.
If parameters, result, or errors is specified, they will be merged with
the existing paramet... | python | def extend(self, *schema_items, **kwargs):
"""
Add any number of schema items to a new schema.
Takes the same arguments as the constructor, and returns a new
L{Schema} instance.
If parameters, result, or errors is specified, they will be merged with
the existing paramet... | [
"def",
"extend",
"(",
"self",
",",
"*",
"schema_items",
",",
"**",
"kwargs",
")",
":",
"new_kwargs",
"=",
"{",
"'name'",
":",
"self",
".",
"name",
",",
"'doc'",
":",
"self",
".",
"doc",
",",
"'parameters'",
":",
"self",
".",
"_parameters",
"[",
":",
... | Add any number of schema items to a new schema.
Takes the same arguments as the constructor, and returns a new
L{Schema} instance.
If parameters, result, or errors is specified, they will be merged with
the existing parameters, result, or errors. | [
"Add",
"any",
"number",
"of",
"schema",
"items",
"to",
"a",
"new",
"schema",
"."
] | 5c3317376cd47e536625027e38c3b37840175ce0 | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/server/schema.py#L706-L732 | train |
twisted/txaws | txaws/server/schema.py | Schema._convert_old_schema | def _convert_old_schema(self, parameters):
"""
Convert an ugly old schema, using dotted names, to the hot new schema,
using List and Structure.
The old schema assumes that every other dot implies an array. So a list
of two parameters,
[Integer("foo.bar.baz.quux"), I... | python | def _convert_old_schema(self, parameters):
"""
Convert an ugly old schema, using dotted names, to the hot new schema,
using List and Structure.
The old schema assumes that every other dot implies an array. So a list
of two parameters,
[Integer("foo.bar.baz.quux"), I... | [
"def",
"_convert_old_schema",
"(",
"self",
",",
"parameters",
")",
":",
"merged",
"=",
"[",
"]",
"for",
"parameter",
"in",
"parameters",
":",
"segments",
"=",
"parameter",
".",
"name",
".",
"split",
"(",
"'.'",
")",
"_merge_associative_list",
"(",
"merged",
... | Convert an ugly old schema, using dotted names, to the hot new schema,
using List and Structure.
The old schema assumes that every other dot implies an array. So a list
of two parameters,
[Integer("foo.bar.baz.quux"), Integer("foo.bar.shimmy")]
becomes::
[List... | [
"Convert",
"an",
"ugly",
"old",
"schema",
"using",
"dotted",
"names",
"to",
"the",
"hot",
"new",
"schema",
"using",
"List",
"and",
"Structure",
"."
] | 5c3317376cd47e536625027e38c3b37840175ce0 | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/server/schema.py#L734-L771 | train |
Duke-GCB/DukeDSClient | ddsc/core/util.py | ProgressPrinter.finished | def finished(self):
"""
Must be called to print final progress label.
"""
self.progress_bar.set_state(ProgressBar.STATE_DONE)
self.progress_bar.show() | python | def finished(self):
"""
Must be called to print final progress label.
"""
self.progress_bar.set_state(ProgressBar.STATE_DONE)
self.progress_bar.show() | [
"def",
"finished",
"(",
"self",
")",
":",
"self",
".",
"progress_bar",
".",
"set_state",
"(",
"ProgressBar",
".",
"STATE_DONE",
")",
"self",
".",
"progress_bar",
".",
"show",
"(",
")"
] | Must be called to print final progress label. | [
"Must",
"be",
"called",
"to",
"print",
"final",
"progress",
"label",
"."
] | 117f68fb9bae82e4c81ea487ad5d61ac350f3726 | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/util.py#L76-L81 | train |
Duke-GCB/DukeDSClient | ddsc/core/util.py | ProgressPrinter.start_waiting | def start_waiting(self):
"""
Show waiting progress bar until done_waiting is called.
Only has an effect if we are in waiting state.
"""
if not self.waiting:
self.waiting = True
wait_msg = "Waiting for project to become ready for {}".format(self.msg_verb)
... | python | def start_waiting(self):
"""
Show waiting progress bar until done_waiting is called.
Only has an effect if we are in waiting state.
"""
if not self.waiting:
self.waiting = True
wait_msg = "Waiting for project to become ready for {}".format(self.msg_verb)
... | [
"def",
"start_waiting",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"waiting",
":",
"self",
".",
"waiting",
"=",
"True",
"wait_msg",
"=",
"\"Waiting for project to become ready for {}\"",
".",
"format",
"(",
"self",
".",
"msg_verb",
")",
"self",
".",
"p... | Show waiting progress bar until done_waiting is called.
Only has an effect if we are in waiting state. | [
"Show",
"waiting",
"progress",
"bar",
"until",
"done_waiting",
"is",
"called",
".",
"Only",
"has",
"an",
"effect",
"if",
"we",
"are",
"in",
"waiting",
"state",
"."
] | 117f68fb9bae82e4c81ea487ad5d61ac350f3726 | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/util.py#L90-L98 | train |
twisted/txaws | txaws/s3/client.py | s3_url_context | def s3_url_context(service_endpoint, bucket=None, object_name=None):
"""
Create a URL based on the given service endpoint and suitable for
the given bucket or object.
@param service_endpoint: The service endpoint on which to base the
resulting URL.
@type service_endpoint: L{AWSServiceEndpoi... | python | def s3_url_context(service_endpoint, bucket=None, object_name=None):
"""
Create a URL based on the given service endpoint and suitable for
the given bucket or object.
@param service_endpoint: The service endpoint on which to base the
resulting URL.
@type service_endpoint: L{AWSServiceEndpoi... | [
"def",
"s3_url_context",
"(",
"service_endpoint",
",",
"bucket",
"=",
"None",
",",
"object_name",
"=",
"None",
")",
":",
"def",
"p",
"(",
"s",
")",
":",
"results",
"=",
"[",
"]",
"args",
"=",
"s",
".",
"split",
"(",
"u\"&\"",
")",
"for",
"a",
"in",... | Create a URL based on the given service endpoint and suitable for
the given bucket or object.
@param service_endpoint: The service endpoint on which to base the
resulting URL.
@type service_endpoint: L{AWSServiceEndpoint}
@param bucket: If given, the name of a bucket to reference.
@type bu... | [
"Create",
"a",
"URL",
"based",
"on",
"the",
"given",
"service",
"endpoint",
"and",
"suitable",
"for",
"the",
"given",
"bucket",
"or",
"object",
"."
] | 5c3317376cd47e536625027e38c3b37840175ce0 | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/s3/client.py#L824-L887 | train |
twisted/txaws | txaws/s3/client.py | S3Client.list_buckets | def list_buckets(self):
"""
List all buckets.
Returns a list of all the buckets owned by the authenticated sender of
the request.
"""
details = self._details(
method=b"GET",
url_context=self._url_context(),
)
query = self._query_fa... | python | def list_buckets(self):
"""
List all buckets.
Returns a list of all the buckets owned by the authenticated sender of
the request.
"""
details = self._details(
method=b"GET",
url_context=self._url_context(),
)
query = self._query_fa... | [
"def",
"list_buckets",
"(",
"self",
")",
":",
"details",
"=",
"self",
".",
"_details",
"(",
"method",
"=",
"b\"GET\"",
",",
"url_context",
"=",
"self",
".",
"_url_context",
"(",
")",
",",
")",
"query",
"=",
"self",
".",
"_query_factory",
"(",
"details",
... | List all buckets.
Returns a list of all the buckets owned by the authenticated sender of
the request. | [
"List",
"all",
"buckets",
"."
] | 5c3317376cd47e536625027e38c3b37840175ce0 | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/s3/client.py#L140-L154 | train |
twisted/txaws | txaws/s3/client.py | S3Client._parse_list_buckets | def _parse_list_buckets(self, (response, xml_bytes)):
"""
Parse XML bucket list response.
"""
root = XML(xml_bytes)
buckets = []
for bucket_data in root.find("Buckets"):
name = bucket_data.findtext("Name")
date_text = bucket_data.findtext("Creation... | python | def _parse_list_buckets(self, (response, xml_bytes)):
"""
Parse XML bucket list response.
"""
root = XML(xml_bytes)
buckets = []
for bucket_data in root.find("Buckets"):
name = bucket_data.findtext("Name")
date_text = bucket_data.findtext("Creation... | [
"def",
"_parse_list_buckets",
"(",
"self",
",",
"(",
"response",
",",
"xml_bytes",
")",
")",
":",
"root",
"=",
"XML",
"(",
"xml_bytes",
")",
"buckets",
"=",
"[",
"]",
"for",
"bucket_data",
"in",
"root",
".",
"find",
"(",
"\"Buckets\"",
")",
":",
"name"... | Parse XML bucket list response. | [
"Parse",
"XML",
"bucket",
"list",
"response",
"."
] | 5c3317376cd47e536625027e38c3b37840175ce0 | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/s3/client.py#L156-L168 | train |
twisted/txaws | txaws/s3/client.py | S3Client.get_bucket | def get_bucket(self, bucket, marker=None, max_keys=None, prefix=None):
"""
Get a list of all the objects in a bucket.
@param bucket: The name of the bucket from which to retrieve objects.
@type bucket: L{unicode}
@param marker: If given, indicate a position in the overall
... | python | def get_bucket(self, bucket, marker=None, max_keys=None, prefix=None):
"""
Get a list of all the objects in a bucket.
@param bucket: The name of the bucket from which to retrieve objects.
@type bucket: L{unicode}
@param marker: If given, indicate a position in the overall
... | [
"def",
"get_bucket",
"(",
"self",
",",
"bucket",
",",
"marker",
"=",
"None",
",",
"max_keys",
"=",
"None",
",",
"prefix",
"=",
"None",
")",
":",
"args",
"=",
"[",
"]",
"if",
"marker",
"is",
"not",
"None",
":",
"args",
".",
"append",
"(",
"(",
"\"... | Get a list of all the objects in a bucket.
@param bucket: The name of the bucket from which to retrieve objects.
@type bucket: L{unicode}
@param marker: If given, indicate a position in the overall
results where the results of this call should begin. The
first result i... | [
"Get",
"a",
"list",
"of",
"all",
"the",
"objects",
"in",
"a",
"bucket",
"."
] | 5c3317376cd47e536625027e38c3b37840175ce0 | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/s3/client.py#L194-L237 | train |
twisted/txaws | txaws/s3/client.py | S3Client.get_bucket_lifecycle | def get_bucket_lifecycle(self, bucket):
"""
Get the lifecycle configuration of a bucket.
@param bucket: The name of the bucket.
@return: A C{Deferred} that will fire with the bucket's lifecycle
configuration.
"""
details = self._details(
method=b"GET"... | python | def get_bucket_lifecycle(self, bucket):
"""
Get the lifecycle configuration of a bucket.
@param bucket: The name of the bucket.
@return: A C{Deferred} that will fire with the bucket's lifecycle
configuration.
"""
details = self._details(
method=b"GET"... | [
"def",
"get_bucket_lifecycle",
"(",
"self",
",",
"bucket",
")",
":",
"details",
"=",
"self",
".",
"_details",
"(",
"method",
"=",
"b\"GET\"",
",",
"url_context",
"=",
"self",
".",
"_url_context",
"(",
"bucket",
"=",
"bucket",
",",
"object_name",
"=",
"\"?l... | Get the lifecycle configuration of a bucket.
@param bucket: The name of the bucket.
@return: A C{Deferred} that will fire with the bucket's lifecycle
configuration. | [
"Get",
"the",
"lifecycle",
"configuration",
"of",
"a",
"bucket",
"."
] | 5c3317376cd47e536625027e38c3b37840175ce0 | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/s3/client.py#L289-L303 | train |
twisted/txaws | txaws/s3/client.py | S3Client.get_bucket_website_config | def get_bucket_website_config(self, bucket):
"""
Get the website configuration of a bucket.
@param bucket: The name of the bucket.
@return: A C{Deferred} that will fire with the bucket's website
configuration.
"""
details = self._details(
method=b"GET... | python | def get_bucket_website_config(self, bucket):
"""
Get the website configuration of a bucket.
@param bucket: The name of the bucket.
@return: A C{Deferred} that will fire with the bucket's website
configuration.
"""
details = self._details(
method=b"GET... | [
"def",
"get_bucket_website_config",
"(",
"self",
",",
"bucket",
")",
":",
"details",
"=",
"self",
".",
"_details",
"(",
"method",
"=",
"b\"GET\"",
",",
"url_context",
"=",
"self",
".",
"_url_context",
"(",
"bucket",
"=",
"bucket",
",",
"object_name",
"=",
... | Get the website configuration of a bucket.
@param bucket: The name of the bucket.
@return: A C{Deferred} that will fire with the bucket's website
configuration. | [
"Get",
"the",
"website",
"configuration",
"of",
"a",
"bucket",
"."
] | 5c3317376cd47e536625027e38c3b37840175ce0 | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/s3/client.py#L320-L334 | train |
twisted/txaws | txaws/s3/client.py | S3Client.get_bucket_notification_config | def get_bucket_notification_config(self, bucket):
"""
Get the notification configuration of a bucket.
@param bucket: The name of the bucket.
@return: A C{Deferred} that will request the bucket's notification
configuration.
"""
details = self._details(
... | python | def get_bucket_notification_config(self, bucket):
"""
Get the notification configuration of a bucket.
@param bucket: The name of the bucket.
@return: A C{Deferred} that will request the bucket's notification
configuration.
"""
details = self._details(
... | [
"def",
"get_bucket_notification_config",
"(",
"self",
",",
"bucket",
")",
":",
"details",
"=",
"self",
".",
"_details",
"(",
"method",
"=",
"b\"GET\"",
",",
"url_context",
"=",
"self",
".",
"_url_context",
"(",
"bucket",
"=",
"bucket",
",",
"object_name",
"=... | Get the notification configuration of a bucket.
@param bucket: The name of the bucket.
@return: A C{Deferred} that will request the bucket's notification
configuration. | [
"Get",
"the",
"notification",
"configuration",
"of",
"a",
"bucket",
"."
] | 5c3317376cd47e536625027e38c3b37840175ce0 | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/s3/client.py#L344-L358 | train |
twisted/txaws | txaws/s3/client.py | S3Client.get_bucket_versioning_config | def get_bucket_versioning_config(self, bucket):
"""
Get the versioning configuration of a bucket.
@param bucket: The name of the bucket. @return: A C{Deferred} that
will request the bucket's versioning configuration.
"""
details = self._details(
method=b"GET... | python | def get_bucket_versioning_config(self, bucket):
"""
Get the versioning configuration of a bucket.
@param bucket: The name of the bucket. @return: A C{Deferred} that
will request the bucket's versioning configuration.
"""
details = self._details(
method=b"GET... | [
"def",
"get_bucket_versioning_config",
"(",
"self",
",",
"bucket",
")",
":",
"details",
"=",
"self",
".",
"_details",
"(",
"method",
"=",
"b\"GET\"",
",",
"url_context",
"=",
"self",
".",
"_url_context",
"(",
"bucket",
"=",
"bucket",
",",
"object_name",
"=",... | Get the versioning configuration of a bucket.
@param bucket: The name of the bucket. @return: A C{Deferred} that
will request the bucket's versioning configuration. | [
"Get",
"the",
"versioning",
"configuration",
"of",
"a",
"bucket",
"."
] | 5c3317376cd47e536625027e38c3b37840175ce0 | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/s3/client.py#L368-L381 | train |
twisted/txaws | txaws/s3/client.py | S3Client.get_bucket_acl | def get_bucket_acl(self, bucket):
"""
Get the access control policy for a bucket.
"""
details = self._details(
method=b"GET",
url_context=self._url_context(bucket=bucket, object_name="?acl"),
)
d = self._submit(self._query_factory(details))
... | python | def get_bucket_acl(self, bucket):
"""
Get the access control policy for a bucket.
"""
details = self._details(
method=b"GET",
url_context=self._url_context(bucket=bucket, object_name="?acl"),
)
d = self._submit(self._query_factory(details))
... | [
"def",
"get_bucket_acl",
"(",
"self",
",",
"bucket",
")",
":",
"details",
"=",
"self",
".",
"_details",
"(",
"method",
"=",
"b\"GET\"",
",",
"url_context",
"=",
"self",
".",
"_url_context",
"(",
"bucket",
"=",
"bucket",
",",
"object_name",
"=",
"\"?acl\"",... | Get the access control policy for a bucket. | [
"Get",
"the",
"access",
"control",
"policy",
"for",
"a",
"bucket",
"."
] | 5c3317376cd47e536625027e38c3b37840175ce0 | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/s3/client.py#L391-L401 | train |
twisted/txaws | txaws/s3/client.py | S3Client.put_object | def put_object(self, bucket, object_name, data=None, content_type=None,
metadata={}, amz_headers={}, body_producer=None):
"""
Put an object in a bucket.
An existing object with the same name will be replaced.
@param bucket: The name of the bucket.
@param obje... | python | def put_object(self, bucket, object_name, data=None, content_type=None,
metadata={}, amz_headers={}, body_producer=None):
"""
Put an object in a bucket.
An existing object with the same name will be replaced.
@param bucket: The name of the bucket.
@param obje... | [
"def",
"put_object",
"(",
"self",
",",
"bucket",
",",
"object_name",
",",
"data",
"=",
"None",
",",
"content_type",
"=",
"None",
",",
"metadata",
"=",
"{",
"}",
",",
"amz_headers",
"=",
"{",
"}",
",",
"body_producer",
"=",
"None",
")",
":",
"details",
... | Put an object in a bucket.
An existing object with the same name will be replaced.
@param bucket: The name of the bucket.
@param object_name: The name of the object.
@type object_name: L{unicode}
@param data: The data to write.
@param content_type: The type of data bein... | [
"Put",
"an",
"object",
"in",
"a",
"bucket",
"."
] | 5c3317376cd47e536625027e38c3b37840175ce0 | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/s3/client.py#L424-L451 | train |
twisted/txaws | txaws/s3/client.py | S3Client.copy_object | def copy_object(self, source_bucket, source_object_name, dest_bucket=None,
dest_object_name=None, metadata={}, amz_headers={}):
"""
Copy an object stored in S3 from a source bucket to a destination
bucket.
@param source_bucket: The S3 bucket to copy the object from.
... | python | def copy_object(self, source_bucket, source_object_name, dest_bucket=None,
dest_object_name=None, metadata={}, amz_headers={}):
"""
Copy an object stored in S3 from a source bucket to a destination
bucket.
@param source_bucket: The S3 bucket to copy the object from.
... | [
"def",
"copy_object",
"(",
"self",
",",
"source_bucket",
",",
"source_object_name",
",",
"dest_bucket",
"=",
"None",
",",
"dest_object_name",
"=",
"None",
",",
"metadata",
"=",
"{",
"}",
",",
"amz_headers",
"=",
"{",
"}",
")",
":",
"dest_bucket",
"=",
"des... | Copy an object stored in S3 from a source bucket to a destination
bucket.
@param source_bucket: The S3 bucket to copy the object from.
@param source_object_name: The name of the object to copy.
@param dest_bucket: Optionally, the S3 bucket to copy the object to.
Defaults to ... | [
"Copy",
"an",
"object",
"stored",
"in",
"S3",
"from",
"a",
"source",
"bucket",
"to",
"a",
"destination",
"bucket",
"."
] | 5c3317376cd47e536625027e38c3b37840175ce0 | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/s3/client.py#L453-L482 | train |
twisted/txaws | txaws/s3/client.py | S3Client.get_object | def get_object(self, bucket, object_name):
"""
Get an object from a bucket.
"""
details = self._details(
method=b"GET",
url_context=self._url_context(bucket=bucket, object_name=object_name),
)
d = self._submit(self._query_factory(details))
... | python | def get_object(self, bucket, object_name):
"""
Get an object from a bucket.
"""
details = self._details(
method=b"GET",
url_context=self._url_context(bucket=bucket, object_name=object_name),
)
d = self._submit(self._query_factory(details))
... | [
"def",
"get_object",
"(",
"self",
",",
"bucket",
",",
"object_name",
")",
":",
"details",
"=",
"self",
".",
"_details",
"(",
"method",
"=",
"b\"GET\"",
",",
"url_context",
"=",
"self",
".",
"_url_context",
"(",
"bucket",
"=",
"bucket",
",",
"object_name",
... | Get an object from a bucket. | [
"Get",
"an",
"object",
"from",
"a",
"bucket",
"."
] | 5c3317376cd47e536625027e38c3b37840175ce0 | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/s3/client.py#L484-L494 | train |
twisted/txaws | txaws/s3/client.py | S3Client.head_object | def head_object(self, bucket, object_name):
"""
Retrieve object metadata only.
"""
details = self._details(
method=b"HEAD",
url_context=self._url_context(bucket=bucket, object_name=object_name),
)
d = self._submit(self._query_factory(details))
... | python | def head_object(self, bucket, object_name):
"""
Retrieve object metadata only.
"""
details = self._details(
method=b"HEAD",
url_context=self._url_context(bucket=bucket, object_name=object_name),
)
d = self._submit(self._query_factory(details))
... | [
"def",
"head_object",
"(",
"self",
",",
"bucket",
",",
"object_name",
")",
":",
"details",
"=",
"self",
".",
"_details",
"(",
"method",
"=",
"b\"HEAD\"",
",",
"url_context",
"=",
"self",
".",
"_url_context",
"(",
"bucket",
"=",
"bucket",
",",
"object_name"... | Retrieve object metadata only. | [
"Retrieve",
"object",
"metadata",
"only",
"."
] | 5c3317376cd47e536625027e38c3b37840175ce0 | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/s3/client.py#L496-L506 | train |
twisted/txaws | txaws/s3/client.py | S3Client.delete_object | def delete_object(self, bucket, object_name):
"""
Delete an object from a bucket.
Once deleted, there is no method to restore or undelete an object.
"""
details = self._details(
method=b"DELETE",
url_context=self._url_context(bucket=bucket, object_name=ob... | python | def delete_object(self, bucket, object_name):
"""
Delete an object from a bucket.
Once deleted, there is no method to restore or undelete an object.
"""
details = self._details(
method=b"DELETE",
url_context=self._url_context(bucket=bucket, object_name=ob... | [
"def",
"delete_object",
"(",
"self",
",",
"bucket",
",",
"object_name",
")",
":",
"details",
"=",
"self",
".",
"_details",
"(",
"method",
"=",
"b\"DELETE\"",
",",
"url_context",
"=",
"self",
".",
"_url_context",
"(",
"bucket",
"=",
"bucket",
",",
"object_n... | Delete an object from a bucket.
Once deleted, there is no method to restore or undelete an object. | [
"Delete",
"an",
"object",
"from",
"a",
"bucket",
"."
] | 5c3317376cd47e536625027e38c3b37840175ce0 | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/s3/client.py#L508-L519 | train |
twisted/txaws | txaws/s3/client.py | S3Client.put_object_acl | def put_object_acl(self, bucket, object_name, access_control_policy):
"""
Set access control policy on an object.
"""
data = access_control_policy.to_xml()
details = self._details(
method=b"PUT",
url_context=self._url_context(
bucket=bucket... | python | def put_object_acl(self, bucket, object_name, access_control_policy):
"""
Set access control policy on an object.
"""
data = access_control_policy.to_xml()
details = self._details(
method=b"PUT",
url_context=self._url_context(
bucket=bucket... | [
"def",
"put_object_acl",
"(",
"self",
",",
"bucket",
",",
"object_name",
",",
"access_control_policy",
")",
":",
"data",
"=",
"access_control_policy",
".",
"to_xml",
"(",
")",
"details",
"=",
"self",
".",
"_details",
"(",
"method",
"=",
"b\"PUT\"",
",",
"url... | Set access control policy on an object. | [
"Set",
"access",
"control",
"policy",
"on",
"an",
"object",
"."
] | 5c3317376cd47e536625027e38c3b37840175ce0 | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/s3/client.py#L521-L536 | train |
twisted/txaws | txaws/s3/client.py | S3Client.put_request_payment | def put_request_payment(self, bucket, payer):
"""
Set request payment configuration on bucket to payer.
@param bucket: The name of the bucket.
@param payer: The name of the payer.
@return: A C{Deferred} that will fire with the result of the request.
"""
data = Re... | python | def put_request_payment(self, bucket, payer):
"""
Set request payment configuration on bucket to payer.
@param bucket: The name of the bucket.
@param payer: The name of the payer.
@return: A C{Deferred} that will fire with the result of the request.
"""
data = Re... | [
"def",
"put_request_payment",
"(",
"self",
",",
"bucket",
",",
"payer",
")",
":",
"data",
"=",
"RequestPayment",
"(",
"payer",
")",
".",
"to_xml",
"(",
")",
"details",
"=",
"self",
".",
"_details",
"(",
"method",
"=",
"b\"PUT\"",
",",
"url_context",
"=",... | Set request payment configuration on bucket to payer.
@param bucket: The name of the bucket.
@param payer: The name of the payer.
@return: A C{Deferred} that will fire with the result of the request. | [
"Set",
"request",
"payment",
"configuration",
"on",
"bucket",
"to",
"payer",
"."
] | 5c3317376cd47e536625027e38c3b37840175ce0 | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/s3/client.py#L550-L565 | train |
twisted/txaws | txaws/s3/client.py | S3Client.get_request_payment | def get_request_payment(self, bucket):
"""
Get the request payment configuration on a bucket.
@param bucket: The name of the bucket.
@return: A C{Deferred} that will fire with the name of the payer.
"""
details = self._details(
method=b"GET",
url_... | python | def get_request_payment(self, bucket):
"""
Get the request payment configuration on a bucket.
@param bucket: The name of the bucket.
@return: A C{Deferred} that will fire with the name of the payer.
"""
details = self._details(
method=b"GET",
url_... | [
"def",
"get_request_payment",
"(",
"self",
",",
"bucket",
")",
":",
"details",
"=",
"self",
".",
"_details",
"(",
"method",
"=",
"b\"GET\"",
",",
"url_context",
"=",
"self",
".",
"_url_context",
"(",
"bucket",
"=",
"bucket",
",",
"object_name",
"=",
"\"?re... | Get the request payment configuration on a bucket.
@param bucket: The name of the bucket.
@return: A C{Deferred} that will fire with the name of the payer. | [
"Get",
"the",
"request",
"payment",
"configuration",
"on",
"a",
"bucket",
"."
] | 5c3317376cd47e536625027e38c3b37840175ce0 | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/s3/client.py#L567-L580 | train |
twisted/txaws | txaws/s3/client.py | S3Client.init_multipart_upload | def init_multipart_upload(self, bucket, object_name, content_type=None,
amz_headers={}, metadata={}):
"""
Initiate a multipart upload to a bucket.
@param bucket: The name of the bucket
@param object_name: The object name
@param content_type: The Con... | python | def init_multipart_upload(self, bucket, object_name, content_type=None,
amz_headers={}, metadata={}):
"""
Initiate a multipart upload to a bucket.
@param bucket: The name of the bucket
@param object_name: The object name
@param content_type: The Con... | [
"def",
"init_multipart_upload",
"(",
"self",
",",
"bucket",
",",
"object_name",
",",
"content_type",
"=",
"None",
",",
"amz_headers",
"=",
"{",
"}",
",",
"metadata",
"=",
"{",
"}",
")",
":",
"objectname_plus",
"=",
"'%s?uploads'",
"%",
"object_name",
"detail... | Initiate a multipart upload to a bucket.
@param bucket: The name of the bucket
@param object_name: The object name
@param content_type: The Content-Type for the object
@param metadata: C{dict} containing additional metadata
@param amz_headers: A C{dict} used to build C{x-amz-*} ... | [
"Initiate",
"a",
"multipart",
"upload",
"to",
"a",
"bucket",
"."
] | 5c3317376cd47e536625027e38c3b37840175ce0 | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/s3/client.py#L589-L613 | train |
twisted/txaws | txaws/s3/client.py | S3Client.upload_part | def upload_part(self, bucket, object_name, upload_id, part_number,
data=None, content_type=None, metadata={},
body_producer=None):
"""
Upload a part of data corresponding to a multipart upload.
@param bucket: The bucket name
@param object_name: Th... | python | def upload_part(self, bucket, object_name, upload_id, part_number,
data=None, content_type=None, metadata={},
body_producer=None):
"""
Upload a part of data corresponding to a multipart upload.
@param bucket: The bucket name
@param object_name: Th... | [
"def",
"upload_part",
"(",
"self",
",",
"bucket",
",",
"object_name",
",",
"upload_id",
",",
"part_number",
",",
"data",
"=",
"None",
",",
"content_type",
"=",
"None",
",",
"metadata",
"=",
"{",
"}",
",",
"body_producer",
"=",
"None",
")",
":",
"parms",
... | Upload a part of data corresponding to a multipart upload.
@param bucket: The bucket name
@param object_name: The object name
@param upload_id: The multipart upload id
@param part_number: The part number
@param data: Data (optional, requires body_producer if not specified)
... | [
"Upload",
"a",
"part",
"of",
"data",
"corresponding",
"to",
"a",
"multipart",
"upload",
"."
] | 5c3317376cd47e536625027e38c3b37840175ce0 | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/s3/client.py#L615-L643 | train |
twisted/txaws | txaws/s3/client.py | Query.set_content_type | def set_content_type(self):
"""
Set the content type based on the file extension used in the object
name.
"""
if self.object_name and not self.content_type:
# XXX nothing is currently done with the encoding... we may
# need to in the future
sel... | python | def set_content_type(self):
"""
Set the content type based on the file extension used in the object
name.
"""
if self.object_name and not self.content_type:
# XXX nothing is currently done with the encoding... we may
# need to in the future
sel... | [
"def",
"set_content_type",
"(",
"self",
")",
":",
"if",
"self",
".",
"object_name",
"and",
"not",
"self",
".",
"content_type",
":",
"self",
".",
"content_type",
",",
"encoding",
"=",
"mimetypes",
".",
"guess_type",
"(",
"self",
".",
"object_name",
",",
"st... | Set the content type based on the file extension used in the object
name. | [
"Set",
"the",
"content",
"type",
"based",
"on",
"the",
"file",
"extension",
"used",
"in",
"the",
"object",
"name",
"."
] | 5c3317376cd47e536625027e38c3b37840175ce0 | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/s3/client.py#L734-L743 | train |
twisted/txaws | txaws/s3/client.py | Query.get_headers | def get_headers(self, instant):
"""
Build the list of headers needed in order to perform S3 operations.
"""
headers = {'x-amz-date': _auth_v4.makeAMZDate(instant)}
if self.body_producer is None:
data = self.data
if data is None:
data = b""
... | python | def get_headers(self, instant):
"""
Build the list of headers needed in order to perform S3 operations.
"""
headers = {'x-amz-date': _auth_v4.makeAMZDate(instant)}
if self.body_producer is None:
data = self.data
if data is None:
data = b""
... | [
"def",
"get_headers",
"(",
"self",
",",
"instant",
")",
":",
"headers",
"=",
"{",
"'x-amz-date'",
":",
"_auth_v4",
".",
"makeAMZDate",
"(",
"instant",
")",
"}",
"if",
"self",
".",
"body_producer",
"is",
"None",
":",
"data",
"=",
"self",
".",
"data",
"i... | Build the list of headers needed in order to perform S3 operations. | [
"Build",
"the",
"list",
"of",
"headers",
"needed",
"in",
"order",
"to",
"perform",
"S3",
"operations",
"."
] | 5c3317376cd47e536625027e38c3b37840175ce0 | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/s3/client.py#L745-L775 | train |
UUDigitalHumanitieslab/tei_reader | tei_reader/models/element.py | Element.attributes | def attributes(self):
if 'id' in self.node.attrib:
yield PlaceholderAttribute('id', self.node.attrib['id'])
if 'tei-tag' in self.node.attrib:
yield PlaceholderAttribute('tei-tag', self.node.attrib['tei-tag'])
"""Contain attributes applicable to this element"""
f... | python | def attributes(self):
if 'id' in self.node.attrib:
yield PlaceholderAttribute('id', self.node.attrib['id'])
if 'tei-tag' in self.node.attrib:
yield PlaceholderAttribute('tei-tag', self.node.attrib['tei-tag'])
"""Contain attributes applicable to this element"""
f... | [
"def",
"attributes",
"(",
"self",
")",
":",
"if",
"'id'",
"in",
"self",
".",
"node",
".",
"attrib",
":",
"yield",
"PlaceholderAttribute",
"(",
"'id'",
",",
"self",
".",
"node",
".",
"attrib",
"[",
"'id'",
"]",
")",
"if",
"'tei-tag'",
"in",
"self",
".... | Contain attributes applicable to this element | [
"Contain",
"attributes",
"applicable",
"to",
"this",
"element"
] | 7b19c34a9d7cc941a36ecdcf6f361e26c6488697 | https://github.com/UUDigitalHumanitieslab/tei_reader/blob/7b19c34a9d7cc941a36ecdcf6f361e26c6488697/tei_reader/models/element.py#L14-L24 | train |
UUDigitalHumanitieslab/tei_reader | tei_reader/models/element.py | Element.divisions | def divisions(self):
"""
Recursively get all the text divisions directly part of this element. If an element contains parts or text without tag. Those will be returned in order and wrapped with a TextDivision.
"""
from .placeholder_division import PlaceholderDivision
pl... | python | def divisions(self):
"""
Recursively get all the text divisions directly part of this element. If an element contains parts or text without tag. Those will be returned in order and wrapped with a TextDivision.
"""
from .placeholder_division import PlaceholderDivision
pl... | [
"def",
"divisions",
"(",
"self",
")",
":",
"from",
".",
"placeholder_division",
"import",
"PlaceholderDivision",
"placeholder",
"=",
"None",
"for",
"item",
"in",
"self",
".",
"__parts_and_divisions",
":",
"if",
"item",
".",
"tag",
"==",
"'part'",
":",
"if",
... | Recursively get all the text divisions directly part of this element. If an element contains parts or text without tag. Those will be returned in order and wrapped with a TextDivision. | [
"Recursively",
"get",
"all",
"the",
"text",
"divisions",
"directly",
"part",
"of",
"this",
"element",
".",
"If",
"an",
"element",
"contains",
"parts",
"or",
"text",
"without",
"tag",
".",
"Those",
"will",
"be",
"returned",
"in",
"order",
"and",
"wrapped",
... | 7b19c34a9d7cc941a36ecdcf6f361e26c6488697 | https://github.com/UUDigitalHumanitieslab/tei_reader/blob/7b19c34a9d7cc941a36ecdcf6f361e26c6488697/tei_reader/models/element.py#L32-L51 | train |
UUDigitalHumanitieslab/tei_reader | tei_reader/models/element.py | Element.parts | def parts(self):
"""
Get the parts directly below this element.
"""
for item in self.__parts_and_divisions:
if item.tag == 'part':
yield item
else:
# Divisions shouldn't be beneath a part, but here's a fallback
# fo... | python | def parts(self):
"""
Get the parts directly below this element.
"""
for item in self.__parts_and_divisions:
if item.tag == 'part':
yield item
else:
# Divisions shouldn't be beneath a part, but here's a fallback
# fo... | [
"def",
"parts",
"(",
"self",
")",
":",
"for",
"item",
"in",
"self",
".",
"__parts_and_divisions",
":",
"if",
"item",
".",
"tag",
"==",
"'part'",
":",
"yield",
"item",
"else",
":",
"for",
"part",
"in",
"item",
".",
"parts",
":",
"yield",
"part"
] | Get the parts directly below this element. | [
"Get",
"the",
"parts",
"directly",
"below",
"this",
"element",
"."
] | 7b19c34a9d7cc941a36ecdcf6f361e26c6488697 | https://github.com/UUDigitalHumanitieslab/tei_reader/blob/7b19c34a9d7cc941a36ecdcf6f361e26c6488697/tei_reader/models/element.py#L69-L81 | train |
UUDigitalHumanitieslab/tei_reader | tei_reader/models/element.py | Element.__parts_and_divisions | def __parts_and_divisions(self):
"""
The parts and divisions directly part of this element.
"""
from .division import Division
from .part import Part
from .placeholder_part import PlaceholderPart
text = self.node.text
if text:
stripped_text =... | python | def __parts_and_divisions(self):
"""
The parts and divisions directly part of this element.
"""
from .division import Division
from .part import Part
from .placeholder_part import PlaceholderPart
text = self.node.text
if text:
stripped_text =... | [
"def",
"__parts_and_divisions",
"(",
"self",
")",
":",
"from",
".",
"division",
"import",
"Division",
"from",
".",
"part",
"import",
"Part",
"from",
".",
"placeholder_part",
"import",
"PlaceholderPart",
"text",
"=",
"self",
".",
"node",
".",
"text",
"if",
"t... | The parts and divisions directly part of this element. | [
"The",
"parts",
"and",
"divisions",
"directly",
"part",
"of",
"this",
"element",
"."
] | 7b19c34a9d7cc941a36ecdcf6f361e26c6488697 | https://github.com/UUDigitalHumanitieslab/tei_reader/blob/7b19c34a9d7cc941a36ecdcf6f361e26c6488697/tei_reader/models/element.py#L88-L112 | train |
T-002/pycast | pycast/errors/baseerrormeasure.py | BaseErrorMeasure._get_error_values | def _get_error_values(self, startingPercentage, endPercentage, startDate, endDate):
"""Gets the defined subset of self._errorValues.
Both parameters will be correct at this time.
:param float startingPercentage: Defines the start of the interval. This has to be a value in [0.0, 100.0].
... | python | def _get_error_values(self, startingPercentage, endPercentage, startDate, endDate):
"""Gets the defined subset of self._errorValues.
Both parameters will be correct at this time.
:param float startingPercentage: Defines the start of the interval. This has to be a value in [0.0, 100.0].
... | [
"def",
"_get_error_values",
"(",
"self",
",",
"startingPercentage",
",",
"endPercentage",
",",
"startDate",
",",
"endDate",
")",
":",
"if",
"startDate",
"is",
"not",
"None",
":",
"possibleDates",
"=",
"filter",
"(",
"lambda",
"date",
":",
"date",
">=",
"star... | Gets the defined subset of self._errorValues.
Both parameters will be correct at this time.
:param float startingPercentage: Defines the start of the interval. This has to be a value in [0.0, 100.0].
It represents the value, where the error calculation should be started.
25.0 f... | [
"Gets",
"the",
"defined",
"subset",
"of",
"self",
".",
"_errorValues",
"."
] | 8a53505c6d8367e0ea572e8af768e80b29e1cc41 | https://github.com/T-002/pycast/blob/8a53505c6d8367e0ea572e8af768e80b29e1cc41/pycast/errors/baseerrormeasure.py#L107-L144 | train |
T-002/pycast | pycast/errors/baseerrormeasure.py | BaseErrorMeasure.confidence_interval | def confidence_interval(self, confidenceLevel):
"""Calculates for which value confidenceLevel% of the errors are closer to 0.
:param float confidenceLevel: percentage of the errors that should be
smaller than the returned value for overestimations and larger than
the returned va... | python | def confidence_interval(self, confidenceLevel):
"""Calculates for which value confidenceLevel% of the errors are closer to 0.
:param float confidenceLevel: percentage of the errors that should be
smaller than the returned value for overestimations and larger than
the returned va... | [
"def",
"confidence_interval",
"(",
"self",
",",
"confidenceLevel",
")",
":",
"if",
"not",
"(",
"confidenceLevel",
">=",
"0",
"and",
"confidenceLevel",
"<=",
"1",
")",
":",
"raise",
"ValueError",
"(",
"\"Parameter percentage has to be in [0,1]\"",
")",
"underestimati... | Calculates for which value confidenceLevel% of the errors are closer to 0.
:param float confidenceLevel: percentage of the errors that should be
smaller than the returned value for overestimations and larger than
the returned value for underestimations.
confidenceLevel has t... | [
"Calculates",
"for",
"which",
"value",
"confidenceLevel%",
"of",
"the",
"errors",
"are",
"closer",
"to",
"0",
"."
] | 8a53505c6d8367e0ea572e8af768e80b29e1cc41 | https://github.com/T-002/pycast/blob/8a53505c6d8367e0ea572e8af768e80b29e1cc41/pycast/errors/baseerrormeasure.py#L220-L268 | train |
pdkit/pdkit | pdkit/utils.py | load_segmented_data | def load_segmented_data(filename):
"""
Helper function to load segmented gait time series data.
:param filename: The full path of the file that contais our data. This should be a comma separated value (csv file).
:type filename: str
:return: The gait time series segmented data, wit... | python | def load_segmented_data(filename):
"""
Helper function to load segmented gait time series data.
:param filename: The full path of the file that contais our data. This should be a comma separated value (csv file).
:type filename: str
:return: The gait time series segmented data, wit... | [
"def",
"load_segmented_data",
"(",
"filename",
")",
":",
"data",
"=",
"pd",
".",
"read_csv",
"(",
"filename",
",",
"index_col",
"=",
"0",
")",
"data",
".",
"index",
"=",
"data",
".",
"index",
".",
"astype",
"(",
"np",
".",
"datetime64",
")",
"return",
... | Helper function to load segmented gait time series data.
:param filename: The full path of the file that contais our data. This should be a comma separated value (csv file).
:type filename: str
:return: The gait time series segmented data, with a x, y, z, mag_acc_sum and segmented columns.
... | [
"Helper",
"function",
"to",
"load",
"segmented",
"gait",
"time",
"series",
"data",
"."
] | c7120263da2071bb139815fbdb56ca77b544f340 | https://github.com/pdkit/pdkit/blob/c7120263da2071bb139815fbdb56ca77b544f340/pdkit/utils.py#L81-L94 | train |
pdkit/pdkit | pdkit/utils.py | load_finger_tapping_cloudupdrs_data | def load_finger_tapping_cloudupdrs_data(filename, convert_times=1000.0):
"""
This method loads data in the cloudupdrs format for the finger tapping processor
Usually the data will be saved in a csv file and it should look like this:
.. code-block:: json
timestamp_0, . , action_ty... | python | def load_finger_tapping_cloudupdrs_data(filename, convert_times=1000.0):
"""
This method loads data in the cloudupdrs format for the finger tapping processor
Usually the data will be saved in a csv file and it should look like this:
.. code-block:: json
timestamp_0, . , action_ty... | [
"def",
"load_finger_tapping_cloudupdrs_data",
"(",
"filename",
",",
"convert_times",
"=",
"1000.0",
")",
":",
"data_m",
"=",
"np",
".",
"genfromtxt",
"(",
"filename",
",",
"delimiter",
"=",
"','",
",",
"invalid_raise",
"=",
"False",
",",
"skip_footer",
"=",
"1... | This method loads data in the cloudupdrs format for the finger tapping processor
Usually the data will be saved in a csv file and it should look like this:
.. code-block:: json
timestamp_0, . , action_type_0, x_0, y_0, . , . , x_target_0, y_target_0
timestamp_1, . , action_type_1, x... | [
"This",
"method",
"loads",
"data",
"in",
"the",
"cloudupdrs",
"format",
"for",
"the",
"finger",
"tapping",
"processor"
] | c7120263da2071bb139815fbdb56ca77b544f340 | https://github.com/pdkit/pdkit/blob/c7120263da2071bb139815fbdb56ca77b544f340/pdkit/utils.py#L211-L242 | train |
pdkit/pdkit | pdkit/utils.py | numerical_integration | def numerical_integration(signal, sampling_frequency):
"""
Numerically integrate a signal with it's sampling frequency.
:param signal: A 1-dimensional array or list (the signal).
:type signal: array
:param sampling_frequency: The sampling frequency for the signal.
:type samp... | python | def numerical_integration(signal, sampling_frequency):
"""
Numerically integrate a signal with it's sampling frequency.
:param signal: A 1-dimensional array or list (the signal).
:type signal: array
:param sampling_frequency: The sampling frequency for the signal.
:type samp... | [
"def",
"numerical_integration",
"(",
"signal",
",",
"sampling_frequency",
")",
":",
"integrate",
"=",
"sum",
"(",
"signal",
"[",
"1",
":",
"]",
")",
"/",
"sampling_frequency",
"+",
"sum",
"(",
"signal",
"[",
":",
"-",
"1",
"]",
")",
"integrate",
"/=",
... | Numerically integrate a signal with it's sampling frequency.
:param signal: A 1-dimensional array or list (the signal).
:type signal: array
:param sampling_frequency: The sampling frequency for the signal.
:type sampling_frequency: float
:return: The integrated signal.
:... | [
"Numerically",
"integrate",
"a",
"signal",
"with",
"it",
"s",
"sampling",
"frequency",
"."
] | c7120263da2071bb139815fbdb56ca77b544f340 | https://github.com/pdkit/pdkit/blob/c7120263da2071bb139815fbdb56ca77b544f340/pdkit/utils.py#L327-L342 | train |
pdkit/pdkit | pdkit/utils.py | compute_interpeak | def compute_interpeak(data, sample_rate):
"""
Compute number of samples between signal peaks using the real part of FFT.
:param data: 1-dimensional time series data.
:type data: array
:param sample_rate: Sample rate of accelerometer reading (Hz)
:type sample_rate: float
... | python | def compute_interpeak(data, sample_rate):
"""
Compute number of samples between signal peaks using the real part of FFT.
:param data: 1-dimensional time series data.
:type data: array
:param sample_rate: Sample rate of accelerometer reading (Hz)
:type sample_rate: float
... | [
"def",
"compute_interpeak",
"(",
"data",
",",
"sample_rate",
")",
":",
"freqs",
"=",
"fftfreq",
"(",
"data",
".",
"size",
",",
"d",
"=",
"1.0",
"/",
"sample_rate",
")",
"f_signal",
"=",
"rfft",
"(",
"data",
")",
"imax_freq",
"=",
"np",
".",
"argsort",
... | Compute number of samples between signal peaks using the real part of FFT.
:param data: 1-dimensional time series data.
:type data: array
:param sample_rate: Sample rate of accelerometer reading (Hz)
:type sample_rate: float
:return interpeak: Number of samples between peaks
... | [
"Compute",
"number",
"of",
"samples",
"between",
"signal",
"peaks",
"using",
"the",
"real",
"part",
"of",
"FFT",
"."
] | c7120263da2071bb139815fbdb56ca77b544f340 | https://github.com/pdkit/pdkit/blob/c7120263da2071bb139815fbdb56ca77b544f340/pdkit/utils.py#L430-L461 | train |
pdkit/pdkit | pdkit/utils.py | non_zero_row | def non_zero_row(arr):
"""
0. Empty row returns False.
>>> arr = array([])
>>> non_zero_row(arr)
False
1. Row with a zero returns False.
>>> arr = array([1, 4, 3, 0, 5, -1, -2])
>>> non_zero_row(arr)
False
2. Row... | python | def non_zero_row(arr):
"""
0. Empty row returns False.
>>> arr = array([])
>>> non_zero_row(arr)
False
1. Row with a zero returns False.
>>> arr = array([1, 4, 3, 0, 5, -1, -2])
>>> non_zero_row(arr)
False
2. Row... | [
"def",
"non_zero_row",
"(",
"arr",
")",
":",
"if",
"len",
"(",
"arr",
")",
"==",
"0",
":",
"return",
"False",
"for",
"item",
"in",
"arr",
":",
"if",
"item",
"==",
"0",
":",
"return",
"False",
"return",
"True"
] | 0. Empty row returns False.
>>> arr = array([])
>>> non_zero_row(arr)
False
1. Row with a zero returns False.
>>> arr = array([1, 4, 3, 0, 5, -1, -2])
>>> non_zero_row(arr)
False
2. Row with no zeros returns True.
... | [
"0",
".",
"Empty",
"row",
"returns",
"False",
"."
] | c7120263da2071bb139815fbdb56ca77b544f340 | https://github.com/pdkit/pdkit/blob/c7120263da2071bb139815fbdb56ca77b544f340/pdkit/utils.py#L944-L979 | train |
Duke-GCB/DukeDSClient | ddsc/versioncheck.py | get_pypi_version | def get_pypi_version():
"""
Returns the version info from pypi for this app.
"""
try:
response = requests.get(PYPI_URL, timeout=HALF_SECOND_TIMEOUT)
response.raise_for_status()
data = response.json()
version_str = data["info"]["version"]
return _parse_version_str(... | python | def get_pypi_version():
"""
Returns the version info from pypi for this app.
"""
try:
response = requests.get(PYPI_URL, timeout=HALF_SECOND_TIMEOUT)
response.raise_for_status()
data = response.json()
version_str = data["info"]["version"]
return _parse_version_str(... | [
"def",
"get_pypi_version",
"(",
")",
":",
"try",
":",
"response",
"=",
"requests",
".",
"get",
"(",
"PYPI_URL",
",",
"timeout",
"=",
"HALF_SECOND_TIMEOUT",
")",
"response",
".",
"raise_for_status",
"(",
")",
"data",
"=",
"response",
".",
"json",
"(",
")",
... | Returns the version info from pypi for this app. | [
"Returns",
"the",
"version",
"info",
"from",
"pypi",
"for",
"this",
"app",
"."
] | 117f68fb9bae82e4c81ea487ad5d61ac350f3726 | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/versioncheck.py#L18-L31 | train |
Duke-GCB/DukeDSClient | ddsc/core/parallel.py | TaskExecutor.start_tasks | def start_tasks(self):
"""
Start however many tasks we can based on our limits and what we have left to finish.
"""
while self.tasks_at_once > len(self.pending_results) and self._has_more_tasks():
task, parent_result = self.tasks.popleft()
self.execute_task(task, ... | python | def start_tasks(self):
"""
Start however many tasks we can based on our limits and what we have left to finish.
"""
while self.tasks_at_once > len(self.pending_results) and self._has_more_tasks():
task, parent_result = self.tasks.popleft()
self.execute_task(task, ... | [
"def",
"start_tasks",
"(",
"self",
")",
":",
"while",
"self",
".",
"tasks_at_once",
">",
"len",
"(",
"self",
".",
"pending_results",
")",
"and",
"self",
".",
"_has_more_tasks",
"(",
")",
":",
"task",
",",
"parent_result",
"=",
"self",
".",
"tasks",
".",
... | Start however many tasks we can based on our limits and what we have left to finish. | [
"Start",
"however",
"many",
"tasks",
"we",
"can",
"based",
"on",
"our",
"limits",
"and",
"what",
"we",
"have",
"left",
"to",
"finish",
"."
] | 117f68fb9bae82e4c81ea487ad5d61ac350f3726 | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/parallel.py#L206-L212 | train |
Duke-GCB/DukeDSClient | ddsc/core/parallel.py | TaskExecutor.get_finished_results | def get_finished_results(self):
"""
Go through pending results and retrieve the results if they are done.
Then start child tasks for the task that finished.
"""
task_and_results = []
for pending_result in self.pending_results:
if pending_result.ready():
... | python | def get_finished_results(self):
"""
Go through pending results and retrieve the results if they are done.
Then start child tasks for the task that finished.
"""
task_and_results = []
for pending_result in self.pending_results:
if pending_result.ready():
... | [
"def",
"get_finished_results",
"(",
"self",
")",
":",
"task_and_results",
"=",
"[",
"]",
"for",
"pending_result",
"in",
"self",
".",
"pending_results",
":",
"if",
"pending_result",
".",
"ready",
"(",
")",
":",
"ret",
"=",
"pending_result",
".",
"get",
"(",
... | Go through pending results and retrieve the results if they are done.
Then start child tasks for the task that finished. | [
"Go",
"through",
"pending",
"results",
"and",
"retrieve",
"the",
"results",
"if",
"they",
"are",
"done",
".",
"Then",
"start",
"child",
"tasks",
"for",
"the",
"task",
"that",
"finished",
"."
] | 117f68fb9bae82e4c81ea487ad5d61ac350f3726 | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/parallel.py#L247-L263 | train |
twisted/txaws | txaws/route53/client.py | get_route53_client | def get_route53_client(agent, region, cooperator=None):
"""
Get a non-registration Route53 client.
"""
if cooperator is None:
cooperator = task
return region.get_client(
_Route53Client,
agent=agent,
creds=region.creds,
region=REGION_US_EAST_1,
endpoint... | python | def get_route53_client(agent, region, cooperator=None):
"""
Get a non-registration Route53 client.
"""
if cooperator is None:
cooperator = task
return region.get_client(
_Route53Client,
agent=agent,
creds=region.creds,
region=REGION_US_EAST_1,
endpoint... | [
"def",
"get_route53_client",
"(",
"agent",
",",
"region",
",",
"cooperator",
"=",
"None",
")",
":",
"if",
"cooperator",
"is",
"None",
":",
"cooperator",
"=",
"task",
"return",
"region",
".",
"get_client",
"(",
"_Route53Client",
",",
"agent",
"=",
"agent",
... | Get a non-registration Route53 client. | [
"Get",
"a",
"non",
"-",
"registration",
"Route53",
"client",
"."
] | 5c3317376cd47e536625027e38c3b37840175ce0 | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/route53/client.py#L60-L73 | train |
twisted/txaws | txaws/server/registry.py | Registry.add | def add(self, method_class, action, version=None):
"""Add a method class to the regitry.
@param method_class: The method class to add
@param action: The action that the method class can handle
@param version: The version that the method class can handle
"""
by_version = ... | python | def add(self, method_class, action, version=None):
"""Add a method class to the regitry.
@param method_class: The method class to add
@param action: The action that the method class can handle
@param version: The version that the method class can handle
"""
by_version = ... | [
"def",
"add",
"(",
"self",
",",
"method_class",
",",
"action",
",",
"version",
"=",
"None",
")",
":",
"by_version",
"=",
"self",
".",
"_by_action",
".",
"setdefault",
"(",
"action",
",",
"{",
"}",
")",
"if",
"version",
"in",
"by_version",
":",
"raise",... | Add a method class to the regitry.
@param method_class: The method class to add
@param action: The action that the method class can handle
@param version: The version that the method class can handle | [
"Add",
"a",
"method",
"class",
"to",
"the",
"regitry",
"."
] | 5c3317376cd47e536625027e38c3b37840175ce0 | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/server/registry.py#L10-L21 | train |
twisted/txaws | txaws/server/registry.py | Registry.check | def check(self, action, version=None):
"""Check if the given action is supported in the given version.
@raises APIError: If there's no method class registered for handling
the given action or version.
"""
if action not in self._by_action:
raise APIError(400, "Inv... | python | def check(self, action, version=None):
"""Check if the given action is supported in the given version.
@raises APIError: If there's no method class registered for handling
the given action or version.
"""
if action not in self._by_action:
raise APIError(400, "Inv... | [
"def",
"check",
"(",
"self",
",",
"action",
",",
"version",
"=",
"None",
")",
":",
"if",
"action",
"not",
"in",
"self",
".",
"_by_action",
":",
"raise",
"APIError",
"(",
"400",
",",
"\"InvalidAction\"",
",",
"\"The action %s is not valid \"",
"\"for this web s... | Check if the given action is supported in the given version.
@raises APIError: If there's no method class registered for handling
the given action or version. | [
"Check",
"if",
"the",
"given",
"action",
"is",
"supported",
"in",
"the",
"given",
"version",
"."
] | 5c3317376cd47e536625027e38c3b37840175ce0 | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/server/registry.py#L23-L36 | train |
twisted/txaws | txaws/server/registry.py | Registry.get | def get(self, action, version=None):
"""Get the method class handing the given action and version."""
by_version = self._by_action[action]
if version in by_version:
return by_version[version]
else:
return by_version[None] | python | def get(self, action, version=None):
"""Get the method class handing the given action and version."""
by_version = self._by_action[action]
if version in by_version:
return by_version[version]
else:
return by_version[None] | [
"def",
"get",
"(",
"self",
",",
"action",
",",
"version",
"=",
"None",
")",
":",
"by_version",
"=",
"self",
".",
"_by_action",
"[",
"action",
"]",
"if",
"version",
"in",
"by_version",
":",
"return",
"by_version",
"[",
"version",
"]",
"else",
":",
"retu... | Get the method class handing the given action and version. | [
"Get",
"the",
"method",
"class",
"handing",
"the",
"given",
"action",
"and",
"version",
"."
] | 5c3317376cd47e536625027e38c3b37840175ce0 | https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/server/registry.py#L38-L44 | train |
T-002/pycast | pycast/methods/regression.py | Regression.calculate_parameters | def calculate_parameters(self, independentTs, dependentTs):
"""Calculate and return the parameters for the regression line
Return the parameter for the line describing the relationship
between the input variables.
:param Timeseries independentTs: The Timeseries used for the
... | python | def calculate_parameters(self, independentTs, dependentTs):
"""Calculate and return the parameters for the regression line
Return the parameter for the line describing the relationship
between the input variables.
:param Timeseries independentTs: The Timeseries used for the
... | [
"def",
"calculate_parameters",
"(",
"self",
",",
"independentTs",
",",
"dependentTs",
")",
":",
"listX",
",",
"listY",
"=",
"self",
".",
"match_time_series",
"(",
"independentTs",
",",
"dependentTs",
")",
"if",
"len",
"(",
"listX",
")",
"==",
"0",
"or",
"l... | Calculate and return the parameters for the regression line
Return the parameter for the line describing the relationship
between the input variables.
:param Timeseries independentTs: The Timeseries used for the
independent variable (x-axis). The Timeseries must have
at... | [
"Calculate",
"and",
"return",
"the",
"parameters",
"for",
"the",
"regression",
"line"
] | 8a53505c6d8367e0ea572e8af768e80b29e1cc41 | https://github.com/T-002/pycast/blob/8a53505c6d8367e0ea572e8af768e80b29e1cc41/pycast/methods/regression.py#L35-L79 | train |
T-002/pycast | pycast/methods/regression.py | Regression.calculate_parameters_with_confidence | def calculate_parameters_with_confidence(self, independentTs, dependentTs, confidenceLevel, samplePercentage=.1):
"""Same functionality as calculate_parameters, just that additionally
the confidence interval for a given confidenceLevel is calculated.
This is done based on a sample of the depende... | python | def calculate_parameters_with_confidence(self, independentTs, dependentTs, confidenceLevel, samplePercentage=.1):
"""Same functionality as calculate_parameters, just that additionally
the confidence interval for a given confidenceLevel is calculated.
This is done based on a sample of the depende... | [
"def",
"calculate_parameters_with_confidence",
"(",
"self",
",",
"independentTs",
",",
"dependentTs",
",",
"confidenceLevel",
",",
"samplePercentage",
"=",
".1",
")",
":",
"sampleY",
",",
"trainingY",
"=",
"dependentTs",
".",
"sample",
"(",
"samplePercentage",
")",
... | Same functionality as calculate_parameters, just that additionally
the confidence interval for a given confidenceLevel is calculated.
This is done based on a sample of the dependentTs training data that is validated
against the prediction. The signed error of the predictions and the sample is th... | [
"Same",
"functionality",
"as",
"calculate_parameters",
"just",
"that",
"additionally",
"the",
"confidence",
"interval",
"for",
"a",
"given",
"confidenceLevel",
"is",
"calculated",
".",
"This",
"is",
"done",
"based",
"on",
"a",
"sample",
"of",
"the",
"dependentTs",... | 8a53505c6d8367e0ea572e8af768e80b29e1cc41 | https://github.com/T-002/pycast/blob/8a53505c6d8367e0ea572e8af768e80b29e1cc41/pycast/methods/regression.py#L81-L128 | train |
T-002/pycast | pycast/methods/regression.py | Regression.match_time_series | def match_time_series(self, timeseries1, timeseries2):
"""Return two lists of the two input time series with matching dates
:param TimeSeries timeseries1: The first timeseries
:param TimeSeries timeseries2: The second timeseries
:return: Two two dimensional lists containing the match... | python | def match_time_series(self, timeseries1, timeseries2):
"""Return two lists of the two input time series with matching dates
:param TimeSeries timeseries1: The first timeseries
:param TimeSeries timeseries2: The second timeseries
:return: Two two dimensional lists containing the match... | [
"def",
"match_time_series",
"(",
"self",
",",
"timeseries1",
",",
"timeseries2",
")",
":",
"time1",
"=",
"map",
"(",
"lambda",
"item",
":",
"item",
"[",
"0",
"]",
",",
"timeseries1",
".",
"to_twodim_list",
"(",
")",
")",
"time2",
"=",
"map",
"(",
"lamb... | Return two lists of the two input time series with matching dates
:param TimeSeries timeseries1: The first timeseries
:param TimeSeries timeseries2: The second timeseries
:return: Two two dimensional lists containing the matched values,
:rtype: two List | [
"Return",
"two",
"lists",
"of",
"the",
"two",
"input",
"time",
"series",
"with",
"matching",
"dates"
] | 8a53505c6d8367e0ea572e8af768e80b29e1cc41 | https://github.com/T-002/pycast/blob/8a53505c6d8367e0ea572e8af768e80b29e1cc41/pycast/methods/regression.py#L153-L168 | train |
T-002/pycast | pycast/methods/regression.py | LinearRegression.lstsq | def lstsq(cls, a, b):
"""Return the least-squares solution to a linear matrix equation.
:param Matrix a: Design matrix with the values of the independent variables.
:param Matrix b: Matrix with the "dependent variable" values.
b can only have one column.
... | python | def lstsq(cls, a, b):
"""Return the least-squares solution to a linear matrix equation.
:param Matrix a: Design matrix with the values of the independent variables.
:param Matrix b: Matrix with the "dependent variable" values.
b can only have one column.
... | [
"def",
"lstsq",
"(",
"cls",
",",
"a",
",",
"b",
")",
":",
"if",
"a",
".",
"get_height",
"(",
")",
"!=",
"b",
".",
"get_height",
"(",
")",
":",
"raise",
"ValueError",
"(",
"\"Size of input matrices does not match\"",
")",
"if",
"b",
".",
"get_width",
"(... | Return the least-squares solution to a linear matrix equation.
:param Matrix a: Design matrix with the values of the independent variables.
:param Matrix b: Matrix with the "dependent variable" values.
b can only have one column.
:raise: Raises an ... | [
"Return",
"the",
"least",
"-",
"squares",
"solution",
"to",
"a",
"linear",
"matrix",
"equation",
"."
] | 8a53505c6d8367e0ea572e8af768e80b29e1cc41 | https://github.com/T-002/pycast/blob/8a53505c6d8367e0ea572e8af768e80b29e1cc41/pycast/methods/regression.py#L174-L200 | train |
T-002/pycast | pycast/errors/meanabsolutescalederror.py | MeanAbsoluteScaledError._get_historic_means | def _get_historic_means(self, timeSeries):
"""Calculates the mean value for the history of the MeanAbsoluteScaledError.
:param TimeSeries timeSeries: Original TimeSeries used to calculate the mean historic values.
:return: Returns a list containing the historic means.
:rtype: lis... | python | def _get_historic_means(self, timeSeries):
"""Calculates the mean value for the history of the MeanAbsoluteScaledError.
:param TimeSeries timeSeries: Original TimeSeries used to calculate the mean historic values.
:return: Returns a list containing the historic means.
:rtype: lis... | [
"def",
"_get_historic_means",
"(",
"self",
",",
"timeSeries",
")",
":",
"historyLength",
"=",
"self",
".",
"_historyLength",
"historicMeans",
"=",
"[",
"]",
"append",
"=",
"historicMeans",
".",
"append",
"for",
"startIdx",
"in",
"xrange",
"(",
"len",
"(",
"t... | Calculates the mean value for the history of the MeanAbsoluteScaledError.
:param TimeSeries timeSeries: Original TimeSeries used to calculate the mean historic values.
:return: Returns a list containing the historic means.
:rtype: list | [
"Calculates",
"the",
"mean",
"value",
"for",
"the",
"history",
"of",
"the",
"MeanAbsoluteScaledError",
"."
] | 8a53505c6d8367e0ea572e8af768e80b29e1cc41 | https://github.com/T-002/pycast/blob/8a53505c6d8367e0ea572e8af768e80b29e1cc41/pycast/errors/meanabsolutescalederror.py#L63-L84 | train |
pdkit/pdkit | pdkit/updrs.py | UPDRS.write_model | def write_model(self, filename='scores', filepath='', output_format='csv'):
"""
This method calculates the scores and writes them to a file the data frame received. If the output format
is other than 'csv' it will print the scores.
:param filename: the name to give to the fi... | python | def write_model(self, filename='scores', filepath='', output_format='csv'):
"""
This method calculates the scores and writes them to a file the data frame received. If the output format
is other than 'csv' it will print the scores.
:param filename: the name to give to the fi... | [
"def",
"write_model",
"(",
"self",
",",
"filename",
"=",
"'scores'",
",",
"filepath",
"=",
"''",
",",
"output_format",
"=",
"'csv'",
")",
":",
"scores_array",
"=",
"np",
".",
"array",
"(",
"[",
"]",
")",
"for",
"obs",
"in",
"self",
".",
"observations",... | This method calculates the scores and writes them to a file the data frame received. If the output format
is other than 'csv' it will print the scores.
:param filename: the name to give to the file
:type filename: string
:param filepath: the path to save the file
... | [
"This",
"method",
"calculates",
"the",
"scores",
"and",
"writes",
"them",
"to",
"a",
"file",
"the",
"data",
"frame",
"received",
".",
"If",
"the",
"output",
"format",
"is",
"other",
"than",
"csv",
"it",
"will",
"print",
"the",
"scores",
"."
] | c7120263da2071bb139815fbdb56ca77b544f340 | https://github.com/pdkit/pdkit/blob/c7120263da2071bb139815fbdb56ca77b544f340/pdkit/updrs.py#L244-L277 | train |
Duke-GCB/DukeDSClient | ddsc/core/download.py | ProjectDownload.run | def run(self):
"""
Download the contents of the specified project name or id to dest_directory.
"""
files_to_download = self.get_files_to_download()
total_files_size = self.get_total_files_size(files_to_download)
if self.file_download_pre_processor:
self.run_p... | python | def run(self):
"""
Download the contents of the specified project name or id to dest_directory.
"""
files_to_download = self.get_files_to_download()
total_files_size = self.get_total_files_size(files_to_download)
if self.file_download_pre_processor:
self.run_p... | [
"def",
"run",
"(",
"self",
")",
":",
"files_to_download",
"=",
"self",
".",
"get_files_to_download",
"(",
")",
"total_files_size",
"=",
"self",
".",
"get_total_files_size",
"(",
"files_to_download",
")",
"if",
"self",
".",
"file_download_pre_processor",
":",
"self... | Download the contents of the specified project name or id to dest_directory. | [
"Download",
"the",
"contents",
"of",
"the",
"specified",
"project",
"name",
"or",
"id",
"to",
"dest_directory",
"."
] | 117f68fb9bae82e4c81ea487ad5d61ac350f3726 | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/download.py#L38-L54 | train |
Duke-GCB/DukeDSClient | ddsc/core/download.py | FileUrlDownloader.make_local_directories | def make_local_directories(self):
"""
Create directories necessary to download the files into dest_directory
"""
for remote_path in self._get_parent_remote_paths():
local_path = os.path.join(self.dest_directory, remote_path)
self._assure_dir_exists(local_path) | python | def make_local_directories(self):
"""
Create directories necessary to download the files into dest_directory
"""
for remote_path in self._get_parent_remote_paths():
local_path = os.path.join(self.dest_directory, remote_path)
self._assure_dir_exists(local_path) | [
"def",
"make_local_directories",
"(",
"self",
")",
":",
"for",
"remote_path",
"in",
"self",
".",
"_get_parent_remote_paths",
"(",
")",
":",
"local_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"dest_directory",
",",
"remote_path",
")",
"self"... | Create directories necessary to download the files into dest_directory | [
"Create",
"directories",
"necessary",
"to",
"download",
"the",
"files",
"into",
"dest_directory"
] | 117f68fb9bae82e4c81ea487ad5d61ac350f3726 | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/download.py#L197-L203 | train |
Duke-GCB/DukeDSClient | ddsc/core/download.py | FileUrlDownloader.make_big_empty_files | def make_big_empty_files(self):
"""
Write out a empty file so the workers can seek to where they should write and write their data.
"""
for file_url in self.file_urls:
local_path = file_url.get_local_path(self.dest_directory)
with open(local_path, "wb") as outfile... | python | def make_big_empty_files(self):
"""
Write out a empty file so the workers can seek to where they should write and write their data.
"""
for file_url in self.file_urls:
local_path = file_url.get_local_path(self.dest_directory)
with open(local_path, "wb") as outfile... | [
"def",
"make_big_empty_files",
"(",
"self",
")",
":",
"for",
"file_url",
"in",
"self",
".",
"file_urls",
":",
"local_path",
"=",
"file_url",
".",
"get_local_path",
"(",
"self",
".",
"dest_directory",
")",
"with",
"open",
"(",
"local_path",
",",
"\"wb\"",
")"... | Write out a empty file so the workers can seek to where they should write and write their data. | [
"Write",
"out",
"a",
"empty",
"file",
"so",
"the",
"workers",
"can",
"seek",
"to",
"where",
"they",
"should",
"write",
"and",
"write",
"their",
"data",
"."
] | 117f68fb9bae82e4c81ea487ad5d61ac350f3726 | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/download.py#L205-L214 | train |
Duke-GCB/DukeDSClient | ddsc/core/download.py | FileUrlDownloader.check_downloaded_files_sizes | def check_downloaded_files_sizes(self):
"""
Make sure the files sizes are correct. Since we manually create the files this will only catch overruns.
Raises ValueError if there is a problematic file.
"""
for file_url in self.file_urls:
local_path = file_url.get_local_p... | python | def check_downloaded_files_sizes(self):
"""
Make sure the files sizes are correct. Since we manually create the files this will only catch overruns.
Raises ValueError if there is a problematic file.
"""
for file_url in self.file_urls:
local_path = file_url.get_local_p... | [
"def",
"check_downloaded_files_sizes",
"(",
"self",
")",
":",
"for",
"file_url",
"in",
"self",
".",
"file_urls",
":",
"local_path",
"=",
"file_url",
".",
"get_local_path",
"(",
"self",
".",
"dest_directory",
")",
"self",
".",
"check_file_size",
"(",
"file_url",
... | Make sure the files sizes are correct. Since we manually create the files this will only catch overruns.
Raises ValueError if there is a problematic file. | [
"Make",
"sure",
"the",
"files",
"sizes",
"are",
"correct",
".",
"Since",
"we",
"manually",
"create",
"the",
"files",
"this",
"will",
"only",
"catch",
"overruns",
".",
"Raises",
"ValueError",
"if",
"there",
"is",
"a",
"problematic",
"file",
"."
] | 117f68fb9bae82e4c81ea487ad5d61ac350f3726 | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/download.py#L299-L306 | train |
Duke-GCB/DukeDSClient | ddsc/core/download.py | RetryChunkDownloader._verify_download_complete | def _verify_download_complete(self):
"""
Make sure we received all the data
"""
if self.actual_bytes_read > self.bytes_to_read:
raise TooLargeChunkDownloadError(self.actual_bytes_read, self.bytes_to_read, self.local_path)
elif self.actual_bytes_read < self.bytes_to_re... | python | def _verify_download_complete(self):
"""
Make sure we received all the data
"""
if self.actual_bytes_read > self.bytes_to_read:
raise TooLargeChunkDownloadError(self.actual_bytes_read, self.bytes_to_read, self.local_path)
elif self.actual_bytes_read < self.bytes_to_re... | [
"def",
"_verify_download_complete",
"(",
"self",
")",
":",
"if",
"self",
".",
"actual_bytes_read",
">",
"self",
".",
"bytes_to_read",
":",
"raise",
"TooLargeChunkDownloadError",
"(",
"self",
".",
"actual_bytes_read",
",",
"self",
".",
"bytes_to_read",
",",
"self",... | Make sure we received all the data | [
"Make",
"sure",
"we",
"received",
"all",
"the",
"data"
] | 117f68fb9bae82e4c81ea487ad5d61ac350f3726 | https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/download.py#L474-L481 | train |
T-002/pycast | pycast/optimization/gridsearch.py | GridSearch.optimize | def optimize(self, timeSeries, forecastingMethods=None, startingPercentage=0.0, endPercentage=100.0):
"""Runs the optimization of the given TimeSeries.
:param TimeSeries timeSeries: TimeSeries instance that requires an optimized forecast.
:param list forecastingMethods: List of forecastin... | python | def optimize(self, timeSeries, forecastingMethods=None, startingPercentage=0.0, endPercentage=100.0):
"""Runs the optimization of the given TimeSeries.
:param TimeSeries timeSeries: TimeSeries instance that requires an optimized forecast.
:param list forecastingMethods: List of forecastin... | [
"def",
"optimize",
"(",
"self",
",",
"timeSeries",
",",
"forecastingMethods",
"=",
"None",
",",
"startingPercentage",
"=",
"0.0",
",",
"endPercentage",
"=",
"100.0",
")",
":",
"if",
"forecastingMethods",
"is",
"None",
"or",
"len",
"(",
"forecastingMethods",
")... | Runs the optimization of the given TimeSeries.
:param TimeSeries timeSeries: TimeSeries instance that requires an optimized forecast.
:param list forecastingMethods: List of forecastingMethods that will be used for optimization.
:param float startingPercentage: Defines the start of the in... | [
"Runs",
"the",
"optimization",
"of",
"the",
"given",
"TimeSeries",
"."
] | 8a53505c6d8367e0ea572e8af768e80b29e1cc41 | https://github.com/T-002/pycast/blob/8a53505c6d8367e0ea572e8af768e80b29e1cc41/pycast/optimization/gridsearch.py#L34-L69 | train |
T-002/pycast | pycast/optimization/gridsearch.py | GridSearch._generate_next_parameter_value | def _generate_next_parameter_value(self, parameter, forecastingMethod):
"""Generator for a specific parameter of the given forecasting method.
:param string parameter: Name of the parameter the generator is used for.
:param BaseForecastingMethod forecastingMethod: Instance of a Forecastin... | python | def _generate_next_parameter_value(self, parameter, forecastingMethod):
"""Generator for a specific parameter of the given forecasting method.
:param string parameter: Name of the parameter the generator is used for.
:param BaseForecastingMethod forecastingMethod: Instance of a Forecastin... | [
"def",
"_generate_next_parameter_value",
"(",
"self",
",",
"parameter",
",",
"forecastingMethod",
")",
":",
"interval",
"=",
"forecastingMethod",
".",
"get_interval",
"(",
"parameter",
")",
"precision",
"=",
"10",
"**",
"self",
".",
"_precison",
"startValue",
"=",... | Generator for a specific parameter of the given forecasting method.
:param string parameter: Name of the parameter the generator is used for.
:param BaseForecastingMethod forecastingMethod: Instance of a ForecastingMethod.
:return: Creates a generator used to iterate over possible par... | [
"Generator",
"for",
"a",
"specific",
"parameter",
"of",
"the",
"given",
"forecasting",
"method",
"."
] | 8a53505c6d8367e0ea572e8af768e80b29e1cc41 | https://github.com/T-002/pycast/blob/8a53505c6d8367e0ea572e8af768e80b29e1cc41/pycast/optimization/gridsearch.py#L72-L98 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.