partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | create_cluster | Creates a new cluster.
To create the cluster in Virtual Private Cloud (VPC), you must provide a cluster subnet group name. The cluster subnet group identifies the subnets of your VPC that Amazon Redshift uses when creating the cluster. For more information about managing clusters, go to Amazon Redshift Clusters in ... | pyboto3/redshift.py | def create_cluster(DBName=None, ClusterIdentifier=None, ClusterType=None, NodeType=None, MasterUsername=None, MasterUserPassword=None, ClusterSecurityGroups=None, VpcSecurityGroupIds=None, ClusterSubnetGroupName=None, AvailabilityZone=None, PreferredMaintenanceWindow=None, ClusterParameterGroupName=None, AutomatedSnaps... | def create_cluster(DBName=None, ClusterIdentifier=None, ClusterType=None, NodeType=None, MasterUsername=None, MasterUserPassword=None, ClusterSecurityGroups=None, VpcSecurityGroupIds=None, ClusterSubnetGroupName=None, AvailabilityZone=None, PreferredMaintenanceWindow=None, ClusterParameterGroupName=None, AutomatedSnaps... | [
"Creates",
"a",
"new",
"cluster",
".",
"To",
"create",
"the",
"cluster",
"in",
"Virtual",
"Private",
"Cloud",
"(",
"VPC",
")",
"you",
"must",
"provide",
"a",
"cluster",
"subnet",
"group",
"name",
".",
"The",
"cluster",
"subnet",
"group",
"identifies",
"the... | wavycloud/pyboto3 | python | https://github.com/wavycloud/pyboto3/blob/924957ccf994303713a4eed90b775ff2ab95b2e5/pyboto3/redshift.py#L297-L650 | [
"def",
"create_cluster",
"(",
"DBName",
"=",
"None",
",",
"ClusterIdentifier",
"=",
"None",
",",
"ClusterType",
"=",
"None",
",",
"NodeType",
"=",
"None",
",",
"MasterUsername",
"=",
"None",
",",
"MasterUserPassword",
"=",
"None",
",",
"ClusterSecurityGroups",
... | 924957ccf994303713a4eed90b775ff2ab95b2e5 |
train | describe_cluster_snapshots | Returns one or more snapshot objects, which contain metadata about your cluster snapshots. By default, this operation returns information about all snapshots of all clusters that are owned by you AWS customer account. No information is returned for snapshots owned by inactive AWS customer accounts.
If you specify b... | pyboto3/redshift.py | def describe_cluster_snapshots(ClusterIdentifier=None, SnapshotIdentifier=None, SnapshotType=None, StartTime=None, EndTime=None, MaxRecords=None, Marker=None, OwnerAccount=None, TagKeys=None, TagValues=None):
"""
Returns one or more snapshot objects, which contain metadata about your cluster snapshots. By defau... | def describe_cluster_snapshots(ClusterIdentifier=None, SnapshotIdentifier=None, SnapshotType=None, StartTime=None, EndTime=None, MaxRecords=None, Marker=None, OwnerAccount=None, TagKeys=None, TagValues=None):
"""
Returns one or more snapshot objects, which contain metadata about your cluster snapshots. By defau... | [
"Returns",
"one",
"or",
"more",
"snapshot",
"objects",
"which",
"contain",
"metadata",
"about",
"your",
"cluster",
"snapshots",
".",
"By",
"default",
"this",
"operation",
"returns",
"information",
"about",
"all",
"snapshots",
"of",
"all",
"clusters",
"that",
"ar... | wavycloud/pyboto3 | python | https://github.com/wavycloud/pyboto3/blob/924957ccf994303713a4eed90b775ff2ab95b2e5/pyboto3/redshift.py#L1957-L2083 | [
"def",
"describe_cluster_snapshots",
"(",
"ClusterIdentifier",
"=",
"None",
",",
"SnapshotIdentifier",
"=",
"None",
",",
"SnapshotType",
"=",
"None",
",",
"StartTime",
"=",
"None",
",",
"EndTime",
"=",
"None",
",",
"MaxRecords",
"=",
"None",
",",
"Marker",
"="... | 924957ccf994303713a4eed90b775ff2ab95b2e5 |
train | modify_cluster | Modifies the settings for a cluster. For example, you can add another security or parameter group, update the preferred maintenance window, or change the master user password. Resetting a cluster password or modifying the security groups associated with a cluster do not need a reboot. However, modifying a parameter gro... | pyboto3/redshift.py | def modify_cluster(ClusterIdentifier=None, ClusterType=None, NodeType=None, NumberOfNodes=None, ClusterSecurityGroups=None, VpcSecurityGroupIds=None, MasterUserPassword=None, ClusterParameterGroupName=None, AutomatedSnapshotRetentionPeriod=None, PreferredMaintenanceWindow=None, ClusterVersion=None, AllowVersionUpgrade=... | def modify_cluster(ClusterIdentifier=None, ClusterType=None, NodeType=None, NumberOfNodes=None, ClusterSecurityGroups=None, VpcSecurityGroupIds=None, MasterUserPassword=None, ClusterParameterGroupName=None, AutomatedSnapshotRetentionPeriod=None, PreferredMaintenanceWindow=None, ClusterVersion=None, AllowVersionUpgrade=... | [
"Modifies",
"the",
"settings",
"for",
"a",
"cluster",
".",
"For",
"example",
"you",
"can",
"add",
"another",
"security",
"or",
"parameter",
"group",
"update",
"the",
"preferred",
"maintenance",
"window",
"or",
"change",
"the",
"master",
"user",
"password",
"."... | wavycloud/pyboto3 | python | https://github.com/wavycloud/pyboto3/blob/924957ccf994303713a4eed90b775ff2ab95b2e5/pyboto3/redshift.py#L3733-L4010 | [
"def",
"modify_cluster",
"(",
"ClusterIdentifier",
"=",
"None",
",",
"ClusterType",
"=",
"None",
",",
"NodeType",
"=",
"None",
",",
"NumberOfNodes",
"=",
"None",
",",
"ClusterSecurityGroups",
"=",
"None",
",",
"VpcSecurityGroupIds",
"=",
"None",
",",
"MasterUser... | 924957ccf994303713a4eed90b775ff2ab95b2e5 |
train | restore_from_cluster_snapshot | Creates a new cluster from a snapshot. By default, Amazon Redshift creates the resulting cluster with the same configuration as the original cluster from which the snapshot was created, except that the new cluster is created with the default cluster security and parameter groups. After Amazon Redshift creates the clust... | pyboto3/redshift.py | def restore_from_cluster_snapshot(ClusterIdentifier=None, SnapshotIdentifier=None, SnapshotClusterIdentifier=None, Port=None, AvailabilityZone=None, AllowVersionUpgrade=None, ClusterSubnetGroupName=None, PubliclyAccessible=None, OwnerAccount=None, HsmClientCertificateIdentifier=None, HsmConfigurationIdentifier=None, El... | def restore_from_cluster_snapshot(ClusterIdentifier=None, SnapshotIdentifier=None, SnapshotClusterIdentifier=None, Port=None, AvailabilityZone=None, AllowVersionUpgrade=None, ClusterSubnetGroupName=None, PubliclyAccessible=None, OwnerAccount=None, HsmClientCertificateIdentifier=None, HsmConfigurationIdentifier=None, El... | [
"Creates",
"a",
"new",
"cluster",
"from",
"a",
"snapshot",
".",
"By",
"default",
"Amazon",
"Redshift",
"creates",
"the",
"resulting",
"cluster",
"with",
"the",
"same",
"configuration",
"as",
"the",
"original",
"cluster",
"from",
"which",
"the",
"snapshot",
"wa... | wavycloud/pyboto3 | python | https://github.com/wavycloud/pyboto3/blob/924957ccf994303713a4eed90b775ff2ab95b2e5/pyboto3/redshift.py#L4788-L5073 | [
"def",
"restore_from_cluster_snapshot",
"(",
"ClusterIdentifier",
"=",
"None",
",",
"SnapshotIdentifier",
"=",
"None",
",",
"SnapshotClusterIdentifier",
"=",
"None",
",",
"Port",
"=",
"None",
",",
"AvailabilityZone",
"=",
"None",
",",
"AllowVersionUpgrade",
"=",
"No... | 924957ccf994303713a4eed90b775ff2ab95b2e5 |
train | create_cluster | Creates an empty cluster. Each cluster supports five nodes. You use the CreateJob action separately to create the jobs for each of these nodes. The cluster does not ship until these five node jobs have been created.
See also: AWS API Documentation
Examples
Creates an empty cluster. Each cluster suppor... | pyboto3/snowball.py | def create_cluster(JobType=None, Resources=None, Description=None, AddressId=None, KmsKeyARN=None, RoleARN=None, SnowballType=None, ShippingOption=None, Notification=None, ForwardingAddressId=None):
"""
Creates an empty cluster. Each cluster supports five nodes. You use the CreateJob action separately to creat... | def create_cluster(JobType=None, Resources=None, Description=None, AddressId=None, KmsKeyARN=None, RoleARN=None, SnowballType=None, ShippingOption=None, Notification=None, ForwardingAddressId=None):
"""
Creates an empty cluster. Each cluster supports five nodes. You use the CreateJob action separately to creat... | [
"Creates",
"an",
"empty",
"cluster",
".",
"Each",
"cluster",
"supports",
"five",
"nodes",
".",
"You",
"use",
"the",
"CreateJob",
"action",
"separately",
"to",
"create",
"the",
"jobs",
"for",
"each",
"of",
"these",
"nodes",
".",
"The",
"cluster",
"does",
"n... | wavycloud/pyboto3 | python | https://github.com/wavycloud/pyboto3/blob/924957ccf994303713a4eed90b775ff2ab95b2e5/pyboto3/snowball.py#L151-L272 | [
"def",
"create_cluster",
"(",
"JobType",
"=",
"None",
",",
"Resources",
"=",
"None",
",",
"Description",
"=",
"None",
",",
"AddressId",
"=",
"None",
",",
"KmsKeyARN",
"=",
"None",
",",
"RoleARN",
"=",
"None",
",",
"SnowballType",
"=",
"None",
",",
"Shipp... | 924957ccf994303713a4eed90b775ff2ab95b2e5 |
train | create_job | Creates a job to import or export data between Amazon S3 and your on-premises data center. Your AWS account must have the right trust policies and permissions in place to create a job for Snowball. If you're creating a job for a node in a cluster, you only need to provide the clusterId value; the other job attributes a... | pyboto3/snowball.py | def create_job(JobType=None, Resources=None, Description=None, AddressId=None, KmsKeyARN=None, RoleARN=None, SnowballCapacityPreference=None, ShippingOption=None, Notification=None, ClusterId=None, SnowballType=None, ForwardingAddressId=None):
"""
Creates a job to import or export data between Amazon S3 and you... | def create_job(JobType=None, Resources=None, Description=None, AddressId=None, KmsKeyARN=None, RoleARN=None, SnowballCapacityPreference=None, ShippingOption=None, Notification=None, ClusterId=None, SnowballType=None, ForwardingAddressId=None):
"""
Creates a job to import or export data between Amazon S3 and you... | [
"Creates",
"a",
"job",
"to",
"import",
"or",
"export",
"data",
"between",
"Amazon",
"S3",
"and",
"your",
"on",
"-",
"premises",
"data",
"center",
".",
"Your",
"AWS",
"account",
"must",
"have",
"the",
"right",
"trust",
"policies",
"and",
"permissions",
"in"... | wavycloud/pyboto3 | python | https://github.com/wavycloud/pyboto3/blob/924957ccf994303713a4eed90b775ff2ab95b2e5/pyboto3/snowball.py#L274-L397 | [
"def",
"create_job",
"(",
"JobType",
"=",
"None",
",",
"Resources",
"=",
"None",
",",
"Description",
"=",
"None",
",",
"AddressId",
"=",
"None",
",",
"KmsKeyARN",
"=",
"None",
",",
"RoleARN",
"=",
"None",
",",
"SnowballCapacityPreference",
"=",
"None",
","... | 924957ccf994303713a4eed90b775ff2ab95b2e5 |
train | update_job | While a job's JobState value is New , you can update some of the information associated with a job. Once the job changes to a different job state, usually within 60 minutes of the job being created, this action is no longer available.
See also: AWS API Documentation
Examples
This action allows you to u... | pyboto3/snowball.py | def update_job(JobId=None, RoleARN=None, Notification=None, Resources=None, AddressId=None, ShippingOption=None, Description=None, SnowballCapacityPreference=None, ForwardingAddressId=None):
"""
While a job's JobState value is New , you can update some of the information associated with a job. Once the job chan... | def update_job(JobId=None, RoleARN=None, Notification=None, Resources=None, AddressId=None, ShippingOption=None, Description=None, SnowballCapacityPreference=None, ForwardingAddressId=None):
"""
While a job's JobState value is New , you can update some of the information associated with a job. Once the job chan... | [
"While",
"a",
"job",
"s",
"JobState",
"value",
"is",
"New",
"you",
"can",
"update",
"some",
"of",
"the",
"information",
"associated",
"with",
"a",
"job",
".",
"Once",
"the",
"job",
"changes",
"to",
"a",
"different",
"job",
"state",
"usually",
"within",
"... | wavycloud/pyboto3 | python | https://github.com/wavycloud/pyboto3/blob/924957ccf994303713a4eed90b775ff2ab95b2e5/pyboto3/snowball.py#L1077-L1184 | [
"def",
"update_job",
"(",
"JobId",
"=",
"None",
",",
"RoleARN",
"=",
"None",
",",
"Notification",
"=",
"None",
",",
"Resources",
"=",
"None",
",",
"AddressId",
"=",
"None",
",",
"ShippingOption",
"=",
"None",
",",
"Description",
"=",
"None",
",",
"Snowba... | 924957ccf994303713a4eed90b775ff2ab95b2e5 |
train | register_task_with_maintenance_window | Adds a new task to a Maintenance Window.
See also: AWS API Documentation
:example: response = client.register_task_with_maintenance_window(
WindowId='string',
Targets=[
{
'Key': 'string',
'Values': [
'string',
... | pyboto3/ssm.py | def register_task_with_maintenance_window(WindowId=None, Targets=None, TaskArn=None, ServiceRoleArn=None, TaskType=None, TaskParameters=None, Priority=None, MaxConcurrency=None, MaxErrors=None, LoggingInfo=None, ClientToken=None):
"""
Adds a new task to a Maintenance Window.
See also: AWS API Documentation
... | def register_task_with_maintenance_window(WindowId=None, Targets=None, TaskArn=None, ServiceRoleArn=None, TaskType=None, TaskParameters=None, Priority=None, MaxConcurrency=None, MaxErrors=None, LoggingInfo=None, ClientToken=None):
"""
Adds a new task to a Maintenance Window.
See also: AWS API Documentation
... | [
"Adds",
"a",
"new",
"task",
"to",
"a",
"Maintenance",
"Window",
".",
"See",
"also",
":",
"AWS",
"API",
"Documentation",
":",
"example",
":",
"response",
"=",
"client",
".",
"register_task_with_maintenance_window",
"(",
"WindowId",
"=",
"string",
"Targets",
"="... | wavycloud/pyboto3 | python | https://github.com/wavycloud/pyboto3/blob/924957ccf994303713a4eed90b775ff2ab95b2e5/pyboto3/ssm.py#L3774-L3883 | [
"def",
"register_task_with_maintenance_window",
"(",
"WindowId",
"=",
"None",
",",
"Targets",
"=",
"None",
",",
"TaskArn",
"=",
"None",
",",
"ServiceRoleArn",
"=",
"None",
",",
"TaskType",
"=",
"None",
",",
"TaskParameters",
"=",
"None",
",",
"Priority",
"=",
... | 924957ccf994303713a4eed90b775ff2ab95b2e5 |
train | send_command | Executes commands on one or more remote instances.
See also: AWS API Documentation
:example: response = client.send_command(
InstanceIds=[
'string',
],
Targets=[
{
'Key': 'string',
'Values': [
'string',... | pyboto3/ssm.py | def send_command(InstanceIds=None, Targets=None, DocumentName=None, DocumentHash=None, DocumentHashType=None, TimeoutSeconds=None, Comment=None, Parameters=None, OutputS3Region=None, OutputS3BucketName=None, OutputS3KeyPrefix=None, MaxConcurrency=None, MaxErrors=None, ServiceRoleArn=None, NotificationConfig=None):
... | def send_command(InstanceIds=None, Targets=None, DocumentName=None, DocumentHash=None, DocumentHashType=None, TimeoutSeconds=None, Comment=None, Parameters=None, OutputS3Region=None, OutputS3BucketName=None, OutputS3KeyPrefix=None, MaxConcurrency=None, MaxErrors=None, ServiceRoleArn=None, NotificationConfig=None):
... | [
"Executes",
"commands",
"on",
"one",
"or",
"more",
"remote",
"instances",
".",
"See",
"also",
":",
"AWS",
"API",
"Documentation",
":",
"example",
":",
"response",
"=",
"client",
".",
"send_command",
"(",
"InstanceIds",
"=",
"[",
"string",
"]",
"Targets",
"... | wavycloud/pyboto3 | python | https://github.com/wavycloud/pyboto3/blob/924957ccf994303713a4eed90b775ff2ab95b2e5/pyboto3/ssm.py#L3926-L4097 | [
"def",
"send_command",
"(",
"InstanceIds",
"=",
"None",
",",
"Targets",
"=",
"None",
",",
"DocumentName",
"=",
"None",
",",
"DocumentHash",
"=",
"None",
",",
"DocumentHashType",
"=",
"None",
",",
"TimeoutSeconds",
"=",
"None",
",",
"Comment",
"=",
"None",
... | 924957ccf994303713a4eed90b775ff2ab95b2e5 |
train | create_server | Creates and immedately starts a new server. The server is ready to use when it is in the HEALTHY state. By default, you can create a maximum of 10 servers.
This operation is asynchronous.
A LimitExceededException is thrown when you have created the maximum number of servers (10). A ResourceAlreadyExistsExceptio... | pyboto3/opsworkscm.py | def create_server(AssociatePublicIpAddress=None, DisableAutomatedBackup=None, Engine=None, EngineModel=None, EngineVersion=None, EngineAttributes=None, BackupRetentionCount=None, ServerName=None, InstanceProfileArn=None, InstanceType=None, KeyPair=None, PreferredMaintenanceWindow=None, PreferredBackupWindow=None, Secur... | def create_server(AssociatePublicIpAddress=None, DisableAutomatedBackup=None, Engine=None, EngineModel=None, EngineVersion=None, EngineAttributes=None, BackupRetentionCount=None, ServerName=None, InstanceProfileArn=None, InstanceType=None, KeyPair=None, PreferredMaintenanceWindow=None, PreferredBackupWindow=None, Secur... | [
"Creates",
"and",
"immedately",
"starts",
"a",
"new",
"server",
".",
"The",
"server",
"is",
"ready",
"to",
"use",
"when",
"it",
"is",
"in",
"the",
"HEALTHY",
"state",
".",
"By",
"default",
"you",
"can",
"create",
"a",
"maximum",
"of",
"10",
"servers",
... | wavycloud/pyboto3 | python | https://github.com/wavycloud/pyboto3/blob/924957ccf994303713a4eed90b775ff2ab95b2e5/pyboto3/opsworkscm.py#L157-L323 | [
"def",
"create_server",
"(",
"AssociatePublicIpAddress",
"=",
"None",
",",
"DisableAutomatedBackup",
"=",
"None",
",",
"Engine",
"=",
"None",
",",
"EngineModel",
"=",
"None",
",",
"EngineVersion",
"=",
"None",
",",
"EngineAttributes",
"=",
"None",
",",
"BackupRe... | 924957ccf994303713a4eed90b775ff2ab95b2e5 |
train | create_product | Creates a new product.
See also: AWS API Documentation
:example: response = client.create_product(
AcceptLanguage='string',
Name='string',
Owner='string',
Description='string',
Distributor='string',
SupportDescription='string',
SupportEmail='stri... | pyboto3/servicecatalog.py | def create_product(AcceptLanguage=None, Name=None, Owner=None, Description=None, Distributor=None, SupportDescription=None, SupportEmail=None, SupportUrl=None, ProductType=None, Tags=None, ProvisioningArtifactParameters=None, IdempotencyToken=None):
"""
Creates a new product.
See also: AWS API Documentation... | def create_product(AcceptLanguage=None, Name=None, Owner=None, Description=None, Distributor=None, SupportDescription=None, SupportEmail=None, SupportUrl=None, ProductType=None, Tags=None, ProvisioningArtifactParameters=None, IdempotencyToken=None):
"""
Creates a new product.
See also: AWS API Documentation... | [
"Creates",
"a",
"new",
"product",
".",
"See",
"also",
":",
"AWS",
"API",
"Documentation",
":",
"example",
":",
"response",
"=",
"client",
".",
"create_product",
"(",
"AcceptLanguage",
"=",
"string",
"Name",
"=",
"string",
"Owner",
"=",
"string",
"Description... | wavycloud/pyboto3 | python | https://github.com/wavycloud/pyboto3/blob/924957ccf994303713a4eed90b775ff2ab95b2e5/pyboto3/servicecatalog.py#L358-L493 | [
"def",
"create_product",
"(",
"AcceptLanguage",
"=",
"None",
",",
"Name",
"=",
"None",
",",
"Owner",
"=",
"None",
",",
"Description",
"=",
"None",
",",
"Distributor",
"=",
"None",
",",
"SupportDescription",
"=",
"None",
",",
"SupportEmail",
"=",
"None",
",... | 924957ccf994303713a4eed90b775ff2ab95b2e5 |
train | provision_product | Requests a Provision of a specified product. A ProvisionedProduct is a resourced instance for a product. For example, provisioning a CloudFormation-template-backed product results in launching a CloudFormation stack and all the underlying resources that come with it.
You can check the status of this request using t... | pyboto3/servicecatalog.py | def provision_product(AcceptLanguage=None, ProductId=None, ProvisioningArtifactId=None, PathId=None, ProvisionedProductName=None, ProvisioningParameters=None, Tags=None, NotificationArns=None, ProvisionToken=None):
"""
Requests a Provision of a specified product. A ProvisionedProduct is a resourced instance for... | def provision_product(AcceptLanguage=None, ProductId=None, ProvisioningArtifactId=None, PathId=None, ProvisionedProductName=None, ProvisioningParameters=None, Tags=None, NotificationArns=None, ProvisionToken=None):
"""
Requests a Provision of a specified product. A ProvisionedProduct is a resourced instance for... | [
"Requests",
"a",
"Provision",
"of",
"a",
"specified",
"product",
".",
"A",
"ProvisionedProduct",
"is",
"a",
"resourced",
"instance",
"for",
"a",
"product",
".",
"For",
"example",
"provisioning",
"a",
"CloudFormation",
"-",
"template",
"-",
"backed",
"product",
... | wavycloud/pyboto3 | python | https://github.com/wavycloud/pyboto3/blob/924957ccf994303713a4eed90b775ff2ab95b2e5/pyboto3/servicecatalog.py#L1816-L1932 | [
"def",
"provision_product",
"(",
"AcceptLanguage",
"=",
"None",
",",
"ProductId",
"=",
"None",
",",
"ProvisioningArtifactId",
"=",
"None",
",",
"PathId",
"=",
"None",
",",
"ProvisionedProductName",
"=",
"None",
",",
"ProvisioningParameters",
"=",
"None",
",",
"T... | 924957ccf994303713a4eed90b775ff2ab95b2e5 |
train | update_product | Updates an existing product.
See also: AWS API Documentation
:example: response = client.update_product(
AcceptLanguage='string',
Id='string',
Name='string',
Owner='string',
Description='string',
Distributor='string',
SupportDescription='string',... | pyboto3/servicecatalog.py | def update_product(AcceptLanguage=None, Id=None, Name=None, Owner=None, Description=None, Distributor=None, SupportDescription=None, SupportEmail=None, SupportUrl=None, AddTags=None, RemoveTags=None):
"""
Updates an existing product.
See also: AWS API Documentation
:example: response = client.... | def update_product(AcceptLanguage=None, Id=None, Name=None, Owner=None, Description=None, Distributor=None, SupportDescription=None, SupportEmail=None, SupportUrl=None, AddTags=None, RemoveTags=None):
"""
Updates an existing product.
See also: AWS API Documentation
:example: response = client.... | [
"Updates",
"an",
"existing",
"product",
".",
"See",
"also",
":",
"AWS",
"API",
"Documentation",
":",
"example",
":",
"response",
"=",
"client",
".",
"update_product",
"(",
"AcceptLanguage",
"=",
"string",
"Id",
"=",
"string",
"Name",
"=",
"string",
"Owner",
... | wavycloud/pyboto3 | python | https://github.com/wavycloud/pyboto3/blob/924957ccf994303713a4eed90b775ff2ab95b2e5/pyboto3/servicecatalog.py#L2395-L2500 | [
"def",
"update_product",
"(",
"AcceptLanguage",
"=",
"None",
",",
"Id",
"=",
"None",
",",
"Name",
"=",
"None",
",",
"Owner",
"=",
"None",
",",
"Description",
"=",
"None",
",",
"Distributor",
"=",
"None",
",",
"SupportDescription",
"=",
"None",
",",
"Supp... | 924957ccf994303713a4eed90b775ff2ab95b2e5 |
train | list_closed_workflow_executions | Returns a list of closed workflow executions in the specified domain that meet the filtering criteria. The results may be split into multiple pages. To retrieve subsequent pages, make the call again using the nextPageToken returned by the initial call.
Access Control
You can use IAM policies to control this act... | pyboto3/swf.py | def list_closed_workflow_executions(domain=None, startTimeFilter=None, closeTimeFilter=None, executionFilter=None, closeStatusFilter=None, typeFilter=None, tagFilter=None, nextPageToken=None, maximumPageSize=None, reverseOrder=None):
"""
Returns a list of closed workflow executions in the specified domain that ... | def list_closed_workflow_executions(domain=None, startTimeFilter=None, closeTimeFilter=None, executionFilter=None, closeStatusFilter=None, typeFilter=None, tagFilter=None, nextPageToken=None, maximumPageSize=None, reverseOrder=None):
"""
Returns a list of closed workflow executions in the specified domain that ... | [
"Returns",
"a",
"list",
"of",
"closed",
"workflow",
"executions",
"in",
"the",
"specified",
"domain",
"that",
"meet",
"the",
"filtering",
"criteria",
".",
"The",
"results",
"may",
"be",
"split",
"into",
"multiple",
"pages",
".",
"To",
"retrieve",
"subsequent",... | wavycloud/pyboto3 | python | https://github.com/wavycloud/pyboto3/blob/924957ccf994303713a4eed90b775ff2ab95b2e5/pyboto3/swf.py#L1483-L1693 | [
"def",
"list_closed_workflow_executions",
"(",
"domain",
"=",
"None",
",",
"startTimeFilter",
"=",
"None",
",",
"closeTimeFilter",
"=",
"None",
",",
"executionFilter",
"=",
"None",
",",
"closeStatusFilter",
"=",
"None",
",",
"typeFilter",
"=",
"None",
",",
"tagF... | 924957ccf994303713a4eed90b775ff2ab95b2e5 |
train | register_activity_type | Registers a new activity type along with its configuration settings in the specified domain.
Access Control
You can use IAM policies to control this action's access to Amazon SWF resources as follows:
If the caller does not have sufficient permissions to invoke the action, or the parameter values fall outsi... | pyboto3/swf.py | def register_activity_type(domain=None, name=None, version=None, description=None, defaultTaskStartToCloseTimeout=None, defaultTaskHeartbeatTimeout=None, defaultTaskList=None, defaultTaskPriority=None, defaultTaskScheduleToStartTimeout=None, defaultTaskScheduleToCloseTimeout=None):
"""
Registers a new activity ... | def register_activity_type(domain=None, name=None, version=None, description=None, defaultTaskStartToCloseTimeout=None, defaultTaskHeartbeatTimeout=None, defaultTaskList=None, defaultTaskPriority=None, defaultTaskScheduleToStartTimeout=None, defaultTaskScheduleToCloseTimeout=None):
"""
Registers a new activity ... | [
"Registers",
"a",
"new",
"activity",
"type",
"along",
"with",
"its",
"configuration",
"settings",
"in",
"the",
"specified",
"domain",
".",
"Access",
"Control",
"You",
"can",
"use",
"IAM",
"policies",
"to",
"control",
"this",
"action",
"s",
"access",
"to",
"A... | wavycloud/pyboto3 | python | https://github.com/wavycloud/pyboto3/blob/924957ccf994303713a4eed90b775ff2ab95b2e5/pyboto3/swf.py#L2631-L2748 | [
"def",
"register_activity_type",
"(",
"domain",
"=",
"None",
",",
"name",
"=",
"None",
",",
"version",
"=",
"None",
",",
"description",
"=",
"None",
",",
"defaultTaskStartToCloseTimeout",
"=",
"None",
",",
"defaultTaskHeartbeatTimeout",
"=",
"None",
",",
"defaul... | 924957ccf994303713a4eed90b775ff2ab95b2e5 |
train | register_workflow_type | Registers a new workflow type and its configuration settings in the specified domain.
The retention period for the workflow history is set by the RegisterDomain action.
Access Control
You can use IAM policies to control this action's access to Amazon SWF resources as follows:
If the caller does not hav... | pyboto3/swf.py | def register_workflow_type(domain=None, name=None, version=None, description=None, defaultTaskStartToCloseTimeout=None, defaultExecutionStartToCloseTimeout=None, defaultTaskList=None, defaultTaskPriority=None, defaultChildPolicy=None, defaultLambdaRole=None):
"""
Registers a new workflow type and its configurat... | def register_workflow_type(domain=None, name=None, version=None, description=None, defaultTaskStartToCloseTimeout=None, defaultExecutionStartToCloseTimeout=None, defaultTaskList=None, defaultTaskPriority=None, defaultChildPolicy=None, defaultLambdaRole=None):
"""
Registers a new workflow type and its configurat... | [
"Registers",
"a",
"new",
"workflow",
"type",
"and",
"its",
"configuration",
"settings",
"in",
"the",
"specified",
"domain",
".",
"The",
"retention",
"period",
"for",
"the",
"workflow",
"history",
"is",
"set",
"by",
"the",
"RegisterDomain",
"action",
".",
"Acce... | wavycloud/pyboto3 | python | https://github.com/wavycloud/pyboto3/blob/924957ccf994303713a4eed90b775ff2ab95b2e5/pyboto3/swf.py#L2797-L2923 | [
"def",
"register_workflow_type",
"(",
"domain",
"=",
"None",
",",
"name",
"=",
"None",
",",
"version",
"=",
"None",
",",
"description",
"=",
"None",
",",
"defaultTaskStartToCloseTimeout",
"=",
"None",
",",
"defaultExecutionStartToCloseTimeout",
"=",
"None",
",",
... | 924957ccf994303713a4eed90b775ff2ab95b2e5 |
train | start_workflow_execution | Starts an execution of the workflow type in the specified domain using the provided workflowId and input data.
This action returns the newly started workflow execution.
Access Control
You can use IAM policies to control this action's access to Amazon SWF resources as follows:
If the caller does not have... | pyboto3/swf.py | def start_workflow_execution(domain=None, workflowId=None, workflowType=None, taskList=None, taskPriority=None, input=None, executionStartToCloseTimeout=None, tagList=None, taskStartToCloseTimeout=None, childPolicy=None, lambdaRole=None):
"""
Starts an execution of the workflow type in the specified domain usin... | def start_workflow_execution(domain=None, workflowId=None, workflowType=None, taskList=None, taskPriority=None, input=None, executionStartToCloseTimeout=None, tagList=None, taskStartToCloseTimeout=None, childPolicy=None, lambdaRole=None):
"""
Starts an execution of the workflow type in the specified domain usin... | [
"Starts",
"an",
"execution",
"of",
"the",
"workflow",
"type",
"in",
"the",
"specified",
"domain",
"using",
"the",
"provided",
"workflowId",
"and",
"input",
"data",
".",
"This",
"action",
"returns",
"the",
"newly",
"started",
"workflow",
"execution",
".",
"Acce... | wavycloud/pyboto3 | python | https://github.com/wavycloud/pyboto3/blob/924957ccf994303713a4eed90b775ff2ab95b2e5/pyboto3/swf.py#L3478-L3668 | [
"def",
"start_workflow_execution",
"(",
"domain",
"=",
"None",
",",
"workflowId",
"=",
"None",
",",
"workflowType",
"=",
"None",
",",
"taskList",
"=",
"None",
",",
"taskPriority",
"=",
"None",
",",
"input",
"=",
"None",
",",
"executionStartToCloseTimeout",
"="... | 924957ccf994303713a4eed90b775ff2ab95b2e5 |
train | create_db_cluster | Creates a new Amazon Aurora DB cluster.
You can use the ReplicationSourceIdentifier parameter to create the DB cluster as a Read Replica of another DB cluster or Amazon RDS MySQL DB instance. For cross-region replication where the DB cluster identified by ReplicationSourceIdentifier is encrypted, you must also spec... | pyboto3/rds.py | def create_db_cluster(AvailabilityZones=None, BackupRetentionPeriod=None, CharacterSetName=None, DatabaseName=None, DBClusterIdentifier=None, DBClusterParameterGroupName=None, VpcSecurityGroupIds=None, DBSubnetGroupName=None, Engine=None, EngineVersion=None, Port=None, MasterUsername=None, MasterUserPassword=None, Opti... | def create_db_cluster(AvailabilityZones=None, BackupRetentionPeriod=None, CharacterSetName=None, DatabaseName=None, DBClusterIdentifier=None, DBClusterParameterGroupName=None, VpcSecurityGroupIds=None, DBSubnetGroupName=None, Engine=None, EngineVersion=None, Port=None, MasterUsername=None, MasterUserPassword=None, Opti... | [
"Creates",
"a",
"new",
"Amazon",
"Aurora",
"DB",
"cluster",
".",
"You",
"can",
"use",
"the",
"ReplicationSourceIdentifier",
"parameter",
"to",
"create",
"the",
"DB",
"cluster",
"as",
"a",
"Read",
"Replica",
"of",
"another",
"DB",
"cluster",
"or",
"Amazon",
"... | wavycloud/pyboto3 | python | https://github.com/wavycloud/pyboto3/blob/924957ccf994303713a4eed90b775ff2ab95b2e5/pyboto3/rds.py#L800-L1062 | [
"def",
"create_db_cluster",
"(",
"AvailabilityZones",
"=",
"None",
",",
"BackupRetentionPeriod",
"=",
"None",
",",
"CharacterSetName",
"=",
"None",
",",
"DatabaseName",
"=",
"None",
",",
"DBClusterIdentifier",
"=",
"None",
",",
"DBClusterParameterGroupName",
"=",
"N... | 924957ccf994303713a4eed90b775ff2ab95b2e5 |
train | create_db_instance | Creates a new DB instance.
See also: AWS API Documentation
Examples
This example creates a DB instance.
Expected Output:
:example: response = client.create_db_instance(
DBName='string',
DBInstanceIdentifier='string',
AllocatedStorage=123,
DBInstanceClass='st... | pyboto3/rds.py | def create_db_instance(DBName=None, DBInstanceIdentifier=None, AllocatedStorage=None, DBInstanceClass=None, Engine=None, MasterUsername=None, MasterUserPassword=None, DBSecurityGroups=None, VpcSecurityGroupIds=None, AvailabilityZone=None, DBSubnetGroupName=None, PreferredMaintenanceWindow=None, DBParameterGroupName=Non... | def create_db_instance(DBName=None, DBInstanceIdentifier=None, AllocatedStorage=None, DBInstanceClass=None, Engine=None, MasterUsername=None, MasterUserPassword=None, DBSecurityGroups=None, VpcSecurityGroupIds=None, AvailabilityZone=None, DBSubnetGroupName=None, PreferredMaintenanceWindow=None, DBParameterGroupName=Non... | [
"Creates",
"a",
"new",
"DB",
"instance",
".",
"See",
"also",
":",
"AWS",
"API",
"Documentation",
"Examples",
"This",
"example",
"creates",
"a",
"DB",
"instance",
".",
"Expected",
"Output",
":",
":",
"example",
":",
"response",
"=",
"client",
".",
"create_d... | wavycloud/pyboto3 | python | https://github.com/wavycloud/pyboto3/blob/924957ccf994303713a4eed90b775ff2ab95b2e5/pyboto3/rds.py#L1217-L1783 | [
"def",
"create_db_instance",
"(",
"DBName",
"=",
"None",
",",
"DBInstanceIdentifier",
"=",
"None",
",",
"AllocatedStorage",
"=",
"None",
",",
"DBInstanceClass",
"=",
"None",
",",
"Engine",
"=",
"None",
",",
"MasterUsername",
"=",
"None",
",",
"MasterUserPassword... | 924957ccf994303713a4eed90b775ff2ab95b2e5 |
train | create_db_instance_read_replica | Creates a DB instance for a DB instance running MySQL, MariaDB, or PostgreSQL that acts as a Read Replica of a source DB instance.
All Read Replica DB instances are created as Single-AZ deployments with backups disabled. All other DB instance attributes (including DB security groups and DB parameter groups) are inh... | pyboto3/rds.py | def create_db_instance_read_replica(DBInstanceIdentifier=None, SourceDBInstanceIdentifier=None, DBInstanceClass=None, AvailabilityZone=None, Port=None, AutoMinorVersionUpgrade=None, Iops=None, OptionGroupName=None, PubliclyAccessible=None, Tags=None, DBSubnetGroupName=None, StorageType=None, CopyTagsToSnapshot=None, Mo... | def create_db_instance_read_replica(DBInstanceIdentifier=None, SourceDBInstanceIdentifier=None, DBInstanceClass=None, AvailabilityZone=None, Port=None, AutoMinorVersionUpgrade=None, Iops=None, OptionGroupName=None, PubliclyAccessible=None, Tags=None, DBSubnetGroupName=None, StorageType=None, CopyTagsToSnapshot=None, Mo... | [
"Creates",
"a",
"DB",
"instance",
"for",
"a",
"DB",
"instance",
"running",
"MySQL",
"MariaDB",
"or",
"PostgreSQL",
"that",
"acts",
"as",
"a",
"Read",
"Replica",
"of",
"a",
"source",
"DB",
"instance",
".",
"All",
"Read",
"Replica",
"DB",
"instances",
"are",... | wavycloud/pyboto3 | python | https://github.com/wavycloud/pyboto3/blob/924957ccf994303713a4eed90b775ff2ab95b2e5/pyboto3/rds.py#L1785-L2081 | [
"def",
"create_db_instance_read_replica",
"(",
"DBInstanceIdentifier",
"=",
"None",
",",
"SourceDBInstanceIdentifier",
"=",
"None",
",",
"DBInstanceClass",
"=",
"None",
",",
"AvailabilityZone",
"=",
"None",
",",
"Port",
"=",
"None",
",",
"AutoMinorVersionUpgrade",
"="... | 924957ccf994303713a4eed90b775ff2ab95b2e5 |
train | describe_db_engine_versions | Returns a list of the available DB engines.
See also: AWS API Documentation
Examples
This example lists settings for the specified DB engine version.
Expected Output:
:example: response = client.describe_db_engine_versions(
Engine='string',
EngineVersion='string',
D... | pyboto3/rds.py | def describe_db_engine_versions(Engine=None, EngineVersion=None, DBParameterGroupFamily=None, Filters=None, MaxRecords=None, Marker=None, DefaultOnly=None, ListSupportedCharacterSets=None, ListSupportedTimezones=None):
"""
Returns a list of the available DB engines.
See also: AWS API Documentation
... | def describe_db_engine_versions(Engine=None, EngineVersion=None, DBParameterGroupFamily=None, Filters=None, MaxRecords=None, Marker=None, DefaultOnly=None, ListSupportedCharacterSets=None, ListSupportedTimezones=None):
"""
Returns a list of the available DB engines.
See also: AWS API Documentation
... | [
"Returns",
"a",
"list",
"of",
"the",
"available",
"DB",
"engines",
".",
"See",
"also",
":",
"AWS",
"API",
"Documentation",
"Examples",
"This",
"example",
"lists",
"settings",
"for",
"the",
"specified",
"DB",
"engine",
"version",
".",
"Expected",
"Output",
":... | wavycloud/pyboto3 | python | https://github.com/wavycloud/pyboto3/blob/924957ccf994303713a4eed90b775ff2ab95b2e5/pyboto3/rds.py#L3813-L3925 | [
"def",
"describe_db_engine_versions",
"(",
"Engine",
"=",
"None",
",",
"EngineVersion",
"=",
"None",
",",
"DBParameterGroupFamily",
"=",
"None",
",",
"Filters",
"=",
"None",
",",
"MaxRecords",
"=",
"None",
",",
"Marker",
"=",
"None",
",",
"DefaultOnly",
"=",
... | 924957ccf994303713a4eed90b775ff2ab95b2e5 |
train | describe_reserved_db_instances | Returns information about reserved DB instances for this account, or about a specified reserved DB instance.
See also: AWS API Documentation
Examples
This example lists information for all reserved DB instances for the specified DB instance class, duration, product, offering type, and availability zone... | pyboto3/rds.py | def describe_reserved_db_instances(ReservedDBInstanceId=None, ReservedDBInstancesOfferingId=None, DBInstanceClass=None, Duration=None, ProductDescription=None, OfferingType=None, MultiAZ=None, Filters=None, MaxRecords=None, Marker=None):
"""
Returns information about reserved DB instances for this account, or a... | def describe_reserved_db_instances(ReservedDBInstanceId=None, ReservedDBInstancesOfferingId=None, DBInstanceClass=None, Duration=None, ProductDescription=None, OfferingType=None, MultiAZ=None, Filters=None, MaxRecords=None, Marker=None):
"""
Returns information about reserved DB instances for this account, or a... | [
"Returns",
"information",
"about",
"reserved",
"DB",
"instances",
"for",
"this",
"account",
"or",
"about",
"a",
"specified",
"reserved",
"DB",
"instance",
".",
"See",
"also",
":",
"AWS",
"API",
"Documentation",
"Examples",
"This",
"example",
"lists",
"informatio... | wavycloud/pyboto3 | python | https://github.com/wavycloud/pyboto3/blob/924957ccf994303713a4eed90b775ff2ab95b2e5/pyboto3/rds.py#L5435-L5539 | [
"def",
"describe_reserved_db_instances",
"(",
"ReservedDBInstanceId",
"=",
"None",
",",
"ReservedDBInstancesOfferingId",
"=",
"None",
",",
"DBInstanceClass",
"=",
"None",
",",
"Duration",
"=",
"None",
",",
"ProductDescription",
"=",
"None",
",",
"OfferingType",
"=",
... | 924957ccf994303713a4eed90b775ff2ab95b2e5 |
train | describe_reserved_db_instances_offerings | Lists available reserved DB instance offerings.
See also: AWS API Documentation
Examples
This example lists information for all reserved DB instance offerings for the specified DB instance class, duration, product, offering type, and availability zone settings.
Expected Output:
:example: r... | pyboto3/rds.py | def describe_reserved_db_instances_offerings(ReservedDBInstancesOfferingId=None, DBInstanceClass=None, Duration=None, ProductDescription=None, OfferingType=None, MultiAZ=None, Filters=None, MaxRecords=None, Marker=None):
"""
Lists available reserved DB instance offerings.
See also: AWS API Documentation
... | def describe_reserved_db_instances_offerings(ReservedDBInstancesOfferingId=None, DBInstanceClass=None, Duration=None, ProductDescription=None, OfferingType=None, MultiAZ=None, Filters=None, MaxRecords=None, Marker=None):
"""
Lists available reserved DB instance offerings.
See also: AWS API Documentation
... | [
"Lists",
"available",
"reserved",
"DB",
"instance",
"offerings",
".",
"See",
"also",
":",
"AWS",
"API",
"Documentation",
"Examples",
"This",
"example",
"lists",
"information",
"for",
"all",
"reserved",
"DB",
"instance",
"offerings",
"for",
"the",
"specified",
"D... | wavycloud/pyboto3 | python | https://github.com/wavycloud/pyboto3/blob/924957ccf994303713a4eed90b775ff2ab95b2e5/pyboto3/rds.py#L5541-L5638 | [
"def",
"describe_reserved_db_instances_offerings",
"(",
"ReservedDBInstancesOfferingId",
"=",
"None",
",",
"DBInstanceClass",
"=",
"None",
",",
"Duration",
"=",
"None",
",",
"ProductDescription",
"=",
"None",
",",
"OfferingType",
"=",
"None",
",",
"MultiAZ",
"=",
"N... | 924957ccf994303713a4eed90b775ff2ab95b2e5 |
train | modify_db_cluster | Modify a setting for an Amazon Aurora DB cluster. You can change one or more database configuration parameters by specifying these parameters and the new values in the request. For more information on Amazon Aurora, see Aurora on Amazon RDS in the Amazon RDS User Guide.
See also: AWS API Documentation
Exam... | pyboto3/rds.py | def modify_db_cluster(DBClusterIdentifier=None, NewDBClusterIdentifier=None, ApplyImmediately=None, BackupRetentionPeriod=None, DBClusterParameterGroupName=None, VpcSecurityGroupIds=None, Port=None, MasterUserPassword=None, OptionGroupName=None, PreferredBackupWindow=None, PreferredMaintenanceWindow=None, EnableIAMData... | def modify_db_cluster(DBClusterIdentifier=None, NewDBClusterIdentifier=None, ApplyImmediately=None, BackupRetentionPeriod=None, DBClusterParameterGroupName=None, VpcSecurityGroupIds=None, Port=None, MasterUserPassword=None, OptionGroupName=None, PreferredBackupWindow=None, PreferredMaintenanceWindow=None, EnableIAMData... | [
"Modify",
"a",
"setting",
"for",
"an",
"Amazon",
"Aurora",
"DB",
"cluster",
".",
"You",
"can",
"change",
"one",
"or",
"more",
"database",
"configuration",
"parameters",
"by",
"specifying",
"these",
"parameters",
"and",
"the",
"new",
"values",
"in",
"the",
"r... | wavycloud/pyboto3 | python | https://github.com/wavycloud/pyboto3/blob/924957ccf994303713a4eed90b775ff2ab95b2e5/pyboto3/rds.py#L5982-L6164 | [
"def",
"modify_db_cluster",
"(",
"DBClusterIdentifier",
"=",
"None",
",",
"NewDBClusterIdentifier",
"=",
"None",
",",
"ApplyImmediately",
"=",
"None",
",",
"BackupRetentionPeriod",
"=",
"None",
",",
"DBClusterParameterGroupName",
"=",
"None",
",",
"VpcSecurityGroupIds",... | 924957ccf994303713a4eed90b775ff2ab95b2e5 |
train | modify_db_instance | Modifies settings for a DB instance. You can change one or more database configuration parameters by specifying these parameters and the new values in the request.
See also: AWS API Documentation
Examples
This example immediately changes the specified settings for the specified DB instance.
Expecte... | pyboto3/rds.py | def modify_db_instance(DBInstanceIdentifier=None, AllocatedStorage=None, DBInstanceClass=None, DBSubnetGroupName=None, DBSecurityGroups=None, VpcSecurityGroupIds=None, ApplyImmediately=None, MasterUserPassword=None, DBParameterGroupName=None, BackupRetentionPeriod=None, PreferredBackupWindow=None, PreferredMaintenanceW... | def modify_db_instance(DBInstanceIdentifier=None, AllocatedStorage=None, DBInstanceClass=None, DBSubnetGroupName=None, DBSecurityGroups=None, VpcSecurityGroupIds=None, ApplyImmediately=None, MasterUserPassword=None, DBParameterGroupName=None, BackupRetentionPeriod=None, PreferredBackupWindow=None, PreferredMaintenanceW... | [
"Modifies",
"settings",
"for",
"a",
"DB",
"instance",
".",
"You",
"can",
"change",
"one",
"or",
"more",
"database",
"configuration",
"parameters",
"by",
"specifying",
"these",
"parameters",
"and",
"the",
"new",
"values",
"in",
"the",
"request",
".",
"See",
"... | wavycloud/pyboto3 | python | https://github.com/wavycloud/pyboto3/blob/924957ccf994303713a4eed90b775ff2ab95b2e5/pyboto3/rds.py#L6300-L6729 | [
"def",
"modify_db_instance",
"(",
"DBInstanceIdentifier",
"=",
"None",
",",
"AllocatedStorage",
"=",
"None",
",",
"DBInstanceClass",
"=",
"None",
",",
"DBSubnetGroupName",
"=",
"None",
",",
"DBSecurityGroups",
"=",
"None",
",",
"VpcSecurityGroupIds",
"=",
"None",
... | 924957ccf994303713a4eed90b775ff2ab95b2e5 |
train | restore_db_cluster_from_s3 | Creates an Amazon Aurora DB cluster from data stored in an Amazon S3 bucket. Amazon RDS must be authorized to access the Amazon S3 bucket and the data must be created using the Percona XtraBackup utility as described in Migrating Data from MySQL by Using an Amazon S3 Bucket .
See also: AWS API Documentation
... | pyboto3/rds.py | def restore_db_cluster_from_s3(AvailabilityZones=None, BackupRetentionPeriod=None, CharacterSetName=None, DatabaseName=None, DBClusterIdentifier=None, DBClusterParameterGroupName=None, VpcSecurityGroupIds=None, DBSubnetGroupName=None, Engine=None, EngineVersion=None, Port=None, MasterUsername=None, MasterUserPassword=N... | def restore_db_cluster_from_s3(AvailabilityZones=None, BackupRetentionPeriod=None, CharacterSetName=None, DatabaseName=None, DBClusterIdentifier=None, DBClusterParameterGroupName=None, VpcSecurityGroupIds=None, DBSubnetGroupName=None, Engine=None, EngineVersion=None, Port=None, MasterUsername=None, MasterUserPassword=N... | [
"Creates",
"an",
"Amazon",
"Aurora",
"DB",
"cluster",
"from",
"data",
"stored",
"in",
"an",
"Amazon",
"S3",
"bucket",
".",
"Amazon",
"RDS",
"must",
"be",
"authorized",
"to",
"access",
"the",
"Amazon",
"S3",
"bucket",
"and",
"the",
"data",
"must",
"be",
"... | wavycloud/pyboto3 | python | https://github.com/wavycloud/pyboto3/blob/924957ccf994303713a4eed90b775ff2ab95b2e5/pyboto3/rds.py#L7988-L8258 | [
"def",
"restore_db_cluster_from_s3",
"(",
"AvailabilityZones",
"=",
"None",
",",
"BackupRetentionPeriod",
"=",
"None",
",",
"CharacterSetName",
"=",
"None",
",",
"DatabaseName",
"=",
"None",
",",
"DBClusterIdentifier",
"=",
"None",
",",
"DBClusterParameterGroupName",
... | 924957ccf994303713a4eed90b775ff2ab95b2e5 |
train | restore_db_cluster_from_snapshot | Creates a new DB cluster from a DB cluster snapshot. The target DB cluster is created from the source DB cluster restore point with the same configuration as the original source DB cluster, except that the new DB cluster is created with the default security group.
For more information on Amazon Aurora, see Aurora o... | pyboto3/rds.py | def restore_db_cluster_from_snapshot(AvailabilityZones=None, DBClusterIdentifier=None, SnapshotIdentifier=None, Engine=None, EngineVersion=None, Port=None, DBSubnetGroupName=None, DatabaseName=None, OptionGroupName=None, VpcSecurityGroupIds=None, Tags=None, KmsKeyId=None, EnableIAMDatabaseAuthentication=None):
"""
... | def restore_db_cluster_from_snapshot(AvailabilityZones=None, DBClusterIdentifier=None, SnapshotIdentifier=None, Engine=None, EngineVersion=None, Port=None, DBSubnetGroupName=None, DatabaseName=None, OptionGroupName=None, VpcSecurityGroupIds=None, Tags=None, KmsKeyId=None, EnableIAMDatabaseAuthentication=None):
"""
... | [
"Creates",
"a",
"new",
"DB",
"cluster",
"from",
"a",
"DB",
"cluster",
"snapshot",
".",
"The",
"target",
"DB",
"cluster",
"is",
"created",
"from",
"the",
"source",
"DB",
"cluster",
"restore",
"point",
"with",
"the",
"same",
"configuration",
"as",
"the",
"or... | wavycloud/pyboto3 | python | https://github.com/wavycloud/pyboto3/blob/924957ccf994303713a4eed90b775ff2ab95b2e5/pyboto3/rds.py#L8260-L8450 | [
"def",
"restore_db_cluster_from_snapshot",
"(",
"AvailabilityZones",
"=",
"None",
",",
"DBClusterIdentifier",
"=",
"None",
",",
"SnapshotIdentifier",
"=",
"None",
",",
"Engine",
"=",
"None",
",",
"EngineVersion",
"=",
"None",
",",
"Port",
"=",
"None",
",",
"DBSu... | 924957ccf994303713a4eed90b775ff2ab95b2e5 |
train | restore_db_cluster_to_point_in_time | Restores a DB cluster to an arbitrary point in time. Users can restore to any point in time before LatestRestorableTime for up to BackupRetentionPeriod days. The target DB cluster is created from the source DB cluster with the same configuration as the original DB cluster, except that the new DB cluster is created with... | pyboto3/rds.py | def restore_db_cluster_to_point_in_time(DBClusterIdentifier=None, SourceDBClusterIdentifier=None, RestoreToTime=None, UseLatestRestorableTime=None, Port=None, DBSubnetGroupName=None, OptionGroupName=None, VpcSecurityGroupIds=None, Tags=None, KmsKeyId=None, EnableIAMDatabaseAuthentication=None):
"""
Restores a D... | def restore_db_cluster_to_point_in_time(DBClusterIdentifier=None, SourceDBClusterIdentifier=None, RestoreToTime=None, UseLatestRestorableTime=None, Port=None, DBSubnetGroupName=None, OptionGroupName=None, VpcSecurityGroupIds=None, Tags=None, KmsKeyId=None, EnableIAMDatabaseAuthentication=None):
"""
Restores a D... | [
"Restores",
"a",
"DB",
"cluster",
"to",
"an",
"arbitrary",
"point",
"in",
"time",
".",
"Users",
"can",
"restore",
"to",
"any",
"point",
"in",
"time",
"before",
"LatestRestorableTime",
"for",
"up",
"to",
"BackupRetentionPeriod",
"days",
".",
"The",
"target",
... | wavycloud/pyboto3 | python | https://github.com/wavycloud/pyboto3/blob/924957ccf994303713a4eed90b775ff2ab95b2e5/pyboto3/rds.py#L8452-L8637 | [
"def",
"restore_db_cluster_to_point_in_time",
"(",
"DBClusterIdentifier",
"=",
"None",
",",
"SourceDBClusterIdentifier",
"=",
"None",
",",
"RestoreToTime",
"=",
"None",
",",
"UseLatestRestorableTime",
"=",
"None",
",",
"Port",
"=",
"None",
",",
"DBSubnetGroupName",
"=... | 924957ccf994303713a4eed90b775ff2ab95b2e5 |
train | restore_db_instance_from_db_snapshot | Creates a new DB instance from a DB snapshot. The target database is created from the source database restore point with the most of original configuration with the default security group and the default DB parameter group. By default, the new DB instance is created as a single-AZ deployment except when the instance is... | pyboto3/rds.py | def restore_db_instance_from_db_snapshot(DBInstanceIdentifier=None, DBSnapshotIdentifier=None, DBInstanceClass=None, Port=None, AvailabilityZone=None, DBSubnetGroupName=None, MultiAZ=None, PubliclyAccessible=None, AutoMinorVersionUpgrade=None, LicenseModel=None, DBName=None, Engine=None, Iops=None, OptionGroupName=None... | def restore_db_instance_from_db_snapshot(DBInstanceIdentifier=None, DBSnapshotIdentifier=None, DBInstanceClass=None, Port=None, AvailabilityZone=None, DBSubnetGroupName=None, MultiAZ=None, PubliclyAccessible=None, AutoMinorVersionUpgrade=None, LicenseModel=None, DBName=None, Engine=None, Iops=None, OptionGroupName=None... | [
"Creates",
"a",
"new",
"DB",
"instance",
"from",
"a",
"DB",
"snapshot",
".",
"The",
"target",
"database",
"is",
"created",
"from",
"the",
"source",
"database",
"restore",
"point",
"with",
"the",
"most",
"of",
"original",
"configuration",
"with",
"the",
"defa... | wavycloud/pyboto3 | python | https://github.com/wavycloud/pyboto3/blob/924957ccf994303713a4eed90b775ff2ab95b2e5/pyboto3/rds.py#L8639-L8941 | [
"def",
"restore_db_instance_from_db_snapshot",
"(",
"DBInstanceIdentifier",
"=",
"None",
",",
"DBSnapshotIdentifier",
"=",
"None",
",",
"DBInstanceClass",
"=",
"None",
",",
"Port",
"=",
"None",
",",
"AvailabilityZone",
"=",
"None",
",",
"DBSubnetGroupName",
"=",
"No... | 924957ccf994303713a4eed90b775ff2ab95b2e5 |
train | restore_db_instance_to_point_in_time | Restores a DB instance to an arbitrary point in time. You can restore to any point in time before the time identified by the LatestRestorableTime property. You can restore to a point up to the number of days specified by the BackupRetentionPeriod property.
The target database is created with most of the original co... | pyboto3/rds.py | def restore_db_instance_to_point_in_time(SourceDBInstanceIdentifier=None, TargetDBInstanceIdentifier=None, RestoreTime=None, UseLatestRestorableTime=None, DBInstanceClass=None, Port=None, AvailabilityZone=None, DBSubnetGroupName=None, MultiAZ=None, PubliclyAccessible=None, AutoMinorVersionUpgrade=None, LicenseModel=Non... | def restore_db_instance_to_point_in_time(SourceDBInstanceIdentifier=None, TargetDBInstanceIdentifier=None, RestoreTime=None, UseLatestRestorableTime=None, DBInstanceClass=None, Port=None, AvailabilityZone=None, DBSubnetGroupName=None, MultiAZ=None, PubliclyAccessible=None, AutoMinorVersionUpgrade=None, LicenseModel=Non... | [
"Restores",
"a",
"DB",
"instance",
"to",
"an",
"arbitrary",
"point",
"in",
"time",
".",
"You",
"can",
"restore",
"to",
"any",
"point",
"in",
"time",
"before",
"the",
"time",
"identified",
"by",
"the",
"LatestRestorableTime",
"property",
".",
"You",
"can",
... | wavycloud/pyboto3 | python | https://github.com/wavycloud/pyboto3/blob/924957ccf994303713a4eed90b775ff2ab95b2e5/pyboto3/rds.py#L8943-L9261 | [
"def",
"restore_db_instance_to_point_in_time",
"(",
"SourceDBInstanceIdentifier",
"=",
"None",
",",
"TargetDBInstanceIdentifier",
"=",
"None",
",",
"RestoreTime",
"=",
"None",
",",
"UseLatestRestorableTime",
"=",
"None",
",",
"DBInstanceClass",
"=",
"None",
",",
"Port",... | 924957ccf994303713a4eed90b775ff2ab95b2e5 |
train | update_health_check | Updates an existing health check. Note that some values can't be updated.
For more information about updating health checks, see Creating, Updating, and Deleting Health Checks in the Amazon Route 53 Developer Guide .
See also: AWS API Documentation
:example: response = client.update_health_check(
... | pyboto3/route53.py | def update_health_check(HealthCheckId=None, HealthCheckVersion=None, IPAddress=None, Port=None, ResourcePath=None, FullyQualifiedDomainName=None, SearchString=None, FailureThreshold=None, Inverted=None, HealthThreshold=None, ChildHealthChecks=None, EnableSNI=None, Regions=None, AlarmIdentifier=None, InsufficientDataHea... | def update_health_check(HealthCheckId=None, HealthCheckVersion=None, IPAddress=None, Port=None, ResourcePath=None, FullyQualifiedDomainName=None, SearchString=None, FailureThreshold=None, Inverted=None, HealthThreshold=None, ChildHealthChecks=None, EnableSNI=None, Regions=None, AlarmIdentifier=None, InsufficientDataHea... | [
"Updates",
"an",
"existing",
"health",
"check",
".",
"Note",
"that",
"some",
"values",
"can",
"t",
"be",
"updated",
".",
"For",
"more",
"information",
"about",
"updating",
"health",
"checks",
"see",
"Creating",
"Updating",
"and",
"Deleting",
"Health",
"Checks"... | wavycloud/pyboto3 | python | https://github.com/wavycloud/pyboto3/blob/924957ccf994303713a4eed90b775ff2ab95b2e5/pyboto3/route53.py#L2976-L3170 | [
"def",
"update_health_check",
"(",
"HealthCheckId",
"=",
"None",
",",
"HealthCheckVersion",
"=",
"None",
",",
"IPAddress",
"=",
"None",
",",
"Port",
"=",
"None",
",",
"ResourcePath",
"=",
"None",
",",
"FullyQualifiedDomainName",
"=",
"None",
",",
"SearchString",... | 924957ccf994303713a4eed90b775ff2ab95b2e5 |
train | create_hit | The CreateHIT operation creates a new Human Intelligence Task (HIT). The new HIT is made available for Workers to find and accept on the Amazon Mechanical Turk website.
This operation allows you to specify a new HIT by passing in values for the properties of the HIT, such as its title, reward amount and number of a... | pyboto3/mturk.py | def create_hit(MaxAssignments=None, AutoApprovalDelayInSeconds=None, LifetimeInSeconds=None, AssignmentDurationInSeconds=None, Reward=None, Title=None, Keywords=None, Description=None, Question=None, RequesterAnnotation=None, QualificationRequirements=None, UniqueRequestToken=None, AssignmentReviewPolicy=None, HITRevie... | def create_hit(MaxAssignments=None, AutoApprovalDelayInSeconds=None, LifetimeInSeconds=None, AssignmentDurationInSeconds=None, Reward=None, Title=None, Keywords=None, Description=None, Question=None, RequesterAnnotation=None, QualificationRequirements=None, UniqueRequestToken=None, AssignmentReviewPolicy=None, HITRevie... | [
"The",
"CreateHIT",
"operation",
"creates",
"a",
"new",
"Human",
"Intelligence",
"Task",
"(",
"HIT",
")",
".",
"The",
"new",
"HIT",
"is",
"made",
"available",
"for",
"Workers",
"to",
"find",
"and",
"accept",
"on",
"the",
"Amazon",
"Mechanical",
"Turk",
"we... | wavycloud/pyboto3 | python | https://github.com/wavycloud/pyboto3/blob/924957ccf994303713a4eed90b775ff2ab95b2e5/pyboto3/mturk.py#L195-L442 | [
"def",
"create_hit",
"(",
"MaxAssignments",
"=",
"None",
",",
"AutoApprovalDelayInSeconds",
"=",
"None",
",",
"LifetimeInSeconds",
"=",
"None",
",",
"AssignmentDurationInSeconds",
"=",
"None",
",",
"Reward",
"=",
"None",
",",
"Title",
"=",
"None",
",",
"Keywords... | 924957ccf994303713a4eed90b775ff2ab95b2e5 |
train | create_hit_with_hit_type | The CreateHITWithHITType operation creates a new Human Intelligence Task (HIT) using an existing HITTypeID generated by the CreateHITType operation.
This is an alternative way to create HITs from the CreateHIT operation. This is the recommended best practice for Requesters who are creating large numbers of HITs.
... | pyboto3/mturk.py | def create_hit_with_hit_type(HITTypeId=None, MaxAssignments=None, LifetimeInSeconds=None, Question=None, RequesterAnnotation=None, UniqueRequestToken=None, AssignmentReviewPolicy=None, HITReviewPolicy=None, HITLayoutId=None, HITLayoutParameters=None):
"""
The CreateHITWithHITType operation creates a new Human I... | def create_hit_with_hit_type(HITTypeId=None, MaxAssignments=None, LifetimeInSeconds=None, Question=None, RequesterAnnotation=None, UniqueRequestToken=None, AssignmentReviewPolicy=None, HITReviewPolicy=None, HITLayoutId=None, HITLayoutParameters=None):
"""
The CreateHITWithHITType operation creates a new Human I... | [
"The",
"CreateHITWithHITType",
"operation",
"creates",
"a",
"new",
"Human",
"Intelligence",
"Task",
"(",
"HIT",
")",
"using",
"an",
"existing",
"HITTypeID",
"generated",
"by",
"the",
"CreateHITType",
"operation",
".",
"This",
"is",
"an",
"alternative",
"way",
"t... | wavycloud/pyboto3 | python | https://github.com/wavycloud/pyboto3/blob/924957ccf994303713a4eed90b775ff2ab95b2e5/pyboto3/mturk.py#L527-L715 | [
"def",
"create_hit_with_hit_type",
"(",
"HITTypeId",
"=",
"None",
",",
"MaxAssignments",
"=",
"None",
",",
"LifetimeInSeconds",
"=",
"None",
",",
"Question",
"=",
"None",
",",
"RequesterAnnotation",
"=",
"None",
",",
"UniqueRequestToken",
"=",
"None",
",",
"Assi... | 924957ccf994303713a4eed90b775ff2ab95b2e5 |
train | create_qualification_type | The CreateQualificationType operation creates a new Qualification type, which is represented by a QualificationType data structure.
See also: AWS API Documentation
:example: response = client.create_qualification_type(
Name='string',
Keywords='string',
Description='string',
... | pyboto3/mturk.py | def create_qualification_type(Name=None, Keywords=None, Description=None, QualificationTypeStatus=None, RetryDelayInSeconds=None, Test=None, AnswerKey=None, TestDurationInSeconds=None, AutoGranted=None, AutoGrantedValue=None):
"""
The CreateQualificationType operation creates a new Qualification type, which is ... | def create_qualification_type(Name=None, Keywords=None, Description=None, QualificationTypeStatus=None, RetryDelayInSeconds=None, Test=None, AnswerKey=None, TestDurationInSeconds=None, AutoGranted=None, AutoGrantedValue=None):
"""
The CreateQualificationType operation creates a new Qualification type, which is ... | [
"The",
"CreateQualificationType",
"operation",
"creates",
"a",
"new",
"Qualification",
"type",
"which",
"is",
"represented",
"by",
"a",
"QualificationType",
"data",
"structure",
".",
"See",
"also",
":",
"AWS",
"API",
"Documentation",
":",
"example",
":",
"response... | wavycloud/pyboto3 | python | https://github.com/wavycloud/pyboto3/blob/924957ccf994303713a4eed90b775ff2ab95b2e5/pyboto3/mturk.py#L717-L805 | [
"def",
"create_qualification_type",
"(",
"Name",
"=",
"None",
",",
"Keywords",
"=",
"None",
",",
"Description",
"=",
"None",
",",
"QualificationTypeStatus",
"=",
"None",
",",
"RetryDelayInSeconds",
"=",
"None",
",",
"Test",
"=",
"None",
",",
"AnswerKey",
"=",
... | 924957ccf994303713a4eed90b775ff2ab95b2e5 |
train | update_qualification_type | The UpdateQualificationType operation modifies the attributes of an existing Qualification type, which is represented by a QualificationType data structure. Only the owner of a Qualification type can modify its attributes.
Most attributes of a Qualification type can be changed after the type has been created. Howev... | pyboto3/mturk.py | def update_qualification_type(QualificationTypeId=None, Description=None, QualificationTypeStatus=None, Test=None, AnswerKey=None, TestDurationInSeconds=None, RetryDelayInSeconds=None, AutoGranted=None, AutoGrantedValue=None):
"""
The UpdateQualificationType operation modifies the attributes of an existing Qual... | def update_qualification_type(QualificationTypeId=None, Description=None, QualificationTypeStatus=None, Test=None, AnswerKey=None, TestDurationInSeconds=None, RetryDelayInSeconds=None, AutoGranted=None, AutoGrantedValue=None):
"""
The UpdateQualificationType operation modifies the attributes of an existing Qual... | [
"The",
"UpdateQualificationType",
"operation",
"modifies",
"the",
"attributes",
"of",
"an",
"existing",
"Qualification",
"type",
"which",
"is",
"represented",
"by",
"a",
"QualificationType",
"data",
"structure",
".",
"Only",
"the",
"owner",
"of",
"a",
"Qualification... | wavycloud/pyboto3 | python | https://github.com/wavycloud/pyboto3/blob/924957ccf994303713a4eed90b775ff2ab95b2e5/pyboto3/mturk.py#L2271-L2351 | [
"def",
"update_qualification_type",
"(",
"QualificationTypeId",
"=",
"None",
",",
"Description",
"=",
"None",
",",
"QualificationTypeStatus",
"=",
"None",
",",
"Test",
"=",
"None",
",",
"AnswerKey",
"=",
"None",
",",
"TestDurationInSeconds",
"=",
"None",
",",
"R... | 924957ccf994303713a4eed90b775ff2ab95b2e5 |
train | str2hashalgo | Convert the name of a hash algorithm as described in the OATH
specifications, to a python object handling the digest algorithm
interface, PEP-xxx.
:param description
the name of the hash algorithm, example
:rtype: a hash algorithm class constructor | oath/_ocra.py | def str2hashalgo(description):
'''Convert the name of a hash algorithm as described in the OATH
specifications, to a python object handling the digest algorithm
interface, PEP-xxx.
:param description
the name of the hash algorithm, example
:rtype: a hash algorithm class const... | def str2hashalgo(description):
'''Convert the name of a hash algorithm as described in the OATH
specifications, to a python object handling the digest algorithm
interface, PEP-xxx.
:param description
the name of the hash algorithm, example
:rtype: a hash algorithm class const... | [
"Convert",
"the",
"name",
"of",
"a",
"hash",
"algorithm",
"as",
"described",
"in",
"the",
"OATH",
"specifications",
"to",
"a",
"python",
"object",
"handling",
"the",
"digest",
"algorithm",
"interface",
"PEP",
"-",
"xxx",
"."
] | bdauvergne/python-oath | python | https://github.com/bdauvergne/python-oath/blob/c37cd63880b39032b9ba69cd1516e6fb06923e46/oath/_ocra.py#L73-L85 | [
"def",
"str2hashalgo",
"(",
"description",
")",
":",
"algo",
"=",
"getattr",
"(",
"hashlib",
",",
"description",
".",
"lower",
"(",
")",
",",
"None",
")",
"if",
"not",
"callable",
"(",
"algo",
")",
":",
"raise",
"ValueError",
"(",
"'Unknown hash algorithm ... | c37cd63880b39032b9ba69cd1516e6fb06923e46 |
train | str2cryptofunction | Convert an OCRA crypto function description into a CryptoFunction
instance
:param crypto_function_description:
:returns:
the CryptoFunction object
:rtype: CryptoFunction | oath/_ocra.py | def str2cryptofunction(crypto_function_description):
'''
Convert an OCRA crypto function description into a CryptoFunction
instance
:param crypto_function_description:
:returns:
the CryptoFunction object
:rtype: CryptoFunction
'''
s = crypto_function_descriptio... | def str2cryptofunction(crypto_function_description):
'''
Convert an OCRA crypto function description into a CryptoFunction
instance
:param crypto_function_description:
:returns:
the CryptoFunction object
:rtype: CryptoFunction
'''
s = crypto_function_descriptio... | [
"Convert",
"an",
"OCRA",
"crypto",
"function",
"description",
"into",
"a",
"CryptoFunction",
"instance"
] | bdauvergne/python-oath | python | https://github.com/bdauvergne/python-oath/blob/c37cd63880b39032b9ba69cd1516e6fb06923e46/oath/_ocra.py#L87-L109 | [
"def",
"str2cryptofunction",
"(",
"crypto_function_description",
")",
":",
"s",
"=",
"crypto_function_description",
".",
"split",
"(",
"'-'",
")",
"if",
"len",
"(",
"s",
")",
"!=",
"3",
":",
"raise",
"ValueError",
"(",
"'CryptoFunction description must be triplet se... | c37cd63880b39032b9ba69cd1516e6fb06923e46 |
train | hotp | Compute a HOTP value as prescribed by RFC4226
:param key:
the HOTP secret key given as an hexadecimal string
:param counter:
the OTP generation counter
:param format:
the output format, can be:
- hex, for a variable length hexadecimal format,
... | oath/_hotp.py | def hotp(key,counter,format='dec6',hash=hashlib.sha1):
'''
Compute a HOTP value as prescribed by RFC4226
:param key:
the HOTP secret key given as an hexadecimal string
:param counter:
the OTP generation counter
:param format:
the output format, can be:
... | def hotp(key,counter,format='dec6',hash=hashlib.sha1):
'''
Compute a HOTP value as prescribed by RFC4226
:param key:
the HOTP secret key given as an hexadecimal string
:param counter:
the OTP generation counter
:param format:
the output format, can be:
... | [
"Compute",
"a",
"HOTP",
"value",
"as",
"prescribed",
"by",
"RFC4226"
] | bdauvergne/python-oath | python | https://github.com/bdauvergne/python-oath/blob/c37cd63880b39032b9ba69cd1516e6fb06923e46/oath/_hotp.py#L43-L91 | [
"def",
"hotp",
"(",
"key",
",",
"counter",
",",
"format",
"=",
"'dec6'",
",",
"hash",
"=",
"hashlib",
".",
"sha1",
")",
":",
"bin_hotp",
"=",
"__hotp",
"(",
"key",
",",
"counter",
",",
"hash",
")",
"if",
"format",
"==",
"'dec4'",
":",
"return",
"de... | c37cd63880b39032b9ba69cd1516e6fb06923e46 |
train | accept_hotp | Validate a HOTP value inside a window of
[counter-backward_drift:counter+forward_drift]
:param key:
the shared secret
:type key:
hexadecimal string of even length
:param response:
the OTP to check
:type response:
ASCII string
:param ... | oath/_hotp.py | def accept_hotp(key, response, counter, format='dec6', hash=hashlib.sha1,
drift=3, backward_drift=0):
'''
Validate a HOTP value inside a window of
[counter-backward_drift:counter+forward_drift]
:param key:
the shared secret
:type key:
hexadecimal string of ... | def accept_hotp(key, response, counter, format='dec6', hash=hashlib.sha1,
drift=3, backward_drift=0):
'''
Validate a HOTP value inside a window of
[counter-backward_drift:counter+forward_drift]
:param key:
the shared secret
:type key:
hexadecimal string of ... | [
"Validate",
"a",
"HOTP",
"value",
"inside",
"a",
"window",
"of",
"[",
"counter",
"-",
"backward_drift",
":",
"counter",
"+",
"forward_drift",
"]"
] | bdauvergne/python-oath | python | https://github.com/bdauvergne/python-oath/blob/c37cd63880b39032b9ba69cd1516e6fb06923e46/oath/_hotp.py#L93-L157 | [
"def",
"accept_hotp",
"(",
"key",
",",
"response",
",",
"counter",
",",
"format",
"=",
"'dec6'",
",",
"hash",
"=",
"hashlib",
".",
"sha1",
",",
"drift",
"=",
"3",
",",
"backward_drift",
"=",
"0",
")",
":",
"for",
"i",
"in",
"range",
"(",
"-",
"back... | c37cd63880b39032b9ba69cd1516e6fb06923e46 |
train | totp | Compute a TOTP value as prescribed by OATH specifications.
:param key:
the TOTP key given as an hexadecimal string
:param format:
the output format, can be:
- hex, for a variable length hexadecimal format,
- hex-notrunc, for a 40 characters hexadecimal no... | oath/_totp.py | def totp(key, format='dec6', period=30, t=None, hash=hashlib.sha1):
'''
Compute a TOTP value as prescribed by OATH specifications.
:param key:
the TOTP key given as an hexadecimal string
:param format:
the output format, can be:
- hex, for a variable length ... | def totp(key, format='dec6', period=30, t=None, hash=hashlib.sha1):
'''
Compute a TOTP value as prescribed by OATH specifications.
:param key:
the TOTP key given as an hexadecimal string
:param format:
the output format, can be:
- hex, for a variable length ... | [
"Compute",
"a",
"TOTP",
"value",
"as",
"prescribed",
"by",
"OATH",
"specifications",
"."
] | bdauvergne/python-oath | python | https://github.com/bdauvergne/python-oath/blob/c37cd63880b39032b9ba69cd1516e6fb06923e46/oath/_totp.py#L24-L62 | [
"def",
"totp",
"(",
"key",
",",
"format",
"=",
"'dec6'",
",",
"period",
"=",
"30",
",",
"t",
"=",
"None",
",",
"hash",
"=",
"hashlib",
".",
"sha1",
")",
":",
"if",
"t",
"is",
"None",
":",
"t",
"=",
"int",
"(",
"time",
".",
"time",
"(",
")",
... | c37cd63880b39032b9ba69cd1516e6fb06923e46 |
train | accept_totp | Validate a TOTP value inside a window of
[drift-bacward_drift:drift+forward_drift] of time steps.
Where drift is the drift obtained during the last call to accept_totp.
:param response:
a string representing the OTP to check, its format should correspond
to the format parame... | oath/_totp.py | def accept_totp(key, response, format='dec6', period=30, t=None,
hash=hashlib.sha1, forward_drift=1, backward_drift=1, drift=0):
'''
Validate a TOTP value inside a window of
[drift-bacward_drift:drift+forward_drift] of time steps.
Where drift is the drift obtained during the last call ... | def accept_totp(key, response, format='dec6', period=30, t=None,
hash=hashlib.sha1, forward_drift=1, backward_drift=1, drift=0):
'''
Validate a TOTP value inside a window of
[drift-bacward_drift:drift+forward_drift] of time steps.
Where drift is the drift obtained during the last call ... | [
"Validate",
"a",
"TOTP",
"value",
"inside",
"a",
"window",
"of",
"[",
"drift",
"-",
"bacward_drift",
":",
"drift",
"+",
"forward_drift",
"]",
"of",
"time",
"steps",
".",
"Where",
"drift",
"is",
"the",
"drift",
"obtained",
"during",
"the",
"last",
"call",
... | bdauvergne/python-oath | python | https://github.com/bdauvergne/python-oath/blob/c37cd63880b39032b9ba69cd1516e6fb06923e46/oath/_totp.py#L64-L132 | [
"def",
"accept_totp",
"(",
"key",
",",
"response",
",",
"format",
"=",
"'dec6'",
",",
"period",
"=",
"30",
",",
"t",
"=",
"None",
",",
"hash",
"=",
"hashlib",
".",
"sha1",
",",
"forward_drift",
"=",
"1",
",",
"backward_drift",
"=",
"1",
",",
"drift",... | c37cd63880b39032b9ba69cd1516e6fb06923e46 |
train | from_b32key | Some phone app directly accept a partial b32 encoding, we try to emulate that | oath/google_authenticator.py | def from_b32key(b32_key, state=None):
'''Some phone app directly accept a partial b32 encoding, we try to emulate that'''
try:
lenient_b32decode(b32_key)
except TypeError:
raise ValueError('invalid base32 value')
return GoogleAuthenticator('otpauth://totp/xxx?%s' %
urlencode(... | def from_b32key(b32_key, state=None):
'''Some phone app directly accept a partial b32 encoding, we try to emulate that'''
try:
lenient_b32decode(b32_key)
except TypeError:
raise ValueError('invalid base32 value')
return GoogleAuthenticator('otpauth://totp/xxx?%s' %
urlencode(... | [
"Some",
"phone",
"app",
"directly",
"accept",
"a",
"partial",
"b32",
"encoding",
"we",
"try",
"to",
"emulate",
"that"
] | bdauvergne/python-oath | python | https://github.com/bdauvergne/python-oath/blob/c37cd63880b39032b9ba69cd1516e6fb06923e46/oath/google_authenticator.py#L103-L110 | [
"def",
"from_b32key",
"(",
"b32_key",
",",
"state",
"=",
"None",
")",
":",
"try",
":",
"lenient_b32decode",
"(",
"b32_key",
")",
"except",
"TypeError",
":",
"raise",
"ValueError",
"(",
"'invalid base32 value'",
")",
"return",
"GoogleAuthenticator",
"(",
"'otpaut... | c37cd63880b39032b9ba69cd1516e6fb06923e46 |
train | GoogleAuthenticatorURI.generate | https://github.com/google/google-authenticator/wiki/Key-Uri-Format | oath/google_authenticator.py | def generate(self,
secret,
type='totp',
account='alex',
issuer=None,
algo='sha1',
digits=6,
init_counter=None):
"""
https://github.com/google/google-authenticator/wiki/Key-Uri-Format
... | def generate(self,
secret,
type='totp',
account='alex',
issuer=None,
algo='sha1',
digits=6,
init_counter=None):
"""
https://github.com/google/google-authenticator/wiki/Key-Uri-Format
... | [
"https",
":",
"//",
"github",
".",
"com",
"/",
"google",
"/",
"google",
"-",
"authenticator",
"/",
"wiki",
"/",
"Key",
"-",
"Uri",
"-",
"Format"
] | bdauvergne/python-oath | python | https://github.com/bdauvergne/python-oath/blob/c37cd63880b39032b9ba69cd1516e6fb06923e46/oath/google_authenticator.py#L178-L239 | [
"def",
"generate",
"(",
"self",
",",
"secret",
",",
"type",
"=",
"'totp'",
",",
"account",
"=",
"'alex'",
",",
"issuer",
"=",
"None",
",",
"algo",
"=",
"'sha1'",
",",
"digits",
"=",
"6",
",",
"init_counter",
"=",
"None",
")",
":",
"args",
"=",
"{",... | c37cd63880b39032b9ba69cd1516e6fb06923e46 |
train | _convert_operator | Convert from onnx operator to mxnet operator.
The converter must specify conversions explicitly for incompatible name, and
apply handlers to operator attributes.
Parameters
----------
op_name : str
Operator name, such as Convolution, FullyConnected
attrs : dict
Dict of operator ... | onnx_mxnet/import_onnx.py | def _convert_operator(op_name, attrs, identity_list=None, convert_map=None):
"""Convert from onnx operator to mxnet operator.
The converter must specify conversions explicitly for incompatible name, and
apply handlers to operator attributes.
Parameters
----------
op_name : str
Operator ... | def _convert_operator(op_name, attrs, identity_list=None, convert_map=None):
"""Convert from onnx operator to mxnet operator.
The converter must specify conversions explicitly for incompatible name, and
apply handlers to operator attributes.
Parameters
----------
op_name : str
Operator ... | [
"Convert",
"from",
"onnx",
"operator",
"to",
"mxnet",
"operator",
".",
"The",
"converter",
"must",
"specify",
"conversions",
"explicitly",
"for",
"incompatible",
"name",
"and",
"apply",
"handlers",
"to",
"operator",
"attributes",
"."
] | onnx/onnx-mxnet | python | https://github.com/onnx/onnx-mxnet/blob/b602d75c5a01f5ed8f68b11150a06374f058a86b/onnx_mxnet/import_onnx.py#L21-L55 | [
"def",
"_convert_operator",
"(",
"op_name",
",",
"attrs",
",",
"identity_list",
"=",
"None",
",",
"convert_map",
"=",
"None",
")",
":",
"identity_list",
"=",
"identity_list",
"if",
"identity_list",
"else",
"_identity_list",
"convert_map",
"=",
"convert_map",
"if",... | b602d75c5a01f5ed8f68b11150a06374f058a86b |
train | GraphProto.from_onnx | Construct symbol from onnx graph.
The inputs from onnx graph is vague, only providing "1", "2"...
For convenience, we rename the `real` input names to "input_0",
"input_1"... And renaming parameters to "param_0", "param_1"...
Parameters
----------
graph : onnx protobuf o... | onnx_mxnet/import_onnx.py | def from_onnx(self, graph):
"""Construct symbol from onnx graph.
The inputs from onnx graph is vague, only providing "1", "2"...
For convenience, we rename the `real` input names to "input_0",
"input_1"... And renaming parameters to "param_0", "param_1"...
Parameters
---... | def from_onnx(self, graph):
"""Construct symbol from onnx graph.
The inputs from onnx graph is vague, only providing "1", "2"...
For convenience, we rename the `real` input names to "input_0",
"input_1"... And renaming parameters to "param_0", "param_1"...
Parameters
---... | [
"Construct",
"symbol",
"from",
"onnx",
"graph",
".",
"The",
"inputs",
"from",
"onnx",
"graph",
"is",
"vague",
"only",
"providing",
"1",
"2",
"...",
"For",
"convenience",
"we",
"rename",
"the",
"real",
"input",
"names",
"to",
"input_0",
"input_1",
"...",
"A... | onnx/onnx-mxnet | python | https://github.com/onnx/onnx-mxnet/blob/b602d75c5a01f5ed8f68b11150a06374f058a86b/onnx_mxnet/import_onnx.py#L68-L160 | [
"def",
"from_onnx",
"(",
"self",
",",
"graph",
")",
":",
"# parse network inputs, aka parameters",
"for",
"init_tensor",
"in",
"graph",
".",
"initializer",
":",
"if",
"not",
"init_tensor",
".",
"name",
".",
"strip",
"(",
")",
":",
"raise",
"ValueError",
"(",
... | b602d75c5a01f5ed8f68b11150a06374f058a86b |
train | GraphProto._fix_pooling | onnx pooling operator supports asymmetrical padding
Adding pad operator before pooling in mxnet to work with onnx | onnx_mxnet/import_onnx.py | def _fix_pooling(self, op_name, inputs, new_attr):
"""onnx pooling operator supports asymmetrical padding
Adding pad operator before pooling in mxnet to work with onnx"""
pool_type = 'avg' if op_name == 'AveragePool' else 'max'
stride = new_attr.get('strides')
kernel = new_attr.g... | def _fix_pooling(self, op_name, inputs, new_attr):
"""onnx pooling operator supports asymmetrical padding
Adding pad operator before pooling in mxnet to work with onnx"""
pool_type = 'avg' if op_name == 'AveragePool' else 'max'
stride = new_attr.get('strides')
kernel = new_attr.g... | [
"onnx",
"pooling",
"operator",
"supports",
"asymmetrical",
"padding",
"Adding",
"pad",
"operator",
"before",
"pooling",
"in",
"mxnet",
"to",
"work",
"with",
"onnx"
] | onnx/onnx-mxnet | python | https://github.com/onnx/onnx-mxnet/blob/b602d75c5a01f5ed8f68b11150a06374f058a86b/onnx_mxnet/import_onnx.py#L162-L173 | [
"def",
"_fix_pooling",
"(",
"self",
",",
"op_name",
",",
"inputs",
",",
"new_attr",
")",
":",
"pool_type",
"=",
"'avg'",
"if",
"op_name",
"==",
"'AveragePool'",
"else",
"'max'",
"stride",
"=",
"new_attr",
".",
"get",
"(",
"'strides'",
")",
"kernel",
"=",
... | b602d75c5a01f5ed8f68b11150a06374f058a86b |
train | GraphProto._fix_slice | onnx slice provides slicing on multiple axis. Adding multiple slice_axis operator
for multiple axes from mxnet | onnx_mxnet/import_onnx.py | def _fix_slice(self, inputs, new_attr):
"""onnx slice provides slicing on multiple axis. Adding multiple slice_axis operator
for multiple axes from mxnet"""
begin = new_attr.get('begin')
end = new_attr.get('end')
axes = new_attr.get('axis', tuple(range(len(begin))))
slice... | def _fix_slice(self, inputs, new_attr):
"""onnx slice provides slicing on multiple axis. Adding multiple slice_axis operator
for multiple axes from mxnet"""
begin = new_attr.get('begin')
end = new_attr.get('end')
axes = new_attr.get('axis', tuple(range(len(begin))))
slice... | [
"onnx",
"slice",
"provides",
"slicing",
"on",
"multiple",
"axis",
".",
"Adding",
"multiple",
"slice_axis",
"operator",
"for",
"multiple",
"axes",
"from",
"mxnet"
] | onnx/onnx-mxnet | python | https://github.com/onnx/onnx-mxnet/blob/b602d75c5a01f5ed8f68b11150a06374f058a86b/onnx_mxnet/import_onnx.py#L175-L185 | [
"def",
"_fix_slice",
"(",
"self",
",",
"inputs",
",",
"new_attr",
")",
":",
"begin",
"=",
"new_attr",
".",
"get",
"(",
"'begin'",
")",
"end",
"=",
"new_attr",
".",
"get",
"(",
"'end'",
")",
"axes",
"=",
"new_attr",
".",
"get",
"(",
"'axis'",
",",
"... | b602d75c5a01f5ed8f68b11150a06374f058a86b |
train | GraphProto._fix_squeeze | MXNet doesnt have a squeeze operator.
Using "split" to perform similar operation.
"split" can be slower compared to "reshape".
This can have performance impact.
TODO: Remove this implementation once mxnet adds the support. | onnx_mxnet/import_onnx.py | def _fix_squeeze(self, inputs, new_attr):
"""
MXNet doesnt have a squeeze operator.
Using "split" to perform similar operation.
"split" can be slower compared to "reshape".
This can have performance impact.
TODO: Remove this implementation once mxnet adds the support.
... | def _fix_squeeze(self, inputs, new_attr):
"""
MXNet doesnt have a squeeze operator.
Using "split" to perform similar operation.
"split" can be slower compared to "reshape".
This can have performance impact.
TODO: Remove this implementation once mxnet adds the support.
... | [
"MXNet",
"doesnt",
"have",
"a",
"squeeze",
"operator",
".",
"Using",
"split",
"to",
"perform",
"similar",
"operation",
".",
"split",
"can",
"be",
"slower",
"compared",
"to",
"reshape",
".",
"This",
"can",
"have",
"performance",
"impact",
".",
"TODO",
":",
... | onnx/onnx-mxnet | python | https://github.com/onnx/onnx-mxnet/blob/b602d75c5a01f5ed8f68b11150a06374f058a86b/onnx_mxnet/import_onnx.py#L187-L199 | [
"def",
"_fix_squeeze",
"(",
"self",
",",
"inputs",
",",
"new_attr",
")",
":",
"axes",
"=",
"new_attr",
".",
"get",
"(",
"'axis'",
")",
"op",
"=",
"mx",
".",
"sym",
".",
"split",
"(",
"inputs",
"[",
"0",
"]",
",",
"axis",
"=",
"axes",
"[",
"0",
... | b602d75c5a01f5ed8f68b11150a06374f058a86b |
train | GraphProto._fix_max_min | MXNet maximum/minimum compares only two symbols at a time.
ONNX can send more than two to compare.
Breaking into multiple mxnet ops to compare two symbols at a time | onnx_mxnet/import_onnx.py | def _fix_max_min(self, op_name, inputs):
""" MXNet maximum/minimum compares only two symbols at a time.
ONNX can send more than two to compare.
Breaking into multiple mxnet ops to compare two symbols at a time"""
if len(inputs) > 1:
if op_name == 'Max':
... | def _fix_max_min(self, op_name, inputs):
""" MXNet maximum/minimum compares only two symbols at a time.
ONNX can send more than two to compare.
Breaking into multiple mxnet ops to compare two symbols at a time"""
if len(inputs) > 1:
if op_name == 'Max':
... | [
"MXNet",
"maximum",
"/",
"minimum",
"compares",
"only",
"two",
"symbols",
"at",
"a",
"time",
".",
"ONNX",
"can",
"send",
"more",
"than",
"two",
"to",
"compare",
".",
"Breaking",
"into",
"multiple",
"mxnet",
"ops",
"to",
"compare",
"two",
"symbols",
"at",
... | onnx/onnx-mxnet | python | https://github.com/onnx/onnx-mxnet/blob/b602d75c5a01f5ed8f68b11150a06374f058a86b/onnx_mxnet/import_onnx.py#L201-L216 | [
"def",
"_fix_max_min",
"(",
"self",
",",
"op_name",
",",
"inputs",
")",
":",
"if",
"len",
"(",
"inputs",
")",
">",
"1",
":",
"if",
"op_name",
"==",
"'Max'",
":",
"op",
"=",
"mx",
".",
"sym",
".",
"maximum",
"(",
"inputs",
"[",
"0",
"]",
",",
"i... | b602d75c5a01f5ed8f68b11150a06374f058a86b |
train | GraphProto._fix_gemm | Using FullyConnected operator in place of linalg_gemm to perform same operation | onnx_mxnet/import_onnx.py | def _fix_gemm(self, op_name, inputs, old_attr):
"""Using FullyConnected operator in place of linalg_gemm to perform same operation"""
op = getattr(mx.sym, op_name, None)
alpha = float(old_attr.get('alpha', 1.0))
beta = float(old_attr.get('beta', 1.0))
transA = int(old_attr.get('t... | def _fix_gemm(self, op_name, inputs, old_attr):
"""Using FullyConnected operator in place of linalg_gemm to perform same operation"""
op = getattr(mx.sym, op_name, None)
alpha = float(old_attr.get('alpha', 1.0))
beta = float(old_attr.get('beta', 1.0))
transA = int(old_attr.get('t... | [
"Using",
"FullyConnected",
"operator",
"in",
"place",
"of",
"linalg_gemm",
"to",
"perform",
"same",
"operation"
] | onnx/onnx-mxnet | python | https://github.com/onnx/onnx-mxnet/blob/b602d75c5a01f5ed8f68b11150a06374f058a86b/onnx_mxnet/import_onnx.py#L219-L232 | [
"def",
"_fix_gemm",
"(",
"self",
",",
"op_name",
",",
"inputs",
",",
"old_attr",
")",
":",
"op",
"=",
"getattr",
"(",
"mx",
".",
"sym",
",",
"op_name",
",",
"None",
")",
"alpha",
"=",
"float",
"(",
"old_attr",
".",
"get",
"(",
"'alpha'",
",",
"1.0"... | b602d75c5a01f5ed8f68b11150a06374f058a86b |
train | GraphProto._parse_array | Grab data in TensorProto and convert to numpy array. | onnx_mxnet/import_onnx.py | def _parse_array(self, tensor_proto):
"""Grab data in TensorProto and convert to numpy array."""
try:
from onnx.numpy_helper import to_array
except ImportError as e:
raise ImportError("Unable to import onnx which is required {}".format(e))
np_array = to_array(tens... | def _parse_array(self, tensor_proto):
"""Grab data in TensorProto and convert to numpy array."""
try:
from onnx.numpy_helper import to_array
except ImportError as e:
raise ImportError("Unable to import onnx which is required {}".format(e))
np_array = to_array(tens... | [
"Grab",
"data",
"in",
"TensorProto",
"and",
"convert",
"to",
"numpy",
"array",
"."
] | onnx/onnx-mxnet | python | https://github.com/onnx/onnx-mxnet/blob/b602d75c5a01f5ed8f68b11150a06374f058a86b/onnx_mxnet/import_onnx.py#L234-L241 | [
"def",
"_parse_array",
"(",
"self",
",",
"tensor_proto",
")",
":",
"try",
":",
"from",
"onnx",
".",
"numpy_helper",
"import",
"to_array",
"except",
"ImportError",
"as",
"e",
":",
"raise",
"ImportError",
"(",
"\"Unable to import onnx which is required {}\"",
".",
"... | b602d75c5a01f5ed8f68b11150a06374f058a86b |
train | GraphProto._parse_attr | Convert a list of AttributeProto to a dict, with names as keys. | onnx_mxnet/import_onnx.py | def _parse_attr(self, attr_proto):
"""Convert a list of AttributeProto to a dict, with names as keys."""
attrs = {}
for a in attr_proto:
for f in ['f', 'i', 's']:
if a.HasField(f):
attrs[a.name] = getattr(a, f)
for f in ['floats', 'ints... | def _parse_attr(self, attr_proto):
"""Convert a list of AttributeProto to a dict, with names as keys."""
attrs = {}
for a in attr_proto:
for f in ['f', 'i', 's']:
if a.HasField(f):
attrs[a.name] = getattr(a, f)
for f in ['floats', 'ints... | [
"Convert",
"a",
"list",
"of",
"AttributeProto",
"to",
"a",
"dict",
"with",
"names",
"as",
"keys",
"."
] | onnx/onnx-mxnet | python | https://github.com/onnx/onnx-mxnet/blob/b602d75c5a01f5ed8f68b11150a06374f058a86b/onnx_mxnet/import_onnx.py#L243-L262 | [
"def",
"_parse_attr",
"(",
"self",
",",
"attr_proto",
")",
":",
"attrs",
"=",
"{",
"}",
"for",
"a",
"in",
"attr_proto",
":",
"for",
"f",
"in",
"[",
"'f'",
",",
"'i'",
",",
"'s'",
"]",
":",
"if",
"a",
".",
"HasField",
"(",
"f",
")",
":",
"attrs"... | b602d75c5a01f5ed8f68b11150a06374f058a86b |
train | GraphProto._fix_outputs | A workaround to handle dropout or similar operator that have more than one out
in ONNX. | onnx_mxnet/import_onnx.py | def _fix_outputs(self, op, outputs):
"""A workaround to handle dropout or similar operator that have more than one out
in ONNX.
"""
if op == 'Dropout':
assert len(outputs) == 2, "ONNX have two outputs for dropout layer."
outputs = outputs[:-1]
return outpu... | def _fix_outputs(self, op, outputs):
"""A workaround to handle dropout or similar operator that have more than one out
in ONNX.
"""
if op == 'Dropout':
assert len(outputs) == 2, "ONNX have two outputs for dropout layer."
outputs = outputs[:-1]
return outpu... | [
"A",
"workaround",
"to",
"handle",
"dropout",
"or",
"similar",
"operator",
"that",
"have",
"more",
"than",
"one",
"out",
"in",
"ONNX",
"."
] | onnx/onnx-mxnet | python | https://github.com/onnx/onnx-mxnet/blob/b602d75c5a01f5ed8f68b11150a06374f058a86b/onnx_mxnet/import_onnx.py#L264-L271 | [
"def",
"_fix_outputs",
"(",
"self",
",",
"op",
",",
"outputs",
")",
":",
"if",
"op",
"==",
"'Dropout'",
":",
"assert",
"len",
"(",
"outputs",
")",
"==",
"2",
",",
"\"ONNX have two outputs for dropout layer.\"",
"outputs",
"=",
"outputs",
"[",
":",
"-",
"1"... | b602d75c5a01f5ed8f68b11150a06374f058a86b |
train | GraphProto._fix_bias | A workaround for 'use_bias' attribute since onnx don't provide this attribute,
we have to check the number of inputs to decide it. | onnx_mxnet/import_onnx.py | def _fix_bias(self, op, attrs, num_inputs):
"""A workaround for 'use_bias' attribute since onnx don't provide this attribute,
we have to check the number of inputs to decide it."""
if op not in [mx.sym.Convolution, mx.sym.Deconvolution, mx.sym.FullyConnected]:
return attrs
if... | def _fix_bias(self, op, attrs, num_inputs):
"""A workaround for 'use_bias' attribute since onnx don't provide this attribute,
we have to check the number of inputs to decide it."""
if op not in [mx.sym.Convolution, mx.sym.Deconvolution, mx.sym.FullyConnected]:
return attrs
if... | [
"A",
"workaround",
"for",
"use_bias",
"attribute",
"since",
"onnx",
"don",
"t",
"provide",
"this",
"attribute",
"we",
"have",
"to",
"check",
"the",
"number",
"of",
"inputs",
"to",
"decide",
"it",
"."
] | onnx/onnx-mxnet | python | https://github.com/onnx/onnx-mxnet/blob/b602d75c5a01f5ed8f68b11150a06374f058a86b/onnx_mxnet/import_onnx.py#L273-L284 | [
"def",
"_fix_bias",
"(",
"self",
",",
"op",
",",
"attrs",
",",
"num_inputs",
")",
":",
"if",
"op",
"not",
"in",
"[",
"mx",
".",
"sym",
".",
"Convolution",
",",
"mx",
".",
"sym",
".",
"Deconvolution",
",",
"mx",
".",
"sym",
".",
"FullyConnected",
"]... | b602d75c5a01f5ed8f68b11150a06374f058a86b |
train | GraphProto._fix_bias_shape | A workaround to reshape bias term to (1, num_channel). | onnx_mxnet/import_onnx.py | def _fix_bias_shape(self, op_name, inputs, attrs):
"""A workaround to reshape bias term to (1, num_channel)."""
if (op_name == 'Add' or op_name == 'Mul') and (int(len(self._params)) > 0) and \
('broadcast' in attrs and attrs['broadcast'] == 1):
assert len(list(inputs)) == 2
... | def _fix_bias_shape(self, op_name, inputs, attrs):
"""A workaround to reshape bias term to (1, num_channel)."""
if (op_name == 'Add' or op_name == 'Mul') and (int(len(self._params)) > 0) and \
('broadcast' in attrs and attrs['broadcast'] == 1):
assert len(list(inputs)) == 2
... | [
"A",
"workaround",
"to",
"reshape",
"bias",
"term",
"to",
"(",
"1",
"num_channel",
")",
"."
] | onnx/onnx-mxnet | python | https://github.com/onnx/onnx-mxnet/blob/b602d75c5a01f5ed8f68b11150a06374f058a86b/onnx_mxnet/import_onnx.py#L287-L299 | [
"def",
"_fix_bias_shape",
"(",
"self",
",",
"op_name",
",",
"inputs",
",",
"attrs",
")",
":",
"if",
"(",
"op_name",
"==",
"'Add'",
"or",
"op_name",
"==",
"'Mul'",
")",
"and",
"(",
"int",
"(",
"len",
"(",
"self",
".",
"_params",
")",
")",
">",
"0",
... | b602d75c5a01f5ed8f68b11150a06374f058a86b |
train | GraphProto._fix_channels | A workaround for getting 'channels' or 'units' since onnx don't provide
these attributes. We check the shape of weights provided to get the number. | onnx_mxnet/import_onnx.py | def _fix_channels(self, op, attrs, inputs):
"""A workaround for getting 'channels' or 'units' since onnx don't provide
these attributes. We check the shape of weights provided to get the number.
"""
if op not in [mx.sym.Convolution, mx.sym.Deconvolution, mx.sym.FullyConnected]:
... | def _fix_channels(self, op, attrs, inputs):
"""A workaround for getting 'channels' or 'units' since onnx don't provide
these attributes. We check the shape of weights provided to get the number.
"""
if op not in [mx.sym.Convolution, mx.sym.Deconvolution, mx.sym.FullyConnected]:
... | [
"A",
"workaround",
"for",
"getting",
"channels",
"or",
"units",
"since",
"onnx",
"don",
"t",
"provide",
"these",
"attributes",
".",
"We",
"check",
"the",
"shape",
"of",
"weights",
"provided",
"to",
"get",
"the",
"number",
"."
] | onnx/onnx-mxnet | python | https://github.com/onnx/onnx-mxnet/blob/b602d75c5a01f5ed8f68b11150a06374f058a86b/onnx_mxnet/import_onnx.py#L302-L326 | [
"def",
"_fix_channels",
"(",
"self",
",",
"op",
",",
"attrs",
",",
"inputs",
")",
":",
"if",
"op",
"not",
"in",
"[",
"mx",
".",
"sym",
".",
"Convolution",
",",
"mx",
".",
"sym",
".",
"Deconvolution",
",",
"mx",
".",
"sym",
".",
"FullyConnected",
"]... | b602d75c5a01f5ed8f68b11150a06374f058a86b |
train | MXNetBackendRep.run | Run model inference and return the result
Parameters
----------
inputs : numpy array
input to run a layer on
Returns
-------
params : numpy array
result obtained after running the inference on mxnet | onnx_mxnet/backend_rep.py | def run(self, inputs, **kwargs):
"""Run model inference and return the result
Parameters
----------
inputs : numpy array
input to run a layer on
Returns
-------
params : numpy array
result obtained after running the inference on mxnet
... | def run(self, inputs, **kwargs):
"""Run model inference and return the result
Parameters
----------
inputs : numpy array
input to run a layer on
Returns
-------
params : numpy array
result obtained after running the inference on mxnet
... | [
"Run",
"model",
"inference",
"and",
"return",
"the",
"result"
] | onnx/onnx-mxnet | python | https://github.com/onnx/onnx-mxnet/blob/b602d75c5a01f5ed8f68b11150a06374f058a86b/onnx_mxnet/backend_rep.py#L36-L68 | [
"def",
"run",
"(",
"self",
",",
"inputs",
",",
"*",
"*",
"kwargs",
")",
":",
"input_data",
"=",
"np",
".",
"asarray",
"(",
"inputs",
"[",
"0",
"]",
",",
"dtype",
"=",
"'f'",
")",
"# create module, passing cpu context",
"if",
"self",
".",
"device",
"=="... | b602d75c5a01f5ed8f68b11150a06374f058a86b |
train | AttributeConverter._parse_default | Helper function to parse default values. | onnx_mxnet/common.py | def _parse_default(self, target):
"""Helper function to parse default values."""
if not isinstance(target, (list, tuple)):
k, v, t = target, None, lambda x: x
elif len(target) == 1:
k, v, t = target[0], None, lambda x: x
elif len(target) == 2:
k, v, t ... | def _parse_default(self, target):
"""Helper function to parse default values."""
if not isinstance(target, (list, tuple)):
k, v, t = target, None, lambda x: x
elif len(target) == 1:
k, v, t = target[0], None, lambda x: x
elif len(target) == 2:
k, v, t ... | [
"Helper",
"function",
"to",
"parse",
"default",
"values",
"."
] | onnx/onnx-mxnet | python | https://github.com/onnx/onnx-mxnet/blob/b602d75c5a01f5ed8f68b11150a06374f058a86b/onnx_mxnet/common.py#L114-L129 | [
"def",
"_parse_default",
"(",
"self",
",",
"target",
")",
":",
"if",
"not",
"isinstance",
"(",
"target",
",",
"(",
"list",
",",
"tuple",
")",
")",
":",
"k",
",",
"v",
",",
"t",
"=",
"target",
",",
"None",
",",
"lambda",
"x",
":",
"x",
"elif",
"... | b602d75c5a01f5ed8f68b11150a06374f058a86b |
train | AttributeConverter._parse_bool | Helper function to parse default boolean values. | onnx_mxnet/common.py | def _parse_bool(self, value):
"""Helper function to parse default boolean values."""
if isinstance(value, string_types):
return value.strip().lower() in ['true', '1', 't', 'y', 'yes']
return bool(value) | def _parse_bool(self, value):
"""Helper function to parse default boolean values."""
if isinstance(value, string_types):
return value.strip().lower() in ['true', '1', 't', 'y', 'yes']
return bool(value) | [
"Helper",
"function",
"to",
"parse",
"default",
"boolean",
"values",
"."
] | onnx/onnx-mxnet | python | https://github.com/onnx/onnx-mxnet/blob/b602d75c5a01f5ed8f68b11150a06374f058a86b/onnx_mxnet/common.py#L131-L135 | [
"def",
"_parse_bool",
"(",
"self",
",",
"value",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"string_types",
")",
":",
"return",
"value",
".",
"strip",
"(",
")",
".",
"lower",
"(",
")",
"in",
"[",
"'true'",
",",
"'1'",
",",
"'t'",
",",
"'y'",
... | b602d75c5a01f5ed8f68b11150a06374f058a86b |
train | AttributeConverter._required_attr | Wrapper for getting required attributes. | onnx_mxnet/common.py | def _required_attr(self, attr, key):
"""Wrapper for getting required attributes."""
assert isinstance(attr, dict)
if key not in attr:
raise AttributeError("Required attribute {} not found.".format(key))
return attr[key] | def _required_attr(self, attr, key):
"""Wrapper for getting required attributes."""
assert isinstance(attr, dict)
if key not in attr:
raise AttributeError("Required attribute {} not found.".format(key))
return attr[key] | [
"Wrapper",
"for",
"getting",
"required",
"attributes",
"."
] | onnx/onnx-mxnet | python | https://github.com/onnx/onnx-mxnet/blob/b602d75c5a01f5ed8f68b11150a06374f058a86b/onnx_mxnet/common.py#L137-L142 | [
"def",
"_required_attr",
"(",
"self",
",",
"attr",
",",
"key",
")",
":",
"assert",
"isinstance",
"(",
"attr",
",",
"dict",
")",
"if",
"key",
"not",
"in",
"attr",
":",
"raise",
"AttributeError",
"(",
"\"Required attribute {} not found.\"",
".",
"format",
"(",... | b602d75c5a01f5ed8f68b11150a06374f058a86b |
train | MXNetBackend.make_graph | Created ONNX GraphProto from node | onnx_mxnet/backend.py | def make_graph(node, inputs):
""" Created ONNX GraphProto from node"""
initializer = []
tensor_input_info = []
tensor_output_info = []
# Adding input tensor info.
for index in range(len(node.input)):
tensor_input_info.append(
helper.make_tenso... | def make_graph(node, inputs):
""" Created ONNX GraphProto from node"""
initializer = []
tensor_input_info = []
tensor_output_info = []
# Adding input tensor info.
for index in range(len(node.input)):
tensor_input_info.append(
helper.make_tenso... | [
"Created",
"ONNX",
"GraphProto",
"from",
"node"
] | onnx/onnx-mxnet | python | https://github.com/onnx/onnx-mxnet/blob/b602d75c5a01f5ed8f68b11150a06374f058a86b/onnx_mxnet/backend.py#L30-L68 | [
"def",
"make_graph",
"(",
"node",
",",
"inputs",
")",
":",
"initializer",
"=",
"[",
"]",
"tensor_input_info",
"=",
"[",
"]",
"tensor_output_info",
"=",
"[",
"]",
"# Adding input tensor info.",
"for",
"index",
"in",
"range",
"(",
"len",
"(",
"node",
".",
"i... | b602d75c5a01f5ed8f68b11150a06374f058a86b |
train | MXNetBackend.run_node | Running individual node inference on mxnet engine and
return the result to onnx test infrastructure.
Parameters
----------
node : onnx node object
loaded onnx node (individual layer)
inputs : numpy array
input to run a node on
device : 'CPU'
... | onnx_mxnet/backend.py | def run_node(cls, node, inputs, device='CPU'): # pylint: disable=arguments-differ
"""Running individual node inference on mxnet engine and
return the result to onnx test infrastructure.
Parameters
----------
node : onnx node object
loaded onnx node (individual lay... | def run_node(cls, node, inputs, device='CPU'): # pylint: disable=arguments-differ
"""Running individual node inference on mxnet engine and
return the result to onnx test infrastructure.
Parameters
----------
node : onnx node object
loaded onnx node (individual lay... | [
"Running",
"individual",
"node",
"inference",
"on",
"mxnet",
"engine",
"and",
"return",
"the",
"result",
"to",
"onnx",
"test",
"infrastructure",
"."
] | onnx/onnx-mxnet | python | https://github.com/onnx/onnx-mxnet/blob/b602d75c5a01f5ed8f68b11150a06374f058a86b/onnx_mxnet/backend.py#L72-L137 | [
"def",
"run_node",
"(",
"cls",
",",
"node",
",",
"inputs",
",",
"device",
"=",
"'CPU'",
")",
":",
"# pylint: disable=arguments-differ",
"graph",
"=",
"GraphProto",
"(",
")",
"sym",
",",
"_",
"=",
"graph",
".",
"from_onnx",
"(",
"MXNetBackend",
".",
"make_g... | b602d75c5a01f5ed8f68b11150a06374f058a86b |
train | MXNetBackend.prepare | For running end to end model(used for onnx test backend)
Parameters
----------
model : onnx ModelProto object
loaded onnx graph
device : 'CPU'
specifying device to run test on
kwargs :
other arguments
Returns
-------
... | onnx_mxnet/backend.py | def prepare(cls, model, device='CPU', **kwargs):
"""For running end to end model(used for onnx test backend)
Parameters
----------
model : onnx ModelProto object
loaded onnx graph
device : 'CPU'
specifying device to run test on
kwargs :
... | def prepare(cls, model, device='CPU', **kwargs):
"""For running end to end model(used for onnx test backend)
Parameters
----------
model : onnx ModelProto object
loaded onnx graph
device : 'CPU'
specifying device to run test on
kwargs :
... | [
"For",
"running",
"end",
"to",
"end",
"model",
"(",
"used",
"for",
"onnx",
"test",
"backend",
")"
] | onnx/onnx-mxnet | python | https://github.com/onnx/onnx-mxnet/blob/b602d75c5a01f5ed8f68b11150a06374f058a86b/onnx_mxnet/backend.py#L140-L160 | [
"def",
"prepare",
"(",
"cls",
",",
"model",
",",
"device",
"=",
"'CPU'",
",",
"*",
"*",
"kwargs",
")",
":",
"graph",
"=",
"GraphProto",
"(",
")",
"sym",
",",
"params",
"=",
"graph",
".",
"from_onnx",
"(",
"model",
".",
"graph",
")",
"return",
"MXNe... | b602d75c5a01f5ed8f68b11150a06374f058a86b |
train | _revert_caffe2_pad | Removing extra padding from Caffe2. | onnx_mxnet/import_helper.py | def _revert_caffe2_pad(attr):
"""Removing extra padding from Caffe2."""
if len(attr) == 4:
attr = attr[:2]
elif len(attr) == 2:
pass
else:
raise ValueError("Invalid caffe2 type padding: {}".format(attr))
return attr | def _revert_caffe2_pad(attr):
"""Removing extra padding from Caffe2."""
if len(attr) == 4:
attr = attr[:2]
elif len(attr) == 2:
pass
else:
raise ValueError("Invalid caffe2 type padding: {}".format(attr))
return attr | [
"Removing",
"extra",
"padding",
"from",
"Caffe2",
"."
] | onnx/onnx-mxnet | python | https://github.com/onnx/onnx-mxnet/blob/b602d75c5a01f5ed8f68b11150a06374f058a86b/onnx_mxnet/import_helper.py#L19-L27 | [
"def",
"_revert_caffe2_pad",
"(",
"attr",
")",
":",
"if",
"len",
"(",
"attr",
")",
"==",
"4",
":",
"attr",
"=",
"attr",
"[",
":",
"2",
"]",
"elif",
"len",
"(",
"attr",
")",
"==",
"2",
":",
"pass",
"else",
":",
"raise",
"ValueError",
"(",
"\"Inval... | b602d75c5a01f5ed8f68b11150a06374f058a86b |
train | _pad_sequence_fix | Changing onnx's pads sequence to match with mxnet's pad_width
mxnet: (x1_begin, x1_end, ... , xn_begin, xn_end)
onnx: (x1_begin, x2_begin, ... , xn_end, xn_end) | onnx_mxnet/import_helper.py | def _pad_sequence_fix(attr, kernelDim=None):
"""Changing onnx's pads sequence to match with mxnet's pad_width
mxnet: (x1_begin, x1_end, ... , xn_begin, xn_end)
onnx: (x1_begin, x2_begin, ... , xn_end, xn_end)"""
new_attr = ()
if len(attr) % 2 == 0:
for index in range(int(len(attr) / 2)):
... | def _pad_sequence_fix(attr, kernelDim=None):
"""Changing onnx's pads sequence to match with mxnet's pad_width
mxnet: (x1_begin, x1_end, ... , xn_begin, xn_end)
onnx: (x1_begin, x2_begin, ... , xn_end, xn_end)"""
new_attr = ()
if len(attr) % 2 == 0:
for index in range(int(len(attr) / 2)):
... | [
"Changing",
"onnx",
"s",
"pads",
"sequence",
"to",
"match",
"with",
"mxnet",
"s",
"pad_width",
"mxnet",
":",
"(",
"x1_begin",
"x1_end",
"...",
"xn_begin",
"xn_end",
")",
"onnx",
":",
"(",
"x1_begin",
"x2_begin",
"...",
"xn_end",
"xn_end",
")"
] | onnx/onnx-mxnet | python | https://github.com/onnx/onnx-mxnet/blob/b602d75c5a01f5ed8f68b11150a06374f058a86b/onnx_mxnet/import_helper.py#L111-L124 | [
"def",
"_pad_sequence_fix",
"(",
"attr",
",",
"kernelDim",
"=",
"None",
")",
":",
"new_attr",
"=",
"(",
")",
"if",
"len",
"(",
"attr",
")",
"%",
"2",
"==",
"0",
":",
"for",
"index",
"in",
"range",
"(",
"int",
"(",
"len",
"(",
"attr",
")",
"/",
... | b602d75c5a01f5ed8f68b11150a06374f058a86b |
train | import_model | Imports the supplied ONNX model file into MXNet symbol and parameters.
Parameters
----------
model_file : ONNX model file name
Returns
-------
sym : mx.symbol
Compatible mxnet symbol
params : dict of str to mx.ndarray
Dict of converted parameters stored in mx.ndarray forma... | onnx_mxnet/__init__.py | def import_model(model_file):
"""Imports the supplied ONNX model file into MXNet symbol and parameters.
Parameters
----------
model_file : ONNX model file name
Returns
-------
sym : mx.symbol
Compatible mxnet symbol
params : dict of str to mx.ndarray
Dict of converted ... | def import_model(model_file):
"""Imports the supplied ONNX model file into MXNet symbol and parameters.
Parameters
----------
model_file : ONNX model file name
Returns
-------
sym : mx.symbol
Compatible mxnet symbol
params : dict of str to mx.ndarray
Dict of converted ... | [
"Imports",
"the",
"supplied",
"ONNX",
"model",
"file",
"into",
"MXNet",
"symbol",
"and",
"parameters",
"."
] | onnx/onnx-mxnet | python | https://github.com/onnx/onnx-mxnet/blob/b602d75c5a01f5ed8f68b11150a06374f058a86b/onnx_mxnet/__init__.py#L16-L36 | [
"def",
"import_model",
"(",
"model_file",
")",
":",
"graph",
"=",
"GraphProto",
"(",
")",
"# loads model file and returns ONNX protobuf object",
"model_proto",
"=",
"onnx",
".",
"load",
"(",
"model_file",
")",
"sym",
",",
"params",
"=",
"graph",
".",
"from_onnx",
... | b602d75c5a01f5ed8f68b11150a06374f058a86b |
train | generate_hash | Public function that reads a local file and generates a SHA256 hash digest for it | lib/crypto/library/hash.py | def generate_hash(filepath):
"""Public function that reads a local file and generates a SHA256 hash digest for it"""
fr = FileReader(filepath)
data = fr.read_bin()
return _calculate_sha256(data) | def generate_hash(filepath):
"""Public function that reads a local file and generates a SHA256 hash digest for it"""
fr = FileReader(filepath)
data = fr.read_bin()
return _calculate_sha256(data) | [
"Public",
"function",
"that",
"reads",
"a",
"local",
"file",
"and",
"generates",
"a",
"SHA256",
"hash",
"digest",
"for",
"it"
] | chrissimpkins/crypto | python | https://github.com/chrissimpkins/crypto/blob/6b95fa81b26312e46f02557dca0b5f5c898a76fd/lib/crypto/library/hash.py#L10-L14 | [
"def",
"generate_hash",
"(",
"filepath",
")",
":",
"fr",
"=",
"FileReader",
"(",
"filepath",
")",
"data",
"=",
"fr",
".",
"read_bin",
"(",
")",
"return",
"_calculate_sha256",
"(",
"data",
")"
] | 6b95fa81b26312e46f02557dca0b5f5c898a76fd |
train | generate_tar_files | Public function that reads a list of local directories and generates tar archives from them | lib/crypto/library/package.py | def generate_tar_files(directory_list):
"""Public function that reads a list of local directories and generates tar archives from them"""
tar_file_list = []
for directory in directory_list:
if dir_exists(directory):
_generate_tar(directory) # create the tar archive... | def generate_tar_files(directory_list):
"""Public function that reads a list of local directories and generates tar archives from them"""
tar_file_list = []
for directory in directory_list:
if dir_exists(directory):
_generate_tar(directory) # create the tar archive... | [
"Public",
"function",
"that",
"reads",
"a",
"list",
"of",
"local",
"directories",
"and",
"generates",
"tar",
"archives",
"from",
"them"
] | chrissimpkins/crypto | python | https://github.com/chrissimpkins/crypto/blob/6b95fa81b26312e46f02557dca0b5f5c898a76fd/lib/crypto/library/package.py#L13-L25 | [
"def",
"generate_tar_files",
"(",
"directory_list",
")",
":",
"tar_file_list",
"=",
"[",
"]",
"for",
"directory",
"in",
"directory_list",
":",
"if",
"dir_exists",
"(",
"directory",
")",
":",
"_generate_tar",
"(",
"directory",
")",
"# create the tar archive",
"tar_... | 6b95fa81b26312e46f02557dca0b5f5c898a76fd |
train | remove_tar_files | Public function that removes temporary tar archive files in a local directory | lib/crypto/library/package.py | def remove_tar_files(file_list):
"""Public function that removes temporary tar archive files in a local directory"""
for f in file_list:
if file_exists(f) and f.endswith('.tar'):
os.remove(f) | def remove_tar_files(file_list):
"""Public function that removes temporary tar archive files in a local directory"""
for f in file_list:
if file_exists(f) and f.endswith('.tar'):
os.remove(f) | [
"Public",
"function",
"that",
"removes",
"temporary",
"tar",
"archive",
"files",
"in",
"a",
"local",
"directory"
] | chrissimpkins/crypto | python | https://github.com/chrissimpkins/crypto/blob/6b95fa81b26312e46f02557dca0b5f5c898a76fd/lib/crypto/library/package.py#L28-L32 | [
"def",
"remove_tar_files",
"(",
"file_list",
")",
":",
"for",
"f",
"in",
"file_list",
":",
"if",
"file_exists",
"(",
"f",
")",
"and",
"f",
".",
"endswith",
"(",
"'.tar'",
")",
":",
"os",
".",
"remove",
"(",
"f",
")"
] | 6b95fa81b26312e46f02557dca0b5f5c898a76fd |
train | _generate_tar | Private function that reads a local directory and generates a tar archive from it | lib/crypto/library/package.py | def _generate_tar(dir_path):
"""Private function that reads a local directory and generates a tar archive from it"""
try:
with tarfile.open(dir_path + '.tar', 'w') as tar:
tar.add(dir_path)
except tarfile.TarError as e:
stderr("Error: tar archive creation failed [" + str(e) + "]"... | def _generate_tar(dir_path):
"""Private function that reads a local directory and generates a tar archive from it"""
try:
with tarfile.open(dir_path + '.tar', 'w') as tar:
tar.add(dir_path)
except tarfile.TarError as e:
stderr("Error: tar archive creation failed [" + str(e) + "]"... | [
"Private",
"function",
"that",
"reads",
"a",
"local",
"directory",
"and",
"generates",
"a",
"tar",
"archive",
"from",
"it"
] | chrissimpkins/crypto | python | https://github.com/chrissimpkins/crypto/blob/6b95fa81b26312e46f02557dca0b5f5c898a76fd/lib/crypto/library/package.py#L39-L45 | [
"def",
"_generate_tar",
"(",
"dir_path",
")",
":",
"try",
":",
"with",
"tarfile",
".",
"open",
"(",
"dir_path",
"+",
"'.tar'",
",",
"'w'",
")",
"as",
"tar",
":",
"tar",
".",
"add",
"(",
"dir_path",
")",
"except",
"tarfile",
".",
"TarError",
"as",
"e"... | 6b95fa81b26312e46f02557dca0b5f5c898a76fd |
train | Cryptor.encrypt_file | public method for single file encryption with optional compression, ASCII armored formatting, and file hash digest generation | lib/crypto/library/cryptor.py | def encrypt_file(self, inpath, force_nocompress=False, force_compress=False, armored=False, checksum=False):
"""public method for single file encryption with optional compression, ASCII armored formatting, and file hash digest generation"""
if armored:
if force_compress:
comm... | def encrypt_file(self, inpath, force_nocompress=False, force_compress=False, armored=False, checksum=False):
"""public method for single file encryption with optional compression, ASCII armored formatting, and file hash digest generation"""
if armored:
if force_compress:
comm... | [
"public",
"method",
"for",
"single",
"file",
"encryption",
"with",
"optional",
"compression",
"ASCII",
"armored",
"formatting",
"and",
"file",
"hash",
"digest",
"generation"
] | chrissimpkins/crypto | python | https://github.com/chrissimpkins/crypto/blob/6b95fa81b26312e46f02557dca0b5f5c898a76fd/lib/crypto/library/cryptor.py#L36-L81 | [
"def",
"encrypt_file",
"(",
"self",
",",
"inpath",
",",
"force_nocompress",
"=",
"False",
",",
"force_compress",
"=",
"False",
",",
"armored",
"=",
"False",
",",
"checksum",
"=",
"False",
")",
":",
"if",
"armored",
":",
"if",
"force_compress",
":",
"comman... | 6b95fa81b26312e46f02557dca0b5f5c898a76fd |
train | Cryptor.encrypt_files | public method for multiple file encryption with optional compression, ASCII armored formatting, and file hash digest generation | lib/crypto/library/cryptor.py | def encrypt_files(self, file_list, force_nocompress=False, force_compress=False, armored=False, checksum=False):
"""public method for multiple file encryption with optional compression, ASCII armored formatting, and file hash digest generation"""
for the_file in file_list:
self.encrypt_file(... | def encrypt_files(self, file_list, force_nocompress=False, force_compress=False, armored=False, checksum=False):
"""public method for multiple file encryption with optional compression, ASCII armored formatting, and file hash digest generation"""
for the_file in file_list:
self.encrypt_file(... | [
"public",
"method",
"for",
"multiple",
"file",
"encryption",
"with",
"optional",
"compression",
"ASCII",
"armored",
"formatting",
"and",
"file",
"hash",
"digest",
"generation"
] | chrissimpkins/crypto | python | https://github.com/chrissimpkins/crypto/blob/6b95fa81b26312e46f02557dca0b5f5c898a76fd/lib/crypto/library/cryptor.py#L86-L89 | [
"def",
"encrypt_files",
"(",
"self",
",",
"file_list",
",",
"force_nocompress",
"=",
"False",
",",
"force_compress",
"=",
"False",
",",
"armored",
"=",
"False",
",",
"checksum",
"=",
"False",
")",
":",
"for",
"the_file",
"in",
"file_list",
":",
"self",
"."... | 6b95fa81b26312e46f02557dca0b5f5c898a76fd |
train | Cryptor._is_compress_filetype | private method that performs magic number and size check on file to determine whether to compress the file | lib/crypto/library/cryptor.py | def _is_compress_filetype(self, inpath):
"""private method that performs magic number and size check on file to determine whether to compress the file"""
# check for common file type suffixes in order to avoid the need for file reads to check magic number for binary vs. text file
if self._is_com... | def _is_compress_filetype(self, inpath):
"""private method that performs magic number and size check on file to determine whether to compress the file"""
# check for common file type suffixes in order to avoid the need for file reads to check magic number for binary vs. text file
if self._is_com... | [
"private",
"method",
"that",
"performs",
"magic",
"number",
"and",
"size",
"check",
"on",
"file",
"to",
"determine",
"whether",
"to",
"compress",
"the",
"file"
] | chrissimpkins/crypto | python | https://github.com/chrissimpkins/crypto/blob/6b95fa81b26312e46f02557dca0b5f5c898a76fd/lib/crypto/library/cryptor.py#L106-L130 | [
"def",
"_is_compress_filetype",
"(",
"self",
",",
"inpath",
")",
":",
"# check for common file type suffixes in order to avoid the need for file reads to check magic number for binary vs. text file",
"if",
"self",
".",
"_is_common_binary",
"(",
"inpath",
")",
":",
"return",
"Fals... | 6b95fa81b26312e46f02557dca0b5f5c898a76fd |
train | Cryptor._is_common_binary | private method to compare file path mime type to common binary file types | lib/crypto/library/cryptor.py | def _is_common_binary(self, inpath):
"""private method to compare file path mime type to common binary file types"""
# make local variables for the available char numbers in the suffix types to be tested
two_suffix = inpath[-3:]
three_suffix = inpath[-4:]
four_suffix = inpath[-5:... | def _is_common_binary(self, inpath):
"""private method to compare file path mime type to common binary file types"""
# make local variables for the available char numbers in the suffix types to be tested
two_suffix = inpath[-3:]
three_suffix = inpath[-4:]
four_suffix = inpath[-5:... | [
"private",
"method",
"to",
"compare",
"file",
"path",
"mime",
"type",
"to",
"common",
"binary",
"file",
"types"
] | chrissimpkins/crypto | python | https://github.com/chrissimpkins/crypto/blob/6b95fa81b26312e46f02557dca0b5f5c898a76fd/lib/crypto/library/cryptor.py#L132-L147 | [
"def",
"_is_common_binary",
"(",
"self",
",",
"inpath",
")",
":",
"# make local variables for the available char numbers in the suffix types to be tested",
"two_suffix",
"=",
"inpath",
"[",
"-",
"3",
":",
"]",
"three_suffix",
"=",
"inpath",
"[",
"-",
"4",
":",
"]",
... | 6b95fa81b26312e46f02557dca0b5f5c898a76fd |
train | Cryptor._is_common_text | private method to compare file path mime type to common text file types | lib/crypto/library/cryptor.py | def _is_common_text(self, inpath):
"""private method to compare file path mime type to common text file types"""
# make local variables for the available char numbers in the suffix types to be tested
one_suffix = inpath[-2:]
two_suffix = inpath[-3:]
three_suffix = inpath[-4:]
... | def _is_common_text(self, inpath):
"""private method to compare file path mime type to common text file types"""
# make local variables for the available char numbers in the suffix types to be tested
one_suffix = inpath[-2:]
two_suffix = inpath[-3:]
three_suffix = inpath[-4:]
... | [
"private",
"method",
"to",
"compare",
"file",
"path",
"mime",
"type",
"to",
"common",
"text",
"file",
"types"
] | chrissimpkins/crypto | python | https://github.com/chrissimpkins/crypto/blob/6b95fa81b26312e46f02557dca0b5f5c898a76fd/lib/crypto/library/cryptor.py#L149-L167 | [
"def",
"_is_common_text",
"(",
"self",
",",
"inpath",
")",
":",
"# make local variables for the available char numbers in the suffix types to be tested",
"one_suffix",
"=",
"inpath",
"[",
"-",
"2",
":",
"]",
"two_suffix",
"=",
"inpath",
"[",
"-",
"3",
":",
"]",
"thr... | 6b95fa81b26312e46f02557dca0b5f5c898a76fd |
train | knn_impute_few_observed | Seems to be the fastest kNN implementation. Pre-sorts each rows neighbors
and then filters these sorted indices using each columns mask of
observed values.
Important detail: If k observed values are not available then uses fewer
than k neighboring rows.
Parameters
----------
X : np.ndarray... | knnimpute/few_observed_entries.py | def knn_impute_few_observed(
X, missing_mask, k, verbose=False, print_interval=100):
"""
Seems to be the fastest kNN implementation. Pre-sorts each rows neighbors
and then filters these sorted indices using each columns mask of
observed values.
Important detail: If k observed values are not... | def knn_impute_few_observed(
X, missing_mask, k, verbose=False, print_interval=100):
"""
Seems to be the fastest kNN implementation. Pre-sorts each rows neighbors
and then filters these sorted indices using each columns mask of
observed values.
Important detail: If k observed values are not... | [
"Seems",
"to",
"be",
"the",
"fastest",
"kNN",
"implementation",
".",
"Pre",
"-",
"sorts",
"each",
"rows",
"neighbors",
"and",
"then",
"filters",
"these",
"sorted",
"indices",
"using",
"each",
"columns",
"mask",
"of",
"observed",
"values",
"."
] | iskandr/knnimpute | python | https://github.com/iskandr/knnimpute/blob/9a1b8abed9ce6c07a606f3f28cf45333e84d62f4/knnimpute/few_observed_entries.py#L21-L90 | [
"def",
"knn_impute_few_observed",
"(",
"X",
",",
"missing_mask",
",",
"k",
",",
"verbose",
"=",
"False",
",",
"print_interval",
"=",
"100",
")",
":",
"start_t",
"=",
"time",
".",
"time",
"(",
")",
"n_rows",
",",
"n_cols",
"=",
"X",
".",
"shape",
"# put... | 9a1b8abed9ce6c07a606f3f28cf45333e84d62f4 |
train | knn_initialize | Fill X with NaN values if necessary, construct the n_samples x n_samples
distance matrix and set the self-distance of each row to infinity.
Returns contents of X laid out in row-major, the distance matrix,
and an "effective infinity" which is larger than any entry of the
distance matrix. | knnimpute/common.py | def knn_initialize(
X,
missing_mask,
verbose=False,
min_dist=1e-6,
max_dist_multiplier=1e6):
"""
Fill X with NaN values if necessary, construct the n_samples x n_samples
distance matrix and set the self-distance of each row to infinity.
Returns contents of X laid... | def knn_initialize(
X,
missing_mask,
verbose=False,
min_dist=1e-6,
max_dist_multiplier=1e6):
"""
Fill X with NaN values if necessary, construct the n_samples x n_samples
distance matrix and set the self-distance of each row to infinity.
Returns contents of X laid... | [
"Fill",
"X",
"with",
"NaN",
"values",
"if",
"necessary",
"construct",
"the",
"n_samples",
"x",
"n_samples",
"distance",
"matrix",
"and",
"set",
"the",
"self",
"-",
"distance",
"of",
"each",
"row",
"to",
"infinity",
"."
] | iskandr/knnimpute | python | https://github.com/iskandr/knnimpute/blob/9a1b8abed9ce6c07a606f3f28cf45333e84d62f4/knnimpute/common.py#L20-L50 | [
"def",
"knn_initialize",
"(",
"X",
",",
"missing_mask",
",",
"verbose",
"=",
"False",
",",
"min_dist",
"=",
"1e-6",
",",
"max_dist_multiplier",
"=",
"1e6",
")",
":",
"X_row_major",
"=",
"X",
".",
"copy",
"(",
"\"C\"",
")",
"if",
"missing_mask",
".",
"sum... | 9a1b8abed9ce6c07a606f3f28cf45333e84d62f4 |
train | knn_impute_optimistic | Fill in the given incomplete matrix using k-nearest neighbor imputation.
This version assumes that most of the time the same neighbors will be
used so first performs the weighted average of a row's k-nearest neighbors
and checks afterward whether it was valid (due to possible missing values).
Has been... | knnimpute/optimistic.py | def knn_impute_optimistic(
X,
missing_mask,
k,
verbose=False,
print_interval=100):
"""
Fill in the given incomplete matrix using k-nearest neighbor imputation.
This version assumes that most of the time the same neighbors will be
used so first performs the weight... | def knn_impute_optimistic(
X,
missing_mask,
k,
verbose=False,
print_interval=100):
"""
Fill in the given incomplete matrix using k-nearest neighbor imputation.
This version assumes that most of the time the same neighbors will be
used so first performs the weight... | [
"Fill",
"in",
"the",
"given",
"incomplete",
"matrix",
"using",
"k",
"-",
"nearest",
"neighbor",
"imputation",
"."
] | iskandr/knnimpute | python | https://github.com/iskandr/knnimpute/blob/9a1b8abed9ce6c07a606f3f28cf45333e84d62f4/knnimpute/optimistic.py#L21-L152 | [
"def",
"knn_impute_optimistic",
"(",
"X",
",",
"missing_mask",
",",
"k",
",",
"verbose",
"=",
"False",
",",
"print_interval",
"=",
"100",
")",
":",
"start_t",
"=",
"time",
".",
"time",
"(",
")",
"n_rows",
",",
"n_cols",
"=",
"X",
".",
"shape",
"X_row_m... | 9a1b8abed9ce6c07a606f3f28cf45333e84d62f4 |
train | all_pairs_normalized_distances | We can't really compute distances over incomplete data since
rows are missing different numbers of entries.
The next best thing is the mean squared difference between two vectors
(a normalized distance), which gets computed only over the columns that
two vectors have in common. If two vectors have no fe... | knnimpute/normalized_distance.py | def all_pairs_normalized_distances(X):
"""
We can't really compute distances over incomplete data since
rows are missing different numbers of entries.
The next best thing is the mean squared difference between two vectors
(a normalized distance), which gets computed only over the columns that
tw... | def all_pairs_normalized_distances(X):
"""
We can't really compute distances over incomplete data since
rows are missing different numbers of entries.
The next best thing is the mean squared difference between two vectors
(a normalized distance), which gets computed only over the columns that
tw... | [
"We",
"can",
"t",
"really",
"compute",
"distances",
"over",
"incomplete",
"data",
"since",
"rows",
"are",
"missing",
"different",
"numbers",
"of",
"entries",
".",
"The",
"next",
"best",
"thing",
"is",
"the",
"mean",
"squared",
"difference",
"between",
"two",
... | iskandr/knnimpute | python | https://github.com/iskandr/knnimpute/blob/9a1b8abed9ce6c07a606f3f28cf45333e84d62f4/knnimpute/normalized_distance.py#L18-L84 | [
"def",
"all_pairs_normalized_distances",
"(",
"X",
")",
":",
"n_rows",
",",
"n_cols",
"=",
"X",
".",
"shape",
"# matrix of mean squared difference between between samples",
"D",
"=",
"np",
".",
"ones",
"(",
"(",
"n_rows",
",",
"n_rows",
")",
",",
"dtype",
"=",
... | 9a1b8abed9ce6c07a606f3f28cf45333e84d62f4 |
train | all_pairs_normalized_distances_reference | Reference implementation of normalized all-pairs distance, used
for testing the more efficient implementation above for equivalence. | knnimpute/normalized_distance.py | def all_pairs_normalized_distances_reference(X):
"""
Reference implementation of normalized all-pairs distance, used
for testing the more efficient implementation above for equivalence.
"""
n_samples, n_cols = X.shape
# matrix of mean squared difference between between samples
D = np.ones((n... | def all_pairs_normalized_distances_reference(X):
"""
Reference implementation of normalized all-pairs distance, used
for testing the more efficient implementation above for equivalence.
"""
n_samples, n_cols = X.shape
# matrix of mean squared difference between between samples
D = np.ones((n... | [
"Reference",
"implementation",
"of",
"normalized",
"all",
"-",
"pairs",
"distance",
"used",
"for",
"testing",
"the",
"more",
"efficient",
"implementation",
"above",
"for",
"equivalence",
"."
] | iskandr/knnimpute | python | https://github.com/iskandr/knnimpute/blob/9a1b8abed9ce6c07a606f3f28cf45333e84d62f4/knnimpute/normalized_distance.py#L87-L103 | [
"def",
"all_pairs_normalized_distances_reference",
"(",
"X",
")",
":",
"n_samples",
",",
"n_cols",
"=",
"X",
".",
"shape",
"# matrix of mean squared difference between between samples",
"D",
"=",
"np",
".",
"ones",
"(",
"(",
"n_samples",
",",
"n_samples",
")",
",",
... | 9a1b8abed9ce6c07a606f3f28cf45333e84d62f4 |
train | knn_impute_with_argpartition | Fill in the given incomplete matrix using k-nearest neighbor imputation.
This version is a simpler algorithm meant primarily for testing but
surprisingly it's faster for many (but not all) dataset sizes, particularly
when most of the columns are missing in any given row. The crucial
bottleneck is the c... | knnimpute/argpartition.py | def knn_impute_with_argpartition(
X,
missing_mask,
k,
verbose=False,
print_interval=100):
"""
Fill in the given incomplete matrix using k-nearest neighbor imputation.
This version is a simpler algorithm meant primarily for testing but
surprisingly it's faster for... | def knn_impute_with_argpartition(
X,
missing_mask,
k,
verbose=False,
print_interval=100):
"""
Fill in the given incomplete matrix using k-nearest neighbor imputation.
This version is a simpler algorithm meant primarily for testing but
surprisingly it's faster for... | [
"Fill",
"in",
"the",
"given",
"incomplete",
"matrix",
"using",
"k",
"-",
"nearest",
"neighbor",
"imputation",
"."
] | iskandr/knnimpute | python | https://github.com/iskandr/knnimpute/blob/9a1b8abed9ce6c07a606f3f28cf45333e84d62f4/knnimpute/argpartition.py#L22-L98 | [
"def",
"knn_impute_with_argpartition",
"(",
"X",
",",
"missing_mask",
",",
"k",
",",
"verbose",
"=",
"False",
",",
"print_interval",
"=",
"100",
")",
":",
"start_t",
"=",
"time",
".",
"time",
"(",
")",
"n_rows",
",",
"n_cols",
"=",
"X",
".",
"shape",
"... | 9a1b8abed9ce6c07a606f3f28cf45333e84d62f4 |
train | knn_impute_reference | Reference implementation of kNN imputation logic. | knnimpute/reference.py | def knn_impute_reference(
X,
missing_mask,
k,
verbose=False,
print_interval=100):
"""
Reference implementation of kNN imputation logic.
"""
n_rows, n_cols = X.shape
X_result, D, effective_infinity = \
knn_initialize(X, missing_mask, verbose=verbose)
... | def knn_impute_reference(
X,
missing_mask,
k,
verbose=False,
print_interval=100):
"""
Reference implementation of kNN imputation logic.
"""
n_rows, n_cols = X.shape
X_result, D, effective_infinity = \
knn_initialize(X, missing_mask, verbose=verbose)
... | [
"Reference",
"implementation",
"of",
"kNN",
"imputation",
"logic",
"."
] | iskandr/knnimpute | python | https://github.com/iskandr/knnimpute/blob/9a1b8abed9ce6c07a606f3f28cf45333e84d62f4/knnimpute/reference.py#L20-L55 | [
"def",
"knn_impute_reference",
"(",
"X",
",",
"missing_mask",
",",
"k",
",",
"verbose",
"=",
"False",
",",
"print_interval",
"=",
"100",
")",
":",
"n_rows",
",",
"n_cols",
"=",
"X",
".",
"shape",
"X_result",
",",
"D",
",",
"effective_infinity",
"=",
"knn... | 9a1b8abed9ce6c07a606f3f28cf45333e84d62f4 |
train | VisitorManager.active | Returns all active users, e.g. not logged and non-expired session. | tracking/managers.py | def active(self, registered_only=True):
"Returns all active users, e.g. not logged and non-expired session."
visitors = self.filter(
expiry_time__gt=timezone.now(),
end_time=None
)
if registered_only:
visitors = visitors.filter(user__isnull=False)
... | def active(self, registered_only=True):
"Returns all active users, e.g. not logged and non-expired session."
visitors = self.filter(
expiry_time__gt=timezone.now(),
end_time=None
)
if registered_only:
visitors = visitors.filter(user__isnull=False)
... | [
"Returns",
"all",
"active",
"users",
"e",
".",
"g",
".",
"not",
"logged",
"and",
"non",
"-",
"expired",
"session",
"."
] | bruth/django-tracking2 | python | https://github.com/bruth/django-tracking2/blob/e029f35907e65ca38e0783f6bdbe9f481d946ddb/tracking/managers.py#L13-L21 | [
"def",
"active",
"(",
"self",
",",
"registered_only",
"=",
"True",
")",
":",
"visitors",
"=",
"self",
".",
"filter",
"(",
"expiry_time__gt",
"=",
"timezone",
".",
"now",
"(",
")",
",",
"end_time",
"=",
"None",
")",
"if",
"registered_only",
":",
"visitors... | e029f35907e65ca38e0783f6bdbe9f481d946ddb |
train | VisitorManager.stats | Returns a dictionary of visits including:
* total visits
* unique visits
* return ratio
* pages per visit (if pageviews are enabled)
* time on site
for all users, registered users and guests. | tracking/managers.py | def stats(self, start_date, end_date, registered_only=False):
"""Returns a dictionary of visits including:
* total visits
* unique visits
* return ratio
* pages per visit (if pageviews are enabled)
* time on site
for all users, registered use... | def stats(self, start_date, end_date, registered_only=False):
"""Returns a dictionary of visits including:
* total visits
* unique visits
* return ratio
* pages per visit (if pageviews are enabled)
* time on site
for all users, registered use... | [
"Returns",
"a",
"dictionary",
"of",
"visits",
"including",
":"
] | bruth/django-tracking2 | python | https://github.com/bruth/django-tracking2/blob/e029f35907e65ca38e0783f6bdbe9f481d946ddb/tracking/managers.py#L29-L151 | [
"def",
"stats",
"(",
"self",
",",
"start_date",
",",
"end_date",
",",
"registered_only",
"=",
"False",
")",
":",
"visitors",
"=",
"self",
".",
"filter",
"(",
"start_time__gte",
"=",
"start_date",
",",
"start_time__lt",
"=",
"end_date",
")",
"stats",
"=",
"... | e029f35907e65ca38e0783f6bdbe9f481d946ddb |
train | PageviewManager.stats | Returns a dictionary of pageviews including:
* total pageviews
for all users, registered users and guests. | tracking/managers.py | def stats(self, start_date=None, end_date=None, registered_only=False):
"""Returns a dictionary of pageviews including:
* total pageviews
for all users, registered users and guests.
"""
pageviews = self.filter(
visitor__start_time__lt=end_date,
visit... | def stats(self, start_date=None, end_date=None, registered_only=False):
"""Returns a dictionary of pageviews including:
* total pageviews
for all users, registered users and guests.
"""
pageviews = self.filter(
visitor__start_time__lt=end_date,
visit... | [
"Returns",
"a",
"dictionary",
"of",
"pageviews",
"including",
":"
] | bruth/django-tracking2 | python | https://github.com/bruth/django-tracking2/blob/e029f35907e65ca38e0783f6bdbe9f481d946ddb/tracking/managers.py#L189-L247 | [
"def",
"stats",
"(",
"self",
",",
"start_date",
"=",
"None",
",",
"end_date",
"=",
"None",
",",
"registered_only",
"=",
"False",
")",
":",
"pageviews",
"=",
"self",
".",
"filter",
"(",
"visitor__start_time__lt",
"=",
"end_date",
",",
"visitor__start_time__gte"... | e029f35907e65ca38e0783f6bdbe9f481d946ddb |
train | dashboard | Counts, aggregations and more! | tracking/views.py | def dashboard(request):
"Counts, aggregations and more!"
end_time = now()
start_time = end_time - timedelta(days=7)
defaults = {'start': start_time, 'end': end_time}
form = DashboardForm(data=request.GET or defaults)
if form.is_valid():
start_time = form.cleaned_data['start']
en... | def dashboard(request):
"Counts, aggregations and more!"
end_time = now()
start_time = end_time - timedelta(days=7)
defaults = {'start': start_time, 'end': end_time}
form = DashboardForm(data=request.GET or defaults)
if form.is_valid():
start_time = form.cleaned_data['start']
en... | [
"Counts",
"aggregations",
"and",
"more!"
] | bruth/django-tracking2 | python | https://github.com/bruth/django-tracking2/blob/e029f35907e65ca38e0783f6bdbe9f481d946ddb/tracking/views.py#L31-L68 | [
"def",
"dashboard",
"(",
"request",
")",
":",
"end_time",
"=",
"now",
"(",
")",
"start_time",
"=",
"end_time",
"-",
"timedelta",
"(",
"days",
"=",
"7",
")",
"defaults",
"=",
"{",
"'start'",
":",
"start_time",
",",
"'end'",
":",
"end_time",
"}",
"form",... | e029f35907e65ca38e0783f6bdbe9f481d946ddb |
train | Visitor.geoip_data | Attempt to retrieve MaxMind GeoIP data based on visitor's IP. | tracking/models.py | def geoip_data(self):
"""Attempt to retrieve MaxMind GeoIP data based on visitor's IP."""
if not HAS_GEOIP or not TRACK_USING_GEOIP:
return
if not hasattr(self, '_geoip_data'):
self._geoip_data = None
try:
gip = GeoIP(cache=GEOIP_CACHE_TYPE)
... | def geoip_data(self):
"""Attempt to retrieve MaxMind GeoIP data based on visitor's IP."""
if not HAS_GEOIP or not TRACK_USING_GEOIP:
return
if not hasattr(self, '_geoip_data'):
self._geoip_data = None
try:
gip = GeoIP(cache=GEOIP_CACHE_TYPE)
... | [
"Attempt",
"to",
"retrieve",
"MaxMind",
"GeoIP",
"data",
"based",
"on",
"visitor",
"s",
"IP",
"."
] | bruth/django-tracking2 | python | https://github.com/bruth/django-tracking2/blob/e029f35907e65ca38e0783f6bdbe9f481d946ddb/tracking/models.py#L62-L77 | [
"def",
"geoip_data",
"(",
"self",
")",
":",
"if",
"not",
"HAS_GEOIP",
"or",
"not",
"TRACK_USING_GEOIP",
":",
"return",
"if",
"not",
"hasattr",
"(",
"self",
",",
"'_geoip_data'",
")",
":",
"self",
".",
"_geoip_data",
"=",
"None",
"try",
":",
"gip",
"=",
... | e029f35907e65ca38e0783f6bdbe9f481d946ddb |
train | escape | Convert the characters &, <, >, ' and " in string s to HTML-safe
sequences. Use this if you need to display text that might contain
such characters in HTML. Marks return value as markup string. | pyjade/runtime.py | def escape(s):
"""Convert the characters &, <, >, ' and " in string s to HTML-safe
sequences. Use this if you need to display text that might contain
such characters in HTML. Marks return value as markup string.
"""
if hasattr(s, '__html__'):
return s.__html__()
if isinstance(s, six.bi... | def escape(s):
"""Convert the characters &, <, >, ' and " in string s to HTML-safe
sequences. Use this if you need to display text that might contain
such characters in HTML. Marks return value as markup string.
"""
if hasattr(s, '__html__'):
return s.__html__()
if isinstance(s, six.bi... | [
"Convert",
"the",
"characters",
"&",
"<",
">",
"and",
"in",
"string",
"s",
"to",
"HTML",
"-",
"safe",
"sequences",
".",
"Use",
"this",
"if",
"you",
"need",
"to",
"display",
"text",
"that",
"might",
"contain",
"such",
"characters",
"in",
"HTML",
".",
"M... | syrusakbary/pyjade | python | https://github.com/syrusakbary/pyjade/blob/d8cf1d9404c759c6a2430c9a900874ab0e970cd8/pyjade/runtime.py#L28-L48 | [
"def",
"escape",
"(",
"s",
")",
":",
"if",
"hasattr",
"(",
"s",
",",
"'__html__'",
")",
":",
"return",
"s",
".",
"__html__",
"(",
")",
"if",
"isinstance",
"(",
"s",
",",
"six",
".",
"binary_type",
")",
":",
"s",
"=",
"six",
".",
"text_type",
"(",... | d8cf1d9404c759c6a2430c9a900874ab0e970cd8 |
train | iteration | Jade iteration supports "for 'value' [, key]?" iteration only.
PyJade has implicitly supported value unpacking instead, without
the list indexes. Trying to not break existing code, the following
rules are applied:
1. If the object is a mapping type, return it as-is, and assume
the caller has... | pyjade/runtime.py | def iteration(obj, num_keys):
"""
Jade iteration supports "for 'value' [, key]?" iteration only.
PyJade has implicitly supported value unpacking instead, without
the list indexes. Trying to not break existing code, the following
rules are applied:
1. If the object is a mapping type, return it... | def iteration(obj, num_keys):
"""
Jade iteration supports "for 'value' [, key]?" iteration only.
PyJade has implicitly supported value unpacking instead, without
the list indexes. Trying to not break existing code, the following
rules are applied:
1. If the object is a mapping type, return it... | [
"Jade",
"iteration",
"supports",
"for",
"value",
"[",
"key",
"]",
"?",
"iteration",
"only",
".",
"PyJade",
"has",
"implicitly",
"supported",
"value",
"unpacking",
"instead",
"without",
"the",
"list",
"indexes",
".",
"Trying",
"to",
"not",
"break",
"existing",
... | syrusakbary/pyjade | python | https://github.com/syrusakbary/pyjade/blob/d8cf1d9404c759c6a2430c9a900874ab0e970cd8/pyjade/runtime.py#L89-L135 | [
"def",
"iteration",
"(",
"obj",
",",
"num_keys",
")",
":",
"# If the object is a mapping type, return it as-is",
"if",
"is_mapping",
"(",
"obj",
")",
":",
"return",
"obj",
"_marker",
"=",
"[",
"]",
"iter_obj",
"=",
"iter",
"(",
"obj",
")",
"head",
"=",
"next... | d8cf1d9404c759c6a2430c9a900874ab0e970cd8 |
train | do_evaluate | Calls an arbitrary method on an object. | pyjade/ext/django/templatetags.py | def do_evaluate(parser, token):
'''Calls an arbitrary method on an object.'''
code = token.contents
firstspace = code.find(' ')
if firstspace >= 0:
code = code[firstspace+1:]
return Evaluator(code) | def do_evaluate(parser, token):
'''Calls an arbitrary method on an object.'''
code = token.contents
firstspace = code.find(' ')
if firstspace >= 0:
code = code[firstspace+1:]
return Evaluator(code) | [
"Calls",
"an",
"arbitrary",
"method",
"on",
"an",
"object",
"."
] | syrusakbary/pyjade | python | https://github.com/syrusakbary/pyjade/blob/d8cf1d9404c759c6a2430c9a900874ab0e970cd8/pyjade/ext/django/templatetags.py#L24-L30 | [
"def",
"do_evaluate",
"(",
"parser",
",",
"token",
")",
":",
"code",
"=",
"token",
".",
"contents",
"firstspace",
"=",
"code",
".",
"find",
"(",
"' '",
")",
"if",
"firstspace",
">=",
"0",
":",
"code",
"=",
"code",
"[",
"firstspace",
"+",
"1",
":",
... | d8cf1d9404c759c6a2430c9a900874ab0e970cd8 |
train | do_set | Calls an arbitrary method on an object. | pyjade/ext/django/templatetags.py | def do_set(parser, token):
'''Calls an arbitrary method on an object.'''
code = token.contents
firstspace = code.find(' ')
if firstspace >= 0:
code = code[firstspace+1:]
return Setter(code) | def do_set(parser, token):
'''Calls an arbitrary method on an object.'''
code = token.contents
firstspace = code.find(' ')
if firstspace >= 0:
code = code[firstspace+1:]
return Setter(code) | [
"Calls",
"an",
"arbitrary",
"method",
"on",
"an",
"object",
"."
] | syrusakbary/pyjade | python | https://github.com/syrusakbary/pyjade/blob/d8cf1d9404c759c6a2430c9a900874ab0e970cd8/pyjade/ext/django/templatetags.py#L50-L56 | [
"def",
"do_set",
"(",
"parser",
",",
"token",
")",
":",
"code",
"=",
"token",
".",
"contents",
"firstspace",
"=",
"code",
".",
"find",
"(",
"' '",
")",
"if",
"firstspace",
">=",
"0",
":",
"code",
"=",
"code",
"[",
"firstspace",
"+",
"1",
":",
"]",
... | d8cf1d9404c759c6a2430c9a900874ab0e970cd8 |
train | Evaluator.render | Evaluates the code in the page and returns the result | pyjade/ext/django/templatetags.py | def render(self, context):
'''Evaluates the code in the page and returns the result'''
modules = {
'pyjade': __import__('pyjade')
}
context['false'] = False
context['true'] = True
try:
return six.text_type(eval('pyjade.runtime.attrs(%s)'%self.code,modules,context))
except NameE... | def render(self, context):
'''Evaluates the code in the page and returns the result'''
modules = {
'pyjade': __import__('pyjade')
}
context['false'] = False
context['true'] = True
try:
return six.text_type(eval('pyjade.runtime.attrs(%s)'%self.code,modules,context))
except NameE... | [
"Evaluates",
"the",
"code",
"in",
"the",
"page",
"and",
"returns",
"the",
"result"
] | syrusakbary/pyjade | python | https://github.com/syrusakbary/pyjade/blob/d8cf1d9404c759c6a2430c9a900874ab0e970cd8/pyjade/ext/django/templatetags.py#L37-L47 | [
"def",
"render",
"(",
"self",
",",
"context",
")",
":",
"modules",
"=",
"{",
"'pyjade'",
":",
"__import__",
"(",
"'pyjade'",
")",
"}",
"context",
"[",
"'false'",
"]",
"=",
"False",
"context",
"[",
"'true'",
"]",
"=",
"True",
"try",
":",
"return",
"si... | d8cf1d9404c759c6a2430c9a900874ab0e970cd8 |
train | Setter.render | Evaluates the code in the page and returns the result | pyjade/ext/django/templatetags.py | def render(self, context):
'''Evaluates the code in the page and returns the result'''
modules = {
}
context['false'] = False
context['true'] = True
new_ctx = eval('dict(%s)'%self.code,modules,context)
context.update(new_ctx)
return '' | def render(self, context):
'''Evaluates the code in the page and returns the result'''
modules = {
}
context['false'] = False
context['true'] = True
new_ctx = eval('dict(%s)'%self.code,modules,context)
context.update(new_ctx)
return '' | [
"Evaluates",
"the",
"code",
"in",
"the",
"page",
"and",
"returns",
"the",
"result"
] | syrusakbary/pyjade | python | https://github.com/syrusakbary/pyjade/blob/d8cf1d9404c759c6a2430c9a900874ab0e970cd8/pyjade/ext/django/templatetags.py#L63-L71 | [
"def",
"render",
"(",
"self",
",",
"context",
")",
":",
"modules",
"=",
"{",
"}",
"context",
"[",
"'false'",
"]",
"=",
"False",
"context",
"[",
"'true'",
"]",
"=",
"True",
"new_ctx",
"=",
"eval",
"(",
"'dict(%s)'",
"%",
"self",
".",
"code",
",",
"m... | d8cf1d9404c759c6a2430c9a900874ab0e970cd8 |
train | sprite_filepath_build | returns the filepath of the sprite *relative to SPRITE_CACHE* | pokebase/common.py | def sprite_filepath_build(sprite_type, sprite_id, **kwargs):
"""returns the filepath of the sprite *relative to SPRITE_CACHE*"""
options = parse_sprite_options(sprite_type, **kwargs)
filename = '.'.join([str(sprite_id), SPRITE_EXT])
filepath = os.path.join(sprite_type, *options, filename)
return ... | def sprite_filepath_build(sprite_type, sprite_id, **kwargs):
"""returns the filepath of the sprite *relative to SPRITE_CACHE*"""
options = parse_sprite_options(sprite_type, **kwargs)
filename = '.'.join([str(sprite_id), SPRITE_EXT])
filepath = os.path.join(sprite_type, *options, filename)
return ... | [
"returns",
"the",
"filepath",
"of",
"the",
"sprite",
"*",
"relative",
"to",
"SPRITE_CACHE",
"*"
] | PokeAPI/pokebase | python | https://github.com/PokeAPI/pokebase/blob/e7d695662037811f3956ed4ea817ffee70b12e33/pokebase/common.py#L72-L80 | [
"def",
"sprite_filepath_build",
"(",
"sprite_type",
",",
"sprite_id",
",",
"*",
"*",
"kwargs",
")",
":",
"options",
"=",
"parse_sprite_options",
"(",
"sprite_type",
",",
"*",
"*",
"kwargs",
")",
"filename",
"=",
"'.'",
".",
"join",
"(",
"[",
"str",
"(",
... | e7d695662037811f3956ed4ea817ffee70b12e33 |
train | _make_obj | Takes an object and returns a corresponding API class.
The names and values of the data will match exactly with those found
in the online docs at https://pokeapi.co/docsv2/ . In some cases, the data
may be of a standard type, such as an integer or string. For those cases,
the input value is simply retu... | pokebase/interface.py | def _make_obj(obj):
"""Takes an object and returns a corresponding API class.
The names and values of the data will match exactly with those found
in the online docs at https://pokeapi.co/docsv2/ . In some cases, the data
may be of a standard type, such as an integer or string. For those cases,
the... | def _make_obj(obj):
"""Takes an object and returns a corresponding API class.
The names and values of the data will match exactly with those found
in the online docs at https://pokeapi.co/docsv2/ . In some cases, the data
may be of a standard type, such as an integer or string. For those cases,
the... | [
"Takes",
"an",
"object",
"and",
"returns",
"a",
"corresponding",
"API",
"class",
"."
] | PokeAPI/pokebase | python | https://github.com/PokeAPI/pokebase/blob/e7d695662037811f3956ed4ea817ffee70b12e33/pokebase/interface.py#L7-L29 | [
"def",
"_make_obj",
"(",
"obj",
")",
":",
"if",
"isinstance",
"(",
"obj",
",",
"dict",
")",
":",
"if",
"'url'",
"in",
"obj",
".",
"keys",
"(",
")",
":",
"url",
"=",
"obj",
"[",
"'url'",
"]",
"id_",
"=",
"int",
"(",
"url",
".",
"split",
"(",
"... | e7d695662037811f3956ed4ea817ffee70b12e33 |
train | APIResource._load | Function to collect reference data and connect it to the instance as
attributes.
Internal function, does not usually need to be called by the user, as
it is called automatically when an attribute is requested.
:return None | pokebase/interface.py | def _load(self):
"""Function to collect reference data and connect it to the instance as
attributes.
Internal function, does not usually need to be called by the user, as
it is called automatically when an attribute is requested.
:return None
"""
data = get_... | def _load(self):
"""Function to collect reference data and connect it to the instance as
attributes.
Internal function, does not usually need to be called by the user, as
it is called automatically when an attribute is requested.
:return None
"""
data = get_... | [
"Function",
"to",
"collect",
"reference",
"data",
"and",
"connect",
"it",
"to",
"the",
"instance",
"as",
"attributes",
"."
] | PokeAPI/pokebase | python | https://github.com/PokeAPI/pokebase/blob/e7d695662037811f3956ed4ea817ffee70b12e33/pokebase/interface.py#L126-L158 | [
"def",
"_load",
"(",
"self",
")",
":",
"data",
"=",
"get_data",
"(",
"self",
".",
"endpoint",
",",
"self",
".",
"id_",
",",
"force_lookup",
"=",
"self",
".",
"__force_lookup",
")",
"# Make our custom objects from the data.",
"for",
"key",
",",
"val",
"in",
... | e7d695662037811f3956ed4ea817ffee70b12e33 |
train | safe_make_dirs | Create a leaf directory and all intermediate ones in a safe way.
A wrapper to os.makedirs() that handles existing leaf directories while
avoiding os.path.exists() race conditions.
:param path: relative or absolute directory tree to create
:param mode: directory permissions in octal
:return: The ne... | pokebase/cache.py | def safe_make_dirs(path, mode=0o777):
"""Create a leaf directory and all intermediate ones in a safe way.
A wrapper to os.makedirs() that handles existing leaf directories while
avoiding os.path.exists() race conditions.
:param path: relative or absolute directory tree to create
:param mode: direc... | def safe_make_dirs(path, mode=0o777):
"""Create a leaf directory and all intermediate ones in a safe way.
A wrapper to os.makedirs() that handles existing leaf directories while
avoiding os.path.exists() race conditions.
:param path: relative or absolute directory tree to create
:param mode: direc... | [
"Create",
"a",
"leaf",
"directory",
"and",
"all",
"intermediate",
"ones",
"in",
"a",
"safe",
"way",
"."
] | PokeAPI/pokebase | python | https://github.com/PokeAPI/pokebase/blob/e7d695662037811f3956ed4ea817ffee70b12e33/pokebase/cache.py#L76-L92 | [
"def",
"safe_make_dirs",
"(",
"path",
",",
"mode",
"=",
"0o777",
")",
":",
"try",
":",
"os",
".",
"makedirs",
"(",
"path",
",",
"mode",
")",
"except",
"OSError",
"as",
"error",
":",
"if",
"error",
".",
"errno",
"!=",
"17",
":",
"# File exists",
"rais... | e7d695662037811f3956ed4ea817ffee70b12e33 |
train | get_default_cache | Get the default cache location.
Adheres to the XDG Base Directory specification, as described in
https://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
:return: the default cache directory absolute path | pokebase/cache.py | def get_default_cache():
"""Get the default cache location.
Adheres to the XDG Base Directory specification, as described in
https://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
:return: the default cache directory absolute path
"""
xdg_cache_home = os.environ.get('XDG_CACH... | def get_default_cache():
"""Get the default cache location.
Adheres to the XDG Base Directory specification, as described in
https://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
:return: the default cache directory absolute path
"""
xdg_cache_home = os.environ.get('XDG_CACH... | [
"Get",
"the",
"default",
"cache",
"location",
"."
] | PokeAPI/pokebase | python | https://github.com/PokeAPI/pokebase/blob/e7d695662037811f3956ed4ea817ffee70b12e33/pokebase/cache.py#L95-L107 | [
"def",
"get_default_cache",
"(",
")",
":",
"xdg_cache_home",
"=",
"os",
".",
"environ",
".",
"get",
"(",
"'XDG_CACHE_HOME'",
")",
"or",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"path",
".",
"expanduser",
"(",
"'~'",
")",
",",
"'.cache'",
")",
... | e7d695662037811f3956ed4ea817ffee70b12e33 |
train | set_cache | Simple function to change the cache location.
`new_path` can be an absolute or relative path. If the directory does not
exist yet, this function will create it. If None it will set the cache to
the default cache directory.
If you are going to change the cache directory, this function should be
cal... | pokebase/cache.py | def set_cache(new_path=None):
"""Simple function to change the cache location.
`new_path` can be an absolute or relative path. If the directory does not
exist yet, this function will create it. If None it will set the cache to
the default cache directory.
If you are going to change the cache direc... | def set_cache(new_path=None):
"""Simple function to change the cache location.
`new_path` can be an absolute or relative path. If the directory does not
exist yet, this function will create it. If None it will set the cache to
the default cache directory.
If you are going to change the cache direc... | [
"Simple",
"function",
"to",
"change",
"the",
"cache",
"location",
"."
] | PokeAPI/pokebase | python | https://github.com/PokeAPI/pokebase/blob/e7d695662037811f3956ed4ea817ffee70b12e33/pokebase/cache.py#L117-L142 | [
"def",
"set_cache",
"(",
"new_path",
"=",
"None",
")",
":",
"global",
"CACHE_DIR",
",",
"API_CACHE",
",",
"SPRITE_CACHE",
"if",
"new_path",
"is",
"None",
":",
"new_path",
"=",
"get_default_cache",
"(",
")",
"CACHE_DIR",
"=",
"safe_make_dirs",
"(",
"os",
".",... | e7d695662037811f3956ed4ea817ffee70b12e33 |
train | UnityHost.attach | Attaches lun, snap or member snap of cg snap to host.
Don't pass cg snapshot in as `lun_or_snap`.
:param lun_or_snap: the lun, snap, or a member snap of cg snap
:param skip_hlu_0: whether to skip hlu 0
:return: the hlu number | storops/unity/resource/host.py | def attach(self, lun_or_snap, skip_hlu_0=False):
""" Attaches lun, snap or member snap of cg snap to host.
Don't pass cg snapshot in as `lun_or_snap`.
:param lun_or_snap: the lun, snap, or a member snap of cg snap
:param skip_hlu_0: whether to skip hlu 0
:return: the hlu number... | def attach(self, lun_or_snap, skip_hlu_0=False):
""" Attaches lun, snap or member snap of cg snap to host.
Don't pass cg snapshot in as `lun_or_snap`.
:param lun_or_snap: the lun, snap, or a member snap of cg snap
:param skip_hlu_0: whether to skip hlu 0
:return: the hlu number... | [
"Attaches",
"lun",
"snap",
"or",
"member",
"snap",
"of",
"cg",
"snap",
"to",
"host",
"."
] | emc-openstack/storops | python | https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/unity/resource/host.py#L259-L289 | [
"def",
"attach",
"(",
"self",
",",
"lun_or_snap",
",",
"skip_hlu_0",
"=",
"False",
")",
":",
"# `UnityResourceAlreadyAttachedError` check was removed due to there",
"# is a host cache existing in Cinder driver. If the lun was attached to",
"# the host and the info was stored in the cache... | 24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.