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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
valid | Droplet.get_actions | Returns a list of Action objects
This actions can be used to check the droplet's status | digitalocean/Droplet.py | def get_actions(self):
"""
Returns a list of Action objects
This actions can be used to check the droplet's status
"""
answer = self.get_data("droplets/%s/actions/" % self.id, type=GET)
actions = []
for action_dict in answer['actions']:
action... | def get_actions(self):
"""
Returns a list of Action objects
This actions can be used to check the droplet's status
"""
answer = self.get_data("droplets/%s/actions/" % self.id, type=GET)
actions = []
for action_dict in answer['actions']:
action... | [
"Returns",
"a",
"list",
"of",
"Action",
"objects",
"This",
"actions",
"can",
"be",
"used",
"to",
"check",
"the",
"droplet",
"s",
"status"
] | koalalorenzo/python-digitalocean | python | https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/Droplet.py#L579-L593 | [
"def",
"get_actions",
"(",
"self",
")",
":",
"answer",
"=",
"self",
".",
"get_data",
"(",
"\"droplets/%s/actions/\"",
"%",
"self",
".",
"id",
",",
"type",
"=",
"GET",
")",
"actions",
"=",
"[",
"]",
"for",
"action_dict",
"in",
"answer",
"[",
"'actions'",
... | d0221b57856fb1e131cafecf99d826f7b07a947c |
valid | Droplet.get_action | Returns a specific Action by its ID.
Args:
action_id (int): id of action | digitalocean/Droplet.py | def get_action(self, action_id):
"""Returns a specific Action by its ID.
Args:
action_id (int): id of action
"""
return Action.get_object(
api_token=self.token,
action_id=action_id
) | def get_action(self, action_id):
"""Returns a specific Action by its ID.
Args:
action_id (int): id of action
"""
return Action.get_object(
api_token=self.token,
action_id=action_id
) | [
"Returns",
"a",
"specific",
"Action",
"by",
"its",
"ID",
"."
] | koalalorenzo/python-digitalocean | python | https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/Droplet.py#L595-L604 | [
"def",
"get_action",
"(",
"self",
",",
"action_id",
")",
":",
"return",
"Action",
".",
"get_object",
"(",
"api_token",
"=",
"self",
".",
"token",
",",
"action_id",
"=",
"action_id",
")"
] | d0221b57856fb1e131cafecf99d826f7b07a947c |
valid | Droplet.get_snapshots | This method will return the snapshots/images connected to that
specific droplet. | digitalocean/Droplet.py | def get_snapshots(self):
"""
This method will return the snapshots/images connected to that
specific droplet.
"""
snapshots = list()
for id in self.snapshot_ids:
snapshot = Image()
snapshot.id = id
snapshot.token = self.token
... | def get_snapshots(self):
"""
This method will return the snapshots/images connected to that
specific droplet.
"""
snapshots = list()
for id in self.snapshot_ids:
snapshot = Image()
snapshot.id = id
snapshot.token = self.token
... | [
"This",
"method",
"will",
"return",
"the",
"snapshots",
"/",
"images",
"connected",
"to",
"that",
"specific",
"droplet",
"."
] | koalalorenzo/python-digitalocean | python | https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/Droplet.py#L606-L617 | [
"def",
"get_snapshots",
"(",
"self",
")",
":",
"snapshots",
"=",
"list",
"(",
")",
"for",
"id",
"in",
"self",
".",
"snapshot_ids",
":",
"snapshot",
"=",
"Image",
"(",
")",
"snapshot",
".",
"id",
"=",
"id",
"snapshot",
".",
"token",
"=",
"self",
".",
... | d0221b57856fb1e131cafecf99d826f7b07a947c |
valid | Droplet.get_kernel_available | Get a list of kernels available | digitalocean/Droplet.py | def get_kernel_available(self):
"""
Get a list of kernels available
"""
kernels = list()
data = self.get_data("droplets/%s/kernels/" % self.id)
while True:
for jsond in data[u'kernels']:
kernel = Kernel(**jsond)
kernel.toke... | def get_kernel_available(self):
"""
Get a list of kernels available
"""
kernels = list()
data = self.get_data("droplets/%s/kernels/" % self.id)
while True:
for jsond in data[u'kernels']:
kernel = Kernel(**jsond)
kernel.toke... | [
"Get",
"a",
"list",
"of",
"kernels",
"available"
] | koalalorenzo/python-digitalocean | python | https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/Droplet.py#L619-L639 | [
"def",
"get_kernel_available",
"(",
"self",
")",
":",
"kernels",
"=",
"list",
"(",
")",
"data",
"=",
"self",
".",
"get_data",
"(",
"\"droplets/%s/kernels/\"",
"%",
"self",
".",
"id",
")",
"while",
"True",
":",
"for",
"jsond",
"in",
"data",
"[",
"u'kernel... | d0221b57856fb1e131cafecf99d826f7b07a947c |
valid | Domain.get_object | Class method that will return a Domain object by ID. | digitalocean/Domain.py | def get_object(cls, api_token, domain_name):
"""
Class method that will return a Domain object by ID.
"""
domain = cls(token=api_token, name=domain_name)
domain.load()
return domain | def get_object(cls, api_token, domain_name):
"""
Class method that will return a Domain object by ID.
"""
domain = cls(token=api_token, name=domain_name)
domain.load()
return domain | [
"Class",
"method",
"that",
"will",
"return",
"a",
"Domain",
"object",
"by",
"ID",
"."
] | koalalorenzo/python-digitalocean | python | https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/Domain.py#L16-L22 | [
"def",
"get_object",
"(",
"cls",
",",
"api_token",
",",
"domain_name",
")",
":",
"domain",
"=",
"cls",
"(",
"token",
"=",
"api_token",
",",
"name",
"=",
"domain_name",
")",
"domain",
".",
"load",
"(",
")",
"return",
"domain"
] | d0221b57856fb1e131cafecf99d826f7b07a947c |
valid | Domain.create_new_domain_record | Create new domain record.
https://developers.digitalocean.com/#create-a-new-domain-record
Args:
type: The record type (A, MX, CNAME, etc).
name: The host name, alias, or service being defined by the record
data: Variable data depending on record t... | digitalocean/Domain.py | def create_new_domain_record(self, *args, **kwargs):
"""
Create new domain record.
https://developers.digitalocean.com/#create-a-new-domain-record
Args:
type: The record type (A, MX, CNAME, etc).
name: The host name, alias, or service being de... | def create_new_domain_record(self, *args, **kwargs):
"""
Create new domain record.
https://developers.digitalocean.com/#create-a-new-domain-record
Args:
type: The record type (A, MX, CNAME, etc).
name: The host name, alias, or service being de... | [
"Create",
"new",
"domain",
"record",
".",
"https",
":",
"//",
"developers",
".",
"digitalocean",
".",
"com",
"/",
"#create",
"-",
"a",
"-",
"new",
"-",
"domain",
"-",
"record"
] | koalalorenzo/python-digitalocean | python | https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/Domain.py#L39-L74 | [
"def",
"create_new_domain_record",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"data",
"=",
"{",
"\"type\"",
":",
"kwargs",
".",
"get",
"(",
"\"type\"",
",",
"None",
")",
",",
"\"name\"",
":",
"kwargs",
".",
"get",
"(",
"\"name\... | d0221b57856fb1e131cafecf99d826f7b07a947c |
valid | Domain.create | Create new doamin | digitalocean/Domain.py | def create(self):
"""
Create new doamin
"""
# URL https://api.digitalocean.com/v2/domains
data = {
"name": self.name,
"ip_address": self.ip_address,
}
domain = self.get_data("domains", type=POST, params=data)
return domain | def create(self):
"""
Create new doamin
"""
# URL https://api.digitalocean.com/v2/domains
data = {
"name": self.name,
"ip_address": self.ip_address,
}
domain = self.get_data("domains", type=POST, params=data)
return domain | [
"Create",
"new",
"doamin"
] | koalalorenzo/python-digitalocean | python | https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/Domain.py#L76-L87 | [
"def",
"create",
"(",
"self",
")",
":",
"# URL https://api.digitalocean.com/v2/domains",
"data",
"=",
"{",
"\"name\"",
":",
"self",
".",
"name",
",",
"\"ip_address\"",
":",
"self",
".",
"ip_address",
",",
"}",
"domain",
"=",
"self",
".",
"get_data",
"(",
"\"... | d0221b57856fb1e131cafecf99d826f7b07a947c |
valid | Domain.get_records | Returns a list of Record objects | digitalocean/Domain.py | def get_records(self, params=None):
"""
Returns a list of Record objects
"""
if params is None:
params = {}
# URL https://api.digitalocean.com/v2/domains/[NAME]/records/
records = []
data = self.get_data("domains/%s/records/" % self.name, ... | def get_records(self, params=None):
"""
Returns a list of Record objects
"""
if params is None:
params = {}
# URL https://api.digitalocean.com/v2/domains/[NAME]/records/
records = []
data = self.get_data("domains/%s/records/" % self.name, ... | [
"Returns",
"a",
"list",
"of",
"Record",
"objects"
] | koalalorenzo/python-digitalocean | python | https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/Domain.py#L89-L106 | [
"def",
"get_records",
"(",
"self",
",",
"params",
"=",
"None",
")",
":",
"if",
"params",
"is",
"None",
":",
"params",
"=",
"{",
"}",
"# URL https://api.digitalocean.com/v2/domains/[NAME]/records/",
"records",
"=",
"[",
"]",
"data",
"=",
"self",
".",
"get_data"... | d0221b57856fb1e131cafecf99d826f7b07a947c |
valid | Account.get_object | Class method that will return an Account object. | digitalocean/Account.py | def get_object(cls, api_token):
"""
Class method that will return an Account object.
"""
acct = cls(token=api_token)
acct.load()
return acct | def get_object(cls, api_token):
"""
Class method that will return an Account object.
"""
acct = cls(token=api_token)
acct.load()
return acct | [
"Class",
"method",
"that",
"will",
"return",
"an",
"Account",
"object",
"."
] | koalalorenzo/python-digitalocean | python | https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/Account.py#L18-L24 | [
"def",
"get_object",
"(",
"cls",
",",
"api_token",
")",
":",
"acct",
"=",
"cls",
"(",
"token",
"=",
"api_token",
")",
"acct",
".",
"load",
"(",
")",
"return",
"acct"
] | d0221b57856fb1e131cafecf99d826f7b07a947c |
valid | FloatingIP.get_object | Class method that will return a FloatingIP object by its IP.
Args:
api_token: str - token
ip: str - floating ip address | digitalocean/FloatingIP.py | def get_object(cls, api_token, ip):
"""
Class method that will return a FloatingIP object by its IP.
Args:
api_token: str - token
ip: str - floating ip address
"""
floating_ip = cls(token=api_token, ip=ip)
floating_ip.load()
... | def get_object(cls, api_token, ip):
"""
Class method that will return a FloatingIP object by its IP.
Args:
api_token: str - token
ip: str - floating ip address
"""
floating_ip = cls(token=api_token, ip=ip)
floating_ip.load()
... | [
"Class",
"method",
"that",
"will",
"return",
"a",
"FloatingIP",
"object",
"by",
"its",
"IP",
"."
] | koalalorenzo/python-digitalocean | python | https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/FloatingIP.py#L14-L24 | [
"def",
"get_object",
"(",
"cls",
",",
"api_token",
",",
"ip",
")",
":",
"floating_ip",
"=",
"cls",
"(",
"token",
"=",
"api_token",
",",
"ip",
"=",
"ip",
")",
"floating_ip",
".",
"load",
"(",
")",
"return",
"floating_ip"
] | d0221b57856fb1e131cafecf99d826f7b07a947c |
valid | FloatingIP.load | Load the FloatingIP object from DigitalOcean.
Requires self.ip to be set. | digitalocean/FloatingIP.py | def load(self):
"""
Load the FloatingIP object from DigitalOcean.
Requires self.ip to be set.
"""
data = self.get_data('floating_ips/%s' % self.ip, type=GET)
floating_ip = data['floating_ip']
# Setting the attribute values
for attr in floating_ip... | def load(self):
"""
Load the FloatingIP object from DigitalOcean.
Requires self.ip to be set.
"""
data = self.get_data('floating_ips/%s' % self.ip, type=GET)
floating_ip = data['floating_ip']
# Setting the attribute values
for attr in floating_ip... | [
"Load",
"the",
"FloatingIP",
"object",
"from",
"DigitalOcean",
"."
] | koalalorenzo/python-digitalocean | python | https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/FloatingIP.py#L26-L39 | [
"def",
"load",
"(",
"self",
")",
":",
"data",
"=",
"self",
".",
"get_data",
"(",
"'floating_ips/%s'",
"%",
"self",
".",
"ip",
",",
"type",
"=",
"GET",
")",
"floating_ip",
"=",
"data",
"[",
"'floating_ip'",
"]",
"# Setting the attribute values",
"for",
"att... | d0221b57856fb1e131cafecf99d826f7b07a947c |
valid | FloatingIP.create | Creates a FloatingIP and assigns it to a Droplet.
Note: Every argument and parameter given to this method will be
assigned to the object.
Args:
droplet_id: int - droplet id | digitalocean/FloatingIP.py | def create(self, *args, **kwargs):
"""
Creates a FloatingIP and assigns it to a Droplet.
Note: Every argument and parameter given to this method will be
assigned to the object.
Args:
droplet_id: int - droplet id
"""
data = self.ge... | def create(self, *args, **kwargs):
"""
Creates a FloatingIP and assigns it to a Droplet.
Note: Every argument and parameter given to this method will be
assigned to the object.
Args:
droplet_id: int - droplet id
"""
data = self.ge... | [
"Creates",
"a",
"FloatingIP",
"and",
"assigns",
"it",
"to",
"a",
"Droplet",
"."
] | koalalorenzo/python-digitalocean | python | https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/FloatingIP.py#L41-L59 | [
"def",
"create",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"data",
"=",
"self",
".",
"get_data",
"(",
"'floating_ips/'",
",",
"type",
"=",
"POST",
",",
"params",
"=",
"{",
"'droplet_id'",
":",
"self",
".",
"droplet_id",
"}",
... | d0221b57856fb1e131cafecf99d826f7b07a947c |
valid | FloatingIP.reserve | Creates a FloatingIP in a region without assigning
it to a specific Droplet.
Note: Every argument and parameter given to this method will be
assigned to the object.
Args:
region_slug: str - region's slug (e.g. 'nyc3') | digitalocean/FloatingIP.py | def reserve(self, *args, **kwargs):
"""
Creates a FloatingIP in a region without assigning
it to a specific Droplet.
Note: Every argument and parameter given to this method will be
assigned to the object.
Args:
region_slug: str - regi... | def reserve(self, *args, **kwargs):
"""
Creates a FloatingIP in a region without assigning
it to a specific Droplet.
Note: Every argument and parameter given to this method will be
assigned to the object.
Args:
region_slug: str - regi... | [
"Creates",
"a",
"FloatingIP",
"in",
"a",
"region",
"without",
"assigning",
"it",
"to",
"a",
"specific",
"Droplet",
"."
] | koalalorenzo/python-digitalocean | python | https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/FloatingIP.py#L61-L80 | [
"def",
"reserve",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"data",
"=",
"self",
".",
"get_data",
"(",
"'floating_ips/'",
",",
"type",
"=",
"POST",
",",
"params",
"=",
"{",
"'region'",
":",
"self",
".",
"region_slug",
"}",
"... | d0221b57856fb1e131cafecf99d826f7b07a947c |
valid | FloatingIP.assign | Assign a FloatingIP to a Droplet.
Args:
droplet_id: int - droplet id | digitalocean/FloatingIP.py | def assign(self, droplet_id):
"""
Assign a FloatingIP to a Droplet.
Args:
droplet_id: int - droplet id
"""
return self.get_data(
"floating_ips/%s/actions/" % self.ip,
type=POST,
params={"type": "assign", "droplet_id": d... | def assign(self, droplet_id):
"""
Assign a FloatingIP to a Droplet.
Args:
droplet_id: int - droplet id
"""
return self.get_data(
"floating_ips/%s/actions/" % self.ip,
type=POST,
params={"type": "assign", "droplet_id": d... | [
"Assign",
"a",
"FloatingIP",
"to",
"a",
"Droplet",
"."
] | koalalorenzo/python-digitalocean | python | https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/FloatingIP.py#L88-L99 | [
"def",
"assign",
"(",
"self",
",",
"droplet_id",
")",
":",
"return",
"self",
".",
"get_data",
"(",
"\"floating_ips/%s/actions/\"",
"%",
"self",
".",
"ip",
",",
"type",
"=",
"POST",
",",
"params",
"=",
"{",
"\"type\"",
":",
"\"assign\"",
",",
"\"droplet_id\... | d0221b57856fb1e131cafecf99d826f7b07a947c |
valid | Firewall.get_object | Class method that will return a Firewall object by ID. | digitalocean/Firewall.py | def get_object(cls, api_token, firewall_id):
"""
Class method that will return a Firewall object by ID.
"""
firewall = cls(token=api_token, id=firewall_id)
firewall.load()
return firewall | def get_object(cls, api_token, firewall_id):
"""
Class method that will return a Firewall object by ID.
"""
firewall = cls(token=api_token, id=firewall_id)
firewall.load()
return firewall | [
"Class",
"method",
"that",
"will",
"return",
"a",
"Firewall",
"object",
"by",
"ID",
"."
] | koalalorenzo/python-digitalocean | python | https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/Firewall.py#L148-L154 | [
"def",
"get_object",
"(",
"cls",
",",
"api_token",
",",
"firewall_id",
")",
":",
"firewall",
"=",
"cls",
"(",
"token",
"=",
"api_token",
",",
"id",
"=",
"firewall_id",
")",
"firewall",
".",
"load",
"(",
")",
"return",
"firewall"
] | d0221b57856fb1e131cafecf99d826f7b07a947c |
valid | Firewall.add_tags | Add tags to this Firewall. | digitalocean/Firewall.py | def add_tags(self, tags):
"""
Add tags to this Firewall.
"""
return self.get_data(
"firewalls/%s/tags" % self.id,
type=POST,
params={"tags": tags}
) | def add_tags(self, tags):
"""
Add tags to this Firewall.
"""
return self.get_data(
"firewalls/%s/tags" % self.id,
type=POST,
params={"tags": tags}
) | [
"Add",
"tags",
"to",
"this",
"Firewall",
"."
] | koalalorenzo/python-digitalocean | python | https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/Firewall.py#L218-L226 | [
"def",
"add_tags",
"(",
"self",
",",
"tags",
")",
":",
"return",
"self",
".",
"get_data",
"(",
"\"firewalls/%s/tags\"",
"%",
"self",
".",
"id",
",",
"type",
"=",
"POST",
",",
"params",
"=",
"{",
"\"tags\"",
":",
"tags",
"}",
")"
] | d0221b57856fb1e131cafecf99d826f7b07a947c |
valid | Firewall.remove_tags | Remove tags from this Firewall. | digitalocean/Firewall.py | def remove_tags(self, tags):
"""
Remove tags from this Firewall.
"""
return self.get_data(
"firewalls/%s/tags" % self.id,
type=DELETE,
params={"tags": tags}
) | def remove_tags(self, tags):
"""
Remove tags from this Firewall.
"""
return self.get_data(
"firewalls/%s/tags" % self.id,
type=DELETE,
params={"tags": tags}
) | [
"Remove",
"tags",
"from",
"this",
"Firewall",
"."
] | koalalorenzo/python-digitalocean | python | https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/Firewall.py#L228-L236 | [
"def",
"remove_tags",
"(",
"self",
",",
"tags",
")",
":",
"return",
"self",
".",
"get_data",
"(",
"\"firewalls/%s/tags\"",
"%",
"self",
".",
"id",
",",
"type",
"=",
"DELETE",
",",
"params",
"=",
"{",
"\"tags\"",
":",
"tags",
"}",
")"
] | d0221b57856fb1e131cafecf99d826f7b07a947c |
valid | SSHKey.get_object | Class method that will return a SSHKey object by ID. | digitalocean/SSHKey.py | def get_object(cls, api_token, ssh_key_id):
"""
Class method that will return a SSHKey object by ID.
"""
ssh_key = cls(token=api_token, id=ssh_key_id)
ssh_key.load()
return ssh_key | def get_object(cls, api_token, ssh_key_id):
"""
Class method that will return a SSHKey object by ID.
"""
ssh_key = cls(token=api_token, id=ssh_key_id)
ssh_key.load()
return ssh_key | [
"Class",
"method",
"that",
"will",
"return",
"a",
"SSHKey",
"object",
"by",
"ID",
"."
] | koalalorenzo/python-digitalocean | python | https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/SSHKey.py#L15-L21 | [
"def",
"get_object",
"(",
"cls",
",",
"api_token",
",",
"ssh_key_id",
")",
":",
"ssh_key",
"=",
"cls",
"(",
"token",
"=",
"api_token",
",",
"id",
"=",
"ssh_key_id",
")",
"ssh_key",
".",
"load",
"(",
")",
"return",
"ssh_key"
] | d0221b57856fb1e131cafecf99d826f7b07a947c |
valid | SSHKey.load | Load the SSHKey object from DigitalOcean.
Requires either self.id or self.fingerprint to be set. | digitalocean/SSHKey.py | def load(self):
"""
Load the SSHKey object from DigitalOcean.
Requires either self.id or self.fingerprint to be set.
"""
identifier = None
if self.id:
identifier = self.id
elif self.fingerprint is not None:
identifier = self.finger... | def load(self):
"""
Load the SSHKey object from DigitalOcean.
Requires either self.id or self.fingerprint to be set.
"""
identifier = None
if self.id:
identifier = self.id
elif self.fingerprint is not None:
identifier = self.finger... | [
"Load",
"the",
"SSHKey",
"object",
"from",
"DigitalOcean",
"."
] | koalalorenzo/python-digitalocean | python | https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/SSHKey.py#L23-L42 | [
"def",
"load",
"(",
"self",
")",
":",
"identifier",
"=",
"None",
"if",
"self",
".",
"id",
":",
"identifier",
"=",
"self",
".",
"id",
"elif",
"self",
".",
"fingerprint",
"is",
"not",
"None",
":",
"identifier",
"=",
"self",
".",
"fingerprint",
"data",
... | d0221b57856fb1e131cafecf99d826f7b07a947c |
valid | SSHKey.load_by_pub_key | This method will load a SSHKey object from DigitalOcean
from a public_key. This method will avoid problems like
uploading the same public_key twice. | digitalocean/SSHKey.py | def load_by_pub_key(self, public_key):
"""
This method will load a SSHKey object from DigitalOcean
from a public_key. This method will avoid problems like
uploading the same public_key twice.
"""
data = self.get_data("account/keys/")
for jsoned in dat... | def load_by_pub_key(self, public_key):
"""
This method will load a SSHKey object from DigitalOcean
from a public_key. This method will avoid problems like
uploading the same public_key twice.
"""
data = self.get_data("account/keys/")
for jsoned in dat... | [
"This",
"method",
"will",
"load",
"a",
"SSHKey",
"object",
"from",
"DigitalOcean",
"from",
"a",
"public_key",
".",
"This",
"method",
"will",
"avoid",
"problems",
"like",
"uploading",
"the",
"same",
"public_key",
"twice",
"."
] | koalalorenzo/python-digitalocean | python | https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/SSHKey.py#L44-L57 | [
"def",
"load_by_pub_key",
"(",
"self",
",",
"public_key",
")",
":",
"data",
"=",
"self",
".",
"get_data",
"(",
"\"account/keys/\"",
")",
"for",
"jsoned",
"in",
"data",
"[",
"'ssh_keys'",
"]",
":",
"if",
"jsoned",
".",
"get",
"(",
"'public_key'",
",",
"\"... | d0221b57856fb1e131cafecf99d826f7b07a947c |
valid | SSHKey.create | Create the SSH Key | digitalocean/SSHKey.py | def create(self):
"""
Create the SSH Key
"""
input_params = {
"name": self.name,
"public_key": self.public_key,
}
data = self.get_data("account/keys/", type=POST, params=input_params)
if data:
self.id = data['ssh_key']['id... | def create(self):
"""
Create the SSH Key
"""
input_params = {
"name": self.name,
"public_key": self.public_key,
}
data = self.get_data("account/keys/", type=POST, params=input_params)
if data:
self.id = data['ssh_key']['id... | [
"Create",
"the",
"SSH",
"Key"
] | koalalorenzo/python-digitalocean | python | https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/SSHKey.py#L59-L71 | [
"def",
"create",
"(",
"self",
")",
":",
"input_params",
"=",
"{",
"\"name\"",
":",
"self",
".",
"name",
",",
"\"public_key\"",
":",
"self",
".",
"public_key",
",",
"}",
"data",
"=",
"self",
".",
"get_data",
"(",
"\"account/keys/\"",
",",
"type",
"=",
"... | d0221b57856fb1e131cafecf99d826f7b07a947c |
valid | SSHKey.edit | Edit the SSH Key | digitalocean/SSHKey.py | def edit(self):
"""
Edit the SSH Key
"""
input_params = {
"name": self.name,
"public_key": self.public_key,
}
data = self.get_data(
"account/keys/%s" % self.id,
type=PUT,
params=input_params
)
... | def edit(self):
"""
Edit the SSH Key
"""
input_params = {
"name": self.name,
"public_key": self.public_key,
}
data = self.get_data(
"account/keys/%s" % self.id,
type=PUT,
params=input_params
)
... | [
"Edit",
"the",
"SSH",
"Key"
] | koalalorenzo/python-digitalocean | python | https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/SSHKey.py#L73-L89 | [
"def",
"edit",
"(",
"self",
")",
":",
"input_params",
"=",
"{",
"\"name\"",
":",
"self",
".",
"name",
",",
"\"public_key\"",
":",
"self",
".",
"public_key",
",",
"}",
"data",
"=",
"self",
".",
"get_data",
"(",
"\"account/keys/%s\"",
"%",
"self",
".",
"... | d0221b57856fb1e131cafecf99d826f7b07a947c |
valid | Manager.get_all_regions | This function returns a list of Region object. | digitalocean/Manager.py | def get_all_regions(self):
"""
This function returns a list of Region object.
"""
data = self.get_data("regions/")
regions = list()
for jsoned in data['regions']:
region = Region(**jsoned)
region.token = self.token
regions.append(re... | def get_all_regions(self):
"""
This function returns a list of Region object.
"""
data = self.get_data("regions/")
regions = list()
for jsoned in data['regions']:
region = Region(**jsoned)
region.token = self.token
regions.append(re... | [
"This",
"function",
"returns",
"a",
"list",
"of",
"Region",
"object",
"."
] | koalalorenzo/python-digitalocean | python | https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/Manager.py#L36-L46 | [
"def",
"get_all_regions",
"(",
"self",
")",
":",
"data",
"=",
"self",
".",
"get_data",
"(",
"\"regions/\"",
")",
"regions",
"=",
"list",
"(",
")",
"for",
"jsoned",
"in",
"data",
"[",
"'regions'",
"]",
":",
"region",
"=",
"Region",
"(",
"*",
"*",
"jso... | d0221b57856fb1e131cafecf99d826f7b07a947c |
valid | Manager.get_all_droplets | This function returns a list of Droplet object. | digitalocean/Manager.py | def get_all_droplets(self, tag_name=None):
"""
This function returns a list of Droplet object.
"""
params = dict()
if tag_name:
params["tag_name"] = tag_name
data = self.get_data("droplets/", params=params)
droplets = list()
for jsoned in... | def get_all_droplets(self, tag_name=None):
"""
This function returns a list of Droplet object.
"""
params = dict()
if tag_name:
params["tag_name"] = tag_name
data = self.get_data("droplets/", params=params)
droplets = list()
for jsoned in... | [
"This",
"function",
"returns",
"a",
"list",
"of",
"Droplet",
"object",
"."
] | koalalorenzo/python-digitalocean | python | https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/Manager.py#L48-L86 | [
"def",
"get_all_droplets",
"(",
"self",
",",
"tag_name",
"=",
"None",
")",
":",
"params",
"=",
"dict",
"(",
")",
"if",
"tag_name",
":",
"params",
"[",
"\"tag_name\"",
"]",
"=",
"tag_name",
"data",
"=",
"self",
".",
"get_data",
"(",
"\"droplets/\"",
",",
... | d0221b57856fb1e131cafecf99d826f7b07a947c |
valid | Manager.get_droplet | Return a Droplet by its ID. | digitalocean/Manager.py | def get_droplet(self, droplet_id):
"""
Return a Droplet by its ID.
"""
return Droplet.get_object(api_token=self.token, droplet_id=droplet_id) | def get_droplet(self, droplet_id):
"""
Return a Droplet by its ID.
"""
return Droplet.get_object(api_token=self.token, droplet_id=droplet_id) | [
"Return",
"a",
"Droplet",
"by",
"its",
"ID",
"."
] | koalalorenzo/python-digitalocean | python | https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/Manager.py#L88-L92 | [
"def",
"get_droplet",
"(",
"self",
",",
"droplet_id",
")",
":",
"return",
"Droplet",
".",
"get_object",
"(",
"api_token",
"=",
"self",
".",
"token",
",",
"droplet_id",
"=",
"droplet_id",
")"
] | d0221b57856fb1e131cafecf99d826f7b07a947c |
valid | Manager.get_all_sizes | This function returns a list of Size object. | digitalocean/Manager.py | def get_all_sizes(self):
"""
This function returns a list of Size object.
"""
data = self.get_data("sizes/")
sizes = list()
for jsoned in data['sizes']:
size = Size(**jsoned)
size.token = self.token
sizes.append(size)
return... | def get_all_sizes(self):
"""
This function returns a list of Size object.
"""
data = self.get_data("sizes/")
sizes = list()
for jsoned in data['sizes']:
size = Size(**jsoned)
size.token = self.token
sizes.append(size)
return... | [
"This",
"function",
"returns",
"a",
"list",
"of",
"Size",
"object",
"."
] | koalalorenzo/python-digitalocean | python | https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/Manager.py#L94-L104 | [
"def",
"get_all_sizes",
"(",
"self",
")",
":",
"data",
"=",
"self",
".",
"get_data",
"(",
"\"sizes/\"",
")",
"sizes",
"=",
"list",
"(",
")",
"for",
"jsoned",
"in",
"data",
"[",
"'sizes'",
"]",
":",
"size",
"=",
"Size",
"(",
"*",
"*",
"jsoned",
")",... | d0221b57856fb1e131cafecf99d826f7b07a947c |
valid | Manager.get_images | This function returns a list of Image object. | digitalocean/Manager.py | def get_images(self, private=False, type=None):
"""
This function returns a list of Image object.
"""
params = {}
if private:
params['private'] = 'true'
if type:
params['type'] = type
data = self.get_data("images/", params=params)
... | def get_images(self, private=False, type=None):
"""
This function returns a list of Image object.
"""
params = {}
if private:
params['private'] = 'true'
if type:
params['type'] = type
data = self.get_data("images/", params=params)
... | [
"This",
"function",
"returns",
"a",
"list",
"of",
"Image",
"object",
"."
] | koalalorenzo/python-digitalocean | python | https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/Manager.py#L106-L121 | [
"def",
"get_images",
"(",
"self",
",",
"private",
"=",
"False",
",",
"type",
"=",
"None",
")",
":",
"params",
"=",
"{",
"}",
"if",
"private",
":",
"params",
"[",
"'private'",
"]",
"=",
"'true'",
"if",
"type",
":",
"params",
"[",
"'type'",
"]",
"=",... | d0221b57856fb1e131cafecf99d826f7b07a947c |
valid | Manager.get_image | Return a Image by its ID/Slug. | digitalocean/Manager.py | def get_image(self, image_id_or_slug):
"""
Return a Image by its ID/Slug.
"""
return Image.get_object(
api_token=self.token,
image_id_or_slug=image_id_or_slug,
) | def get_image(self, image_id_or_slug):
"""
Return a Image by its ID/Slug.
"""
return Image.get_object(
api_token=self.token,
image_id_or_slug=image_id_or_slug,
) | [
"Return",
"a",
"Image",
"by",
"its",
"ID",
"/",
"Slug",
"."
] | koalalorenzo/python-digitalocean | python | https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/Manager.py#L131-L138 | [
"def",
"get_image",
"(",
"self",
",",
"image_id_or_slug",
")",
":",
"return",
"Image",
".",
"get_object",
"(",
"api_token",
"=",
"self",
".",
"token",
",",
"image_id_or_slug",
"=",
"image_id_or_slug",
",",
")"
] | d0221b57856fb1e131cafecf99d826f7b07a947c |
valid | Manager.get_global_images | This function returns a list of Image objects representing
public DigitalOcean images (e.g. base distribution images
and 'One-Click' applications). | digitalocean/Manager.py | def get_global_images(self):
"""
This function returns a list of Image objects representing
public DigitalOcean images (e.g. base distribution images
and 'One-Click' applications).
"""
data = self.get_images()
images = list()
for i in data:
... | def get_global_images(self):
"""
This function returns a list of Image objects representing
public DigitalOcean images (e.g. base distribution images
and 'One-Click' applications).
"""
data = self.get_images()
images = list()
for i in data:
... | [
"This",
"function",
"returns",
"a",
"list",
"of",
"Image",
"objects",
"representing",
"public",
"DigitalOcean",
"images",
"(",
"e",
".",
"g",
".",
"base",
"distribution",
"images",
"and",
"One",
"-",
"Click",
"applications",
")",
"."
] | koalalorenzo/python-digitalocean | python | https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/Manager.py#L148-L160 | [
"def",
"get_global_images",
"(",
"self",
")",
":",
"data",
"=",
"self",
".",
"get_images",
"(",
")",
"images",
"=",
"list",
"(",
")",
"for",
"i",
"in",
"data",
":",
"if",
"i",
".",
"public",
":",
"i",
".",
"token",
"=",
"self",
".",
"token",
"ima... | d0221b57856fb1e131cafecf99d826f7b07a947c |
valid | Manager.get_all_domains | This function returns a list of Domain object. | digitalocean/Manager.py | def get_all_domains(self):
"""
This function returns a list of Domain object.
"""
data = self.get_data("domains/")
domains = list()
for jsoned in data['domains']:
domain = Domain(**jsoned)
domain.token = self.token
domains.append(do... | def get_all_domains(self):
"""
This function returns a list of Domain object.
"""
data = self.get_data("domains/")
domains = list()
for jsoned in data['domains']:
domain = Domain(**jsoned)
domain.token = self.token
domains.append(do... | [
"This",
"function",
"returns",
"a",
"list",
"of",
"Domain",
"object",
"."
] | koalalorenzo/python-digitalocean | python | https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/Manager.py#L178-L188 | [
"def",
"get_all_domains",
"(",
"self",
")",
":",
"data",
"=",
"self",
".",
"get_data",
"(",
"\"domains/\"",
")",
"domains",
"=",
"list",
"(",
")",
"for",
"jsoned",
"in",
"data",
"[",
"'domains'",
"]",
":",
"domain",
"=",
"Domain",
"(",
"*",
"*",
"jso... | d0221b57856fb1e131cafecf99d826f7b07a947c |
valid | Manager.get_domain | Return a Domain by its domain_name | digitalocean/Manager.py | def get_domain(self, domain_name):
"""
Return a Domain by its domain_name
"""
return Domain.get_object(api_token=self.token, domain_name=domain_name) | def get_domain(self, domain_name):
"""
Return a Domain by its domain_name
"""
return Domain.get_object(api_token=self.token, domain_name=domain_name) | [
"Return",
"a",
"Domain",
"by",
"its",
"domain_name"
] | koalalorenzo/python-digitalocean | python | https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/Manager.py#L190-L194 | [
"def",
"get_domain",
"(",
"self",
",",
"domain_name",
")",
":",
"return",
"Domain",
".",
"get_object",
"(",
"api_token",
"=",
"self",
".",
"token",
",",
"domain_name",
"=",
"domain_name",
")"
] | d0221b57856fb1e131cafecf99d826f7b07a947c |
valid | Manager.get_all_sshkeys | This function returns a list of SSHKey object. | digitalocean/Manager.py | def get_all_sshkeys(self):
"""
This function returns a list of SSHKey object.
"""
data = self.get_data("account/keys/")
ssh_keys = list()
for jsoned in data['ssh_keys']:
ssh_key = SSHKey(**jsoned)
ssh_key.token = self.token
ssh_keys... | def get_all_sshkeys(self):
"""
This function returns a list of SSHKey object.
"""
data = self.get_data("account/keys/")
ssh_keys = list()
for jsoned in data['ssh_keys']:
ssh_key = SSHKey(**jsoned)
ssh_key.token = self.token
ssh_keys... | [
"This",
"function",
"returns",
"a",
"list",
"of",
"SSHKey",
"object",
"."
] | koalalorenzo/python-digitalocean | python | https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/Manager.py#L196-L206 | [
"def",
"get_all_sshkeys",
"(",
"self",
")",
":",
"data",
"=",
"self",
".",
"get_data",
"(",
"\"account/keys/\"",
")",
"ssh_keys",
"=",
"list",
"(",
")",
"for",
"jsoned",
"in",
"data",
"[",
"'ssh_keys'",
"]",
":",
"ssh_key",
"=",
"SSHKey",
"(",
"*",
"*"... | d0221b57856fb1e131cafecf99d826f7b07a947c |
valid | Manager.get_ssh_key | Return a SSHKey object by its ID. | digitalocean/Manager.py | def get_ssh_key(self, ssh_key_id):
"""
Return a SSHKey object by its ID.
"""
return SSHKey.get_object(api_token=self.token, ssh_key_id=ssh_key_id) | def get_ssh_key(self, ssh_key_id):
"""
Return a SSHKey object by its ID.
"""
return SSHKey.get_object(api_token=self.token, ssh_key_id=ssh_key_id) | [
"Return",
"a",
"SSHKey",
"object",
"by",
"its",
"ID",
"."
] | koalalorenzo/python-digitalocean | python | https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/Manager.py#L208-L212 | [
"def",
"get_ssh_key",
"(",
"self",
",",
"ssh_key_id",
")",
":",
"return",
"SSHKey",
".",
"get_object",
"(",
"api_token",
"=",
"self",
".",
"token",
",",
"ssh_key_id",
"=",
"ssh_key_id",
")"
] | d0221b57856fb1e131cafecf99d826f7b07a947c |
valid | Manager.get_all_tags | This method returns a list of all tags. | digitalocean/Manager.py | def get_all_tags(self):
"""
This method returns a list of all tags.
"""
data = self.get_data("tags")
return [
Tag(token=self.token, **tag) for tag in data['tags']
] | def get_all_tags(self):
"""
This method returns a list of all tags.
"""
data = self.get_data("tags")
return [
Tag(token=self.token, **tag) for tag in data['tags']
] | [
"This",
"method",
"returns",
"a",
"list",
"of",
"all",
"tags",
"."
] | koalalorenzo/python-digitalocean | python | https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/Manager.py#L214-L221 | [
"def",
"get_all_tags",
"(",
"self",
")",
":",
"data",
"=",
"self",
".",
"get_data",
"(",
"\"tags\"",
")",
"return",
"[",
"Tag",
"(",
"token",
"=",
"self",
".",
"token",
",",
"*",
"*",
"tag",
")",
"for",
"tag",
"in",
"data",
"[",
"'tags'",
"]",
"]... | d0221b57856fb1e131cafecf99d826f7b07a947c |
valid | Manager.get_all_floating_ips | This function returns a list of FloatingIP objects. | digitalocean/Manager.py | def get_all_floating_ips(self):
"""
This function returns a list of FloatingIP objects.
"""
data = self.get_data("floating_ips")
floating_ips = list()
for jsoned in data['floating_ips']:
floating_ip = FloatingIP(**jsoned)
floating_ip.token = se... | def get_all_floating_ips(self):
"""
This function returns a list of FloatingIP objects.
"""
data = self.get_data("floating_ips")
floating_ips = list()
for jsoned in data['floating_ips']:
floating_ip = FloatingIP(**jsoned)
floating_ip.token = se... | [
"This",
"function",
"returns",
"a",
"list",
"of",
"FloatingIP",
"objects",
"."
] | koalalorenzo/python-digitalocean | python | https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/Manager.py#L229-L239 | [
"def",
"get_all_floating_ips",
"(",
"self",
")",
":",
"data",
"=",
"self",
".",
"get_data",
"(",
"\"floating_ips\"",
")",
"floating_ips",
"=",
"list",
"(",
")",
"for",
"jsoned",
"in",
"data",
"[",
"'floating_ips'",
"]",
":",
"floating_ip",
"=",
"FloatingIP",... | d0221b57856fb1e131cafecf99d826f7b07a947c |
valid | Manager.get_floating_ip | Returns a of FloatingIP object by its IP address. | digitalocean/Manager.py | def get_floating_ip(self, ip):
"""
Returns a of FloatingIP object by its IP address.
"""
return FloatingIP.get_object(api_token=self.token, ip=ip) | def get_floating_ip(self, ip):
"""
Returns a of FloatingIP object by its IP address.
"""
return FloatingIP.get_object(api_token=self.token, ip=ip) | [
"Returns",
"a",
"of",
"FloatingIP",
"object",
"by",
"its",
"IP",
"address",
"."
] | koalalorenzo/python-digitalocean | python | https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/Manager.py#L241-L245 | [
"def",
"get_floating_ip",
"(",
"self",
",",
"ip",
")",
":",
"return",
"FloatingIP",
".",
"get_object",
"(",
"api_token",
"=",
"self",
".",
"token",
",",
"ip",
"=",
"ip",
")"
] | d0221b57856fb1e131cafecf99d826f7b07a947c |
valid | Manager.get_all_load_balancers | Returns a list of Load Balancer objects. | digitalocean/Manager.py | def get_all_load_balancers(self):
"""
Returns a list of Load Balancer objects.
"""
data = self.get_data("load_balancers")
load_balancers = list()
for jsoned in data['load_balancers']:
load_balancer = LoadBalancer(**jsoned)
load_balancer.token ... | def get_all_load_balancers(self):
"""
Returns a list of Load Balancer objects.
"""
data = self.get_data("load_balancers")
load_balancers = list()
for jsoned in data['load_balancers']:
load_balancer = LoadBalancer(**jsoned)
load_balancer.token ... | [
"Returns",
"a",
"list",
"of",
"Load",
"Balancer",
"objects",
"."
] | koalalorenzo/python-digitalocean | python | https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/Manager.py#L247-L264 | [
"def",
"get_all_load_balancers",
"(",
"self",
")",
":",
"data",
"=",
"self",
".",
"get_data",
"(",
"\"load_balancers\"",
")",
"load_balancers",
"=",
"list",
"(",
")",
"for",
"jsoned",
"in",
"data",
"[",
"'load_balancers'",
"]",
":",
"load_balancer",
"=",
"Lo... | d0221b57856fb1e131cafecf99d826f7b07a947c |
valid | Manager.get_load_balancer | Returns a Load Balancer object by its ID.
Args:
id (str): Load Balancer ID | digitalocean/Manager.py | def get_load_balancer(self, id):
"""
Returns a Load Balancer object by its ID.
Args:
id (str): Load Balancer ID
"""
return LoadBalancer.get_object(api_token=self.token, id=id) | def get_load_balancer(self, id):
"""
Returns a Load Balancer object by its ID.
Args:
id (str): Load Balancer ID
"""
return LoadBalancer.get_object(api_token=self.token, id=id) | [
"Returns",
"a",
"Load",
"Balancer",
"object",
"by",
"its",
"ID",
"."
] | koalalorenzo/python-digitalocean | python | https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/Manager.py#L266-L273 | [
"def",
"get_load_balancer",
"(",
"self",
",",
"id",
")",
":",
"return",
"LoadBalancer",
".",
"get_object",
"(",
"api_token",
"=",
"self",
".",
"token",
",",
"id",
"=",
"id",
")"
] | d0221b57856fb1e131cafecf99d826f7b07a947c |
valid | Manager.get_certificate | Returns a Certificate object by its ID.
Args:
id (str): Certificate ID | digitalocean/Manager.py | def get_certificate(self, id):
"""
Returns a Certificate object by its ID.
Args:
id (str): Certificate ID
"""
return Certificate.get_object(api_token=self.token, cert_id=id) | def get_certificate(self, id):
"""
Returns a Certificate object by its ID.
Args:
id (str): Certificate ID
"""
return Certificate.get_object(api_token=self.token, cert_id=id) | [
"Returns",
"a",
"Certificate",
"object",
"by",
"its",
"ID",
"."
] | koalalorenzo/python-digitalocean | python | https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/Manager.py#L275-L282 | [
"def",
"get_certificate",
"(",
"self",
",",
"id",
")",
":",
"return",
"Certificate",
".",
"get_object",
"(",
"api_token",
"=",
"self",
".",
"token",
",",
"cert_id",
"=",
"id",
")"
] | d0221b57856fb1e131cafecf99d826f7b07a947c |
valid | Manager.get_all_certificates | This function returns a list of Certificate objects. | digitalocean/Manager.py | def get_all_certificates(self):
"""
This function returns a list of Certificate objects.
"""
data = self.get_data("certificates")
certificates = list()
for jsoned in data['certificates']:
cert = Certificate(**jsoned)
cert.token = self.token
... | def get_all_certificates(self):
"""
This function returns a list of Certificate objects.
"""
data = self.get_data("certificates")
certificates = list()
for jsoned in data['certificates']:
cert = Certificate(**jsoned)
cert.token = self.token
... | [
"This",
"function",
"returns",
"a",
"list",
"of",
"Certificate",
"objects",
"."
] | koalalorenzo/python-digitalocean | python | https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/Manager.py#L284-L295 | [
"def",
"get_all_certificates",
"(",
"self",
")",
":",
"data",
"=",
"self",
".",
"get_data",
"(",
"\"certificates\"",
")",
"certificates",
"=",
"list",
"(",
")",
"for",
"jsoned",
"in",
"data",
"[",
"'certificates'",
"]",
":",
"cert",
"=",
"Certificate",
"("... | d0221b57856fb1e131cafecf99d826f7b07a947c |
valid | Manager.get_snapshot | Return a Snapshot by its ID. | digitalocean/Manager.py | def get_snapshot(self, snapshot_id):
"""
Return a Snapshot by its ID.
"""
return Snapshot.get_object(
api_token=self.token, snapshot_id=snapshot_id
) | def get_snapshot(self, snapshot_id):
"""
Return a Snapshot by its ID.
"""
return Snapshot.get_object(
api_token=self.token, snapshot_id=snapshot_id
) | [
"Return",
"a",
"Snapshot",
"by",
"its",
"ID",
"."
] | koalalorenzo/python-digitalocean | python | https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/Manager.py#L297-L303 | [
"def",
"get_snapshot",
"(",
"self",
",",
"snapshot_id",
")",
":",
"return",
"Snapshot",
".",
"get_object",
"(",
"api_token",
"=",
"self",
".",
"token",
",",
"snapshot_id",
"=",
"snapshot_id",
")"
] | d0221b57856fb1e131cafecf99d826f7b07a947c |
valid | Manager.get_all_snapshots | This method returns a list of all Snapshots. | digitalocean/Manager.py | def get_all_snapshots(self):
"""
This method returns a list of all Snapshots.
"""
data = self.get_data("snapshots/")
return [
Snapshot(token=self.token, **snapshot)
for snapshot in data['snapshots']
] | def get_all_snapshots(self):
"""
This method returns a list of all Snapshots.
"""
data = self.get_data("snapshots/")
return [
Snapshot(token=self.token, **snapshot)
for snapshot in data['snapshots']
] | [
"This",
"method",
"returns",
"a",
"list",
"of",
"all",
"Snapshots",
"."
] | koalalorenzo/python-digitalocean | python | https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/Manager.py#L305-L313 | [
"def",
"get_all_snapshots",
"(",
"self",
")",
":",
"data",
"=",
"self",
".",
"get_data",
"(",
"\"snapshots/\"",
")",
"return",
"[",
"Snapshot",
"(",
"token",
"=",
"self",
".",
"token",
",",
"*",
"*",
"snapshot",
")",
"for",
"snapshot",
"in",
"data",
"[... | d0221b57856fb1e131cafecf99d826f7b07a947c |
valid | Manager.get_droplet_snapshots | This method returns a list of all Snapshots based on Droplets. | digitalocean/Manager.py | def get_droplet_snapshots(self):
"""
This method returns a list of all Snapshots based on Droplets.
"""
data = self.get_data("snapshots?resource_type=droplet")
return [
Snapshot(token=self.token, **snapshot)
for snapshot in data['snapshots']
] | def get_droplet_snapshots(self):
"""
This method returns a list of all Snapshots based on Droplets.
"""
data = self.get_data("snapshots?resource_type=droplet")
return [
Snapshot(token=self.token, **snapshot)
for snapshot in data['snapshots']
] | [
"This",
"method",
"returns",
"a",
"list",
"of",
"all",
"Snapshots",
"based",
"on",
"Droplets",
"."
] | koalalorenzo/python-digitalocean | python | https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/Manager.py#L315-L323 | [
"def",
"get_droplet_snapshots",
"(",
"self",
")",
":",
"data",
"=",
"self",
".",
"get_data",
"(",
"\"snapshots?resource_type=droplet\"",
")",
"return",
"[",
"Snapshot",
"(",
"token",
"=",
"self",
".",
"token",
",",
"*",
"*",
"snapshot",
")",
"for",
"snapshot... | d0221b57856fb1e131cafecf99d826f7b07a947c |
valid | Manager.get_volume_snapshots | This method returns a list of all Snapshots based on volumes. | digitalocean/Manager.py | def get_volume_snapshots(self):
"""
This method returns a list of all Snapshots based on volumes.
"""
data = self.get_data("snapshots?resource_type=volume")
return [
Snapshot(token=self.token, **snapshot)
for snapshot in data['snapshots']
] | def get_volume_snapshots(self):
"""
This method returns a list of all Snapshots based on volumes.
"""
data = self.get_data("snapshots?resource_type=volume")
return [
Snapshot(token=self.token, **snapshot)
for snapshot in data['snapshots']
] | [
"This",
"method",
"returns",
"a",
"list",
"of",
"all",
"Snapshots",
"based",
"on",
"volumes",
"."
] | koalalorenzo/python-digitalocean | python | https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/Manager.py#L325-L333 | [
"def",
"get_volume_snapshots",
"(",
"self",
")",
":",
"data",
"=",
"self",
".",
"get_data",
"(",
"\"snapshots?resource_type=volume\"",
")",
"return",
"[",
"Snapshot",
"(",
"token",
"=",
"self",
".",
"token",
",",
"*",
"*",
"snapshot",
")",
"for",
"snapshot",... | d0221b57856fb1e131cafecf99d826f7b07a947c |
valid | Manager.get_all_volumes | This function returns a list of Volume objects. | digitalocean/Manager.py | def get_all_volumes(self, region=None):
"""
This function returns a list of Volume objects.
"""
if region:
url = "volumes?region={}".format(region)
else:
url = "volumes"
data = self.get_data(url)
volumes = list()
for jsoned in d... | def get_all_volumes(self, region=None):
"""
This function returns a list of Volume objects.
"""
if region:
url = "volumes?region={}".format(region)
else:
url = "volumes"
data = self.get_data(url)
volumes = list()
for jsoned in d... | [
"This",
"function",
"returns",
"a",
"list",
"of",
"Volume",
"objects",
"."
] | koalalorenzo/python-digitalocean | python | https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/Manager.py#L335-L349 | [
"def",
"get_all_volumes",
"(",
"self",
",",
"region",
"=",
"None",
")",
":",
"if",
"region",
":",
"url",
"=",
"\"volumes?region={}\"",
".",
"format",
"(",
"region",
")",
"else",
":",
"url",
"=",
"\"volumes\"",
"data",
"=",
"self",
".",
"get_data",
"(",
... | d0221b57856fb1e131cafecf99d826f7b07a947c |
valid | Manager.get_volume | Returns a Volume object by its ID. | digitalocean/Manager.py | def get_volume(self, volume_id):
"""
Returns a Volume object by its ID.
"""
return Volume.get_object(api_token=self.token, volume_id=volume_id) | def get_volume(self, volume_id):
"""
Returns a Volume object by its ID.
"""
return Volume.get_object(api_token=self.token, volume_id=volume_id) | [
"Returns",
"a",
"Volume",
"object",
"by",
"its",
"ID",
"."
] | koalalorenzo/python-digitalocean | python | https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/Manager.py#L351-L355 | [
"def",
"get_volume",
"(",
"self",
",",
"volume_id",
")",
":",
"return",
"Volume",
".",
"get_object",
"(",
"api_token",
"=",
"self",
".",
"token",
",",
"volume_id",
"=",
"volume_id",
")"
] | d0221b57856fb1e131cafecf99d826f7b07a947c |
valid | Manager.get_all_firewalls | This function returns a list of Firewall objects. | digitalocean/Manager.py | def get_all_firewalls(self):
"""
This function returns a list of Firewall objects.
"""
data = self.get_data("firewalls")
firewalls = list()
for jsoned in data['firewalls']:
firewall = Firewall(**jsoned)
firewall.token = self.token
i... | def get_all_firewalls(self):
"""
This function returns a list of Firewall objects.
"""
data = self.get_data("firewalls")
firewalls = list()
for jsoned in data['firewalls']:
firewall = Firewall(**jsoned)
firewall.token = self.token
i... | [
"This",
"function",
"returns",
"a",
"list",
"of",
"Firewall",
"objects",
"."
] | koalalorenzo/python-digitalocean | python | https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/Manager.py#L357-L375 | [
"def",
"get_all_firewalls",
"(",
"self",
")",
":",
"data",
"=",
"self",
".",
"get_data",
"(",
"\"firewalls\"",
")",
"firewalls",
"=",
"list",
"(",
")",
"for",
"jsoned",
"in",
"data",
"[",
"'firewalls'",
"]",
":",
"firewall",
"=",
"Firewall",
"(",
"*",
... | d0221b57856fb1e131cafecf99d826f7b07a947c |
valid | Manager.get_firewall | Return a Firewall by its ID. | digitalocean/Manager.py | def get_firewall(self, firewall_id):
"""
Return a Firewall by its ID.
"""
return Firewall.get_object(
api_token=self.token,
firewall_id=firewall_id,
) | def get_firewall(self, firewall_id):
"""
Return a Firewall by its ID.
"""
return Firewall.get_object(
api_token=self.token,
firewall_id=firewall_id,
) | [
"Return",
"a",
"Firewall",
"by",
"its",
"ID",
"."
] | koalalorenzo/python-digitalocean | python | https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/Manager.py#L377-L384 | [
"def",
"get_firewall",
"(",
"self",
",",
"firewall_id",
")",
":",
"return",
"Firewall",
".",
"get_object",
"(",
"api_token",
"=",
"self",
".",
"token",
",",
"firewall_id",
"=",
"firewall_id",
",",
")"
] | d0221b57856fb1e131cafecf99d826f7b07a947c |
valid | LoadBalancer.get_object | Class method that will return a LoadBalancer object by its ID.
Args:
api_token (str): DigitalOcean API token
id (str): Load Balancer ID | digitalocean/LoadBalancer.py | def get_object(cls, api_token, id):
"""
Class method that will return a LoadBalancer object by its ID.
Args:
api_token (str): DigitalOcean API token
id (str): Load Balancer ID
"""
load_balancer = cls(token=api_token, id=id)
load_balancer.load()
... | def get_object(cls, api_token, id):
"""
Class method that will return a LoadBalancer object by its ID.
Args:
api_token (str): DigitalOcean API token
id (str): Load Balancer ID
"""
load_balancer = cls(token=api_token, id=id)
load_balancer.load()
... | [
"Class",
"method",
"that",
"will",
"return",
"a",
"LoadBalancer",
"object",
"by",
"its",
"ID",
"."
] | koalalorenzo/python-digitalocean | python | https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/LoadBalancer.py#L146-L156 | [
"def",
"get_object",
"(",
"cls",
",",
"api_token",
",",
"id",
")",
":",
"load_balancer",
"=",
"cls",
"(",
"token",
"=",
"api_token",
",",
"id",
"=",
"id",
")",
"load_balancer",
".",
"load",
"(",
")",
"return",
"load_balancer"
] | d0221b57856fb1e131cafecf99d826f7b07a947c |
valid | LoadBalancer.load | Loads updated attributues for a LoadBalancer object.
Requires self.id to be set. | digitalocean/LoadBalancer.py | def load(self):
"""
Loads updated attributues for a LoadBalancer object.
Requires self.id to be set.
"""
data = self.get_data('load_balancers/%s' % self.id, type=GET)
load_balancer = data['load_balancer']
# Setting the attribute values
for attr in load_b... | def load(self):
"""
Loads updated attributues for a LoadBalancer object.
Requires self.id to be set.
"""
data = self.get_data('load_balancers/%s' % self.id, type=GET)
load_balancer = data['load_balancer']
# Setting the attribute values
for attr in load_b... | [
"Loads",
"updated",
"attributues",
"for",
"a",
"LoadBalancer",
"object",
"."
] | koalalorenzo/python-digitalocean | python | https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/LoadBalancer.py#L158-L183 | [
"def",
"load",
"(",
"self",
")",
":",
"data",
"=",
"self",
".",
"get_data",
"(",
"'load_balancers/%s'",
"%",
"self",
".",
"id",
",",
"type",
"=",
"GET",
")",
"load_balancer",
"=",
"data",
"[",
"'load_balancer'",
"]",
"# Setting the attribute values",
"for",
... | d0221b57856fb1e131cafecf99d826f7b07a947c |
valid | LoadBalancer.create | Creates a new LoadBalancer.
Note: Every argument and parameter given to this method will be
assigned to the object.
Args:
name (str): The Load Balancer's name
region (str): The slug identifier for a DigitalOcean region
algorithm (str, optional): The load bal... | digitalocean/LoadBalancer.py | def create(self, *args, **kwargs):
"""
Creates a new LoadBalancer.
Note: Every argument and parameter given to this method will be
assigned to the object.
Args:
name (str): The Load Balancer's name
region (str): The slug identifier for a DigitalOcean reg... | def create(self, *args, **kwargs):
"""
Creates a new LoadBalancer.
Note: Every argument and parameter given to this method will be
assigned to the object.
Args:
name (str): The Load Balancer's name
region (str): The slug identifier for a DigitalOcean reg... | [
"Creates",
"a",
"new",
"LoadBalancer",
"."
] | koalalorenzo/python-digitalocean | python | https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/LoadBalancer.py#L185-L244 | [
"def",
"create",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"rules_dict",
"=",
"[",
"rule",
".",
"__dict__",
"for",
"rule",
"in",
"self",
".",
"forwarding_rules",
"]",
"params",
"=",
"{",
"'name'",
":",
"self",
".",
"name",
"... | d0221b57856fb1e131cafecf99d826f7b07a947c |
valid | LoadBalancer.save | Save the LoadBalancer | digitalocean/LoadBalancer.py | def save(self):
"""
Save the LoadBalancer
"""
forwarding_rules = [rule.__dict__ for rule in self.forwarding_rules]
data = {
'name': self.name,
'region': self.region['slug'],
'forwarding_rules': forwarding_rules,
'redirect_http_to_h... | def save(self):
"""
Save the LoadBalancer
"""
forwarding_rules = [rule.__dict__ for rule in self.forwarding_rules]
data = {
'name': self.name,
'region': self.region['slug'],
'forwarding_rules': forwarding_rules,
'redirect_http_to_h... | [
"Save",
"the",
"LoadBalancer"
] | koalalorenzo/python-digitalocean | python | https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/LoadBalancer.py#L246-L273 | [
"def",
"save",
"(",
"self",
")",
":",
"forwarding_rules",
"=",
"[",
"rule",
".",
"__dict__",
"for",
"rule",
"in",
"self",
".",
"forwarding_rules",
"]",
"data",
"=",
"{",
"'name'",
":",
"self",
".",
"name",
",",
"'region'",
":",
"self",
".",
"region",
... | d0221b57856fb1e131cafecf99d826f7b07a947c |
valid | LoadBalancer.add_droplets | Assign a LoadBalancer to a Droplet.
Args:
droplet_ids (obj:`list` of `int`): A list of Droplet IDs | digitalocean/LoadBalancer.py | def add_droplets(self, droplet_ids):
"""
Assign a LoadBalancer to a Droplet.
Args:
droplet_ids (obj:`list` of `int`): A list of Droplet IDs
"""
return self.get_data(
"load_balancers/%s/droplets/" % self.id,
type=POST,
params={"drop... | def add_droplets(self, droplet_ids):
"""
Assign a LoadBalancer to a Droplet.
Args:
droplet_ids (obj:`list` of `int`): A list of Droplet IDs
"""
return self.get_data(
"load_balancers/%s/droplets/" % self.id,
type=POST,
params={"drop... | [
"Assign",
"a",
"LoadBalancer",
"to",
"a",
"Droplet",
"."
] | koalalorenzo/python-digitalocean | python | https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/LoadBalancer.py#L281-L292 | [
"def",
"add_droplets",
"(",
"self",
",",
"droplet_ids",
")",
":",
"return",
"self",
".",
"get_data",
"(",
"\"load_balancers/%s/droplets/\"",
"%",
"self",
".",
"id",
",",
"type",
"=",
"POST",
",",
"params",
"=",
"{",
"\"droplet_ids\"",
":",
"droplet_ids",
"}"... | d0221b57856fb1e131cafecf99d826f7b07a947c |
valid | LoadBalancer.remove_droplets | Unassign a LoadBalancer.
Args:
droplet_ids (obj:`list` of `int`): A list of Droplet IDs | digitalocean/LoadBalancer.py | def remove_droplets(self, droplet_ids):
"""
Unassign a LoadBalancer.
Args:
droplet_ids (obj:`list` of `int`): A list of Droplet IDs
"""
return self.get_data(
"load_balancers/%s/droplets/" % self.id,
type=DELETE,
params={"droplet_id... | def remove_droplets(self, droplet_ids):
"""
Unassign a LoadBalancer.
Args:
droplet_ids (obj:`list` of `int`): A list of Droplet IDs
"""
return self.get_data(
"load_balancers/%s/droplets/" % self.id,
type=DELETE,
params={"droplet_id... | [
"Unassign",
"a",
"LoadBalancer",
"."
] | koalalorenzo/python-digitalocean | python | https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/LoadBalancer.py#L294-L305 | [
"def",
"remove_droplets",
"(",
"self",
",",
"droplet_ids",
")",
":",
"return",
"self",
".",
"get_data",
"(",
"\"load_balancers/%s/droplets/\"",
"%",
"self",
".",
"id",
",",
"type",
"=",
"DELETE",
",",
"params",
"=",
"{",
"\"droplet_ids\"",
":",
"droplet_ids",
... | d0221b57856fb1e131cafecf99d826f7b07a947c |
valid | LoadBalancer.add_forwarding_rules | Adds new forwarding rules to a LoadBalancer.
Args:
forwarding_rules (obj:`list`): A list of `ForwrdingRules` objects | digitalocean/LoadBalancer.py | def add_forwarding_rules(self, forwarding_rules):
"""
Adds new forwarding rules to a LoadBalancer.
Args:
forwarding_rules (obj:`list`): A list of `ForwrdingRules` objects
"""
rules_dict = [rule.__dict__ for rule in forwarding_rules]
return self.get_data(
... | def add_forwarding_rules(self, forwarding_rules):
"""
Adds new forwarding rules to a LoadBalancer.
Args:
forwarding_rules (obj:`list`): A list of `ForwrdingRules` objects
"""
rules_dict = [rule.__dict__ for rule in forwarding_rules]
return self.get_data(
... | [
"Adds",
"new",
"forwarding",
"rules",
"to",
"a",
"LoadBalancer",
"."
] | koalalorenzo/python-digitalocean | python | https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/LoadBalancer.py#L307-L320 | [
"def",
"add_forwarding_rules",
"(",
"self",
",",
"forwarding_rules",
")",
":",
"rules_dict",
"=",
"[",
"rule",
".",
"__dict__",
"for",
"rule",
"in",
"forwarding_rules",
"]",
"return",
"self",
".",
"get_data",
"(",
"\"load_balancers/%s/forwarding_rules/\"",
"%",
"s... | d0221b57856fb1e131cafecf99d826f7b07a947c |
valid | LoadBalancer.remove_forwarding_rules | Removes existing forwarding rules from a LoadBalancer.
Args:
forwarding_rules (obj:`list`): A list of `ForwrdingRules` objects | digitalocean/LoadBalancer.py | def remove_forwarding_rules(self, forwarding_rules):
"""
Removes existing forwarding rules from a LoadBalancer.
Args:
forwarding_rules (obj:`list`): A list of `ForwrdingRules` objects
"""
rules_dict = [rule.__dict__ for rule in forwarding_rules]
return self.... | def remove_forwarding_rules(self, forwarding_rules):
"""
Removes existing forwarding rules from a LoadBalancer.
Args:
forwarding_rules (obj:`list`): A list of `ForwrdingRules` objects
"""
rules_dict = [rule.__dict__ for rule in forwarding_rules]
return self.... | [
"Removes",
"existing",
"forwarding",
"rules",
"from",
"a",
"LoadBalancer",
"."
] | koalalorenzo/python-digitalocean | python | https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/LoadBalancer.py#L322-L335 | [
"def",
"remove_forwarding_rules",
"(",
"self",
",",
"forwarding_rules",
")",
":",
"rules_dict",
"=",
"[",
"rule",
".",
"__dict__",
"for",
"rule",
"in",
"forwarding_rules",
"]",
"return",
"self",
".",
"get_data",
"(",
"\"load_balancers/%s/forwarding_rules/\"",
"%",
... | d0221b57856fb1e131cafecf99d826f7b07a947c |
valid | Metadata.get_data | Customized version of get_data to directly get the data without
using the authentication method. | digitalocean/Metadata.py | def get_data(self, url, headers=dict(), params=dict(), render_json=True):
"""
Customized version of get_data to directly get the data without
using the authentication method.
"""
url = urljoin(self.end_point, url)
response = requests.get(url, headers=headers, par... | def get_data(self, url, headers=dict(), params=dict(), render_json=True):
"""
Customized version of get_data to directly get the data without
using the authentication method.
"""
url = urljoin(self.end_point, url)
response = requests.get(url, headers=headers, par... | [
"Customized",
"version",
"of",
"get_data",
"to",
"directly",
"get",
"the",
"data",
"without",
"using",
"the",
"authentication",
"method",
"."
] | koalalorenzo/python-digitalocean | python | https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/Metadata.py#L23-L35 | [
"def",
"get_data",
"(",
"self",
",",
"url",
",",
"headers",
"=",
"dict",
"(",
")",
",",
"params",
"=",
"dict",
"(",
")",
",",
"render_json",
"=",
"True",
")",
":",
"url",
"=",
"urljoin",
"(",
"self",
".",
"end_point",
",",
"url",
")",
"response",
... | d0221b57856fb1e131cafecf99d826f7b07a947c |
valid | Record.get_object | Class method that will return a Record object by ID and the domain. | digitalocean/Record.py | def get_object(cls, api_token, domain, record_id):
"""
Class method that will return a Record object by ID and the domain.
"""
record = cls(token=api_token, domain=domain, id=record_id)
record.load()
return record | def get_object(cls, api_token, domain, record_id):
"""
Class method that will return a Record object by ID and the domain.
"""
record = cls(token=api_token, domain=domain, id=record_id)
record.load()
return record | [
"Class",
"method",
"that",
"will",
"return",
"a",
"Record",
"object",
"by",
"ID",
"and",
"the",
"domain",
"."
] | koalalorenzo/python-digitalocean | python | https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/Record.py#L39-L45 | [
"def",
"get_object",
"(",
"cls",
",",
"api_token",
",",
"domain",
",",
"record_id",
")",
":",
"record",
"=",
"cls",
"(",
"token",
"=",
"api_token",
",",
"domain",
"=",
"domain",
",",
"id",
"=",
"record_id",
")",
"record",
".",
"load",
"(",
")",
"retu... | d0221b57856fb1e131cafecf99d826f7b07a947c |
valid | Record.create | Creates a new record for a domain.
Args:
type (str): The type of the DNS record (e.g. A, CNAME, TXT).
name (str): The host name, alias, or service being defined by the
record.
data (int): Variable data depending on record type.
priority (int): The... | digitalocean/Record.py | def create(self):
"""
Creates a new record for a domain.
Args:
type (str): The type of the DNS record (e.g. A, CNAME, TXT).
name (str): The host name, alias, or service being defined by the
record.
data (int): Variable data depending on record... | def create(self):
"""
Creates a new record for a domain.
Args:
type (str): The type of the DNS record (e.g. A, CNAME, TXT).
name (str): The host name, alias, or service being defined by the
record.
data (int): Variable data depending on record... | [
"Creates",
"a",
"new",
"record",
"for",
"a",
"domain",
"."
] | koalalorenzo/python-digitalocean | python | https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/Record.py#L47-L83 | [
"def",
"create",
"(",
"self",
")",
":",
"input_params",
"=",
"{",
"\"type\"",
":",
"self",
".",
"type",
",",
"\"data\"",
":",
"self",
".",
"data",
",",
"\"name\"",
":",
"self",
".",
"name",
",",
"\"priority\"",
":",
"self",
".",
"priority",
",",
"\"p... | d0221b57856fb1e131cafecf99d826f7b07a947c |
valid | Record.destroy | Destroy the record | digitalocean/Record.py | def destroy(self):
"""
Destroy the record
"""
return self.get_data(
"domains/%s/records/%s" % (self.domain, self.id),
type=DELETE,
) | def destroy(self):
"""
Destroy the record
"""
return self.get_data(
"domains/%s/records/%s" % (self.domain, self.id),
type=DELETE,
) | [
"Destroy",
"the",
"record"
] | koalalorenzo/python-digitalocean | python | https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/Record.py#L85-L92 | [
"def",
"destroy",
"(",
"self",
")",
":",
"return",
"self",
".",
"get_data",
"(",
"\"domains/%s/records/%s\"",
"%",
"(",
"self",
".",
"domain",
",",
"self",
".",
"id",
")",
",",
"type",
"=",
"DELETE",
",",
")"
] | d0221b57856fb1e131cafecf99d826f7b07a947c |
valid | Record.save | Save existing record | digitalocean/Record.py | def save(self):
"""
Save existing record
"""
data = {
"type": self.type,
"data": self.data,
"name": self.name,
"priority": self.priority,
"port": self.port,
"ttl": self.ttl,
"weight": self.weight,
... | def save(self):
"""
Save existing record
"""
data = {
"type": self.type,
"data": self.data,
"name": self.name,
"priority": self.priority,
"port": self.port,
"ttl": self.ttl,
"weight": self.weight,
... | [
"Save",
"existing",
"record"
] | koalalorenzo/python-digitalocean | python | https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/Record.py#L94-L113 | [
"def",
"save",
"(",
"self",
")",
":",
"data",
"=",
"{",
"\"type\"",
":",
"self",
".",
"type",
",",
"\"data\"",
":",
"self",
".",
"data",
",",
"\"name\"",
":",
"self",
".",
"name",
",",
"\"priority\"",
":",
"self",
".",
"priority",
",",
"\"port\"",
... | d0221b57856fb1e131cafecf99d826f7b07a947c |
valid | BaseAPI.__perform_request | This method will perform the real request,
in this way we can customize only the "output" of the API call by
using self.__call_api method.
This method will return the request object. | digitalocean/baseapi.py | def __perform_request(self, url, type=GET, params=None):
"""
This method will perform the real request,
in this way we can customize only the "output" of the API call by
using self.__call_api method.
This method will return the request object.
"""
... | def __perform_request(self, url, type=GET, params=None):
"""
This method will perform the real request,
in this way we can customize only the "output" of the API call by
using self.__call_api method.
This method will return the request object.
"""
... | [
"This",
"method",
"will",
"perform",
"the",
"real",
"request",
"in",
"this",
"way",
"we",
"can",
"customize",
"only",
"the",
"output",
"of",
"the",
"API",
"call",
"by",
"using",
"self",
".",
"__call_api",
"method",
".",
"This",
"method",
"will",
"return",
... | koalalorenzo/python-digitalocean | python | https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/baseapi.py#L68-L116 | [
"def",
"__perform_request",
"(",
"self",
",",
"url",
",",
"type",
"=",
"GET",
",",
"params",
"=",
"None",
")",
":",
"if",
"params",
"is",
"None",
":",
"params",
"=",
"{",
"}",
"if",
"not",
"self",
".",
"token",
":",
"raise",
"TokenError",
"(",
"\"N... | d0221b57856fb1e131cafecf99d826f7b07a947c |
valid | BaseAPI.__deal_with_pagination | Perform multiple calls in order to have a full list of elements
when the API are "paginated". (content list is divided in more
than one page) | digitalocean/baseapi.py | def __deal_with_pagination(self, url, method, params, data):
"""
Perform multiple calls in order to have a full list of elements
when the API are "paginated". (content list is divided in more
than one page)
"""
all_data = data
while data.get("links", {... | def __deal_with_pagination(self, url, method, params, data):
"""
Perform multiple calls in order to have a full list of elements
when the API are "paginated". (content list is divided in more
than one page)
"""
all_data = data
while data.get("links", {... | [
"Perform",
"multiple",
"calls",
"in",
"order",
"to",
"have",
"a",
"full",
"list",
"of",
"elements",
"when",
"the",
"API",
"are",
"paginated",
".",
"(",
"content",
"list",
"is",
"divided",
"in",
"more",
"than",
"one",
"page",
")"
] | koalalorenzo/python-digitalocean | python | https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/baseapi.py#L118-L141 | [
"def",
"__deal_with_pagination",
"(",
"self",
",",
"url",
",",
"method",
",",
"params",
",",
"data",
")",
":",
"all_data",
"=",
"data",
"while",
"data",
".",
"get",
"(",
"\"links\"",
",",
"{",
"}",
")",
".",
"get",
"(",
"\"pages\"",
",",
"{",
"}",
... | d0221b57856fb1e131cafecf99d826f7b07a947c |
valid | BaseAPI.get_timeout | Checks if any timeout for the requests to DigitalOcean is required.
To set a timeout, use the REQUEST_TIMEOUT_ENV_VAR environment
variable. | digitalocean/baseapi.py | def get_timeout(self):
"""
Checks if any timeout for the requests to DigitalOcean is required.
To set a timeout, use the REQUEST_TIMEOUT_ENV_VAR environment
variable.
"""
timeout_str = os.environ.get(REQUEST_TIMEOUT_ENV_VAR)
if timeout_str:
... | def get_timeout(self):
"""
Checks if any timeout for the requests to DigitalOcean is required.
To set a timeout, use the REQUEST_TIMEOUT_ENV_VAR environment
variable.
"""
timeout_str = os.environ.get(REQUEST_TIMEOUT_ENV_VAR)
if timeout_str:
... | [
"Checks",
"if",
"any",
"timeout",
"for",
"the",
"requests",
"to",
"DigitalOcean",
"is",
"required",
".",
"To",
"set",
"a",
"timeout",
"use",
"the",
"REQUEST_TIMEOUT_ENV_VAR",
"environment",
"variable",
"."
] | koalalorenzo/python-digitalocean | python | https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/baseapi.py#L151-L165 | [
"def",
"get_timeout",
"(",
"self",
")",
":",
"timeout_str",
"=",
"os",
".",
"environ",
".",
"get",
"(",
"REQUEST_TIMEOUT_ENV_VAR",
")",
"if",
"timeout_str",
":",
"try",
":",
"return",
"float",
"(",
"timeout_str",
")",
"except",
":",
"self",
".",
"_log",
... | d0221b57856fb1e131cafecf99d826f7b07a947c |
valid | BaseAPI.get_data | This method is a basic implementation of __call_api that checks
errors too. In case of success the method will return True or the
content of the response to the request.
Pagination is automatically detected and handled accordingly | digitalocean/baseapi.py | def get_data(self, url, type=GET, params=None):
"""
This method is a basic implementation of __call_api that checks
errors too. In case of success the method will return True or the
content of the response to the request.
Pagination is automatically detected and ... | def get_data(self, url, type=GET, params=None):
"""
This method is a basic implementation of __call_api that checks
errors too. In case of success the method will return True or the
content of the response to the request.
Pagination is automatically detected and ... | [
"This",
"method",
"is",
"a",
"basic",
"implementation",
"of",
"__call_api",
"that",
"checks",
"errors",
"too",
".",
"In",
"case",
"of",
"success",
"the",
"method",
"will",
"return",
"True",
"or",
"the",
"content",
"of",
"the",
"response",
"to",
"the",
"req... | koalalorenzo/python-digitalocean | python | https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/baseapi.py#L167-L210 | [
"def",
"get_data",
"(",
"self",
",",
"url",
",",
"type",
"=",
"GET",
",",
"params",
"=",
"None",
")",
":",
"if",
"params",
"is",
"None",
":",
"params",
"=",
"dict",
"(",
")",
"# If per_page is not set, make sure it has a sane default",
"if",
"type",
"is",
... | d0221b57856fb1e131cafecf99d826f7b07a947c |
valid | Volume.get_object | Class method that will return an Volume object by ID. | digitalocean/Volume.py | def get_object(cls, api_token, volume_id):
"""
Class method that will return an Volume object by ID.
"""
volume = cls(token=api_token, id=volume_id)
volume.load()
return volume | def get_object(cls, api_token, volume_id):
"""
Class method that will return an Volume object by ID.
"""
volume = cls(token=api_token, id=volume_id)
volume.load()
return volume | [
"Class",
"method",
"that",
"will",
"return",
"an",
"Volume",
"object",
"by",
"ID",
"."
] | koalalorenzo/python-digitalocean | python | https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/Volume.py#L21-L27 | [
"def",
"get_object",
"(",
"cls",
",",
"api_token",
",",
"volume_id",
")",
":",
"volume",
"=",
"cls",
"(",
"token",
"=",
"api_token",
",",
"id",
"=",
"volume_id",
")",
"volume",
".",
"load",
"(",
")",
"return",
"volume"
] | d0221b57856fb1e131cafecf99d826f7b07a947c |
valid | Volume.create_from_snapshot | Creates a Block Storage volume
Note: Every argument and parameter given to this method will be
assigned to the object.
Args:
name: string - a name for the volume
snapshot_id: string - unique identifier for the volume snapshot
size_gigabytes: int - size of th... | digitalocean/Volume.py | def create_from_snapshot(self, *args, **kwargs):
"""
Creates a Block Storage volume
Note: Every argument and parameter given to this method will be
assigned to the object.
Args:
name: string - a name for the volume
snapshot_id: string - unique identifier... | def create_from_snapshot(self, *args, **kwargs):
"""
Creates a Block Storage volume
Note: Every argument and parameter given to this method will be
assigned to the object.
Args:
name: string - a name for the volume
snapshot_id: string - unique identifier... | [
"Creates",
"a",
"Block",
"Storage",
"volume"
] | koalalorenzo/python-digitalocean | python | https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/Volume.py#L74-L108 | [
"def",
"create_from_snapshot",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"data",
"=",
"self",
".",
"get_data",
"(",
"'volumes/'",
",",
"type",
"=",
"POST",
",",
"params",
"=",
"{",
"'name'",
":",
"self",
".",
"name",
",",
"'... | d0221b57856fb1e131cafecf99d826f7b07a947c |
valid | Volume.attach | Attach a Volume to a Droplet.
Args:
droplet_id: int - droplet id
region: string - slug identifier for the region | digitalocean/Volume.py | def attach(self, droplet_id, region):
"""
Attach a Volume to a Droplet.
Args:
droplet_id: int - droplet id
region: string - slug identifier for the region
"""
return self.get_data(
"volumes/%s/actions/" % self.id,
type=POST,
... | def attach(self, droplet_id, region):
"""
Attach a Volume to a Droplet.
Args:
droplet_id: int - droplet id
region: string - slug identifier for the region
"""
return self.get_data(
"volumes/%s/actions/" % self.id,
type=POST,
... | [
"Attach",
"a",
"Volume",
"to",
"a",
"Droplet",
"."
] | koalalorenzo/python-digitalocean | python | https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/Volume.py#L116-L130 | [
"def",
"attach",
"(",
"self",
",",
"droplet_id",
",",
"region",
")",
":",
"return",
"self",
".",
"get_data",
"(",
"\"volumes/%s/actions/\"",
"%",
"self",
".",
"id",
",",
"type",
"=",
"POST",
",",
"params",
"=",
"{",
"\"type\"",
":",
"\"attach\"",
",",
... | d0221b57856fb1e131cafecf99d826f7b07a947c |
valid | Volume.resize | Detach a Volume to a Droplet.
Args:
size_gigabytes: int - size of the Block Storage volume in GiB
region: string - slug identifier for the region | digitalocean/Volume.py | def resize(self, size_gigabytes, region):
"""
Detach a Volume to a Droplet.
Args:
size_gigabytes: int - size of the Block Storage volume in GiB
region: string - slug identifier for the region
"""
return self.get_data(
"volumes/%s/actions/" % s... | def resize(self, size_gigabytes, region):
"""
Detach a Volume to a Droplet.
Args:
size_gigabytes: int - size of the Block Storage volume in GiB
region: string - slug identifier for the region
"""
return self.get_data(
"volumes/%s/actions/" % s... | [
"Detach",
"a",
"Volume",
"to",
"a",
"Droplet",
"."
] | koalalorenzo/python-digitalocean | python | https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/Volume.py#L148-L162 | [
"def",
"resize",
"(",
"self",
",",
"size_gigabytes",
",",
"region",
")",
":",
"return",
"self",
".",
"get_data",
"(",
"\"volumes/%s/actions/\"",
"%",
"self",
".",
"id",
",",
"type",
"=",
"POST",
",",
"params",
"=",
"{",
"\"type\"",
":",
"\"resize\"",
","... | d0221b57856fb1e131cafecf99d826f7b07a947c |
valid | Volume.snapshot | Create a snapshot of the volume.
Args:
name: string - a human-readable name for the snapshot | digitalocean/Volume.py | def snapshot(self, name):
"""
Create a snapshot of the volume.
Args:
name: string - a human-readable name for the snapshot
"""
return self.get_data(
"volumes/%s/snapshots/" % self.id,
type=POST,
params={"name": name}
) | def snapshot(self, name):
"""
Create a snapshot of the volume.
Args:
name: string - a human-readable name for the snapshot
"""
return self.get_data(
"volumes/%s/snapshots/" % self.id,
type=POST,
params={"name": name}
) | [
"Create",
"a",
"snapshot",
"of",
"the",
"volume",
"."
] | koalalorenzo/python-digitalocean | python | https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/Volume.py#L164-L175 | [
"def",
"snapshot",
"(",
"self",
",",
"name",
")",
":",
"return",
"self",
".",
"get_data",
"(",
"\"volumes/%s/snapshots/\"",
"%",
"self",
".",
"id",
",",
"type",
"=",
"POST",
",",
"params",
"=",
"{",
"\"name\"",
":",
"name",
"}",
")"
] | d0221b57856fb1e131cafecf99d826f7b07a947c |
valid | Volume.get_snapshots | Retrieve the list of snapshots that have been created from a volume.
Args: | digitalocean/Volume.py | def get_snapshots(self):
"""
Retrieve the list of snapshots that have been created from a volume.
Args:
"""
data = self.get_data("volumes/%s/snapshots/" % self.id)
snapshots = list()
for jsond in data[u'snapshots']:
snapshot = Snapshot(**jsond)
... | def get_snapshots(self):
"""
Retrieve the list of snapshots that have been created from a volume.
Args:
"""
data = self.get_data("volumes/%s/snapshots/" % self.id)
snapshots = list()
for jsond in data[u'snapshots']:
snapshot = Snapshot(**jsond)
... | [
"Retrieve",
"the",
"list",
"of",
"snapshots",
"that",
"have",
"been",
"created",
"from",
"a",
"volume",
"."
] | koalalorenzo/python-digitalocean | python | https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/Volume.py#L177-L190 | [
"def",
"get_snapshots",
"(",
"self",
")",
":",
"data",
"=",
"self",
".",
"get_data",
"(",
"\"volumes/%s/snapshots/\"",
"%",
"self",
".",
"id",
")",
"snapshots",
"=",
"list",
"(",
")",
"for",
"jsond",
"in",
"data",
"[",
"u'snapshots'",
"]",
":",
"snapshot... | d0221b57856fb1e131cafecf99d826f7b07a947c |
valid | Certificate.get_object | Class method that will return a Certificate object by its ID. | digitalocean/Certificate.py | def get_object(cls, api_token, cert_id):
"""
Class method that will return a Certificate object by its ID.
"""
certificate = cls(token=api_token, id=cert_id)
certificate.load()
return certificate | def get_object(cls, api_token, cert_id):
"""
Class method that will return a Certificate object by its ID.
"""
certificate = cls(token=api_token, id=cert_id)
certificate.load()
return certificate | [
"Class",
"method",
"that",
"will",
"return",
"a",
"Certificate",
"object",
"by",
"its",
"ID",
"."
] | koalalorenzo/python-digitalocean | python | https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/Certificate.py#L61-L67 | [
"def",
"get_object",
"(",
"cls",
",",
"api_token",
",",
"cert_id",
")",
":",
"certificate",
"=",
"cls",
"(",
"token",
"=",
"api_token",
",",
"id",
"=",
"cert_id",
")",
"certificate",
".",
"load",
"(",
")",
"return",
"certificate"
] | d0221b57856fb1e131cafecf99d826f7b07a947c |
valid | Certificate.load | Load the Certificate object from DigitalOcean.
Requires self.id to be set. | digitalocean/Certificate.py | def load(self):
"""
Load the Certificate object from DigitalOcean.
Requires self.id to be set.
"""
data = self.get_data("certificates/%s" % self.id)
certificate = data["certificate"]
for attr in certificate.keys():
setattr(self, attr, certifi... | def load(self):
"""
Load the Certificate object from DigitalOcean.
Requires self.id to be set.
"""
data = self.get_data("certificates/%s" % self.id)
certificate = data["certificate"]
for attr in certificate.keys():
setattr(self, attr, certifi... | [
"Load",
"the",
"Certificate",
"object",
"from",
"DigitalOcean",
"."
] | koalalorenzo/python-digitalocean | python | https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/Certificate.py#L69-L81 | [
"def",
"load",
"(",
"self",
")",
":",
"data",
"=",
"self",
".",
"get_data",
"(",
"\"certificates/%s\"",
"%",
"self",
".",
"id",
")",
"certificate",
"=",
"data",
"[",
"\"certificate\"",
"]",
"for",
"attr",
"in",
"certificate",
".",
"keys",
"(",
")",
":"... | d0221b57856fb1e131cafecf99d826f7b07a947c |
valid | Certificate.create | Create the Certificate | digitalocean/Certificate.py | def create(self):
"""
Create the Certificate
"""
params = {
"name": self.name,
"type": self.type,
"dns_names": self.dns_names,
"private_key": self.private_key,
"leaf_certificate": self.leaf_certificate,
"certific... | def create(self):
"""
Create the Certificate
"""
params = {
"name": self.name,
"type": self.type,
"dns_names": self.dns_names,
"private_key": self.private_key,
"leaf_certificate": self.leaf_certificate,
"certific... | [
"Create",
"the",
"Certificate"
] | koalalorenzo/python-digitalocean | python | https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/Certificate.py#L83-L107 | [
"def",
"create",
"(",
"self",
")",
":",
"params",
"=",
"{",
"\"name\"",
":",
"self",
".",
"name",
",",
"\"type\"",
":",
"self",
".",
"type",
",",
"\"dns_names\"",
":",
"self",
".",
"dns_names",
",",
"\"private_key\"",
":",
"self",
".",
"private_key",
"... | d0221b57856fb1e131cafecf99d826f7b07a947c |
valid | Image.get_object | Class method that will return an Image object by ID or slug.
This method is used to validate the type of the image. If it is a
number, it will be considered as an Image ID, instead if it is a
string, it will considered as slug. | digitalocean/Image.py | def get_object(cls, api_token, image_id_or_slug):
"""
Class method that will return an Image object by ID or slug.
This method is used to validate the type of the image. If it is a
number, it will be considered as an Image ID, instead if it is a
string, it will c... | def get_object(cls, api_token, image_id_or_slug):
"""
Class method that will return an Image object by ID or slug.
This method is used to validate the type of the image. If it is a
number, it will be considered as an Image ID, instead if it is a
string, it will c... | [
"Class",
"method",
"that",
"will",
"return",
"an",
"Image",
"object",
"by",
"ID",
"or",
"slug",
"."
] | koalalorenzo/python-digitalocean | python | https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/Image.py#L64-L78 | [
"def",
"get_object",
"(",
"cls",
",",
"api_token",
",",
"image_id_or_slug",
")",
":",
"if",
"cls",
".",
"_is_string",
"(",
"image_id_or_slug",
")",
":",
"image",
"=",
"cls",
"(",
"token",
"=",
"api_token",
",",
"slug",
"=",
"image_id_or_slug",
")",
"image"... | d0221b57856fb1e131cafecf99d826f7b07a947c |
valid | Image._is_string | Checks if the value provided is a string (True) or not integer
(False) or something else (None). | digitalocean/Image.py | def _is_string(value):
"""
Checks if the value provided is a string (True) or not integer
(False) or something else (None).
"""
if type(value) in [type(u''), type('')]:
return True
elif type(value) in [int, type(2 ** 64)]:
return False
... | def _is_string(value):
"""
Checks if the value provided is a string (True) or not integer
(False) or something else (None).
"""
if type(value) in [type(u''), type('')]:
return True
elif type(value) in [int, type(2 ** 64)]:
return False
... | [
"Checks",
"if",
"the",
"value",
"provided",
"is",
"a",
"string",
"(",
"True",
")",
"or",
"not",
"integer",
"(",
"False",
")",
"or",
"something",
"else",
"(",
"None",
")",
"."
] | koalalorenzo/python-digitalocean | python | https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/Image.py#L81-L91 | [
"def",
"_is_string",
"(",
"value",
")",
":",
"if",
"type",
"(",
"value",
")",
"in",
"[",
"type",
"(",
"u''",
")",
",",
"type",
"(",
"''",
")",
"]",
":",
"return",
"True",
"elif",
"type",
"(",
"value",
")",
"in",
"[",
"int",
",",
"type",
"(",
... | d0221b57856fb1e131cafecf99d826f7b07a947c |
valid | Image.create | Creates a new custom DigitalOcean Image from the Linux virtual machine
image located at the provided `url`. | digitalocean/Image.py | def create(self):
"""
Creates a new custom DigitalOcean Image from the Linux virtual machine
image located at the provided `url`.
"""
params = {'name': self.name,
'region': self.region,
'url': self.url,
'distribution': self.di... | def create(self):
"""
Creates a new custom DigitalOcean Image from the Linux virtual machine
image located at the provided `url`.
"""
params = {'name': self.name,
'region': self.region,
'url': self.url,
'distribution': self.di... | [
"Creates",
"a",
"new",
"custom",
"DigitalOcean",
"Image",
"from",
"the",
"Linux",
"virtual",
"machine",
"image",
"located",
"at",
"the",
"provided",
"url",
"."
] | koalalorenzo/python-digitalocean | python | https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/Image.py#L93-L111 | [
"def",
"create",
"(",
"self",
")",
":",
"params",
"=",
"{",
"'name'",
":",
"self",
".",
"name",
",",
"'region'",
":",
"self",
".",
"region",
",",
"'url'",
":",
"self",
".",
"url",
",",
"'distribution'",
":",
"self",
".",
"distribution",
",",
"'descri... | d0221b57856fb1e131cafecf99d826f7b07a947c |
valid | Image.load | Load slug.
Loads by id, or by slug if id is not present or use slug is True. | digitalocean/Image.py | def load(self, use_slug=False):
"""
Load slug.
Loads by id, or by slug if id is not present or use slug is True.
"""
identifier = None
if use_slug or not self.id:
identifier = self.slug
else:
identifier = self.id
if not ide... | def load(self, use_slug=False):
"""
Load slug.
Loads by id, or by slug if id is not present or use slug is True.
"""
identifier = None
if use_slug or not self.id:
identifier = self.slug
else:
identifier = self.id
if not ide... | [
"Load",
"slug",
"."
] | koalalorenzo/python-digitalocean | python | https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/Image.py#L113-L133 | [
"def",
"load",
"(",
"self",
",",
"use_slug",
"=",
"False",
")",
":",
"identifier",
"=",
"None",
"if",
"use_slug",
"or",
"not",
"self",
".",
"id",
":",
"identifier",
"=",
"self",
".",
"slug",
"else",
":",
"identifier",
"=",
"self",
".",
"id",
"if",
... | d0221b57856fb1e131cafecf99d826f7b07a947c |
valid | Image.transfer | Transfer the image | digitalocean/Image.py | def transfer(self, new_region_slug):
"""
Transfer the image
"""
return self.get_data(
"images/%s/actions/" % self.id,
type=POST,
params={"type": "transfer", "region": new_region_slug}
) | def transfer(self, new_region_slug):
"""
Transfer the image
"""
return self.get_data(
"images/%s/actions/" % self.id,
type=POST,
params={"type": "transfer", "region": new_region_slug}
) | [
"Transfer",
"the",
"image"
] | koalalorenzo/python-digitalocean | python | https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/Image.py#L141-L149 | [
"def",
"transfer",
"(",
"self",
",",
"new_region_slug",
")",
":",
"return",
"self",
".",
"get_data",
"(",
"\"images/%s/actions/\"",
"%",
"self",
".",
"id",
",",
"type",
"=",
"POST",
",",
"params",
"=",
"{",
"\"type\"",
":",
"\"transfer\"",
",",
"\"region\"... | d0221b57856fb1e131cafecf99d826f7b07a947c |
valid | Image.rename | Rename an image | digitalocean/Image.py | def rename(self, new_name):
"""
Rename an image
"""
return self.get_data(
"images/%s" % self.id,
type=PUT,
params={"name": new_name}
) | def rename(self, new_name):
"""
Rename an image
"""
return self.get_data(
"images/%s" % self.id,
type=PUT,
params={"name": new_name}
) | [
"Rename",
"an",
"image"
] | koalalorenzo/python-digitalocean | python | https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/Image.py#L151-L159 | [
"def",
"rename",
"(",
"self",
",",
"new_name",
")",
":",
"return",
"self",
".",
"get_data",
"(",
"\"images/%s\"",
"%",
"self",
".",
"id",
",",
"type",
"=",
"PUT",
",",
"params",
"=",
"{",
"\"name\"",
":",
"new_name",
"}",
")"
] | d0221b57856fb1e131cafecf99d826f7b07a947c |
valid | convert_conv | Convert convolution layer.
Args:
params: dictionary with layer parameters
w_name: name prefix in state_dict
scope_name: pytorch scope name
inputs: pytorch node inputs
layers: dictionary with keras tensors
weights: pytorch state_dict
names: use short names for... | pytorch2keras/convolution_layers.py | def convert_conv(params, w_name, scope_name, inputs, layers, weights, names):
"""
Convert convolution layer.
Args:
params: dictionary with layer parameters
w_name: name prefix in state_dict
scope_name: pytorch scope name
inputs: pytorch node inputs
layers: dictionary... | def convert_conv(params, w_name, scope_name, inputs, layers, weights, names):
"""
Convert convolution layer.
Args:
params: dictionary with layer parameters
w_name: name prefix in state_dict
scope_name: pytorch scope name
inputs: pytorch node inputs
layers: dictionary... | [
"Convert",
"convolution",
"layer",
"."
] | nerox8664/pytorch2keras | python | https://github.com/nerox8664/pytorch2keras/blob/750eaf747323580e6732d0c5ba9f2f39cb096764/pytorch2keras/convolution_layers.py#L9-L214 | [
"def",
"convert_conv",
"(",
"params",
",",
"w_name",
",",
"scope_name",
",",
"inputs",
",",
"layers",
",",
"weights",
",",
"names",
")",
":",
"print",
"(",
"'Converting convolution ...'",
")",
"if",
"names",
"==",
"'short'",
":",
"tf_name",
"=",
"'C'",
"+"... | 750eaf747323580e6732d0c5ba9f2f39cb096764 |
valid | convert_convtranspose | Convert transposed convolution layer.
Args:
params: dictionary with layer parameters
w_name: name prefix in state_dict
scope_name: pytorch scope name
inputs: pytorch node inputs
layers: dictionary with keras tensors
weights: pytorch state_dict
names: use shor... | pytorch2keras/convolution_layers.py | def convert_convtranspose(params, w_name, scope_name, inputs, layers, weights, names):
"""
Convert transposed convolution layer.
Args:
params: dictionary with layer parameters
w_name: name prefix in state_dict
scope_name: pytorch scope name
inputs: pytorch node inputs
... | def convert_convtranspose(params, w_name, scope_name, inputs, layers, weights, names):
"""
Convert transposed convolution layer.
Args:
params: dictionary with layer parameters
w_name: name prefix in state_dict
scope_name: pytorch scope name
inputs: pytorch node inputs
... | [
"Convert",
"transposed",
"convolution",
"layer",
"."
] | nerox8664/pytorch2keras | python | https://github.com/nerox8664/pytorch2keras/blob/750eaf747323580e6732d0c5ba9f2f39cb096764/pytorch2keras/convolution_layers.py#L217-L297 | [
"def",
"convert_convtranspose",
"(",
"params",
",",
"w_name",
",",
"scope_name",
",",
"inputs",
",",
"layers",
",",
"weights",
",",
"names",
")",
":",
"print",
"(",
"'Converting transposed convolution ...'",
")",
"if",
"names",
"==",
"'short'",
":",
"tf_name",
... | 750eaf747323580e6732d0c5ba9f2f39cb096764 |
valid | convert_sum | Convert sum.
Args:
params: dictionary with layer parameters
w_name: name prefix in state_dict
scope_name: pytorch scope name
inputs: pytorch node inputs
layers: dictionary with keras tensors
weights: pytorch state_dict
names: use short names for keras layers | pytorch2keras/operation_layers.py | def convert_sum(
params, w_name, scope_name, inputs, layers, weights, names
):
"""
Convert sum.
Args:
params: dictionary with layer parameters
w_name: name prefix in state_dict
scope_name: pytorch scope name
inputs: pytorch node inputs
layers: dictionary with ker... | def convert_sum(
params, w_name, scope_name, inputs, layers, weights, names
):
"""
Convert sum.
Args:
params: dictionary with layer parameters
w_name: name prefix in state_dict
scope_name: pytorch scope name
inputs: pytorch node inputs
layers: dictionary with ker... | [
"Convert",
"sum",
"."
] | nerox8664/pytorch2keras | python | https://github.com/nerox8664/pytorch2keras/blob/750eaf747323580e6732d0c5ba9f2f39cb096764/pytorch2keras/operation_layers.py#L10-L32 | [
"def",
"convert_sum",
"(",
"params",
",",
"w_name",
",",
"scope_name",
",",
"inputs",
",",
"layers",
",",
"weights",
",",
"names",
")",
":",
"print",
"(",
"'Converting Sum ...'",
")",
"def",
"target_layer",
"(",
"x",
")",
":",
"import",
"keras",
".",
"ba... | 750eaf747323580e6732d0c5ba9f2f39cb096764 |
valid | convert_reduce_sum | Convert reduce_sum layer.
Args:
params: dictionary with layer parameters
w_name: name prefix in state_dict
scope_name: pytorch scope name
inputs: pytorch node inputs
layers: dictionary with keras tensors
weights: pytorch state_dict
names: use short names for ... | pytorch2keras/operation_layers.py | def convert_reduce_sum(params, w_name, scope_name, inputs, layers, weights, names):
"""
Convert reduce_sum layer.
Args:
params: dictionary with layer parameters
w_name: name prefix in state_dict
scope_name: pytorch scope name
inputs: pytorch node inputs
layers: dicti... | def convert_reduce_sum(params, w_name, scope_name, inputs, layers, weights, names):
"""
Convert reduce_sum layer.
Args:
params: dictionary with layer parameters
w_name: name prefix in state_dict
scope_name: pytorch scope name
inputs: pytorch node inputs
layers: dicti... | [
"Convert",
"reduce_sum",
"layer",
"."
] | nerox8664/pytorch2keras | python | https://github.com/nerox8664/pytorch2keras/blob/750eaf747323580e6732d0c5ba9f2f39cb096764/pytorch2keras/operation_layers.py#L35-L58 | [
"def",
"convert_reduce_sum",
"(",
"params",
",",
"w_name",
",",
"scope_name",
",",
"inputs",
",",
"layers",
",",
"weights",
",",
"names",
")",
":",
"print",
"(",
"'Converting reduce_sum ...'",
")",
"keepdims",
"=",
"params",
"[",
"'keepdims'",
"]",
">",
"0",... | 750eaf747323580e6732d0c5ba9f2f39cb096764 |
valid | convert_concat | Convert concatenation.
Args:
params: dictionary with layer parameters
w_name: name prefix in state_dict
scope_name: pytorch scope name
inputs: pytorch node inputs
layers: dictionary with keras tensors
weights: pytorch state_dict
names: use short names for ker... | pytorch2keras/operation_layers.py | def convert_concat(params, w_name, scope_name, inputs, layers, weights, names):
"""
Convert concatenation.
Args:
params: dictionary with layer parameters
w_name: name prefix in state_dict
scope_name: pytorch scope name
inputs: pytorch node inputs
layers: dictionary w... | def convert_concat(params, w_name, scope_name, inputs, layers, weights, names):
"""
Convert concatenation.
Args:
params: dictionary with layer parameters
w_name: name prefix in state_dict
scope_name: pytorch scope name
inputs: pytorch node inputs
layers: dictionary w... | [
"Convert",
"concatenation",
"."
] | nerox8664/pytorch2keras | python | https://github.com/nerox8664/pytorch2keras/blob/750eaf747323580e6732d0c5ba9f2f39cb096764/pytorch2keras/operation_layers.py#L60-L89 | [
"def",
"convert_concat",
"(",
"params",
",",
"w_name",
",",
"scope_name",
",",
"inputs",
",",
"layers",
",",
"weights",
",",
"names",
")",
":",
"print",
"(",
"'Converting concat ...'",
")",
"concat_nodes",
"=",
"[",
"layers",
"[",
"i",
"]",
"for",
"i",
"... | 750eaf747323580e6732d0c5ba9f2f39cb096764 |
valid | convert_slice | Convert slice operation.
Args:
params: dictionary with layer parameters
w_name: name prefix in state_dict
scope_name: pytorch scope name
inputs: pytorch node inputs
layers: dictionary with keras tensors
weights: pytorch state_dict
names: use short names for k... | pytorch2keras/operation_layers.py | def convert_slice(params, w_name, scope_name, inputs, layers, weights, names):
"""
Convert slice operation.
Args:
params: dictionary with layer parameters
w_name: name prefix in state_dict
scope_name: pytorch scope name
inputs: pytorch node inputs
layers: dictionary ... | def convert_slice(params, w_name, scope_name, inputs, layers, weights, names):
"""
Convert slice operation.
Args:
params: dictionary with layer parameters
w_name: name prefix in state_dict
scope_name: pytorch scope name
inputs: pytorch node inputs
layers: dictionary ... | [
"Convert",
"slice",
"operation",
"."
] | nerox8664/pytorch2keras | python | https://github.com/nerox8664/pytorch2keras/blob/750eaf747323580e6732d0c5ba9f2f39cb096764/pytorch2keras/operation_layers.py#L92-L124 | [
"def",
"convert_slice",
"(",
"params",
",",
"w_name",
",",
"scope_name",
",",
"inputs",
",",
"layers",
",",
"weights",
",",
"names",
")",
":",
"print",
"(",
"'Converting slice ...'",
")",
"if",
"len",
"(",
"params",
"[",
"'axes'",
"]",
")",
">",
"1",
"... | 750eaf747323580e6732d0c5ba9f2f39cb096764 |
valid | convert_clip | Convert clip operation.
Args:
params: dictionary with layer parameters
w_name: name prefix in state_dict
scope_name: pytorch scope name
inputs: pytorch node inputs
layers: dictionary with keras tensors
weights: pytorch state_dict
names: use short names for ke... | pytorch2keras/operation_layers.py | def convert_clip(params, w_name, scope_name, inputs, layers, weights, names):
"""
Convert clip operation.
Args:
params: dictionary with layer parameters
w_name: name prefix in state_dict
scope_name: pytorch scope name
inputs: pytorch node inputs
layers: dictionary wi... | def convert_clip(params, w_name, scope_name, inputs, layers, weights, names):
"""
Convert clip operation.
Args:
params: dictionary with layer parameters
w_name: name prefix in state_dict
scope_name: pytorch scope name
inputs: pytorch node inputs
layers: dictionary wi... | [
"Convert",
"clip",
"operation",
"."
] | nerox8664/pytorch2keras | python | https://github.com/nerox8664/pytorch2keras/blob/750eaf747323580e6732d0c5ba9f2f39cb096764/pytorch2keras/operation_layers.py#L127-L151 | [
"def",
"convert_clip",
"(",
"params",
",",
"w_name",
",",
"scope_name",
",",
"inputs",
",",
"layers",
",",
"weights",
",",
"names",
")",
":",
"print",
"(",
"'Converting clip ...'",
")",
"if",
"params",
"[",
"'min'",
"]",
"==",
"0",
":",
"print",
"(",
"... | 750eaf747323580e6732d0c5ba9f2f39cb096764 |
valid | convert_elementwise_add | Convert elementwise addition.
Args:
params: dictionary with layer parameters
w_name: name prefix in state_dict
scope_name: pytorch scope name
inputs: pytorch node inputs
layers: dictionary with keras tensors
weights: pytorch state_dict
names: use short names ... | pytorch2keras/elementwise_layers.py | def convert_elementwise_add(
params, w_name, scope_name, inputs, layers, weights, names
):
"""
Convert elementwise addition.
Args:
params: dictionary with layer parameters
w_name: name prefix in state_dict
scope_name: pytorch scope name
inputs: pytorch node inputs
... | def convert_elementwise_add(
params, w_name, scope_name, inputs, layers, weights, names
):
"""
Convert elementwise addition.
Args:
params: dictionary with layer parameters
w_name: name prefix in state_dict
scope_name: pytorch scope name
inputs: pytorch node inputs
... | [
"Convert",
"elementwise",
"addition",
"."
] | nerox8664/pytorch2keras | python | https://github.com/nerox8664/pytorch2keras/blob/750eaf747323580e6732d0c5ba9f2f39cb096764/pytorch2keras/elementwise_layers.py#L9-L54 | [
"def",
"convert_elementwise_add",
"(",
"params",
",",
"w_name",
",",
"scope_name",
",",
"inputs",
",",
"layers",
",",
"weights",
",",
"names",
")",
":",
"print",
"(",
"'Converting elementwise_add ...'",
")",
"if",
"'broadcast'",
"in",
"params",
":",
"model0",
... | 750eaf747323580e6732d0c5ba9f2f39cb096764 |
valid | convert_elementwise_mul | Convert elementwise multiplication.
Args:
params: dictionary with layer parameters
w_name: name prefix in state_dict
scope_name: pytorch scope name
inputs: pytorch node inputs
layers: dictionary with keras tensors
weights: pytorch state_dict
names: use short ... | pytorch2keras/elementwise_layers.py | def convert_elementwise_mul(
params, w_name, scope_name, inputs, layers, weights, names
):
"""
Convert elementwise multiplication.
Args:
params: dictionary with layer parameters
w_name: name prefix in state_dict
scope_name: pytorch scope name
inputs: pytorch node inputs
... | def convert_elementwise_mul(
params, w_name, scope_name, inputs, layers, weights, names
):
"""
Convert elementwise multiplication.
Args:
params: dictionary with layer parameters
w_name: name prefix in state_dict
scope_name: pytorch scope name
inputs: pytorch node inputs
... | [
"Convert",
"elementwise",
"multiplication",
"."
] | nerox8664/pytorch2keras | python | https://github.com/nerox8664/pytorch2keras/blob/750eaf747323580e6732d0c5ba9f2f39cb096764/pytorch2keras/elementwise_layers.py#L57-L91 | [
"def",
"convert_elementwise_mul",
"(",
"params",
",",
"w_name",
",",
"scope_name",
",",
"inputs",
",",
"layers",
",",
"weights",
",",
"names",
")",
":",
"print",
"(",
"'Converting elementwise_mul ...'",
")",
"model0",
"=",
"layers",
"[",
"inputs",
"[",
"0",
... | 750eaf747323580e6732d0c5ba9f2f39cb096764 |
valid | convert_elementwise_div | Convert elementwise multiplication.
Args:
params: dictionary with layer parameters
w_name: name prefix in state_dict
scope_name: pytorch scope name
inputs: pytorch node inputs
layers: dictionary with keras tensors
weights: pytorch state_dict
names: use short ... | pytorch2keras/elementwise_layers.py | def convert_elementwise_div(
params, w_name, scope_name, inputs, layers, weights, names
):
"""
Convert elementwise multiplication.
Args:
params: dictionary with layer parameters
w_name: name prefix in state_dict
scope_name: pytorch scope name
inputs: pytorch node inputs
... | def convert_elementwise_div(
params, w_name, scope_name, inputs, layers, weights, names
):
"""
Convert elementwise multiplication.
Args:
params: dictionary with layer parameters
w_name: name prefix in state_dict
scope_name: pytorch scope name
inputs: pytorch node inputs
... | [
"Convert",
"elementwise",
"multiplication",
"."
] | nerox8664/pytorch2keras | python | https://github.com/nerox8664/pytorch2keras/blob/750eaf747323580e6732d0c5ba9f2f39cb096764/pytorch2keras/elementwise_layers.py#L94-L126 | [
"def",
"convert_elementwise_div",
"(",
"params",
",",
"w_name",
",",
"scope_name",
",",
"inputs",
",",
"layers",
",",
"weights",
",",
"names",
")",
":",
"print",
"(",
"'Converting elementwise_div ...'",
")",
"if",
"names",
"==",
"'short'",
":",
"tf_name",
"=",... | 750eaf747323580e6732d0c5ba9f2f39cb096764 |
valid | convert_elementwise_sub | Convert elementwise subtraction.
Args:
params: dictionary with layer parameters
w_name: name prefix in state_dict
scope_name: pytorch scope name
inputs: pytorch node inputs
layers: dictionary with keras tensors
weights: pytorch state_dict
names: use short nam... | pytorch2keras/elementwise_layers.py | def convert_elementwise_sub(
params, w_name, scope_name, inputs, layers, weights, names
):
"""
Convert elementwise subtraction.
Args:
params: dictionary with layer parameters
w_name: name prefix in state_dict
scope_name: pytorch scope name
inputs: pytorch node inputs
... | def convert_elementwise_sub(
params, w_name, scope_name, inputs, layers, weights, names
):
"""
Convert elementwise subtraction.
Args:
params: dictionary with layer parameters
w_name: name prefix in state_dict
scope_name: pytorch scope name
inputs: pytorch node inputs
... | [
"Convert",
"elementwise",
"subtraction",
"."
] | nerox8664/pytorch2keras | python | https://github.com/nerox8664/pytorch2keras/blob/750eaf747323580e6732d0c5ba9f2f39cb096764/pytorch2keras/elementwise_layers.py#L129-L156 | [
"def",
"convert_elementwise_sub",
"(",
"params",
",",
"w_name",
",",
"scope_name",
",",
"inputs",
",",
"layers",
",",
"weights",
",",
"names",
")",
":",
"print",
"(",
"'Converting elementwise_sub ...'",
")",
"model0",
"=",
"layers",
"[",
"inputs",
"[",
"0",
... | 750eaf747323580e6732d0c5ba9f2f39cb096764 |
valid | convert_gemm | Convert Linear.
Args:
params: dictionary with layer parameters
w_name: name prefix in state_dict
scope_name: pytorch scope name
inputs: pytorch node inputs
layers: dictionary with keras tensors
weights: pytorch state_dict
names: use short names for keras laye... | pytorch2keras/linear_layers.py | def convert_gemm(params, w_name, scope_name, inputs, layers, weights, names):
"""
Convert Linear.
Args:
params: dictionary with layer parameters
w_name: name prefix in state_dict
scope_name: pytorch scope name
inputs: pytorch node inputs
layers: dictionary with keras... | def convert_gemm(params, w_name, scope_name, inputs, layers, weights, names):
"""
Convert Linear.
Args:
params: dictionary with layer parameters
w_name: name prefix in state_dict
scope_name: pytorch scope name
inputs: pytorch node inputs
layers: dictionary with keras... | [
"Convert",
"Linear",
"."
] | nerox8664/pytorch2keras | python | https://github.com/nerox8664/pytorch2keras/blob/750eaf747323580e6732d0c5ba9f2f39cb096764/pytorch2keras/linear_layers.py#L9-L49 | [
"def",
"convert_gemm",
"(",
"params",
",",
"w_name",
",",
"scope_name",
",",
"inputs",
",",
"layers",
",",
"weights",
",",
"names",
")",
":",
"print",
"(",
"'Converting Linear ...'",
")",
"if",
"names",
"==",
"'short'",
":",
"tf_name",
"=",
"'FC'",
"+",
... | 750eaf747323580e6732d0c5ba9f2f39cb096764 |
valid | convert_matmul | Convert matmul layer.
Args:
params: dictionary with layer parameters
w_name: name prefix in state_dict
scope_name: pytorch scope name
inputs: pytorch node inputs
layers: dictionary with keras tensors
weights: pytorch state_dict
names: use short names for kera... | pytorch2keras/linear_layers.py | def convert_matmul(params, w_name, scope_name, inputs, layers, weights, names):
"""
Convert matmul layer.
Args:
params: dictionary with layer parameters
w_name: name prefix in state_dict
scope_name: pytorch scope name
inputs: pytorch node inputs
layers: dictionary wi... | def convert_matmul(params, w_name, scope_name, inputs, layers, weights, names):
"""
Convert matmul layer.
Args:
params: dictionary with layer parameters
w_name: name prefix in state_dict
scope_name: pytorch scope name
inputs: pytorch node inputs
layers: dictionary wi... | [
"Convert",
"matmul",
"layer",
"."
] | nerox8664/pytorch2keras | python | https://github.com/nerox8664/pytorch2keras/blob/750eaf747323580e6732d0c5ba9f2f39cb096764/pytorch2keras/linear_layers.py#L52-L101 | [
"def",
"convert_matmul",
"(",
"params",
",",
"w_name",
",",
"scope_name",
",",
"inputs",
",",
"layers",
",",
"weights",
",",
"names",
")",
":",
"print",
"(",
"'Converting matmul ...'",
")",
"if",
"names",
"==",
"'short'",
":",
"tf_name",
"=",
"'MMUL'",
"+"... | 750eaf747323580e6732d0c5ba9f2f39cb096764 |
valid | convert_constant | Convert constant layer.
Args:
params: dictionary with layer parameters
w_name: name prefix in state_dict
scope_name: pytorch scope name
inputs: pytorch node inputs
layers: dictionary with keras tensors
weights: pytorch state_dict
names: use short names for ke... | pytorch2keras/constant_layers.py | def convert_constant(params, w_name, scope_name, inputs, layers, weights, names):
"""
Convert constant layer.
Args:
params: dictionary with layer parameters
w_name: name prefix in state_dict
scope_name: pytorch scope name
inputs: pytorch node inputs
layers: dictionar... | def convert_constant(params, w_name, scope_name, inputs, layers, weights, names):
"""
Convert constant layer.
Args:
params: dictionary with layer parameters
w_name: name prefix in state_dict
scope_name: pytorch scope name
inputs: pytorch node inputs
layers: dictionar... | [
"Convert",
"constant",
"layer",
"."
] | nerox8664/pytorch2keras | python | https://github.com/nerox8664/pytorch2keras/blob/750eaf747323580e6732d0c5ba9f2f39cb096764/pytorch2keras/constant_layers.py#L9-L31 | [
"def",
"convert_constant",
"(",
"params",
",",
"w_name",
",",
"scope_name",
",",
"inputs",
",",
"layers",
",",
"weights",
",",
"names",
")",
":",
"print",
"(",
"'Converting constant ...'",
")",
"params_list",
"=",
"params",
"[",
"'value'",
"]",
".",
"numpy",... | 750eaf747323580e6732d0c5ba9f2f39cb096764 |
valid | convert_flatten | Convert reshape(view).
Args:
params: dictionary with layer parameters
w_name: name prefix in state_dict
scope_name: pytorch scope name
inputs: pytorch node inputs
layers: dictionary with keras tensors
weights: pytorch state_dict
names: use short names for ker... | pytorch2keras/reshape_layers.py | def convert_flatten(params, w_name, scope_name, inputs, layers, weights, names):
"""
Convert reshape(view).
Args:
params: dictionary with layer parameters
w_name: name prefix in state_dict
scope_name: pytorch scope name
inputs: pytorch node inputs
layers: dictionary ... | def convert_flatten(params, w_name, scope_name, inputs, layers, weights, names):
"""
Convert reshape(view).
Args:
params: dictionary with layer parameters
w_name: name prefix in state_dict
scope_name: pytorch scope name
inputs: pytorch node inputs
layers: dictionary ... | [
"Convert",
"reshape",
"(",
"view",
")",
"."
] | nerox8664/pytorch2keras | python | https://github.com/nerox8664/pytorch2keras/blob/750eaf747323580e6732d0c5ba9f2f39cb096764/pytorch2keras/reshape_layers.py#L9-L32 | [
"def",
"convert_flatten",
"(",
"params",
",",
"w_name",
",",
"scope_name",
",",
"inputs",
",",
"layers",
",",
"weights",
",",
"names",
")",
":",
"print",
"(",
"'Converting flatten ...'",
")",
"if",
"names",
"==",
"'short'",
":",
"tf_name",
"=",
"'R'",
"+",... | 750eaf747323580e6732d0c5ba9f2f39cb096764 |
valid | convert_transpose | Convert transpose layer.
Args:
params: dictionary with layer parameters
w_name: name prefix in state_dict
scope_name: pytorch scope name
inputs: pytorch node inputs
layers: dictionary with keras tensors
weights: pytorch state_dict
names: use short names for ke... | pytorch2keras/reshape_layers.py | def convert_transpose(params, w_name, scope_name, inputs, layers, weights, names):
"""
Convert transpose layer.
Args:
params: dictionary with layer parameters
w_name: name prefix in state_dict
scope_name: pytorch scope name
inputs: pytorch node inputs
layers: dictiona... | def convert_transpose(params, w_name, scope_name, inputs, layers, weights, names):
"""
Convert transpose layer.
Args:
params: dictionary with layer parameters
w_name: name prefix in state_dict
scope_name: pytorch scope name
inputs: pytorch node inputs
layers: dictiona... | [
"Convert",
"transpose",
"layer",
"."
] | nerox8664/pytorch2keras | python | https://github.com/nerox8664/pytorch2keras/blob/750eaf747323580e6732d0c5ba9f2f39cb096764/pytorch2keras/reshape_layers.py#L35-L61 | [
"def",
"convert_transpose",
"(",
"params",
",",
"w_name",
",",
"scope_name",
",",
"inputs",
",",
"layers",
",",
"weights",
",",
"names",
")",
":",
"print",
"(",
"'Converting transpose ...'",
")",
"if",
"params",
"[",
"'perm'",
"]",
"[",
"0",
"]",
"!=",
"... | 750eaf747323580e6732d0c5ba9f2f39cb096764 |
valid | convert_reshape | Convert reshape layer.
Args:
params: dictionary with layer parameters
w_name: name prefix in state_dict
scope_name: pytorch scope name
inputs: pytorch node inputs
layers: dictionary with keras tensors
weights: pytorch state_dict
names: use short names for kera... | pytorch2keras/reshape_layers.py | def convert_reshape(params, w_name, scope_name, inputs, layers, weights, names):
"""
Convert reshape layer.
Args:
params: dictionary with layer parameters
w_name: name prefix in state_dict
scope_name: pytorch scope name
inputs: pytorch node inputs
layers: dictionary w... | def convert_reshape(params, w_name, scope_name, inputs, layers, weights, names):
"""
Convert reshape layer.
Args:
params: dictionary with layer parameters
w_name: name prefix in state_dict
scope_name: pytorch scope name
inputs: pytorch node inputs
layers: dictionary w... | [
"Convert",
"reshape",
"layer",
"."
] | nerox8664/pytorch2keras | python | https://github.com/nerox8664/pytorch2keras/blob/750eaf747323580e6732d0c5ba9f2f39cb096764/pytorch2keras/reshape_layers.py#L64-L96 | [
"def",
"convert_reshape",
"(",
"params",
",",
"w_name",
",",
"scope_name",
",",
"inputs",
",",
"layers",
",",
"weights",
",",
"names",
")",
":",
"print",
"(",
"'Converting reshape ...'",
")",
"if",
"names",
"==",
"'short'",
":",
"tf_name",
"=",
"'RESH'",
"... | 750eaf747323580e6732d0c5ba9f2f39cb096764 |
valid | convert_squeeze | Convert squeeze operation.
Args:
params: dictionary with layer parameters
w_name: name prefix in state_dict
scope_name: pytorch scope name
inputs: pytorch node inputs
layers: dictionary with keras tensors
weights: pytorch state_dict
names: use short names for... | pytorch2keras/reshape_layers.py | def convert_squeeze(params, w_name, scope_name, inputs, layers, weights, names):
"""
Convert squeeze operation.
Args:
params: dictionary with layer parameters
w_name: name prefix in state_dict
scope_name: pytorch scope name
inputs: pytorch node inputs
layers: diction... | def convert_squeeze(params, w_name, scope_name, inputs, layers, weights, names):
"""
Convert squeeze operation.
Args:
params: dictionary with layer parameters
w_name: name prefix in state_dict
scope_name: pytorch scope name
inputs: pytorch node inputs
layers: diction... | [
"Convert",
"squeeze",
"operation",
"."
] | nerox8664/pytorch2keras | python | https://github.com/nerox8664/pytorch2keras/blob/750eaf747323580e6732d0c5ba9f2f39cb096764/pytorch2keras/reshape_layers.py#L98-L121 | [
"def",
"convert_squeeze",
"(",
"params",
",",
"w_name",
",",
"scope_name",
",",
"inputs",
",",
"layers",
",",
"weights",
",",
"names",
")",
":",
"print",
"(",
"'Converting squeeze ...'",
")",
"if",
"len",
"(",
"params",
"[",
"'axes'",
"]",
")",
">",
"1",... | 750eaf747323580e6732d0c5ba9f2f39cb096764 |
valid | convert_unsqueeze | Convert unsqueeze operation.
Args:
params: dictionary with layer parameters
w_name: name prefix in state_dict
scope_name: pytorch scope name
inputs: pytorch node inputs
layers: dictionary with keras tensors
weights: pytorch state_dict
names: use short names f... | pytorch2keras/reshape_layers.py | def convert_unsqueeze(params, w_name, scope_name, inputs, layers, weights, names):
"""
Convert unsqueeze operation.
Args:
params: dictionary with layer parameters
w_name: name prefix in state_dict
scope_name: pytorch scope name
inputs: pytorch node inputs
layers: dic... | def convert_unsqueeze(params, w_name, scope_name, inputs, layers, weights, names):
"""
Convert unsqueeze operation.
Args:
params: dictionary with layer parameters
w_name: name prefix in state_dict
scope_name: pytorch scope name
inputs: pytorch node inputs
layers: dic... | [
"Convert",
"unsqueeze",
"operation",
"."
] | nerox8664/pytorch2keras | python | https://github.com/nerox8664/pytorch2keras/blob/750eaf747323580e6732d0c5ba9f2f39cb096764/pytorch2keras/reshape_layers.py#L124-L151 | [
"def",
"convert_unsqueeze",
"(",
"params",
",",
"w_name",
",",
"scope_name",
",",
"inputs",
",",
"layers",
",",
"weights",
",",
"names",
")",
":",
"print",
"(",
"'Converting unsqueeze ...'",
")",
"if",
"names",
"==",
"'short'",
":",
"tf_name",
"=",
"'UNSQ'",... | 750eaf747323580e6732d0c5ba9f2f39cb096764 |
valid | convert_shape | Convert shape operation.
Args:
params: dictionary with layer parameters
w_name: name prefix in state_dict
scope_name: pytorch scope name
inputs: pytorch node inputs
layers: dictionary with keras tensors
weights: pytorch state_dict
names: use short names for k... | pytorch2keras/reshape_layers.py | def convert_shape(params, w_name, scope_name, inputs, layers, weights, names):
"""
Convert shape operation.
Args:
params: dictionary with layer parameters
w_name: name prefix in state_dict
scope_name: pytorch scope name
inputs: pytorch node inputs
layers: dictionary ... | def convert_shape(params, w_name, scope_name, inputs, layers, weights, names):
"""
Convert shape operation.
Args:
params: dictionary with layer parameters
w_name: name prefix in state_dict
scope_name: pytorch scope name
inputs: pytorch node inputs
layers: dictionary ... | [
"Convert",
"shape",
"operation",
"."
] | nerox8664/pytorch2keras | python | https://github.com/nerox8664/pytorch2keras/blob/750eaf747323580e6732d0c5ba9f2f39cb096764/pytorch2keras/reshape_layers.py#L154-L174 | [
"def",
"convert_shape",
"(",
"params",
",",
"w_name",
",",
"scope_name",
",",
"inputs",
",",
"layers",
",",
"weights",
",",
"names",
")",
":",
"print",
"(",
"'Converting shape ...'",
")",
"def",
"target_layer",
"(",
"x",
")",
":",
"import",
"tensorflow",
"... | 750eaf747323580e6732d0c5ba9f2f39cb096764 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.