repo
stringlengths
7
55
path
stringlengths
4
223
func_name
stringlengths
1
134
original_string
stringlengths
75
104k
language
stringclasses
1 value
code
stringlengths
75
104k
code_tokens
listlengths
19
28.4k
docstring
stringlengths
1
46.9k
docstring_tokens
listlengths
1
1.97k
sha
stringlengths
40
40
url
stringlengths
87
315
partition
stringclasses
3 values
summary
stringlengths
4
350
CenturyLinkCloud/clc-python-sdk
src/clc/APIv2/server.py
Server.PriceHourly
def PriceHourly(self): """Returns the total hourly price for the server. Sums unit prices with unit volumes. >>> clc.v2.Server("NY1BTDIPHYP0101").PriceHourly() 0.02857 """ units = self.PriceUnits() return(units['cpu']*self.cpu+units['memory']*self.memory+units['storage']*self.storage+units['managed_o...
python
def PriceHourly(self): """Returns the total hourly price for the server. Sums unit prices with unit volumes. >>> clc.v2.Server("NY1BTDIPHYP0101").PriceHourly() 0.02857 """ units = self.PriceUnits() return(units['cpu']*self.cpu+units['memory']*self.memory+units['storage']*self.storage+units['managed_o...
[ "def", "PriceHourly", "(", "self", ")", ":", "units", "=", "self", ".", "PriceUnits", "(", ")", "return", "(", "units", "[", "'cpu'", "]", "*", "self", ".", "cpu", "+", "units", "[", "'memory'", "]", "*", "self", ".", "memory", "+", "units", "[", ...
Returns the total hourly price for the server. Sums unit prices with unit volumes. >>> clc.v2.Server("NY1BTDIPHYP0101").PriceHourly() 0.02857
[ "Returns", "the", "total", "hourly", "price", "for", "the", "server", "." ]
f4dba40c627cb08dd4b7d0d277e8d67578010b05
https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/server.py#L314-L326
train
Returns the total hourly price for the server.
CenturyLinkCloud/clc-python-sdk
src/clc/APIv2/server.py
Server.Credentials
def Credentials(self): """Returns the administrative credentials for this server. >>> clc.v2.Server("NY1BTDIPHYP0101").Credentials() {u'userName': u'administrator', u'password': u'dszkjh498s^'} """ return(clc.v2.API.Call('GET','servers/%s/%s/credentials' % (self.alias,self.name),session=self.session))
python
def Credentials(self): """Returns the administrative credentials for this server. >>> clc.v2.Server("NY1BTDIPHYP0101").Credentials() {u'userName': u'administrator', u'password': u'dszkjh498s^'} """ return(clc.v2.API.Call('GET','servers/%s/%s/credentials' % (self.alias,self.name),session=self.session))
[ "def", "Credentials", "(", "self", ")", ":", "return", "(", "clc", ".", "v2", ".", "API", ".", "Call", "(", "'GET'", ",", "'servers/%s/%s/credentials'", "%", "(", "self", ".", "alias", ",", "self", ".", "name", ")", ",", "session", "=", "self", ".", ...
Returns the administrative credentials for this server. >>> clc.v2.Server("NY1BTDIPHYP0101").Credentials() {u'userName': u'administrator', u'password': u'dszkjh498s^'}
[ "Returns", "the", "administrative", "credentials", "for", "this", "server", "." ]
f4dba40c627cb08dd4b7d0d277e8d67578010b05
https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/server.py#L329-L337
train
Returns the administrative credentials for this server.
CenturyLinkCloud/clc-python-sdk
src/clc/APIv2/server.py
Server._Operation
def _Operation(self,operation): """Execute specified operations task against one or more servers. Returns a clc.v2.Requests object. If error due to server(s) already being in the requested state this is not raised as an error at this level. >>> clc.v2.Server(alias='BTDI',id='WA1BTDIKRT02').PowerOn().WaitUntil...
python
def _Operation(self,operation): """Execute specified operations task against one or more servers. Returns a clc.v2.Requests object. If error due to server(s) already being in the requested state this is not raised as an error at this level. >>> clc.v2.Server(alias='BTDI',id='WA1BTDIKRT02').PowerOn().WaitUntil...
[ "def", "_Operation", "(", "self", ",", "operation", ")", ":", "try", ":", "return", "(", "clc", ".", "v2", ".", "Requests", "(", "clc", ".", "v2", ".", "API", ".", "Call", "(", "'POST'", ",", "'operations/%s/servers/%s'", "%", "(", "self", ".", "alia...
Execute specified operations task against one or more servers. Returns a clc.v2.Requests object. If error due to server(s) already being in the requested state this is not raised as an error at this level. >>> clc.v2.Server(alias='BTDI',id='WA1BTDIKRT02').PowerOn().WaitUntilComplete() 0
[ "Execute", "specified", "operations", "task", "against", "one", "or", "more", "servers", "." ]
f4dba40c627cb08dd4b7d0d277e8d67578010b05
https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/server.py#L340-L360
train
Execute specified operations task against one or more servers.
CenturyLinkCloud/clc-python-sdk
src/clc/APIv2/server.py
Server.ExecutePackage
def ExecutePackage(self,package_id,parameters={}): """Execute an existing Bluerprint package on the server. https://t3n.zendesk.com/entries/59727040-Execute-Package Requires package ID, currently only available by browsing control and browsing for the package itself. The UUID parameter is the package ID we n...
python
def ExecutePackage(self,package_id,parameters={}): """Execute an existing Bluerprint package on the server. https://t3n.zendesk.com/entries/59727040-Execute-Package Requires package ID, currently only available by browsing control and browsing for the package itself. The UUID parameter is the package ID we n...
[ "def", "ExecutePackage", "(", "self", ",", "package_id", ",", "parameters", "=", "{", "}", ")", ":", "return", "(", "clc", ".", "v2", ".", "Requests", "(", "clc", ".", "v2", ".", "API", ".", "Call", "(", "'POST'", ",", "'operations/%s/servers/executePack...
Execute an existing Bluerprint package on the server. https://t3n.zendesk.com/entries/59727040-Execute-Package Requires package ID, currently only available by browsing control and browsing for the package itself. The UUID parameter is the package ID we need. >>> clc.v2.Server(alias='BTDI',id='WA1BTDIKRT06'...
[ "Execute", "an", "existing", "Bluerprint", "package", "on", "the", "server", "." ]
f4dba40c627cb08dd4b7d0d277e8d67578010b05
https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/server.py#L387-L406
train
Execute an existing Bluerprint package on the server.
CenturyLinkCloud/clc-python-sdk
src/clc/APIv2/server.py
Server.AddNIC
def AddNIC(self,network_id,ip=''): """Add a NIC from the provided network to server and, if provided, assign a provided IP address https://www.ctl.io/api-docs/v2/#servers-add-secondary-network Requires package ID, currently only available by browsing control and browsing for the package itself. The UUID...
python
def AddNIC(self,network_id,ip=''): """Add a NIC from the provided network to server and, if provided, assign a provided IP address https://www.ctl.io/api-docs/v2/#servers-add-secondary-network Requires package ID, currently only available by browsing control and browsing for the package itself. The UUID...
[ "def", "AddNIC", "(", "self", ",", "network_id", ",", "ip", "=", "''", ")", ":", "return", "(", "clc", ".", "v2", ".", "Requests", "(", "clc", ".", "v2", ".", "API", ".", "Call", "(", "'POST'", ",", "'servers/%s/%s/networks'", "%", "(", "self", "."...
Add a NIC from the provided network to server and, if provided, assign a provided IP address https://www.ctl.io/api-docs/v2/#servers-add-secondary-network Requires package ID, currently only available by browsing control and browsing for the package itself. The UUID parameter is the package ID we need. ...
[ "Add", "a", "NIC", "from", "the", "provided", "network", "to", "server", "and", "if", "provided", "assign", "a", "provided", "IP", "address" ]
f4dba40c627cb08dd4b7d0d277e8d67578010b05
https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/server.py#L409-L435
train
Add a NIC from the provided network to the server and if provided assign a provided IP address.
CenturyLinkCloud/clc-python-sdk
src/clc/APIv2/server.py
Server.RemoveNIC
def RemoveNIC(self,network_id): """Remove the NIC associated with the provided network from the server. https://www.ctl.io/api-docs/v2/#servers-remove-secondary-network network_id - ID associated with the network to remove >>> network = clc.v2.Networks(location="VA1").Get("10.128.166.0/24") >>>...
python
def RemoveNIC(self,network_id): """Remove the NIC associated with the provided network from the server. https://www.ctl.io/api-docs/v2/#servers-remove-secondary-network network_id - ID associated with the network to remove >>> network = clc.v2.Networks(location="VA1").Get("10.128.166.0/24") >>>...
[ "def", "RemoveNIC", "(", "self", ",", "network_id", ")", ":", "return", "(", "clc", ".", "v2", ".", "Requests", "(", "clc", ".", "v2", ".", "API", ".", "Call", "(", "'DELETE'", ",", "'servers/%s/%s/networks/%s'", "%", "(", "self", ".", "alias", ",", ...
Remove the NIC associated with the provided network from the server. https://www.ctl.io/api-docs/v2/#servers-remove-secondary-network network_id - ID associated with the network to remove >>> network = clc.v2.Networks(location="VA1").Get("10.128.166.0/24") >>> clc.v2.Server(alias='BTDI',id='WA1BT...
[ "Remove", "the", "NIC", "associated", "with", "the", "provided", "network", "from", "the", "server", "." ]
f4dba40c627cb08dd4b7d0d277e8d67578010b05
https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/server.py#L437-L459
train
Remove the NIC associated with the provided network from the server.
CenturyLinkCloud/clc-python-sdk
src/clc/APIv2/server.py
Server.CreateSnapshot
def CreateSnapshot(self,delete_existing=True,expiration_days=7): """Take a Hypervisor level snapshot retained for between 1 and 10 days (7 is default). Currently only one snapshop may exist at a time, thus will delete snapshots if one already exists before taking this snapshot. >>> clc.v2.Server("WA1BTDIAPI219...
python
def CreateSnapshot(self,delete_existing=True,expiration_days=7): """Take a Hypervisor level snapshot retained for between 1 and 10 days (7 is default). Currently only one snapshop may exist at a time, thus will delete snapshots if one already exists before taking this snapshot. >>> clc.v2.Server("WA1BTDIAPI219...
[ "def", "CreateSnapshot", "(", "self", ",", "delete_existing", "=", "True", ",", "expiration_days", "=", "7", ")", ":", "if", "len", "(", "self", ".", "data", "[", "'details'", "]", "[", "'snapshots'", "]", ")", ":", "if", "delete_existing", ":", "self", ...
Take a Hypervisor level snapshot retained for between 1 and 10 days (7 is default). Currently only one snapshop may exist at a time, thus will delete snapshots if one already exists before taking this snapshot. >>> clc.v2.Server("WA1BTDIAPI219").CreateSnapshot(2) <clc.APIv2.queue.Requests object at 0x10d106cd0...
[ "Take", "a", "Hypervisor", "level", "snapshot", "retained", "for", "between", "1", "and", "10", "days", "(", "7", "is", "default", ")", ".", "Currently", "only", "one", "snapshop", "may", "exist", "at", "a", "time", "thus", "will", "delete", "snapshots", ...
f4dba40c627cb08dd4b7d0d277e8d67578010b05
https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/server.py#L472-L492
train
Create a snapshot of this server.
CenturyLinkCloud/clc-python-sdk
src/clc/APIv2/server.py
Server.DeleteSnapshot
def DeleteSnapshot(self,names=None): """Removes an existing Hypervisor level snapshot. Supply one or more snapshot names to delete them concurrently. If no snapshot names are supplied will delete all existing snapshots. >>> clc.v2.Server(alias='BTDI',id='WA1BTDIKRT02').DeleteSnapshot().WaitUntilComplete() 0...
python
def DeleteSnapshot(self,names=None): """Removes an existing Hypervisor level snapshot. Supply one or more snapshot names to delete them concurrently. If no snapshot names are supplied will delete all existing snapshots. >>> clc.v2.Server(alias='BTDI',id='WA1BTDIKRT02').DeleteSnapshot().WaitUntilComplete() 0...
[ "def", "DeleteSnapshot", "(", "self", ",", "names", "=", "None", ")", ":", "if", "names", "is", "None", ":", "names", "=", "self", ".", "GetSnapshots", "(", ")", "requests_lst", "=", "[", "]", "for", "name", "in", "names", ":", "name_links", "=", "["...
Removes an existing Hypervisor level snapshot. Supply one or more snapshot names to delete them concurrently. If no snapshot names are supplied will delete all existing snapshots. >>> clc.v2.Server(alias='BTDI',id='WA1BTDIKRT02').DeleteSnapshot().WaitUntilComplete() 0
[ "Removes", "an", "existing", "Hypervisor", "level", "snapshot", "." ]
f4dba40c627cb08dd4b7d0d277e8d67578010b05
https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/server.py#L495-L519
train
Removes an existing Hypervisor level snapshot.
CenturyLinkCloud/clc-python-sdk
src/clc/APIv2/server.py
Server.RestoreSnapshot
def RestoreSnapshot(self,name=None): """Restores an existing Hypervisor level snapshot. Supply snapshot name to restore If no snapshot name is supplied will restore the first snapshot found >>> clc.v2.Server(alias='BTDI',id='WA1BTDIKRT02').RestoreSnapshot().WaitUntilComplete() 0 """ if not len(self.da...
python
def RestoreSnapshot(self,name=None): """Restores an existing Hypervisor level snapshot. Supply snapshot name to restore If no snapshot name is supplied will restore the first snapshot found >>> clc.v2.Server(alias='BTDI',id='WA1BTDIKRT02').RestoreSnapshot().WaitUntilComplete() 0 """ if not len(self.da...
[ "def", "RestoreSnapshot", "(", "self", ",", "name", "=", "None", ")", ":", "if", "not", "len", "(", "self", ".", "data", "[", "'details'", "]", "[", "'snapshots'", "]", ")", ":", "raise", "(", "clc", ".", "CLCException", "(", "\"No snapshots exist\"", ...
Restores an existing Hypervisor level snapshot. Supply snapshot name to restore If no snapshot name is supplied will restore the first snapshot found >>> clc.v2.Server(alias='BTDI',id='WA1BTDIKRT02').RestoreSnapshot().WaitUntilComplete() 0
[ "Restores", "an", "existing", "Hypervisor", "level", "snapshot", "." ]
f4dba40c627cb08dd4b7d0d277e8d67578010b05
https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/server.py#L522-L541
train
Restores an existing Hypervisor level snapshot.
CenturyLinkCloud/clc-python-sdk
src/clc/APIv2/server.py
Server.Create
def Create(name,template,group_id,network_id,cpu=None,memory=None,alias=None,password=None,ip_address=None, storage_type="standard",type="standard",primary_dns=None,secondary_dns=None, additional_disks=[],custom_fields=[],ttl=None,managed_os=False,description=None, source_server_password=None,cp...
python
def Create(name,template,group_id,network_id,cpu=None,memory=None,alias=None,password=None,ip_address=None, storage_type="standard",type="standard",primary_dns=None,secondary_dns=None, additional_disks=[],custom_fields=[],ttl=None,managed_os=False,description=None, source_server_password=None,cp...
[ "def", "Create", "(", "name", ",", "template", ",", "group_id", ",", "network_id", ",", "cpu", "=", "None", ",", "memory", "=", "None", ",", "alias", "=", "None", ",", "password", "=", "None", ",", "ip_address", "=", "None", ",", "storage_type", "=", ...
Creates a new server. https://www.centurylinkcloud.com/api-docs/v2/#servers-create-server cpu and memory are optional and if not provided we pull from the default server size values associated with the provided group_id. Set ttl as number of seconds before server is to be terminated. Must be >3600 >>> d ...
[ "Creates", "a", "new", "server", "." ]
f4dba40c627cb08dd4b7d0d277e8d67578010b05
https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/server.py#L545-L617
train
Create a new server.
CenturyLinkCloud/clc-python-sdk
src/clc/APIv2/server.py
Server.Clone
def Clone(self,network_id,name=None,cpu=None,memory=None,group_id=None,alias=None,password=None,ip_address=None, storage_type=None,type=None,primary_dns=None,secondary_dns=None, custom_fields=None,ttl=None,managed_os=False,description=None, source_server_password=None,cpu_autoscale_policy_id=None,a...
python
def Clone(self,network_id,name=None,cpu=None,memory=None,group_id=None,alias=None,password=None,ip_address=None, storage_type=None,type=None,primary_dns=None,secondary_dns=None, custom_fields=None,ttl=None,managed_os=False,description=None, source_server_password=None,cpu_autoscale_policy_id=None,a...
[ "def", "Clone", "(", "self", ",", "network_id", ",", "name", "=", "None", ",", "cpu", "=", "None", ",", "memory", "=", "None", ",", "group_id", "=", "None", ",", "alias", "=", "None", ",", "password", "=", "None", ",", "ip_address", "=", "None", ",...
Creates one or more clones of existing server. https://www.centurylinkcloud.com/api-docs/v2/#servers-create-server Set ttl as number of seconds before server is to be terminated. * - network_id is currently a required parameter. This will change to optional once APIs are available to return the network ...
[ "Creates", "one", "or", "more", "clones", "of", "existing", "server", "." ]
f4dba40c627cb08dd4b7d0d277e8d67578010b05
https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/server.py#L620-L674
train
Create one or more server clones.
CenturyLinkCloud/clc-python-sdk
src/clc/APIv2/server.py
Server.ConvertToTemplate
def ConvertToTemplate(self,visibility,description=None,password=None): """Converts existing server to a template. visibility is one of private or shared. >>> d = clc.v2.Datacenter() >>> clc.v2.Server(alias='BTDI',id='WA1BTDIAPI207').ConvertToTemplate("private","my template") 0 """ if visibility not in...
python
def ConvertToTemplate(self,visibility,description=None,password=None): """Converts existing server to a template. visibility is one of private or shared. >>> d = clc.v2.Datacenter() >>> clc.v2.Server(alias='BTDI',id='WA1BTDIAPI207').ConvertToTemplate("private","my template") 0 """ if visibility not in...
[ "def", "ConvertToTemplate", "(", "self", ",", "visibility", ",", "description", "=", "None", ",", "password", "=", "None", ")", ":", "if", "visibility", "not", "in", "(", "'private'", ",", "'shared'", ")", ":", "raise", "(", "clc", ".", "CLCException", "...
Converts existing server to a template. visibility is one of private or shared. >>> d = clc.v2.Datacenter() >>> clc.v2.Server(alias='BTDI',id='WA1BTDIAPI207').ConvertToTemplate("private","my template") 0
[ "Converts", "existing", "server", "to", "a", "template", "." ]
f4dba40c627cb08dd4b7d0d277e8d67578010b05
https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/server.py#L678-L697
train
Converts existing server to a template.
CenturyLinkCloud/clc-python-sdk
src/clc/APIv2/server.py
Server.Change
def Change(self,cpu=None,memory=None,description=None,group_id=None): """Change existing server object. One more more fields can be set and method will return with a requests object for all queued activities. This is a convenience function - all each of these changes requires a seperate API call. Some API ca...
python
def Change(self,cpu=None,memory=None,description=None,group_id=None): """Change existing server object. One more more fields can be set and method will return with a requests object for all queued activities. This is a convenience function - all each of these changes requires a seperate API call. Some API ca...
[ "def", "Change", "(", "self", ",", "cpu", "=", "None", ",", "memory", "=", "None", ",", "description", "=", "None", ",", "group_id", "=", "None", ")", ":", "if", "group_id", ":", "groupId", "=", "group_id", "else", ":", "groupId", "=", "None", "paylo...
Change existing server object. One more more fields can be set and method will return with a requests object for all queued activities. This is a convenience function - all each of these changes requires a seperate API call. Some API calls are synchronous (e.g. changing group ID or password) while others are...
[ "Change", "existing", "server", "object", "." ]
f4dba40c627cb08dd4b7d0d277e8d67578010b05
https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/server.py#L701-L727
train
Change existing server object.
CenturyLinkCloud/clc-python-sdk
src/clc/APIv2/server.py
Server.SetPassword
def SetPassword(self,password): """Request change of password. The API request requires supplying the current password. For this we issue a call to retrieve the credentials so note there will be an activity log for retrieving the credentials associated with any SetPassword entry >>> s.SetPassword("newpassw...
python
def SetPassword(self,password): """Request change of password. The API request requires supplying the current password. For this we issue a call to retrieve the credentials so note there will be an activity log for retrieving the credentials associated with any SetPassword entry >>> s.SetPassword("newpassw...
[ "def", "SetPassword", "(", "self", ",", "password", ")", ":", "# 0: {op: \"set\", member: \"password\", value: {current: \" r`5Mun/vT:qZ]2?z\", password: \"Savvis123!\"}}", "if", "self", ".", "data", "[", "'status'", "]", "!=", "\"active\"", ":", "raise", "(", "clc", ".",...
Request change of password. The API request requires supplying the current password. For this we issue a call to retrieve the credentials so note there will be an activity log for retrieving the credentials associated with any SetPassword entry >>> s.SetPassword("newpassword")
[ "Request", "change", "of", "password", "." ]
f4dba40c627cb08dd4b7d0d277e8d67578010b05
https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/server.py#L736-L754
train
Change the password of the server.
CenturyLinkCloud/clc-python-sdk
src/clc/APIv2/server.py
Server.Delete
def Delete(self): """Delete server. https://t3n.zendesk.com/entries/59220824-Delete-Server >>> clc.v2.Server("WA1BTDIAPI219").Delete().WaitUntilComplete() 0 """ return(clc.v2.Requests(clc.v2.API.Call('DELETE','servers/%s/%s' % (self.alias,self.id),session=self.session),alias=self.alias,session=self.sessi...
python
def Delete(self): """Delete server. https://t3n.zendesk.com/entries/59220824-Delete-Server >>> clc.v2.Server("WA1BTDIAPI219").Delete().WaitUntilComplete() 0 """ return(clc.v2.Requests(clc.v2.API.Call('DELETE','servers/%s/%s' % (self.alias,self.id),session=self.session),alias=self.alias,session=self.sessi...
[ "def", "Delete", "(", "self", ")", ":", "return", "(", "clc", ".", "v2", ".", "Requests", "(", "clc", ".", "v2", ".", "API", ".", "Call", "(", "'DELETE'", ",", "'servers/%s/%s'", "%", "(", "self", ".", "alias", ",", "self", ".", "id", ")", ",", ...
Delete server. https://t3n.zendesk.com/entries/59220824-Delete-Server >>> clc.v2.Server("WA1BTDIAPI219").Delete().WaitUntilComplete() 0
[ "Delete", "server", "." ]
f4dba40c627cb08dd4b7d0d277e8d67578010b05
https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/server.py#L757-L766
train
Delete server.
CenturyLinkCloud/clc-python-sdk
src/clc/APIv2/public_ip.py
PublicIPs.Get
def Get(self,key): """Get public_ip by providing either the public or the internal IP address.""" for public_ip in self.public_ips: if public_ip.id == key: return(public_ip) elif key == public_ip.internal: return(public_ip)
python
def Get(self,key): """Get public_ip by providing either the public or the internal IP address.""" for public_ip in self.public_ips: if public_ip.id == key: return(public_ip) elif key == public_ip.internal: return(public_ip)
[ "def", "Get", "(", "self", ",", "key", ")", ":", "for", "public_ip", "in", "self", ".", "public_ips", ":", "if", "public_ip", ".", "id", "==", "key", ":", "return", "(", "public_ip", ")", "elif", "key", "==", "public_ip", ".", "internal", ":", "retur...
Get public_ip by providing either the public or the internal IP address.
[ "Get", "public_ip", "by", "providing", "either", "the", "public", "or", "the", "internal", "IP", "address", "." ]
f4dba40c627cb08dd4b7d0d277e8d67578010b05
https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/public_ip.py#L54-L59
train
Get public_ip by providing either the public or internal IP address.
CenturyLinkCloud/clc-python-sdk
src/clc/APIv2/public_ip.py
PublicIPs.Add
def Add(self,ports,source_restrictions=None,private_ip=None): """Add new public_ip. Specify one or more ports using a list of dicts with the following keys: protocol - TCP, UDP, or ICMP port - int 0-65534 port_to - (optional) if specifying a range of ports then the rqange end. int 0-65534 Optionally ...
python
def Add(self,ports,source_restrictions=None,private_ip=None): """Add new public_ip. Specify one or more ports using a list of dicts with the following keys: protocol - TCP, UDP, or ICMP port - int 0-65534 port_to - (optional) if specifying a range of ports then the rqange end. int 0-65534 Optionally ...
[ "def", "Add", "(", "self", ",", "ports", ",", "source_restrictions", "=", "None", ",", "private_ip", "=", "None", ")", ":", "payload", "=", "{", "'ports'", ":", "[", "]", "}", "for", "port", "in", "ports", ":", "if", "'port_to'", "in", "port", ":", ...
Add new public_ip. Specify one or more ports using a list of dicts with the following keys: protocol - TCP, UDP, or ICMP port - int 0-65534 port_to - (optional) if specifying a range of ports then the rqange end. int 0-65534 Optionally specify one or more source restrictions using a list of dicts with ...
[ "Add", "new", "public_ip", "." ]
f4dba40c627cb08dd4b7d0d277e8d67578010b05
https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/public_ip.py#L62-L109
train
Add new public_ip.
CenturyLinkCloud/clc-python-sdk
src/clc/APIv2/public_ip.py
PublicIP._Load
def _Load(self,cached=True): """Performs a full load of all PublicIP metadata.""" if not self.data or not cached: self.data = clc.v2.API.Call('GET','servers/%s/%s/publicIPAddresses/%s' % (self.parent.server.alias,self.parent.server.id,self.id), session=self.session) # build ports self.data['_po...
python
def _Load(self,cached=True): """Performs a full load of all PublicIP metadata.""" if not self.data or not cached: self.data = clc.v2.API.Call('GET','servers/%s/%s/publicIPAddresses/%s' % (self.parent.server.alias,self.parent.server.id,self.id), session=self.session) # build ports self.data['_po...
[ "def", "_Load", "(", "self", ",", "cached", "=", "True", ")", ":", "if", "not", "self", ".", "data", "or", "not", "cached", ":", "self", ".", "data", "=", "clc", ".", "v2", ".", "API", ".", "Call", "(", "'GET'", ",", "'servers/%s/%s/publicIPAddresses...
Performs a full load of all PublicIP metadata.
[ "Performs", "a", "full", "load", "of", "all", "PublicIP", "metadata", "." ]
f4dba40c627cb08dd4b7d0d277e8d67578010b05
https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/public_ip.py#L125-L145
train
Performs a full load of all PublicIP metadata.
CenturyLinkCloud/clc-python-sdk
src/clc/APIv2/public_ip.py
PublicIP.Delete
def Delete(self): """Delete public IP. >>> clc.v2.Server("WA1BTDIX01").PublicIPs().public_ips[0].Delete().WaitUntilComplete() 0 """ public_ip_set = [{'public_ipId': o.id} for o in self.parent.public_ips if o!=self] self.parent.public_ips = [o for o in self.parent.public_ips if o!=self] return(clc.v2.Re...
python
def Delete(self): """Delete public IP. >>> clc.v2.Server("WA1BTDIX01").PublicIPs().public_ips[0].Delete().WaitUntilComplete() 0 """ public_ip_set = [{'public_ipId': o.id} for o in self.parent.public_ips if o!=self] self.parent.public_ips = [o for o in self.parent.public_ips if o!=self] return(clc.v2.Re...
[ "def", "Delete", "(", "self", ")", ":", "public_ip_set", "=", "[", "{", "'public_ipId'", ":", "o", ".", "id", "}", "for", "o", "in", "self", ".", "parent", ".", "public_ips", "if", "o", "!=", "self", "]", "self", ".", "parent", ".", "public_ips", "...
Delete public IP. >>> clc.v2.Server("WA1BTDIX01").PublicIPs().public_ips[0].Delete().WaitUntilComplete() 0
[ "Delete", "public", "IP", "." ]
f4dba40c627cb08dd4b7d0d277e8d67578010b05
https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/public_ip.py#L148-L161
train
Delete public IP.
CenturyLinkCloud/clc-python-sdk
src/clc/APIv2/public_ip.py
PublicIP.Update
def Update(self): """Commit current PublicIP definition to cloud. Usually called by the class to commit changes to port and source restriction policies. >>> clc.v2.Server("WA1BTDIX01").PublicIPs().public_ips[0].Update().WaitUntilComplete() 0 """ return(clc.v2.Requests(clc.v2.API.Call('PUT','servers/%s/...
python
def Update(self): """Commit current PublicIP definition to cloud. Usually called by the class to commit changes to port and source restriction policies. >>> clc.v2.Server("WA1BTDIX01").PublicIPs().public_ips[0].Update().WaitUntilComplete() 0 """ return(clc.v2.Requests(clc.v2.API.Call('PUT','servers/%s/...
[ "def", "Update", "(", "self", ")", ":", "return", "(", "clc", ".", "v2", ".", "Requests", "(", "clc", ".", "v2", ".", "API", ".", "Call", "(", "'PUT'", ",", "'servers/%s/%s/publicIPAddresses/%s'", "%", "(", "self", ".", "parent", ".", "server", ".", ...
Commit current PublicIP definition to cloud. Usually called by the class to commit changes to port and source restriction policies. >>> clc.v2.Server("WA1BTDIX01").PublicIPs().public_ips[0].Update().WaitUntilComplete() 0
[ "Commit", "current", "PublicIP", "definition", "to", "cloud", "." ]
f4dba40c627cb08dd4b7d0d277e8d67578010b05
https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/public_ip.py#L164-L179
train
Update the PublicIP definition to cloud.
CenturyLinkCloud/clc-python-sdk
src/clc/APIv2/public_ip.py
PublicIP.AddPort
def AddPort(self,protocol,port,port_to=None): """Add and commit a single port. # Add single port >>> clc.v2.Server("WA1BTDIX01").PublicIPs().public_ips[0].AddPort(protocol='TCP',port='22').WaitUntilComplete() 0 # Add port range >>> clc.v2.Server("WA1BTDIX01").PublicIPs().public_ips[0].AddPort(protocol='UD...
python
def AddPort(self,protocol,port,port_to=None): """Add and commit a single port. # Add single port >>> clc.v2.Server("WA1BTDIX01").PublicIPs().public_ips[0].AddPort(protocol='TCP',port='22').WaitUntilComplete() 0 # Add port range >>> clc.v2.Server("WA1BTDIX01").PublicIPs().public_ips[0].AddPort(protocol='UD...
[ "def", "AddPort", "(", "self", ",", "protocol", ",", "port", ",", "port_to", "=", "None", ")", ":", "self", ".", "ports", ".", "append", "(", "Port", "(", "self", ",", "protocol", ",", "port", ",", "port_to", ")", ")", "return", "(", "self", ".", ...
Add and commit a single port. # Add single port >>> clc.v2.Server("WA1BTDIX01").PublicIPs().public_ips[0].AddPort(protocol='TCP',port='22').WaitUntilComplete() 0 # Add port range >>> clc.v2.Server("WA1BTDIX01").PublicIPs().public_ips[0].AddPort(protocol='UDP',port='10000',port_to='15000').WaitUntilComplete(...
[ "Add", "and", "commit", "a", "single", "port", "." ]
f4dba40c627cb08dd4b7d0d277e8d67578010b05
https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/public_ip.py#L182-L197
train
Add and commit a single port.
CenturyLinkCloud/clc-python-sdk
src/clc/APIv2/public_ip.py
PublicIP.AddPorts
def AddPorts(self,ports): """Create one or more port access policies. Include a list of dicts with protocol, port, and port_to (optional - for range) keys. >>> clc.v2.Server("WA1BTDIX01").PublicIPs().public_ips[0] .AddPorts([{'protocol': 'TCP', 'port': '80' }, {'protocol': 'UDP', 'port': '100...
python
def AddPorts(self,ports): """Create one or more port access policies. Include a list of dicts with protocol, port, and port_to (optional - for range) keys. >>> clc.v2.Server("WA1BTDIX01").PublicIPs().public_ips[0] .AddPorts([{'protocol': 'TCP', 'port': '80' }, {'protocol': 'UDP', 'port': '100...
[ "def", "AddPorts", "(", "self", ",", "ports", ")", ":", "for", "port", "in", "ports", ":", "if", "'port_to'", "in", "port", ":", "self", ".", "ports", ".", "append", "(", "Port", "(", "self", ",", "port", "[", "'protocol'", "]", ",", "port", "[", ...
Create one or more port access policies. Include a list of dicts with protocol, port, and port_to (optional - for range) keys. >>> clc.v2.Server("WA1BTDIX01").PublicIPs().public_ips[0] .AddPorts([{'protocol': 'TCP', 'port': '80' }, {'protocol': 'UDP', 'port': '10000', 'port_to': '15000'}]).Wait...
[ "Create", "one", "or", "more", "port", "access", "policies", "." ]
f4dba40c627cb08dd4b7d0d277e8d67578010b05
https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/public_ip.py#L200-L216
train
Add ports to the list of ports.
CenturyLinkCloud/clc-python-sdk
src/clc/APIv2/public_ip.py
PublicIP.AddSourceRestriction
def AddSourceRestriction(self,cidr): """Add and commit a single source IP restriction policy. >>> clc.v2.Server("WA1BTDIX01").PublicIPs().public_ips[0] .AddSourceRestriction(cidr="132.200.20.1/32").WaitUntilComplete() 0 """ self.source_restrictions.append(SourceRestriction(self,cidr)) return(self.Up...
python
def AddSourceRestriction(self,cidr): """Add and commit a single source IP restriction policy. >>> clc.v2.Server("WA1BTDIX01").PublicIPs().public_ips[0] .AddSourceRestriction(cidr="132.200.20.1/32").WaitUntilComplete() 0 """ self.source_restrictions.append(SourceRestriction(self,cidr)) return(self.Up...
[ "def", "AddSourceRestriction", "(", "self", ",", "cidr", ")", ":", "self", ".", "source_restrictions", ".", "append", "(", "SourceRestriction", "(", "self", ",", "cidr", ")", ")", "return", "(", "self", ".", "Update", "(", ")", ")" ]
Add and commit a single source IP restriction policy. >>> clc.v2.Server("WA1BTDIX01").PublicIPs().public_ips[0] .AddSourceRestriction(cidr="132.200.20.1/32").WaitUntilComplete() 0
[ "Add", "and", "commit", "a", "single", "source", "IP", "restriction", "policy", "." ]
f4dba40c627cb08dd4b7d0d277e8d67578010b05
https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/public_ip.py#L219-L230
train
Add and commit a single source IP restriction policy.
CenturyLinkCloud/clc-python-sdk
src/clc/APIv2/public_ip.py
PublicIP.AddSourceRestrictions
def AddSourceRestrictions(self,cidrs): """Create one or more CIDR source restriction policies. Include a list of CIDR strings. >>> clc.v2.Server("WA1BTDIX01").PublicIPs().public_ips[0] .AddSourceRestrictions(cidrs=["132.200.20.1/32","132.200.20.100/32"]).WaitUntilComplete() 0 """ for cidr in cidrs: ...
python
def AddSourceRestrictions(self,cidrs): """Create one or more CIDR source restriction policies. Include a list of CIDR strings. >>> clc.v2.Server("WA1BTDIX01").PublicIPs().public_ips[0] .AddSourceRestrictions(cidrs=["132.200.20.1/32","132.200.20.100/32"]).WaitUntilComplete() 0 """ for cidr in cidrs: ...
[ "def", "AddSourceRestrictions", "(", "self", ",", "cidrs", ")", ":", "for", "cidr", "in", "cidrs", ":", "self", ".", "source_restrictions", ".", "append", "(", "SourceRestriction", "(", "self", ",", "cidr", ")", ")", "return", "(", "self", ".", "Update", ...
Create one or more CIDR source restriction policies. Include a list of CIDR strings. >>> clc.v2.Server("WA1BTDIX01").PublicIPs().public_ips[0] .AddSourceRestrictions(cidrs=["132.200.20.1/32","132.200.20.100/32"]).WaitUntilComplete() 0
[ "Create", "one", "or", "more", "CIDR", "source", "restriction", "policies", "." ]
f4dba40c627cb08dd4b7d0d277e8d67578010b05
https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/public_ip.py#L233-L246
train
Add one or more CIDR source restriction policies.
CenturyLinkCloud/clc-python-sdk
src/clc/APIv2/public_ip.py
Port.Delete
def Delete(self): """Delete this port and commit change to cloud. >>> clc.v2.Server("WA1BTDIX01").PublicIPs().public_ips[0].ports[0].Delete().WaitUntilComplete() 0 """ self.public_ip.ports = [o for o in self.public_ip.ports if o!=self] return(self.public_ip.Update())
python
def Delete(self): """Delete this port and commit change to cloud. >>> clc.v2.Server("WA1BTDIX01").PublicIPs().public_ips[0].ports[0].Delete().WaitUntilComplete() 0 """ self.public_ip.ports = [o for o in self.public_ip.ports if o!=self] return(self.public_ip.Update())
[ "def", "Delete", "(", "self", ")", ":", "self", ".", "public_ip", ".", "ports", "=", "[", "o", "for", "o", "in", "self", ".", "public_ip", ".", "ports", "if", "o", "!=", "self", "]", "return", "(", "self", ".", "public_ip", ".", "Update", "(", ")...
Delete this port and commit change to cloud. >>> clc.v2.Server("WA1BTDIX01").PublicIPs().public_ips[0].ports[0].Delete().WaitUntilComplete() 0
[ "Delete", "this", "port", "and", "commit", "change", "to", "cloud", "." ]
f4dba40c627cb08dd4b7d0d277e8d67578010b05
https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/public_ip.py#L274-L284
train
Delete this port and commit change to cloud.
CenturyLinkCloud/clc-python-sdk
src/clc/APIv2/public_ip.py
SourceRestriction.Delete
def Delete(self): """Delete this source restriction and commit change to cloud. >>> clc.v2.Server("WA1BTDIX01").PublicIPs().public_ips[0].source_restrictions[0].Delete().WaitUntilComplete() 0 """ self.public_ip.source_restrictions = [o for o in self.public_ip.source_restrictions if o!=self] return(self....
python
def Delete(self): """Delete this source restriction and commit change to cloud. >>> clc.v2.Server("WA1BTDIX01").PublicIPs().public_ips[0].source_restrictions[0].Delete().WaitUntilComplete() 0 """ self.public_ip.source_restrictions = [o for o in self.public_ip.source_restrictions if o!=self] return(self....
[ "def", "Delete", "(", "self", ")", ":", "self", ".", "public_ip", ".", "source_restrictions", "=", "[", "o", "for", "o", "in", "self", ".", "public_ip", ".", "source_restrictions", "if", "o", "!=", "self", "]", "return", "(", "self", ".", "public_ip", ...
Delete this source restriction and commit change to cloud. >>> clc.v2.Server("WA1BTDIX01").PublicIPs().public_ips[0].source_restrictions[0].Delete().WaitUntilComplete() 0
[ "Delete", "this", "source", "restriction", "and", "commit", "change", "to", "cloud", "." ]
f4dba40c627cb08dd4b7d0d277e8d67578010b05
https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/public_ip.py#L308-L318
train
Delete this source restriction and commit change to cloud.
kamicut/tilepie
tilepie/proj.py
GoogleProjection.tile_bbox
def tile_bbox(self, tile_indices): """ Returns the WGS84 bbox of the specified tile """ (z, x, y) = tile_indices topleft = (x * self.tilesize, (y + 1) * self.tilesize) bottomright = ((x + 1) * self.tilesize, y * self.tilesize) nw = self.unproject_pixels(topleft, z...
python
def tile_bbox(self, tile_indices): """ Returns the WGS84 bbox of the specified tile """ (z, x, y) = tile_indices topleft = (x * self.tilesize, (y + 1) * self.tilesize) bottomright = ((x + 1) * self.tilesize, y * self.tilesize) nw = self.unproject_pixels(topleft, z...
[ "def", "tile_bbox", "(", "self", ",", "tile_indices", ")", ":", "(", "z", ",", "x", ",", "y", ")", "=", "tile_indices", "topleft", "=", "(", "x", "*", "self", ".", "tilesize", ",", "(", "y", "+", "1", ")", "*", "self", ".", "tilesize", ")", "bo...
Returns the WGS84 bbox of the specified tile
[ "Returns", "the", "WGS84", "bbox", "of", "the", "specified", "tile" ]
103ae2be1c3c4e6f7ec4a3bdd265ffcddee92b96
https://github.com/kamicut/tilepie/blob/103ae2be1c3c4e6f7ec4a3bdd265ffcddee92b96/tilepie/proj.py#L73-L82
train
Returns the WGS84 bbox of the specified tile_indices
kamicut/tilepie
tilepie/proj.py
GoogleProjection.unproject
def unproject(self, xy): """ Returns the coordinates from position in meters """ (x, y) = xy lng = x/EARTH_RADIUS * RAD_TO_DEG lat = 2 * atan(exp(y/EARTH_RADIUS)) - pi/2 * RAD_TO_DEG return (lng, lat)
python
def unproject(self, xy): """ Returns the coordinates from position in meters """ (x, y) = xy lng = x/EARTH_RADIUS * RAD_TO_DEG lat = 2 * atan(exp(y/EARTH_RADIUS)) - pi/2 * RAD_TO_DEG return (lng, lat)
[ "def", "unproject", "(", "self", ",", "xy", ")", ":", "(", "x", ",", "y", ")", "=", "xy", "lng", "=", "x", "/", "EARTH_RADIUS", "*", "RAD_TO_DEG", "lat", "=", "2", "*", "atan", "(", "exp", "(", "y", "/", "EARTH_RADIUS", ")", ")", "-", "pi", "...
Returns the coordinates from position in meters
[ "Returns", "the", "coordinates", "from", "position", "in", "meters" ]
103ae2be1c3c4e6f7ec4a3bdd265ffcddee92b96
https://github.com/kamicut/tilepie/blob/103ae2be1c3c4e6f7ec4a3bdd265ffcddee92b96/tilepie/proj.py#L95-L102
train
Returns the coordinates from position in meters
nuclio/nuclio-sdk-py
nuclio_sdk/response.py
Response.from_entrypoint_output
def from_entrypoint_output(json_encoder, handler_output): """Given a handler output's type, generates a response towards the processor""" response = { 'body': '', 'content_type': 'text/plain', 'headers': {}, 'status_code': 200, 'body_e...
python
def from_entrypoint_output(json_encoder, handler_output): """Given a handler output's type, generates a response towards the processor""" response = { 'body': '', 'content_type': 'text/plain', 'headers': {}, 'status_code': 200, 'body_e...
[ "def", "from_entrypoint_output", "(", "json_encoder", ",", "handler_output", ")", ":", "response", "=", "{", "'body'", ":", "''", ",", "'content_type'", ":", "'text/plain'", ",", "'headers'", ":", "{", "}", ",", "'status_code'", ":", "200", ",", "'body_encodin...
Given a handler output's type, generates a response towards the processor
[ "Given", "a", "handler", "output", "s", "type", "generates", "a", "response", "towards", "the", "processor" ]
5af9ffc19a0d96255ff430bc358be9cd7a57f424
https://github.com/nuclio/nuclio-sdk-py/blob/5af9ffc19a0d96255ff430bc358be9cd7a57f424/nuclio_sdk/response.py#L34-L83
train
Takes a handler output s type generates a response towards the entrypoint processor
mjirik/imtools
imtools/sample_data.py
check_python_architecture
def check_python_architecture(pythondir, target_arch_str): """ functions check architecture of target python """ pyth_str = subprocess.check_output( [pythondir + 'python', '-c', 'import platform; print platform.architecture()[0]']) if pyth_str[:2] != target_arch_str: raise E...
python
def check_python_architecture(pythondir, target_arch_str): """ functions check architecture of target python """ pyth_str = subprocess.check_output( [pythondir + 'python', '-c', 'import platform; print platform.architecture()[0]']) if pyth_str[:2] != target_arch_str: raise E...
[ "def", "check_python_architecture", "(", "pythondir", ",", "target_arch_str", ")", ":", "pyth_str", "=", "subprocess", ".", "check_output", "(", "[", "pythondir", "+", "'python'", ",", "'-c'", ",", "'import platform; print platform.architecture()[0]'", "]", ")", "if",...
functions check architecture of target python
[ "functions", "check", "architecture", "of", "target", "python" ]
eb29fa59df0e0684d8334eb3bc5ef36ea46d1d3a
https://github.com/mjirik/imtools/blob/eb29fa59df0e0684d8334eb3bc5ef36ea46d1d3a/imtools/sample_data.py#L42-L52
train
check architecture of target python
mjirik/imtools
imtools/sample_data.py
downzip
def downzip(url, destination='./sample_data/'): """ Download, unzip and delete. """ # url = "http://147.228.240.61/queetech/sample-data/jatra_06mm_jenjatra.zip" logmsg = "downloading from '" + url + "'" print(logmsg) logger.debug(logmsg) local_file_name = os.path.join(destination, 'tmp....
python
def downzip(url, destination='./sample_data/'): """ Download, unzip and delete. """ # url = "http://147.228.240.61/queetech/sample-data/jatra_06mm_jenjatra.zip" logmsg = "downloading from '" + url + "'" print(logmsg) logger.debug(logmsg) local_file_name = os.path.join(destination, 'tmp....
[ "def", "downzip", "(", "url", ",", "destination", "=", "'./sample_data/'", ")", ":", "# url = \"http://147.228.240.61/queetech/sample-data/jatra_06mm_jenjatra.zip\"", "logmsg", "=", "\"downloading from '\"", "+", "url", "+", "\"'\"", "print", "(", "logmsg", ")", "logger",...
Download, unzip and delete.
[ "Download", "unzip", "and", "delete", "." ]
eb29fa59df0e0684d8334eb3bc5ef36ea46d1d3a
https://github.com/mjirik/imtools/blob/eb29fa59df0e0684d8334eb3bc5ef36ea46d1d3a/imtools/sample_data.py#L64-L77
train
Download unzip and delete.
mjirik/imtools
imtools/sample_data.py
get
def get(data_label=None, destination_dir="."): """ Download sample data by data label. Labels can be listed by sample_data.data_urls.keys() :param data_label: label of data. If it is set to None, all data are downloaded :param destination_dir: output dir for data :return: """ try: os...
python
def get(data_label=None, destination_dir="."): """ Download sample data by data label. Labels can be listed by sample_data.data_urls.keys() :param data_label: label of data. If it is set to None, all data are downloaded :param destination_dir: output dir for data :return: """ try: os...
[ "def", "get", "(", "data_label", "=", "None", ",", "destination_dir", "=", "\".\"", ")", ":", "try", ":", "os", ".", "mkdir", "(", "destination_dir", ")", "except", ":", "pass", "if", "data_label", "is", "None", ":", "data_label", "=", "data_urls", ".", ...
Download sample data by data label. Labels can be listed by sample_data.data_urls.keys() :param data_label: label of data. If it is set to None, all data are downloaded :param destination_dir: output dir for data :return:
[ "Download", "sample", "data", "by", "data", "label", ".", "Labels", "can", "be", "listed", "by", "sample_data", ".", "data_urls", ".", "keys", "()", ":", "param", "data_label", ":", "label", "of", "data", ".", "If", "it", "is", "set", "to", "None", "al...
eb29fa59df0e0684d8334eb3bc5ef36ea46d1d3a
https://github.com/mjirik/imtools/blob/eb29fa59df0e0684d8334eb3bc5ef36ea46d1d3a/imtools/sample_data.py#L112-L163
train
Download sample data by label.
mjirik/imtools
imtools/sample_data.py
checksum
def checksum(path, hashfunc='md5'): """ Return checksum given by path. Wildcards can be used in check sum. Function is strongly dependent on checksumdir package by 'cakepietoast'. :param path: :param hashfunc: :return: """ import checksumdir hash_func = checksumdir.HASH_FUNCS.get(ha...
python
def checksum(path, hashfunc='md5'): """ Return checksum given by path. Wildcards can be used in check sum. Function is strongly dependent on checksumdir package by 'cakepietoast'. :param path: :param hashfunc: :return: """ import checksumdir hash_func = checksumdir.HASH_FUNCS.get(ha...
[ "def", "checksum", "(", "path", ",", "hashfunc", "=", "'md5'", ")", ":", "import", "checksumdir", "hash_func", "=", "checksumdir", ".", "HASH_FUNCS", ".", "get", "(", "hashfunc", ")", "if", "not", "hash_func", ":", "raise", "NotImplementedError", "(", "'{} n...
Return checksum given by path. Wildcards can be used in check sum. Function is strongly dependent on checksumdir package by 'cakepietoast'. :param path: :param hashfunc: :return:
[ "Return", "checksum", "given", "by", "path", ".", "Wildcards", "can", "be", "used", "in", "check", "sum", ".", "Function", "is", "strongly", "dependent", "on", "checksumdir", "package", "by", "cakepietoast", "." ]
eb29fa59df0e0684d8334eb3bc5ef36ea46d1d3a
https://github.com/mjirik/imtools/blob/eb29fa59df0e0684d8334eb3bc5ef36ea46d1d3a/imtools/sample_data.py#L166-L191
train
Return checksum given by path. Wildcards can be used in check sum.
mjirik/imtools
imtools/sample_data.py
donut
def donut(): """ Generate donut like shape with stick inside :return: datap with keys data3d, segmentation and voxelsize_mm """ import numpy as np segmentation = np.zeros([20, 30, 40]) # generate test data segmentation[6:10, 7:24, 10:37] = 1 segmentation[6:10, 7, 10] = 0 segment...
python
def donut(): """ Generate donut like shape with stick inside :return: datap with keys data3d, segmentation and voxelsize_mm """ import numpy as np segmentation = np.zeros([20, 30, 40]) # generate test data segmentation[6:10, 7:24, 10:37] = 1 segmentation[6:10, 7, 10] = 0 segment...
[ "def", "donut", "(", ")", ":", "import", "numpy", "as", "np", "segmentation", "=", "np", ".", "zeros", "(", "[", "20", ",", "30", ",", "40", "]", ")", "# generate test data", "segmentation", "[", "6", ":", "10", ",", "7", ":", "24", ",", "10", ":...
Generate donut like shape with stick inside :return: datap with keys data3d, segmentation and voxelsize_mm
[ "Generate", "donut", "like", "shape", "with", "stick", "inside" ]
eb29fa59df0e0684d8334eb3bc5ef36ea46d1d3a
https://github.com/mjirik/imtools/blob/eb29fa59df0e0684d8334eb3bc5ef36ea46d1d3a/imtools/sample_data.py#L194-L220
train
Generate donut like shape with stick inside
mjirik/imtools
imtools/sample_data.py
get_conda_path
def get_conda_path(): """ Return anaconda or miniconda directory :return: anaconda directory """ dstdir = '' # try: import subprocess import re # cond info --root work only for root environment # p = subprocess.Popen(['conda', 'info', '--root'], stdout=subprocess.PIPE, stderr=s...
python
def get_conda_path(): """ Return anaconda or miniconda directory :return: anaconda directory """ dstdir = '' # try: import subprocess import re # cond info --root work only for root environment # p = subprocess.Popen(['conda', 'info', '--root'], stdout=subprocess.PIPE, stderr=s...
[ "def", "get_conda_path", "(", ")", ":", "dstdir", "=", "''", "# try:", "import", "subprocess", "import", "re", "# cond info --root work only for root environment", "# p = subprocess.Popen(['conda', 'info', '--root'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)", "p", "=", "sub...
Return anaconda or miniconda directory :return: anaconda directory
[ "Return", "anaconda", "or", "miniconda", "directory", ":", "return", ":", "anaconda", "directory" ]
eb29fa59df0e0684d8334eb3bc5ef36ea46d1d3a
https://github.com/mjirik/imtools/blob/eb29fa59df0e0684d8334eb3bc5ef36ea46d1d3a/imtools/sample_data.py#L227-L253
train
Return anaconda or miniconda directory
CenturyLinkCloud/clc-python-sdk
src/clc/APIv2/disk.py
Disks.Get
def Get(self,key): """Get disk by providing mount point or ID If key is not unique and finds multiple matches only the first will be returned """ for disk in self.disks: if disk.id == key: return(disk) elif key in disk.partition_paths: return(disk)
python
def Get(self,key): """Get disk by providing mount point or ID If key is not unique and finds multiple matches only the first will be returned """ for disk in self.disks: if disk.id == key: return(disk) elif key in disk.partition_paths: return(disk)
[ "def", "Get", "(", "self", ",", "key", ")", ":", "for", "disk", "in", "self", ".", "disks", ":", "if", "disk", ".", "id", "==", "key", ":", "return", "(", "disk", ")", "elif", "key", "in", "disk", ".", "partition_paths", ":", "return", "(", "disk...
Get disk by providing mount point or ID If key is not unique and finds multiple matches only the first will be returned
[ "Get", "disk", "by", "providing", "mount", "point", "or", "ID" ]
f4dba40c627cb08dd4b7d0d277e8d67578010b05
https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/disk.py#L31-L40
train
Get a disk by providing mount point or partition path.
CenturyLinkCloud/clc-python-sdk
src/clc/APIv2/disk.py
Disks.Search
def Search(self,key): """Search disk list by partial mount point or ID """ results = [] for disk in self.disks: if disk.id.lower().find(key.lower()) != -1: results.append(disk) # TODO - search in list to match partial mount points elif key.lower() in disk.partition_paths: results.append(disk) re...
python
def Search(self,key): """Search disk list by partial mount point or ID """ results = [] for disk in self.disks: if disk.id.lower().find(key.lower()) != -1: results.append(disk) # TODO - search in list to match partial mount points elif key.lower() in disk.partition_paths: results.append(disk) re...
[ "def", "Search", "(", "self", ",", "key", ")", ":", "results", "=", "[", "]", "for", "disk", "in", "self", ".", "disks", ":", "if", "disk", ".", "id", ".", "lower", "(", ")", ".", "find", "(", "key", ".", "lower", "(", ")", ")", "!=", "-", ...
Search disk list by partial mount point or ID
[ "Search", "disk", "list", "by", "partial", "mount", "point", "or", "ID" ]
f4dba40c627cb08dd4b7d0d277e8d67578010b05
https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/disk.py#L43-L54
train
Search disk list by partial mount point or ID
CenturyLinkCloud/clc-python-sdk
src/clc/APIv2/disk.py
Disks.Add
def Add(self,size,path=None,type="partitioned"): """Add new disk. This request will error if disk is protected and cannot be removed (e.g. a system disk) # Partitioned disk >>> clc.v2.Server("WA1BTDIX01").Disks().Add(size=20,path=None,type="raw").WaitUntilComplete() 0 # Raw disk >>> clc.v2.Server("WA1B...
python
def Add(self,size,path=None,type="partitioned"): """Add new disk. This request will error if disk is protected and cannot be removed (e.g. a system disk) # Partitioned disk >>> clc.v2.Server("WA1BTDIX01").Disks().Add(size=20,path=None,type="raw").WaitUntilComplete() 0 # Raw disk >>> clc.v2.Server("WA1B...
[ "def", "Add", "(", "self", ",", "size", ",", "path", "=", "None", ",", "type", "=", "\"partitioned\"", ")", ":", "if", "type", "==", "\"partitioned\"", "and", "not", "path", ":", "raise", "(", "clc", ".", "CLCException", "(", "\"Must specify path to mount ...
Add new disk. This request will error if disk is protected and cannot be removed (e.g. a system disk) # Partitioned disk >>> clc.v2.Server("WA1BTDIX01").Disks().Add(size=20,path=None,type="raw").WaitUntilComplete() 0 # Raw disk >>> clc.v2.Server("WA1BTDIX01").Disks().Add(size=20,path=None,type="raw").Wai...
[ "Add", "new", "disk", "." ]
f4dba40c627cb08dd4b7d0d277e8d67578010b05
https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/disk.py#L57-L86
train
Add new disk to server.
CenturyLinkCloud/clc-python-sdk
src/clc/APIv2/disk.py
Disk.Grow
def Grow(self,size): """Grow disk to the newly specified size. Size must be less than 1024 and must be greater than the current size. >>> clc.v2.Server("WA1BTDIX01").Disks().disks[2].Grow(30).WaitUntilComplete() 0 """ if size>1024: raise(clc.CLCException("Cannot grow disk beyond 1024GB")) if size<=se...
python
def Grow(self,size): """Grow disk to the newly specified size. Size must be less than 1024 and must be greater than the current size. >>> clc.v2.Server("WA1BTDIX01").Disks().disks[2].Grow(30).WaitUntilComplete() 0 """ if size>1024: raise(clc.CLCException("Cannot grow disk beyond 1024GB")) if size<=se...
[ "def", "Grow", "(", "self", ",", "size", ")", ":", "if", "size", ">", "1024", ":", "raise", "(", "clc", ".", "CLCException", "(", "\"Cannot grow disk beyond 1024GB\"", ")", ")", "if", "size", "<=", "self", ".", "size", ":", "raise", "(", "clc", ".", ...
Grow disk to the newly specified size. Size must be less than 1024 and must be greater than the current size. >>> clc.v2.Server("WA1BTDIX01").Disks().disks[2].Grow(30).WaitUntilComplete() 0
[ "Grow", "disk", "to", "the", "newly", "specified", "size", "." ]
f4dba40c627cb08dd4b7d0d277e8d67578010b05
https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/disk.py#L102-L125
train
Grow disk to the newly specified size.
CenturyLinkCloud/clc-python-sdk
src/clc/APIv2/disk.py
Disk.Delete
def Delete(self): """Delete disk. This request will error if disk is protected and cannot be removed (e.g. a system disk) >>> clc.v2.Server("WA1BTDIX01").Disks().disks[2].Delete().WaitUntilComplete() 0 """ disk_set = [{'diskId': o.id, 'sizeGB': o.size} for o in self.parent.disks if o!=self] self.paren...
python
def Delete(self): """Delete disk. This request will error if disk is protected and cannot be removed (e.g. a system disk) >>> clc.v2.Server("WA1BTDIX01").Disks().disks[2].Delete().WaitUntilComplete() 0 """ disk_set = [{'diskId': o.id, 'sizeGB': o.size} for o in self.parent.disks if o!=self] self.paren...
[ "def", "Delete", "(", "self", ")", ":", "disk_set", "=", "[", "{", "'diskId'", ":", "o", ".", "id", ",", "'sizeGB'", ":", "o", ".", "size", "}", "for", "o", "in", "self", ".", "parent", ".", "disks", "if", "o", "!=", "self", "]", "self", ".", ...
Delete disk. This request will error if disk is protected and cannot be removed (e.g. a system disk) >>> clc.v2.Server("WA1BTDIX01").Disks().disks[2].Delete().WaitUntilComplete() 0
[ "Delete", "disk", "." ]
f4dba40c627cb08dd4b7d0d277e8d67578010b05
https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/disk.py#L128-L145
train
Delete disk.
sio2project/filetracker
filetracker/utils.py
split_name
def split_name(name): """Splits a (possibly versioned) name into unversioned name and version. Returns a tuple ``(unversioned_name, version)``, where ``version`` may be ``None``. """ s = name.rsplit('@', 1) if len(s) == 1: return s[0], None else: try: retur...
python
def split_name(name): """Splits a (possibly versioned) name into unversioned name and version. Returns a tuple ``(unversioned_name, version)``, where ``version`` may be ``None``. """ s = name.rsplit('@', 1) if len(s) == 1: return s[0], None else: try: retur...
[ "def", "split_name", "(", "name", ")", ":", "s", "=", "name", ".", "rsplit", "(", "'@'", ",", "1", ")", "if", "len", "(", "s", ")", "==", "1", ":", "return", "s", "[", "0", "]", ",", "None", "else", ":", "try", ":", "return", "s", "[", "0",...
Splits a (possibly versioned) name into unversioned name and version. Returns a tuple ``(unversioned_name, version)``, where ``version`` may be ``None``.
[ "Splits", "a", "(", "possibly", "versioned", ")", "name", "into", "unversioned", "name", "and", "version", "." ]
359b474850622e3d0c25ee2596d7242c02f84efb
https://github.com/sio2project/filetracker/blob/359b474850622e3d0c25ee2596d7242c02f84efb/filetracker/utils.py#L12-L26
train
Splits a name into unversioned name and version.
sio2project/filetracker
filetracker/utils.py
file_digest
def file_digest(source): """Calculates SHA256 digest of a file. Args: source: either a file-like object or a path to file """ hash_sha256 = hashlib.sha256() should_close = False if isinstance(source, six.string_types): should_close = True source = open(source, 'rb') ...
python
def file_digest(source): """Calculates SHA256 digest of a file. Args: source: either a file-like object or a path to file """ hash_sha256 = hashlib.sha256() should_close = False if isinstance(source, six.string_types): should_close = True source = open(source, 'rb') ...
[ "def", "file_digest", "(", "source", ")", ":", "hash_sha256", "=", "hashlib", ".", "sha256", "(", ")", "should_close", "=", "False", "if", "isinstance", "(", "source", ",", "six", ".", "string_types", ")", ":", "should_close", "=", "True", "source", "=", ...
Calculates SHA256 digest of a file. Args: source: either a file-like object or a path to file
[ "Calculates", "SHA256", "digest", "of", "a", "file", "." ]
359b474850622e3d0c25ee2596d7242c02f84efb
https://github.com/sio2project/filetracker/blob/359b474850622e3d0c25ee2596d7242c02f84efb/filetracker/utils.py#L68-L88
train
Calculates SHA256 digest of a file.
Unbabel/unbabel-py
unbabel/xliff_converter.py
generate_xliff
def generate_xliff(entry_dict): """ Given a dictionary with keys = ids and values equals to strings generates and xliff file to send to unbabel. Example: {"123": "This is blue car", "234": "This house is yellow" } returns <xliff version = "1.2"> <file original = "...
python
def generate_xliff(entry_dict): """ Given a dictionary with keys = ids and values equals to strings generates and xliff file to send to unbabel. Example: {"123": "This is blue car", "234": "This house is yellow" } returns <xliff version = "1.2"> <file original = "...
[ "def", "generate_xliff", "(", "entry_dict", ")", ":", "entries", "=", "\"\"", "for", "key", ",", "value", "in", "entry_dict", ".", "iteritems", "(", ")", ":", "entries", "+=", "create_trans_unit", "(", "key", ",", "value", ")", ".", "strip", "(", ")", ...
Given a dictionary with keys = ids and values equals to strings generates and xliff file to send to unbabel. Example: {"123": "This is blue car", "234": "This house is yellow" } returns <xliff version = "1.2"> <file original = "" source-language = "en" target-language = "...
[ "Given", "a", "dictionary", "with", "keys", "=", "ids", "and", "values", "equals", "to", "strings", "generates", "and", "xliff", "file", "to", "send", "to", "unbabel", "." ]
3bd6397174e184d89d2a11149d87be5d12570c64
https://github.com/Unbabel/unbabel-py/blob/3bd6397174e184d89d2a11149d87be5d12570c64/unbabel/xliff_converter.py#L5-L34
train
Generates a xliff file from a dictionary containing keys = ids and values = strings
admiralobvious/justbackoff
justbackoff/__init__.py
Backoff.duration
def duration(self): """ Returns the current value of the counter and then multiplies it by :attr:`factor` :rtype: float """ d = self.for_attempt(self.cur_attempt) self.cur_attempt += 1 return d
python
def duration(self): """ Returns the current value of the counter and then multiplies it by :attr:`factor` :rtype: float """ d = self.for_attempt(self.cur_attempt) self.cur_attempt += 1 return d
[ "def", "duration", "(", "self", ")", ":", "d", "=", "self", ".", "for_attempt", "(", "self", ".", "cur_attempt", ")", "self", ".", "cur_attempt", "+=", "1", "return", "d" ]
Returns the current value of the counter and then multiplies it by :attr:`factor` :rtype: float
[ "Returns", "the", "current", "value", "of", "the", "counter", "and", "then", "multiplies", "it", "by", ":", "attr", ":", "factor" ]
4fe69cdded4e1d506bf16464a5acf72bca6ebd28
https://github.com/admiralobvious/justbackoff/blob/4fe69cdded4e1d506bf16464a5acf72bca6ebd28/justbackoff/__init__.py#L59-L68
train
Returns the current value of the counter and then multiplies it by the current value of the counter by the current value of the counter and then increments the counter by factor.
admiralobvious/justbackoff
justbackoff/__init__.py
Backoff.for_attempt
def for_attempt(self, attempt): """ :meth:`for_attempt` returns the duration for a specific attempt. This is useful if you have a large number of independent backoffs, but don't want to use unnecessary memory storing the backoff parameters per backoff. The first attempt should be...
python
def for_attempt(self, attempt): """ :meth:`for_attempt` returns the duration for a specific attempt. This is useful if you have a large number of independent backoffs, but don't want to use unnecessary memory storing the backoff parameters per backoff. The first attempt should be...
[ "def", "for_attempt", "(", "self", ",", "attempt", ")", ":", "dur", "=", "float", "(", "self", ".", "min_ms", "*", "pow", "(", "self", ".", "factor", ",", "attempt", ")", ")", "if", "self", ".", "jitter", ":", "dur", "=", "random", ".", "random", ...
:meth:`for_attempt` returns the duration for a specific attempt. This is useful if you have a large number of independent backoffs, but don't want to use unnecessary memory storing the backoff parameters per backoff. The first attempt should be 0. :meth:`for_attempt` is thread-safe if no...
[ ":", "meth", ":", "for_attempt", "returns", "the", "duration", "for", "a", "specific", "attempt", ".", "This", "is", "useful", "if", "you", "have", "a", "large", "number", "of", "independent", "backoffs", "but", "don", "t", "want", "to", "use", "unnecessar...
4fe69cdded4e1d506bf16464a5acf72bca6ebd28
https://github.com/admiralobvious/justbackoff/blob/4fe69cdded4e1d506bf16464a5acf72bca6ebd28/justbackoff/__init__.py#L70-L93
train
This method returns the duration in seconds for a specific attempt.
CenturyLinkCloud/clc-python-sdk
src/clc/APIv2/alert.py
Alerts.Get
def Get(self,key): """Get alert by providing name, ID, or other unique key. If key is not unique and finds multiple matches only the first will be returned """ for alert in self.alerts: if alert.id == key: return(alert) elif alert.name == key: return(alert)
python
def Get(self,key): """Get alert by providing name, ID, or other unique key. If key is not unique and finds multiple matches only the first will be returned """ for alert in self.alerts: if alert.id == key: return(alert) elif alert.name == key: return(alert)
[ "def", "Get", "(", "self", ",", "key", ")", ":", "for", "alert", "in", "self", ".", "alerts", ":", "if", "alert", ".", "id", "==", "key", ":", "return", "(", "alert", ")", "elif", "alert", ".", "name", "==", "key", ":", "return", "(", "alert", ...
Get alert by providing name, ID, or other unique key. If key is not unique and finds multiple matches only the first will be returned
[ "Get", "alert", "by", "providing", "name", "ID", "or", "other", "unique", "key", "." ]
f4dba40c627cb08dd4b7d0d277e8d67578010b05
https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/alert.py#L30-L39
train
Get alert by providing name ID or other unique key.
CenturyLinkCloud/clc-python-sdk
src/clc/APIv2/alert.py
Alerts.Search
def Search(self,key): """Search alert list by providing partial name, ID, or other key. """ results = [] for alert in self.alerts: if alert.id.lower().find(key.lower()) != -1: results.append(alert) elif alert.name.lower().find(key.lower()) != -1: results.append(alert) return(results)
python
def Search(self,key): """Search alert list by providing partial name, ID, or other key. """ results = [] for alert in self.alerts: if alert.id.lower().find(key.lower()) != -1: results.append(alert) elif alert.name.lower().find(key.lower()) != -1: results.append(alert) return(results)
[ "def", "Search", "(", "self", ",", "key", ")", ":", "results", "=", "[", "]", "for", "alert", "in", "self", ".", "alerts", ":", "if", "alert", ".", "id", ".", "lower", "(", ")", ".", "find", "(", "key", ".", "lower", "(", ")", ")", "!=", "-",...
Search alert list by providing partial name, ID, or other key.
[ "Search", "alert", "list", "by", "providing", "partial", "name", "ID", "or", "other", "key", "." ]
f4dba40c627cb08dd4b7d0d277e8d67578010b05
https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/alert.py#L42-L52
train
Search alert list by providing partial name ID or other key.
CenturyLinkCloud/clc-python-sdk
src/clc/APIv2/api.py
API._Login
def _Login(): """Login to retrieve bearer token and set default accoutn and location aliases.""" if not clc.v2.V2_API_USERNAME or not clc.v2.V2_API_PASSWD: clc.v1.output.Status('ERROR',3,'V2 API username and password not provided') raise(clc.APIV2NotEnabled) session = clc._REQUESTS_SESSION session.header...
python
def _Login(): """Login to retrieve bearer token and set default accoutn and location aliases.""" if not clc.v2.V2_API_USERNAME or not clc.v2.V2_API_PASSWD: clc.v1.output.Status('ERROR',3,'V2 API username and password not provided') raise(clc.APIV2NotEnabled) session = clc._REQUESTS_SESSION session.header...
[ "def", "_Login", "(", ")", ":", "if", "not", "clc", ".", "v2", ".", "V2_API_USERNAME", "or", "not", "clc", ".", "v2", ".", "V2_API_PASSWD", ":", "clc", ".", "v1", ".", "output", ".", "Status", "(", "'ERROR'", ",", "3", ",", "'V2 API username and passwo...
Login to retrieve bearer token and set default accoutn and location aliases.
[ "Login", "to", "retrieve", "bearer", "token", "and", "set", "default", "accoutn", "and", "location", "aliases", "." ]
f4dba40c627cb08dd4b7d0d277e8d67578010b05
https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/api.py#L62-L83
train
Login to retrieve bearer token and set default accoutn and location aliases.
CenturyLinkCloud/clc-python-sdk
src/clc/APIv2/api.py
API.Call
def Call(method,url,payload=None,session=None,debug=False): """Execute v2 API call. :param url: URL paths associated with the API call :param payload: dict containing all parameters to submit with POST call :returns: decoded API json result """ if session is not None: token = session['token'] http_s...
python
def Call(method,url,payload=None,session=None,debug=False): """Execute v2 API call. :param url: URL paths associated with the API call :param payload: dict containing all parameters to submit with POST call :returns: decoded API json result """ if session is not None: token = session['token'] http_s...
[ "def", "Call", "(", "method", ",", "url", ",", "payload", "=", "None", ",", "session", "=", "None", ",", "debug", "=", "False", ")", ":", "if", "session", "is", "not", "None", ":", "token", "=", "session", "[", "'token'", "]", "http_session", "=", ...
Execute v2 API call. :param url: URL paths associated with the API call :param payload: dict containing all parameters to submit with POST call :returns: decoded API json result
[ "Execute", "v2", "API", "call", "." ]
f4dba40c627cb08dd4b7d0d277e8d67578010b05
https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/api.py#L87-L152
train
Execute v2 API call.
cltl/KafNafParserPy
KafNafParserPy/srl_data.py
Crole.get_external_references
def get_external_references(self): """ Returns the external references of the element @rtype: L{CexternalReference} @return: the external references (iterator) """ node = self.node.find('externalReferences') if node is not None: ext_refs = CexternalRef...
python
def get_external_references(self): """ Returns the external references of the element @rtype: L{CexternalReference} @return: the external references (iterator) """ node = self.node.find('externalReferences') if node is not None: ext_refs = CexternalRef...
[ "def", "get_external_references", "(", "self", ")", ":", "node", "=", "self", ".", "node", ".", "find", "(", "'externalReferences'", ")", "if", "node", "is", "not", "None", ":", "ext_refs", "=", "CexternalReferences", "(", "node", ")", "for", "ext_ref", "i...
Returns the external references of the element @rtype: L{CexternalReference} @return: the external references (iterator)
[ "Returns", "the", "external", "references", "of", "the", "element" ]
9bc32e803c176404b255ba317479b8780ed5f569
https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/srl_data.py#L102-L112
train
Returns the external references of the element
cltl/KafNafParserPy
KafNafParserPy/srl_data.py
Crole.add_external_reference
def add_external_reference(self,ext_ref): """ Adds an external reference to the role @param ext_ref: the external reference object @type ext_ref: L{CexternalReference} """ #check if the externalreferences sublayer exist for the role, and create it in case node_ext...
python
def add_external_reference(self,ext_ref): """ Adds an external reference to the role @param ext_ref: the external reference object @type ext_ref: L{CexternalReference} """ #check if the externalreferences sublayer exist for the role, and create it in case node_ext...
[ "def", "add_external_reference", "(", "self", ",", "ext_ref", ")", ":", "#check if the externalreferences sublayer exist for the role, and create it in case", "node_ext_refs", "=", "self", ".", "node", ".", "find", "(", "'externalReferences'", ")", "ext_refs", "=", "None", ...
Adds an external reference to the role @param ext_ref: the external reference object @type ext_ref: L{CexternalReference}
[ "Adds", "an", "external", "reference", "to", "the", "role" ]
9bc32e803c176404b255ba317479b8780ed5f569
https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/srl_data.py#L114-L129
train
Adds an external reference to the role
cltl/KafNafParserPy
KafNafParserPy/srl_data.py
Crole.remove_external_references
def remove_external_references(self): """ Removes any external reference from the role """ for ex_ref_node in self.node.findall('externalReferences'): self.node.remove(ex_ref_node)
python
def remove_external_references(self): """ Removes any external reference from the role """ for ex_ref_node in self.node.findall('externalReferences'): self.node.remove(ex_ref_node)
[ "def", "remove_external_references", "(", "self", ")", ":", "for", "ex_ref_node", "in", "self", ".", "node", ".", "findall", "(", "'externalReferences'", ")", ":", "self", ".", "node", ".", "remove", "(", "ex_ref_node", ")" ]
Removes any external reference from the role
[ "Removes", "any", "external", "reference", "from", "the", "role" ]
9bc32e803c176404b255ba317479b8780ed5f569
https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/srl_data.py#L132-L137
train
Removes any external references from the role
cltl/KafNafParserPy
KafNafParserPy/srl_data.py
Cpredicate.remove_external_references_from_roles
def remove_external_references_from_roles(self): """ Removes any external references on any of the roles from the predicate """ for node_role in self.node.findall('role'): role = Crole(node_role) role.remove_external_references()
python
def remove_external_references_from_roles(self): """ Removes any external references on any of the roles from the predicate """ for node_role in self.node.findall('role'): role = Crole(node_role) role.remove_external_references()
[ "def", "remove_external_references_from_roles", "(", "self", ")", ":", "for", "node_role", "in", "self", ".", "node", ".", "findall", "(", "'role'", ")", ":", "role", "=", "Crole", "(", "node_role", ")", "role", ".", "remove_external_references", "(", ")" ]
Removes any external references on any of the roles from the predicate
[ "Removes", "any", "external", "references", "on", "any", "of", "the", "roles", "from", "the", "predicate" ]
9bc32e803c176404b255ba317479b8780ed5f569
https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/srl_data.py#L290-L297
train
Removes any external references on any of the roles in the predicate.
cltl/KafNafParserPy
KafNafParserPy/srl_data.py
Cpredicate.add_roles
def add_roles(self, list_of_roles): """ Adds a list of roles to the predicate @type list_of_roles: list @param list_of_roles: list of roles """ for role in list_of_roles: role_node = role.get_node() self.node.append(role_node)
python
def add_roles(self, list_of_roles): """ Adds a list of roles to the predicate @type list_of_roles: list @param list_of_roles: list of roles """ for role in list_of_roles: role_node = role.get_node() self.node.append(role_node)
[ "def", "add_roles", "(", "self", ",", "list_of_roles", ")", ":", "for", "role", "in", "list_of_roles", ":", "role_node", "=", "role", ".", "get_node", "(", ")", "self", ".", "node", ".", "append", "(", "role_node", ")" ]
Adds a list of roles to the predicate @type list_of_roles: list @param list_of_roles: list of roles
[ "Adds", "a", "list", "of", "roles", "to", "the", "predicate" ]
9bc32e803c176404b255ba317479b8780ed5f569
https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/srl_data.py#L308-L316
train
Adds a list of roles to the predicate
cltl/KafNafParserPy
KafNafParserPy/srl_data.py
Cpredicate.add_role
def add_role(self, role_obj): """ Add a role to the predicate @type role_obj: L{Crole} @param role_obj: the role object """ role_node = role_obj.get_node() self.node.append(role_node)
python
def add_role(self, role_obj): """ Add a role to the predicate @type role_obj: L{Crole} @param role_obj: the role object """ role_node = role_obj.get_node() self.node.append(role_node)
[ "def", "add_role", "(", "self", ",", "role_obj", ")", ":", "role_node", "=", "role_obj", ".", "get_node", "(", ")", "self", ".", "node", ".", "append", "(", "role_node", ")" ]
Add a role to the predicate @type role_obj: L{Crole} @param role_obj: the role object
[ "Add", "a", "role", "to", "the", "predicate" ]
9bc32e803c176404b255ba317479b8780ed5f569
https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/srl_data.py#L318-L325
train
Adds a role to the predicate
cltl/KafNafParserPy
KafNafParserPy/srl_data.py
Csrl.add_external_reference_to_role
def add_external_reference_to_role(self,role_id,ext_ref): """ Adds an external reference to a role identifier @param role_id: the role identifier @type role_id: string @param ext_ref: the external reference @type ext_ref: L{CexternalReference} """ node_rol...
python
def add_external_reference_to_role(self,role_id,ext_ref): """ Adds an external reference to a role identifier @param role_id: the role identifier @type role_id: string @param ext_ref: the external reference @type ext_ref: L{CexternalReference} """ node_rol...
[ "def", "add_external_reference_to_role", "(", "self", ",", "role_id", ",", "ext_ref", ")", ":", "node_role", "=", "self", ".", "map_roleid_node", "[", "role_id", "]", "obj_role", "=", "Crole", "(", "node_role", ")", "obj_role", ".", "add_external_reference", "("...
Adds an external reference to a role identifier @param role_id: the role identifier @type role_id: string @param ext_ref: the external reference @type ext_ref: L{CexternalReference}
[ "Adds", "an", "external", "reference", "to", "a", "role", "identifier" ]
9bc32e803c176404b255ba317479b8780ed5f569
https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/srl_data.py#L377-L387
train
Adds an external reference to a role identifier
cltl/KafNafParserPy
KafNafParserPy/srl_data.py
Csrl.add_predicate
def add_predicate(self, pred_obj): """ Adds a predicate object to the layer @type pred_obj: L{Cpredicate} @param pred_obj: the predicate object """ pred_id = pred_obj.get_id() if not pred_id in self.idx: pred_node = pred_obj.get_node() self...
python
def add_predicate(self, pred_obj): """ Adds a predicate object to the layer @type pred_obj: L{Cpredicate} @param pred_obj: the predicate object """ pred_id = pred_obj.get_id() if not pred_id in self.idx: pred_node = pred_obj.get_node() self...
[ "def", "add_predicate", "(", "self", ",", "pred_obj", ")", ":", "pred_id", "=", "pred_obj", ".", "get_id", "(", ")", "if", "not", "pred_id", "in", "self", ".", "idx", ":", "pred_node", "=", "pred_obj", ".", "get_node", "(", ")", "self", ".", "node", ...
Adds a predicate object to the layer @type pred_obj: L{Cpredicate} @param pred_obj: the predicate object
[ "Adds", "a", "predicate", "object", "to", "the", "layer" ]
9bc32e803c176404b255ba317479b8780ed5f569
https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/srl_data.py#L390-L403
train
Adds a predicate object to the layer.
thombashi/DataProperty
examples/py/to_dp_matrix.py
display_dp_matrix_attr
def display_dp_matrix_attr(dp_matrix, attr_name): """ show a value assocciated with an attribute for each DataProperty instance in the dp_matrix """ print() print("---------- {:s} ----------".format(attr_name)) for dp_list in dp_matrix: print([getattr(dp, attr_name) for dp in dp_lis...
python
def display_dp_matrix_attr(dp_matrix, attr_name): """ show a value assocciated with an attribute for each DataProperty instance in the dp_matrix """ print() print("---------- {:s} ----------".format(attr_name)) for dp_list in dp_matrix: print([getattr(dp, attr_name) for dp in dp_lis...
[ "def", "display_dp_matrix_attr", "(", "dp_matrix", ",", "attr_name", ")", ":", "print", "(", ")", "print", "(", "\"---------- {:s} ----------\"", ".", "format", "(", "attr_name", ")", ")", "for", "dp_list", "in", "dp_matrix", ":", "print", "(", "[", "getattr",...
show a value assocciated with an attribute for each DataProperty instance in the dp_matrix
[ "show", "a", "value", "assocciated", "with", "an", "attribute", "for", "each", "DataProperty", "instance", "in", "the", "dp_matrix" ]
1d1a4c6abee87264c2f870a932c0194895d80a18
https://github.com/thombashi/DataProperty/blob/1d1a4c6abee87264c2f870a932c0194895d80a18/examples/py/to_dp_matrix.py#L16-L25
train
displays a value assocciated with an attribute for each DataProperty instance in the dp_matrix
srossross/rpmfile
rpmfile/io_extra.py
_doc
def _doc(from_func): '''copy doc from one function to another use as a decorator eg:: @_doc(file.tell) def tell(..): ... ''' def decorator(to_func): to_func.__doc__ = from_func.__doc__ return to_func return decorator
python
def _doc(from_func): '''copy doc from one function to another use as a decorator eg:: @_doc(file.tell) def tell(..): ... ''' def decorator(to_func): to_func.__doc__ = from_func.__doc__ return to_func return decorator
[ "def", "_doc", "(", "from_func", ")", ":", "def", "decorator", "(", "to_func", ")", ":", "to_func", ".", "__doc__", "=", "from_func", ".", "__doc__", "return", "to_func", "return", "decorator" ]
copy doc from one function to another use as a decorator eg:: @_doc(file.tell) def tell(..): ...
[ "copy", "doc", "from", "one", "function", "to", "another", "use", "as", "a", "decorator", "eg", "::" ]
3ab96f211da7b56f5e99d8cc248f714a6e542d31
https://github.com/srossross/rpmfile/blob/3ab96f211da7b56f5e99d8cc248f714a6e542d31/rpmfile/io_extra.py#L7-L18
train
copy doc from one function to another
kamicut/tilepie
tilepie/reader.py
MBTilesReader._query
def _query(self, sql, *args): """ Executes the specified `sql` query and returns the cursor """ if not self._con: logger.debug(("Open MBTiles file '%s'") % self.filename) self._con = sqlite3.connect(self.filename) self._cur = self._con.cursor() sql = ' '.join(sql.split())...
python
def _query(self, sql, *args): """ Executes the specified `sql` query and returns the cursor """ if not self._con: logger.debug(("Open MBTiles file '%s'") % self.filename) self._con = sqlite3.connect(self.filename) self._cur = self._con.cursor() sql = ' '.join(sql.split())...
[ "def", "_query", "(", "self", ",", "sql", ",", "*", "args", ")", ":", "if", "not", "self", ".", "_con", ":", "logger", ".", "debug", "(", "(", "\"Open MBTiles file '%s'\"", ")", "%", "self", ".", "filename", ")", "self", ".", "_con", "=", "sqlite3", ...
Executes the specified `sql` query and returns the cursor
[ "Executes", "the", "specified", "sql", "query", "and", "returns", "the", "cursor" ]
103ae2be1c3c4e6f7ec4a3bdd265ffcddee92b96
https://github.com/kamicut/tilepie/blob/103ae2be1c3c4e6f7ec4a3bdd265ffcddee92b96/tilepie/reader.py#L33-L45
train
Executes the specified sql query and returns the cursor
cltl/KafNafParserPy
KafNafParserPy/opinion_data.py
Cholder.set_comment
def set_comment(self,c): """ Sets the comment for the element @type c: string @param c: comment for the element """ c = ' '+c.replace('-','').strip()+' ' self.node.insert(0,etree.Comment(c))
python
def set_comment(self,c): """ Sets the comment for the element @type c: string @param c: comment for the element """ c = ' '+c.replace('-','').strip()+' ' self.node.insert(0,etree.Comment(c))
[ "def", "set_comment", "(", "self", ",", "c", ")", ":", "c", "=", "' '", "+", "c", ".", "replace", "(", "'-'", ",", "''", ")", ".", "strip", "(", ")", "+", "' '", "self", ".", "node", ".", "insert", "(", "0", ",", "etree", ".", "Comment", "(",...
Sets the comment for the element @type c: string @param c: comment for the element
[ "Sets", "the", "comment", "for", "the", "element" ]
9bc32e803c176404b255ba317479b8780ed5f569
https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/opinion_data.py#L47-L54
train
Sets the comment for the element
cltl/KafNafParserPy
KafNafParserPy/opinion_data.py
Copinion.set_id
def set_id(self,my_id): """ Sets the opinion identifier @type my_id: string @param my_id: the opinion identifier """ if self.type == 'NAF': self.node.set('id',my_id) elif self.type == 'KAF': self.node.set('oid',my_id)
python
def set_id(self,my_id): """ Sets the opinion identifier @type my_id: string @param my_id: the opinion identifier """ if self.type == 'NAF': self.node.set('id',my_id) elif self.type == 'KAF': self.node.set('oid',my_id)
[ "def", "set_id", "(", "self", ",", "my_id", ")", ":", "if", "self", ".", "type", "==", "'NAF'", ":", "self", ".", "node", ".", "set", "(", "'id'", ",", "my_id", ")", "elif", "self", ".", "type", "==", "'KAF'", ":", "self", ".", "node", ".", "se...
Sets the opinion identifier @type my_id: string @param my_id: the opinion identifier
[ "Sets", "the", "opinion", "identifier" ]
9bc32e803c176404b255ba317479b8780ed5f569
https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/opinion_data.py#L325-L334
train
Sets the opinion identifier of the class.
cltl/KafNafParserPy
KafNafParserPy/opinion_data.py
Copinions.to_kaf
def to_kaf(self): """ Converts the opinion layer to KAF """ if self.type == 'NAF': for node in self.__get_opinion_nodes(): node.set('oid',node.get('id')) del node.attrib['id']
python
def to_kaf(self): """ Converts the opinion layer to KAF """ if self.type == 'NAF': for node in self.__get_opinion_nodes(): node.set('oid',node.get('id')) del node.attrib['id']
[ "def", "to_kaf", "(", "self", ")", ":", "if", "self", ".", "type", "==", "'NAF'", ":", "for", "node", "in", "self", ".", "__get_opinion_nodes", "(", ")", ":", "node", ".", "set", "(", "'oid'", ",", "node", ".", "get", "(", "'id'", ")", ")", "del"...
Converts the opinion layer to KAF
[ "Converts", "the", "opinion", "layer", "to", "KAF" ]
9bc32e803c176404b255ba317479b8780ed5f569
https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/opinion_data.py#L453-L460
train
Converts the opinion layer to KAF
cltl/KafNafParserPy
KafNafParserPy/opinion_data.py
Copinions.to_naf
def to_naf(self): """ Converts the opinion layer to NAF """ if self.type == 'KAF': for node in self.__get_opinion_nodes(): node.set('id',node.get('oid')) del node.attrib['oid']
python
def to_naf(self): """ Converts the opinion layer to NAF """ if self.type == 'KAF': for node in self.__get_opinion_nodes(): node.set('id',node.get('oid')) del node.attrib['oid']
[ "def", "to_naf", "(", "self", ")", ":", "if", "self", ".", "type", "==", "'KAF'", ":", "for", "node", "in", "self", ".", "__get_opinion_nodes", "(", ")", ":", "node", ".", "set", "(", "'id'", ",", "node", ".", "get", "(", "'oid'", ")", ")", "del"...
Converts the opinion layer to NAF
[ "Converts", "the", "opinion", "layer", "to", "NAF" ]
9bc32e803c176404b255ba317479b8780ed5f569
https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/opinion_data.py#L462-L469
train
Converts the opinion layer to NAF
cltl/KafNafParserPy
KafNafParserPy/opinion_data.py
Copinions.remove_this_opinion
def remove_this_opinion(self,opinion_id): """ Removes the opinion for the given opinion identifier @type opinion_id: string @param opinion_id: the opinion identifier to be removed """ for opi in self.get_opinions(): if opi.get_id() == opinion_id: ...
python
def remove_this_opinion(self,opinion_id): """ Removes the opinion for the given opinion identifier @type opinion_id: string @param opinion_id: the opinion identifier to be removed """ for opi in self.get_opinions(): if opi.get_id() == opinion_id: ...
[ "def", "remove_this_opinion", "(", "self", ",", "opinion_id", ")", ":", "for", "opi", "in", "self", ".", "get_opinions", "(", ")", ":", "if", "opi", ".", "get_id", "(", ")", "==", "opinion_id", ":", "self", ".", "node", ".", "remove", "(", "opi", "."...
Removes the opinion for the given opinion identifier @type opinion_id: string @param opinion_id: the opinion identifier to be removed
[ "Removes", "the", "opinion", "for", "the", "given", "opinion", "identifier" ]
9bc32e803c176404b255ba317479b8780ed5f569
https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/opinion_data.py#L488-L497
train
Removes the opinion for the given opinion identifier from the set of available opinions.
CenturyLinkCloud/clc-python-sdk
src/clc/APIv1/account.py
Account.GetAccountDetails
def GetAccountDetails(alias=None): """Return account details dict associated with the provided alias.""" if not alias: alias = Account.GetAlias() r = clc.v1.API.Call('post','Account/GetAccountDetails',{'AccountAlias': alias}) if r['Success'] != True: if clc.args: clc.v1.output.Status('ERROR',3,'Error call...
python
def GetAccountDetails(alias=None): """Return account details dict associated with the provided alias.""" if not alias: alias = Account.GetAlias() r = clc.v1.API.Call('post','Account/GetAccountDetails',{'AccountAlias': alias}) if r['Success'] != True: if clc.args: clc.v1.output.Status('ERROR',3,'Error call...
[ "def", "GetAccountDetails", "(", "alias", "=", "None", ")", ":", "if", "not", "alias", ":", "alias", "=", "Account", ".", "GetAlias", "(", ")", "r", "=", "clc", ".", "v1", ".", "API", ".", "Call", "(", "'post'", ",", "'Account/GetAccountDetails'", ",",...
Return account details dict associated with the provided alias.
[ "Return", "account", "details", "dict", "associated", "with", "the", "provided", "alias", "." ]
f4dba40c627cb08dd4b7d0d277e8d67578010b05
https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv1/account.py#L31-L40
train
Get account details dict associated with the provided alias.
CenturyLinkCloud/clc-python-sdk
src/clc/APIv1/account.py
Account.GetLocations
def GetLocations(): """Return all cloud locations available to the calling alias.""" r = clc.v1.API.Call('post','Account/GetLocations',{}) if r['Success'] != True: if clc.args: clc.v1.output.Status('ERROR',3,'Error calling %s. Status code %s. %s' % ('Account/GetLocations',r['StatusCode'],r['Message'])) ...
python
def GetLocations(): """Return all cloud locations available to the calling alias.""" r = clc.v1.API.Call('post','Account/GetLocations',{}) if r['Success'] != True: if clc.args: clc.v1.output.Status('ERROR',3,'Error calling %s. Status code %s. %s' % ('Account/GetLocations',r['StatusCode'],r['Message'])) ...
[ "def", "GetLocations", "(", ")", ":", "r", "=", "clc", ".", "v1", ".", "API", ".", "Call", "(", "'post'", ",", "'Account/GetLocations'", ",", "{", "}", ")", "if", "r", "[", "'Success'", "]", "!=", "True", ":", "if", "clc", ".", "args", ":", "clc"...
Return all cloud locations available to the calling alias.
[ "Return", "all", "cloud", "locations", "available", "to", "the", "calling", "alias", "." ]
f4dba40c627cb08dd4b7d0d277e8d67578010b05
https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv1/account.py#L44-L52
train
Get all cloud locations available to the calling alias.
CenturyLinkCloud/clc-python-sdk
src/clc/APIv1/account.py
Account.GetAccounts
def GetAccounts(alias=None): """Return account inventory dict containing all subaccounts for the given alias. If None search from default alias.""" if alias is not None: payload = {'AccountAlias': alias} else: payload = {} r = clc.v1.API.Call('post','Account/GetAccounts',payload) if int(r['StatusCode']) ==...
python
def GetAccounts(alias=None): """Return account inventory dict containing all subaccounts for the given alias. If None search from default alias.""" if alias is not None: payload = {'AccountAlias': alias} else: payload = {} r = clc.v1.API.Call('post','Account/GetAccounts',payload) if int(r['StatusCode']) ==...
[ "def", "GetAccounts", "(", "alias", "=", "None", ")", ":", "if", "alias", "is", "not", "None", ":", "payload", "=", "{", "'AccountAlias'", ":", "alias", "}", "else", ":", "payload", "=", "{", "}", "r", "=", "clc", ".", "v1", ".", "API", ".", "Cal...
Return account inventory dict containing all subaccounts for the given alias. If None search from default alias.
[ "Return", "account", "inventory", "dict", "containing", "all", "subaccounts", "for", "the", "given", "alias", ".", "If", "None", "search", "from", "default", "alias", "." ]
f4dba40c627cb08dd4b7d0d277e8d67578010b05
https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv1/account.py#L56-L66
train
Return account inventory dict containing all subaccounts for the given alias. If None search from default alias.
nickpandolfi/Cyther
cyther/project.py
assure_cache
def assure_cache(project_path=None): """ Assure that a project directory has a cache folder. If not, it will create it. """ project_path = path(project_path, ISDIR) cache_path = os.path.join(project_path, CACHE_NAME) if not os.path.isdir(cache_path): os.mkdir(cache_path)
python
def assure_cache(project_path=None): """ Assure that a project directory has a cache folder. If not, it will create it. """ project_path = path(project_path, ISDIR) cache_path = os.path.join(project_path, CACHE_NAME) if not os.path.isdir(cache_path): os.mkdir(cache_path)
[ "def", "assure_cache", "(", "project_path", "=", "None", ")", ":", "project_path", "=", "path", "(", "project_path", ",", "ISDIR", ")", "cache_path", "=", "os", ".", "path", ".", "join", "(", "project_path", ",", "CACHE_NAME", ")", "if", "not", "os", "."...
Assure that a project directory has a cache folder. If not, it will create it.
[ "Assure", "that", "a", "project", "directory", "has", "a", "cache", "folder", ".", "If", "not", "it", "will", "create", "it", "." ]
9fb0bd77af594008aa6ee8af460aa8c953abf5bc
https://github.com/nickpandolfi/Cyther/blob/9fb0bd77af594008aa6ee8af460aa8c953abf5bc/cyther/project.py#L13-L23
train
Assure that a project directory has a cache folder.
nickpandolfi/Cyther
cyther/project.py
purge_project
def purge_project(): """ Purge a directory of anything cyther related """ print('Current Directory: {}'.format(os.getcwd())) directories = os.listdir(os.getcwd()) if CACHE_NAME in directories: response = get_input("Would you like to delete the cache and" "eve...
python
def purge_project(): """ Purge a directory of anything cyther related """ print('Current Directory: {}'.format(os.getcwd())) directories = os.listdir(os.getcwd()) if CACHE_NAME in directories: response = get_input("Would you like to delete the cache and" "eve...
[ "def", "purge_project", "(", ")", ":", "print", "(", "'Current Directory: {}'", ".", "format", "(", "os", ".", "getcwd", "(", ")", ")", ")", "directories", "=", "os", ".", "listdir", "(", "os", ".", "getcwd", "(", ")", ")", "if", "CACHE_NAME", "in", ...
Purge a directory of anything cyther related
[ "Purge", "a", "directory", "of", "anything", "cyther", "related" ]
9fb0bd77af594008aa6ee8af460aa8c953abf5bc
https://github.com/nickpandolfi/Cyther/blob/9fb0bd77af594008aa6ee8af460aa8c953abf5bc/cyther/project.py#L33-L67
train
Purges a directory of anything cyther related
teepark/greenhouse
greenhouse/pool.py
map
def map(func, items, pool_size=10): """a parallelized work-alike to the built-in ``map`` function this function works by creating an :class:`OrderedPool` and placing all the arguments in :meth:`put<OrderedPool.put>` calls, then yielding items produced by the pool's :meth:`get<OrderedPool.get>` method. ...
python
def map(func, items, pool_size=10): """a parallelized work-alike to the built-in ``map`` function this function works by creating an :class:`OrderedPool` and placing all the arguments in :meth:`put<OrderedPool.put>` calls, then yielding items produced by the pool's :meth:`get<OrderedPool.get>` method. ...
[ "def", "map", "(", "func", ",", "items", ",", "pool_size", "=", "10", ")", ":", "with", "OrderedPool", "(", "func", ",", "pool_size", ")", "as", "pool", ":", "for", "count", ",", "item", "in", "enumerate", "(", "items", ")", ":", "pool", ".", "put"...
a parallelized work-alike to the built-in ``map`` function this function works by creating an :class:`OrderedPool` and placing all the arguments in :meth:`put<OrderedPool.put>` calls, then yielding items produced by the pool's :meth:`get<OrderedPool.get>` method. :param func: the mapper function to us...
[ "a", "parallelized", "work", "-", "alike", "to", "the", "built", "-", "in", "map", "function" ]
8fd1be4f5443ba090346b5ec82fdbeb0a060d956
https://github.com/teepark/greenhouse/blob/8fd1be4f5443ba090346b5ec82fdbeb0a060d956/greenhouse/pool.py#L255-L280
train
a parallelized work - alike to the built - in map function that returns a list of items from the items iterable.
teepark/greenhouse
greenhouse/pool.py
OneWayPool.start
def start(self): "start the pool's workers" for i in xrange(self.size): scheduler.schedule(self._runner) self._closing = False
python
def start(self): "start the pool's workers" for i in xrange(self.size): scheduler.schedule(self._runner) self._closing = False
[ "def", "start", "(", "self", ")", ":", "for", "i", "in", "xrange", "(", "self", ".", "size", ")", ":", "scheduler", ".", "schedule", "(", "self", ".", "_runner", ")", "self", ".", "_closing", "=", "False" ]
start the pool's workers
[ "start", "the", "pool", "s", "workers" ]
8fd1be4f5443ba090346b5ec82fdbeb0a060d956
https://github.com/teepark/greenhouse/blob/8fd1be4f5443ba090346b5ec82fdbeb0a060d956/greenhouse/pool.py#L36-L40
train
start the pool s workers
teepark/greenhouse
greenhouse/pool.py
OneWayPool.close
def close(self): """shut down the pool's workers this method sets the :attr:`closing` attribute, and once all queued work has been completed it will set the :attr:`closed` attribute """ self._closing = True for i in xrange(self.size): self.inq.put(_STOP)
python
def close(self): """shut down the pool's workers this method sets the :attr:`closing` attribute, and once all queued work has been completed it will set the :attr:`closed` attribute """ self._closing = True for i in xrange(self.size): self.inq.put(_STOP)
[ "def", "close", "(", "self", ")", ":", "self", ".", "_closing", "=", "True", "for", "i", "in", "xrange", "(", "self", ".", "size", ")", ":", "self", ".", "inq", ".", "put", "(", "_STOP", ")" ]
shut down the pool's workers this method sets the :attr:`closing` attribute, and once all queued work has been completed it will set the :attr:`closed` attribute
[ "shut", "down", "the", "pool", "s", "workers" ]
8fd1be4f5443ba090346b5ec82fdbeb0a060d956
https://github.com/teepark/greenhouse/blob/8fd1be4f5443ba090346b5ec82fdbeb0a060d956/greenhouse/pool.py#L42-L50
train
shut down the pool s workers attribute
teepark/greenhouse
greenhouse/pool.py
Pool.get
def get(self): """retrieve a result from the pool if nothing is already completed when this method is called, it will block until something comes back if the pool's function exited via exception, that will come back as a result here as well, but will be re-raised in :meth:`get`...
python
def get(self): """retrieve a result from the pool if nothing is already completed when this method is called, it will block until something comes back if the pool's function exited via exception, that will come back as a result here as well, but will be re-raised in :meth:`get`...
[ "def", "get", "(", "self", ")", ":", "if", "self", ".", "closed", ":", "raise", "PoolClosed", "(", ")", "result", ",", "succeeded", "=", "self", ".", "outq", ".", "get", "(", ")", "if", "not", "succeeded", ":", "klass", ",", "exc", ",", "tb", "="...
retrieve a result from the pool if nothing is already completed when this method is called, it will block until something comes back if the pool's function exited via exception, that will come back as a result here as well, but will be re-raised in :meth:`get`. .. note:: ...
[ "retrieve", "a", "result", "from", "the", "pool" ]
8fd1be4f5443ba090346b5ec82fdbeb0a060d956
https://github.com/teepark/greenhouse/blob/8fd1be4f5443ba090346b5ec82fdbeb0a060d956/greenhouse/pool.py#L134-L164
train
retrieve a result from the pool
teepark/greenhouse
greenhouse/pool.py
Pool.close
def close(self): """shut down the pool's workers this method sets the :attr:`closing` attribute, lines up the :attr:`closed` attribute to be set once any queued data has been processed, and raises a PoolClosed() exception in any coroutines still blocked on :meth:`get`. "...
python
def close(self): """shut down the pool's workers this method sets the :attr:`closing` attribute, lines up the :attr:`closed` attribute to be set once any queued data has been processed, and raises a PoolClosed() exception in any coroutines still blocked on :meth:`get`. "...
[ "def", "close", "(", "self", ")", ":", "super", "(", "Pool", ",", "self", ")", ".", "close", "(", ")", "for", "waiter", ",", "waketime", "in", "self", ".", "outq", ".", "_waiters", ":", "scheduler", ".", "schedule_exception", "(", "PoolClosed", "(", ...
shut down the pool's workers this method sets the :attr:`closing` attribute, lines up the :attr:`closed` attribute to be set once any queued data has been processed, and raises a PoolClosed() exception in any coroutines still blocked on :meth:`get`.
[ "shut", "down", "the", "pool", "s", "workers" ]
8fd1be4f5443ba090346b5ec82fdbeb0a060d956
https://github.com/teepark/greenhouse/blob/8fd1be4f5443ba090346b5ec82fdbeb0a060d956/greenhouse/pool.py#L166-L176
train
shut down the pool s workers attribute and raises a PoolClosed exception in any waiting coroutines still holding the data.
teepark/greenhouse
greenhouse/pool.py
OrderedPool.put
def put(self, *args, **kwargs): """place a new item into the pool to be handled by the workers all positional and keyword arguments will be passed in as the arguments to the function run by the pool's workers """ self.inq.put((self._putcount, (args, kwargs))) self._putco...
python
def put(self, *args, **kwargs): """place a new item into the pool to be handled by the workers all positional and keyword arguments will be passed in as the arguments to the function run by the pool's workers """ self.inq.put((self._putcount, (args, kwargs))) self._putco...
[ "def", "put", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ".", "inq", ".", "put", "(", "(", "self", ".", "_putcount", ",", "(", "args", ",", "kwargs", ")", ")", ")", "self", ".", "_putcount", "+=", "1" ]
place a new item into the pool to be handled by the workers all positional and keyword arguments will be passed in as the arguments to the function run by the pool's workers
[ "place", "a", "new", "item", "into", "the", "pool", "to", "be", "handled", "by", "the", "workers" ]
8fd1be4f5443ba090346b5ec82fdbeb0a060d956
https://github.com/teepark/greenhouse/blob/8fd1be4f5443ba090346b5ec82fdbeb0a060d956/greenhouse/pool.py#L207-L214
train
place a new item into the pool
teepark/greenhouse
greenhouse/pool.py
OrderedPool.get
def get(self): """retrieve a result from the pool if nothing is already completed when this method is called, it will block until something comes back if the pool's function exited via exception, that will come back as a result here as well, but will be re-raised in :meth:`get`...
python
def get(self): """retrieve a result from the pool if nothing is already completed when this method is called, it will block until something comes back if the pool's function exited via exception, that will come back as a result here as well, but will be re-raised in :meth:`get`...
[ "def", "get", "(", "self", ")", ":", "if", "self", ".", "closed", ":", "raise", "PoolClosed", "(", ")", "while", "self", ".", "_getcount", "not", "in", "self", ".", "_cache", ":", "counter", ",", "result", "=", "self", ".", "outq", ".", "get", "(",...
retrieve a result from the pool if nothing is already completed when this method is called, it will block until something comes back if the pool's function exited via exception, that will come back as a result here as well, but will be re-raised in :meth:`get`. .. note:: ...
[ "retrieve", "a", "result", "from", "the", "pool" ]
8fd1be4f5443ba090346b5ec82fdbeb0a060d956
https://github.com/teepark/greenhouse/blob/8fd1be4f5443ba090346b5ec82fdbeb0a060d956/greenhouse/pool.py#L216-L252
train
retrieve a result from the pool
cltl/KafNafParserPy
KafNafParserPy/entity_data.py
Centities.get_entity
def get_entity(self,entity_id): """ Returns the entity object for the given entity identifier @type entity_id: string @param entity_id: the token identifier @rtype: L{Centity} @return: the entity object """ entity_node = self.map_entity_id_to_node.get(en...
python
def get_entity(self,entity_id): """ Returns the entity object for the given entity identifier @type entity_id: string @param entity_id: the token identifier @rtype: L{Centity} @return: the entity object """ entity_node = self.map_entity_id_to_node.get(en...
[ "def", "get_entity", "(", "self", ",", "entity_id", ")", ":", "entity_node", "=", "self", ".", "map_entity_id_to_node", ".", "get", "(", "entity_id", ")", "if", "entity_node", "is", "not", "None", ":", "return", "Centity", "(", "node", "=", "entity_node", ...
Returns the entity object for the given entity identifier @type entity_id: string @param entity_id: the token identifier @rtype: L{Centity} @return: the entity object
[ "Returns", "the", "entity", "object", "for", "the", "given", "entity", "identifier" ]
9bc32e803c176404b255ba317479b8780ed5f569
https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/entity_data.py#L181-L200
train
Returns the entity object for the given entity identifier.
cltl/KafNafParserPy
KafNafParserPy/entity_data.py
Centities.add_external_reference_to_entity
def add_external_reference_to_entity(self,entity_id,ext_ref): """ Adds an external reference to a entity specified by the entity identifier @param entity_id: the entity identifier @type entity_id: string @param ext_ref: the external reference @type ext_ref: L{CexternalRef...
python
def add_external_reference_to_entity(self,entity_id,ext_ref): """ Adds an external reference to a entity specified by the entity identifier @param entity_id: the entity identifier @type entity_id: string @param ext_ref: the external reference @type ext_ref: L{CexternalRef...
[ "def", "add_external_reference_to_entity", "(", "self", ",", "entity_id", ",", "ext_ref", ")", ":", "node_entity", "=", "self", ".", "map_entity_id_to_node", ".", "get", "(", "entity_id", ")", "if", "node_entity", "is", "not", "None", ":", "entity", "=", "Cent...
Adds an external reference to a entity specified by the entity identifier @param entity_id: the entity identifier @type entity_id: string @param ext_ref: the external reference @type ext_ref: L{CexternalReference}
[ "Adds", "an", "external", "reference", "to", "a", "entity", "specified", "by", "the", "entity", "identifier" ]
9bc32e803c176404b255ba317479b8780ed5f569
https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/entity_data.py#L202-L215
train
Adds an external reference to an entity
cltl/KafNafParserPy
KafNafParserPy/entity_data.py
Centities.to_kaf
def to_kaf(self): """ Converts the layer from KAF to NAF """ if self.type == 'NAF': for node in self.__get_entity_nodes(): node.set('eid',node.get('id')) del node.attrib['id']
python
def to_kaf(self): """ Converts the layer from KAF to NAF """ if self.type == 'NAF': for node in self.__get_entity_nodes(): node.set('eid',node.get('id')) del node.attrib['id']
[ "def", "to_kaf", "(", "self", ")", ":", "if", "self", ".", "type", "==", "'NAF'", ":", "for", "node", "in", "self", ".", "__get_entity_nodes", "(", ")", ":", "node", ".", "set", "(", "'eid'", ",", "node", ".", "get", "(", "'id'", ")", ")", "del",...
Converts the layer from KAF to NAF
[ "Converts", "the", "layer", "from", "KAF", "to", "NAF" ]
9bc32e803c176404b255ba317479b8780ed5f569
https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/entity_data.py#L226-L233
train
Converts the layer from KAF to NAF
cltl/KafNafParserPy
KafNafParserPy/entity_data.py
Centities.to_naf
def to_naf(self): """ Converts the layer from NAF to KAF """ if self.type == 'KAF': for node in self.__get_entity_nodes(): node.set('id',node.get('eid')) del node.attrib['eid']
python
def to_naf(self): """ Converts the layer from NAF to KAF """ if self.type == 'KAF': for node in self.__get_entity_nodes(): node.set('id',node.get('eid')) del node.attrib['eid']
[ "def", "to_naf", "(", "self", ")", ":", "if", "self", ".", "type", "==", "'KAF'", ":", "for", "node", "in", "self", ".", "__get_entity_nodes", "(", ")", ":", "node", ".", "set", "(", "'id'", ",", "node", ".", "get", "(", "'eid'", ")", ")", "del",...
Converts the layer from NAF to KAF
[ "Converts", "the", "layer", "from", "NAF", "to", "KAF" ]
9bc32e803c176404b255ba317479b8780ed5f569
https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/entity_data.py#L235-L242
train
Converts the layer from NAF to KAF
mjirik/imtools
imtools/uiThreshold.py
uiThreshold.updateImage
def updateImage(self, val): """ Hlavni update metoda. Cinny kod pro gaussovske filtrovani, prahovani, binarni uzavreni a otevreni a vraceni nejvetsich nebo oznacenych objektu. """ # import ipdb # ipdb.set_trace() # Filtrovani # Zjisteni jakou s...
python
def updateImage(self, val): """ Hlavni update metoda. Cinny kod pro gaussovske filtrovani, prahovani, binarni uzavreni a otevreni a vraceni nejvetsich nebo oznacenych objektu. """ # import ipdb # ipdb.set_trace() # Filtrovani # Zjisteni jakou s...
[ "def", "updateImage", "(", "self", ",", "val", ")", ":", "# import ipdb", "# ipdb.set_trace()", "# Filtrovani", "# Zjisteni jakou sigmu pouzit", "if", "(", "self", ".", "firstRun", "==", "True", "and", "self", ".", "inputSigma", ">=", "0", ")", ":", "sigma", "...
Hlavni update metoda. Cinny kod pro gaussovske filtrovani, prahovani, binarni uzavreni a otevreni a vraceni nejvetsich nebo oznacenych objektu.
[ "Hlavni", "update", "metoda", ".", "Cinny", "kod", "pro", "gaussovske", "filtrovani", "prahovani", "binarni", "uzavreni", "a", "otevreni", "a", "vraceni", "nejvetsich", "nebo", "oznacenych", "objektu", "." ]
eb29fa59df0e0684d8334eb3bc5ef36ea46d1d3a
https://github.com/mjirik/imtools/blob/eb29fa59df0e0684d8334eb3bc5ef36ea46d1d3a/imtools/uiThreshold.py#L413-L479
train
Update the image of the current object.
mjirik/imtools
imtools/uiThreshold.py
uiThreshold.__drawSegmentedSlice
def __drawSegmentedSlice(self, ax, contour, i): """ Used for visualization of midle slice of the data3d :param ax: :param contour: :param i: :return: """ i = int(i) ax.cla() ax.imshow(self.data[i, :, :], cmap=self.cmap) ax.set_xtic...
python
def __drawSegmentedSlice(self, ax, contour, i): """ Used for visualization of midle slice of the data3d :param ax: :param contour: :param i: :return: """ i = int(i) ax.cla() ax.imshow(self.data[i, :, :], cmap=self.cmap) ax.set_xtic...
[ "def", "__drawSegmentedSlice", "(", "self", ",", "ax", ",", "contour", ",", "i", ")", ":", "i", "=", "int", "(", "i", ")", "ax", ".", "cla", "(", ")", "ax", ".", "imshow", "(", "self", ".", "data", "[", "i", ",", ":", ",", ":", "]", ",", "c...
Used for visualization of midle slice of the data3d :param ax: :param contour: :param i: :return:
[ "Used", "for", "visualization", "of", "midle", "slice", "of", "the", "data3d", ":", "param", "ax", ":", ":", "param", "contour", ":", ":", "param", "i", ":", ":", "return", ":" ]
eb29fa59df0e0684d8334eb3bc5ef36ea46d1d3a
https://github.com/mjirik/imtools/blob/eb29fa59df0e0684d8334eb3bc5ef36ea46d1d3a/imtools/uiThreshold.py#L515-L539
train
Draws the midle slice of the data3d.
CenturyLinkCloud/clc-python-sdk
src/clc/APIv2/anti_affinity.py
AntiAffinity.GetAll
def GetAll(alias=None,location=None,session=None): """Gets a list of anti-affinity policies within a given account. https://t3n.zendesk.com/entries/44657214-Get-Anti-Affinity-Policies >>> clc.v2.AntiAffinity.GetAll() [<clc.APIv2.anti_affinity.AntiAffinity object at 0x10c65e910>, <clc.APIv2.anti_affinity.AntiA...
python
def GetAll(alias=None,location=None,session=None): """Gets a list of anti-affinity policies within a given account. https://t3n.zendesk.com/entries/44657214-Get-Anti-Affinity-Policies >>> clc.v2.AntiAffinity.GetAll() [<clc.APIv2.anti_affinity.AntiAffinity object at 0x10c65e910>, <clc.APIv2.anti_affinity.AntiA...
[ "def", "GetAll", "(", "alias", "=", "None", ",", "location", "=", "None", ",", "session", "=", "None", ")", ":", "if", "not", "alias", ":", "alias", "=", "clc", ".", "v2", ".", "Account", ".", "GetAlias", "(", "session", "=", "session", ")", "polic...
Gets a list of anti-affinity policies within a given account. https://t3n.zendesk.com/entries/44657214-Get-Anti-Affinity-Policies >>> clc.v2.AntiAffinity.GetAll() [<clc.APIv2.anti_affinity.AntiAffinity object at 0x10c65e910>, <clc.APIv2.anti_affinity.AntiAffinity object at 0x10c65ec90>]
[ "Gets", "a", "list", "of", "anti", "-", "affinity", "policies", "within", "a", "given", "account", "." ]
f4dba40c627cb08dd4b7d0d277e8d67578010b05
https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/anti_affinity.py#L28-L49
train
Get a list of anti - affinity policies within a given account.
CenturyLinkCloud/clc-python-sdk
src/clc/APIv2/anti_affinity.py
AntiAffinity.GetLocation
def GetLocation(location=None,alias=None,session=None): """Returns a list of anti-affinity policies within a specific location. >>> clc.v2.AntiAffinity.GetLocation("VA1") [<clc.APIv2.anti_affinity.AntiAffinity object at 0x105eeded0>] """ if not location: location = clc.v2.Account.GetLocation(session=sessio...
python
def GetLocation(location=None,alias=None,session=None): """Returns a list of anti-affinity policies within a specific location. >>> clc.v2.AntiAffinity.GetLocation("VA1") [<clc.APIv2.anti_affinity.AntiAffinity object at 0x105eeded0>] """ if not location: location = clc.v2.Account.GetLocation(session=sessio...
[ "def", "GetLocation", "(", "location", "=", "None", ",", "alias", "=", "None", ",", "session", "=", "None", ")", ":", "if", "not", "location", ":", "location", "=", "clc", ".", "v2", ".", "Account", ".", "GetLocation", "(", "session", "=", "session", ...
Returns a list of anti-affinity policies within a specific location. >>> clc.v2.AntiAffinity.GetLocation("VA1") [<clc.APIv2.anti_affinity.AntiAffinity object at 0x105eeded0>]
[ "Returns", "a", "list", "of", "anti", "-", "affinity", "policies", "within", "a", "specific", "location", "." ]
f4dba40c627cb08dd4b7d0d277e8d67578010b05
https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/anti_affinity.py#L53-L62
train
Returns a list of anti - affinity policies within a specific location.
CenturyLinkCloud/clc-python-sdk
src/clc/APIv2/anti_affinity.py
AntiAffinity.Create
def Create(name,alias=None,location=None,session=None): """Creates a new anti-affinity policy within a given account. https://t3n.zendesk.com/entries/45042770-Create-Anti-Affinity-Policy *TODO* Currently returning 400 error: clc.APIFailedResponse: Response code 400. . POST https://api.tier3.com/v2/antiAffinit...
python
def Create(name,alias=None,location=None,session=None): """Creates a new anti-affinity policy within a given account. https://t3n.zendesk.com/entries/45042770-Create-Anti-Affinity-Policy *TODO* Currently returning 400 error: clc.APIFailedResponse: Response code 400. . POST https://api.tier3.com/v2/antiAffinit...
[ "def", "Create", "(", "name", ",", "alias", "=", "None", ",", "location", "=", "None", ",", "session", "=", "None", ")", ":", "if", "not", "alias", ":", "alias", "=", "clc", ".", "v2", ".", "Account", ".", "GetAlias", "(", "session", "=", "session"...
Creates a new anti-affinity policy within a given account. https://t3n.zendesk.com/entries/45042770-Create-Anti-Affinity-Policy *TODO* Currently returning 400 error: clc.APIFailedResponse: Response code 400. . POST https://api.tier3.com/v2/antiAffinityPolicies/BTDI
[ "Creates", "a", "new", "anti", "-", "affinity", "policy", "within", "a", "given", "account", "." ]
f4dba40c627cb08dd4b7d0d277e8d67578010b05
https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/anti_affinity.py#L66-L82
train
Create a new anti - affinity policy within a given account.
CenturyLinkCloud/clc-python-sdk
src/clc/APIv2/anti_affinity.py
AntiAffinity.Update
def Update(self,name): """Change the policy's name. https://t3n.zendesk.com/entries/45066480-Update-Anti-Affinity-Policy *TODO* - currently returning 500 error """ r = clc.v2.API.Call('PUT','antiAffinityPolicies/%s/%s' % (self.alias,self.id),{'name': name},session=self.session) self.name = name
python
def Update(self,name): """Change the policy's name. https://t3n.zendesk.com/entries/45066480-Update-Anti-Affinity-Policy *TODO* - currently returning 500 error """ r = clc.v2.API.Call('PUT','antiAffinityPolicies/%s/%s' % (self.alias,self.id),{'name': name},session=self.session) self.name = name
[ "def", "Update", "(", "self", ",", "name", ")", ":", "r", "=", "clc", ".", "v2", ".", "API", ".", "Call", "(", "'PUT'", ",", "'antiAffinityPolicies/%s/%s'", "%", "(", "self", ".", "alias", ",", "self", ".", "id", ")", ",", "{", "'name'", ":", "na...
Change the policy's name. https://t3n.zendesk.com/entries/45066480-Update-Anti-Affinity-Policy *TODO* - currently returning 500 error
[ "Change", "the", "policy", "s", "name", "." ]
f4dba40c627cb08dd4b7d0d277e8d67578010b05
https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/anti_affinity.py#L115-L125
train
Change the policy s name.
CenturyLinkCloud/clc-python-sdk
src/clc/APIv2/anti_affinity.py
AntiAffinity.Delete
def Delete(self): """Delete policy https://t3n.zendesk.com/entries/45044330-Delete-Anti-Affinity-Policy >>> a = clc.v2.AntiAffinity.GetLocation("WA1")[0] >>> a.Delete() """ r = clc.v2.API.Call('DELETE','antiAffinityPolicies/%s/%s' % (self.alias,self.id),{},session=self.session)
python
def Delete(self): """Delete policy https://t3n.zendesk.com/entries/45044330-Delete-Anti-Affinity-Policy >>> a = clc.v2.AntiAffinity.GetLocation("WA1")[0] >>> a.Delete() """ r = clc.v2.API.Call('DELETE','antiAffinityPolicies/%s/%s' % (self.alias,self.id),{},session=self.session)
[ "def", "Delete", "(", "self", ")", ":", "r", "=", "clc", ".", "v2", ".", "API", ".", "Call", "(", "'DELETE'", ",", "'antiAffinityPolicies/%s/%s'", "%", "(", "self", ".", "alias", ",", "self", ".", "id", ")", ",", "{", "}", ",", "session", "=", "s...
Delete policy https://t3n.zendesk.com/entries/45044330-Delete-Anti-Affinity-Policy >>> a = clc.v2.AntiAffinity.GetLocation("WA1")[0] >>> a.Delete()
[ "Delete", "policy" ]
f4dba40c627cb08dd4b7d0d277e8d67578010b05
https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/anti_affinity.py#L128-L136
train
Delete an anti - affinity policy.
polysquare/cmake-ast
cmakeast/ast_visitor.py
_node
def _node(handler, single=None, multi=None): """Return an _AbstractSyntaxTreeNode with some elements defaulted.""" return _AbstractSyntaxTreeNode(handler=handler, single=(single if single else []), multi=(multi if multi else []))
python
def _node(handler, single=None, multi=None): """Return an _AbstractSyntaxTreeNode with some elements defaulted.""" return _AbstractSyntaxTreeNode(handler=handler, single=(single if single else []), multi=(multi if multi else []))
[ "def", "_node", "(", "handler", ",", "single", "=", "None", ",", "multi", "=", "None", ")", ":", "return", "_AbstractSyntaxTreeNode", "(", "handler", "=", "handler", ",", "single", "=", "(", "single", "if", "single", "else", "[", "]", ")", ",", "multi"...
Return an _AbstractSyntaxTreeNode with some elements defaulted.
[ "Return", "an", "_AbstractSyntaxTreeNode", "with", "some", "elements", "defaulted", "." ]
431a32d595d76f1f8f993eb6ddcc79effbadff9d
https://github.com/polysquare/cmake-ast/blob/431a32d595d76f1f8f993eb6ddcc79effbadff9d/cmakeast/ast_visitor.py#L14-L18
train
Return an _AbstractSyntaxTreeNode with some elements defaulted.
polysquare/cmake-ast
cmakeast/ast_visitor.py
_recurse
def _recurse(node, *args, **kwargs): """Recursive print worker - recurses the AST and prints each node.""" node_name = node.__class__.__name__ try: info_for_node = _NODE_INFO_TABLE[node_name] except KeyError: return action = kwargs[info_for_node.handler] depth = kwargs["depth"] ...
python
def _recurse(node, *args, **kwargs): """Recursive print worker - recurses the AST and prints each node.""" node_name = node.__class__.__name__ try: info_for_node = _NODE_INFO_TABLE[node_name] except KeyError: return action = kwargs[info_for_node.handler] depth = kwargs["depth"] ...
[ "def", "_recurse", "(", "node", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "node_name", "=", "node", ".", "__class__", ".", "__name__", "try", ":", "info_for_node", "=", "_NODE_INFO_TABLE", "[", "node_name", "]", "except", "KeyError", ":", "ret...
Recursive print worker - recurses the AST and prints each node.
[ "Recursive", "print", "worker", "-", "recurses", "the", "AST", "and", "prints", "each", "node", "." ]
431a32d595d76f1f8f993eb6ddcc79effbadff9d
https://github.com/polysquare/cmake-ast/blob/431a32d595d76f1f8f993eb6ddcc79effbadff9d/cmakeast/ast_visitor.py#L43-L71
train
Recursive print worker - recurses the AST and prints each node.
polysquare/cmake-ast
cmakeast/ast_visitor.py
recurse
def recurse(node, *args, **kwargs): """Entry point for AST recursion.""" # Construct a default table of actions, using action from kwargs # if it is available. These are forwarded to _recurse. fwd = dict() for node_info in _NODE_INFO_TABLE.values(): fwd[node_info.handler] = kwargs.get(node_i...
python
def recurse(node, *args, **kwargs): """Entry point for AST recursion.""" # Construct a default table of actions, using action from kwargs # if it is available. These are forwarded to _recurse. fwd = dict() for node_info in _NODE_INFO_TABLE.values(): fwd[node_info.handler] = kwargs.get(node_i...
[ "def", "recurse", "(", "node", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# Construct a default table of actions, using action from kwargs", "# if it is available. These are forwarded to _recurse.", "fwd", "=", "dict", "(", ")", "for", "node_info", "in", "_NO...
Entry point for AST recursion.
[ "Entry", "point", "for", "AST", "recursion", "." ]
431a32d595d76f1f8f993eb6ddcc79effbadff9d
https://github.com/polysquare/cmake-ast/blob/431a32d595d76f1f8f993eb6ddcc79effbadff9d/cmakeast/ast_visitor.py#L74-L83
train
Entry point for AST recursion.
fridex/json2sql
json2sql/json2sql.py
json2sql
def json2sql(raw_json=None, **definition): # pylint: disable=too-many-branches """Convert raw dictionary, JSON/YAML to SQL statement. :param raw_json: raw JSON/YAML or file to convert to SQL statement :type raw_json: str or file :return: raw SQL statement :rtype: str """ if raw_json and de...
python
def json2sql(raw_json=None, **definition): # pylint: disable=too-many-branches """Convert raw dictionary, JSON/YAML to SQL statement. :param raw_json: raw JSON/YAML or file to convert to SQL statement :type raw_json: str or file :return: raw SQL statement :rtype: str """ if raw_json and de...
[ "def", "json2sql", "(", "raw_json", "=", "None", ",", "*", "*", "definition", ")", ":", "# pylint: disable=too-many-branches", "if", "raw_json", "and", "definition", ":", "raise", "InputError", "(", "\"Cannot process dict and kwargs input at the same time\"", ")", "defi...
Convert raw dictionary, JSON/YAML to SQL statement. :param raw_json: raw JSON/YAML or file to convert to SQL statement :type raw_json: str or file :return: raw SQL statement :rtype: str
[ "Convert", "raw", "dictionary", "JSON", "/", "YAML", "to", "SQL", "statement", "." ]
a0851dd79827a684319b03fb899e129f81ff2d3a
https://github.com/fridex/json2sql/blob/a0851dd79827a684319b03fb899e129f81ff2d3a/json2sql/json2sql.py#L67-L110
train
Convert a JSON dictionary to a SQL statement.
mjirik/imtools
imtools/show_segmentation_qt.py
ShowSegmentationWidget.get_filename_filled_with_checked_labels
def get_filename_filled_with_checked_labels(self, labels=None): """ Fill used labels into filename """ if labels is None: labels = self.slab_wg.action_check_slab_ui() string_labels = imma.get_nlabels(slab=self.slab_wg.slab, labels=labels, return_mode="str") filename = self.vt...
python
def get_filename_filled_with_checked_labels(self, labels=None): """ Fill used labels into filename """ if labels is None: labels = self.slab_wg.action_check_slab_ui() string_labels = imma.get_nlabels(slab=self.slab_wg.slab, labels=labels, return_mode="str") filename = self.vt...
[ "def", "get_filename_filled_with_checked_labels", "(", "self", ",", "labels", "=", "None", ")", ":", "if", "labels", "is", "None", ":", "labels", "=", "self", ".", "slab_wg", ".", "action_check_slab_ui", "(", ")", "string_labels", "=", "imma", ".", "get_nlabel...
Fill used labels into filename
[ "Fill", "used", "labels", "into", "filename" ]
eb29fa59df0e0684d8334eb3bc5ef36ea46d1d3a
https://github.com/mjirik/imtools/blob/eb29fa59df0e0684d8334eb3bc5ef36ea46d1d3a/imtools/show_segmentation_qt.py#L322-L329
train
Fill used labels into filename
teepark/greenhouse
greenhouse/emulation/__init__.py
patched
def patched(module_name): """import and return a named module with patches applied locally only this function returns a module after importing it in such as way that it will operate cooperatively, but not overriding the module globally. >>> green_httplib = patched("httplib") >>> # using green_http...
python
def patched(module_name): """import and return a named module with patches applied locally only this function returns a module after importing it in such as way that it will operate cooperatively, but not overriding the module globally. >>> green_httplib = patched("httplib") >>> # using green_http...
[ "def", "patched", "(", "module_name", ")", ":", "if", "module_name", "in", "_patchers", ":", "return", "_patched_copy", "(", "module_name", ",", "_patchers", "[", "module_name", "]", ")", "# grab the unpatched version of the module for posterity", "old_module", "=", "...
import and return a named module with patches applied locally only this function returns a module after importing it in such as way that it will operate cooperatively, but not overriding the module globally. >>> green_httplib = patched("httplib") >>> # using green_httplib will only block greenlets ...
[ "import", "and", "return", "a", "named", "module", "with", "patches", "applied", "locally", "only" ]
8fd1be4f5443ba090346b5ec82fdbeb0a060d956
https://github.com/teepark/greenhouse/blob/8fd1be4f5443ba090346b5ec82fdbeb0a060d956/greenhouse/emulation/__init__.py#L26-L72
train
import and return a named module with patches applied locally only
teepark/greenhouse
greenhouse/emulation/__init__.py
patched_context
def patched_context(*module_names, **kwargs): """apply emulation patches only for a specific context :param module_names: var-args for the modules to patch, as in :func:`patch` :param local: if True, unpatching is done on every switch-out, and re-patching on every switch-in, so that they ar...
python
def patched_context(*module_names, **kwargs): """apply emulation patches only for a specific context :param module_names: var-args for the modules to patch, as in :func:`patch` :param local: if True, unpatching is done on every switch-out, and re-patching on every switch-in, so that they ar...
[ "def", "patched_context", "(", "*", "module_names", ",", "*", "*", "kwargs", ")", ":", "local", "=", "kwargs", ".", "pop", "(", "'local'", ",", "False", ")", "if", "kwargs", ":", "raise", "TypeError", "(", "\"patched_context() got an unexpected keyword \"", "+...
apply emulation patches only for a specific context :param module_names: var-args for the modules to patch, as in :func:`patch` :param local: if True, unpatching is done on every switch-out, and re-patching on every switch-in, so that they are only applied for the one coroutine :returns: ...
[ "apply", "emulation", "patches", "only", "for", "a", "specific", "context" ]
8fd1be4f5443ba090346b5ec82fdbeb0a060d956
https://github.com/teepark/greenhouse/blob/8fd1be4f5443ba090346b5ec82fdbeb0a060d956/greenhouse/emulation/__init__.py#L76-L105
train
returns a new contextmanager that patches modules in the specified order
teepark/greenhouse
greenhouse/emulation/__init__.py
patch
def patch(*module_names): """apply monkey-patches to stdlib modules in-place imports the relevant modules and simply overwrites attributes on the module objects themselves. those attributes may be functions, classes or other attributes. valid arguments are: - __builtin__ - Queue - fcn...
python
def patch(*module_names): """apply monkey-patches to stdlib modules in-place imports the relevant modules and simply overwrites attributes on the module objects themselves. those attributes may be functions, classes or other attributes. valid arguments are: - __builtin__ - Queue - fcn...
[ "def", "patch", "(", "*", "module_names", ")", ":", "if", "not", "module_names", ":", "module_names", "=", "_patchers", ".", "keys", "(", ")", "log", ".", "info", "(", "\"monkey-patching in-place (%d modules)\"", "%", "len", "(", "module_names", ")", ")", "f...
apply monkey-patches to stdlib modules in-place imports the relevant modules and simply overwrites attributes on the module objects themselves. those attributes may be functions, classes or other attributes. valid arguments are: - __builtin__ - Queue - fcntl - os - select - si...
[ "apply", "monkey", "-", "patches", "to", "stdlib", "modules", "in", "-", "place" ]
8fd1be4f5443ba090346b5ec82fdbeb0a060d956
https://github.com/teepark/greenhouse/blob/8fd1be4f5443ba090346b5ec82fdbeb0a060d956/greenhouse/emulation/__init__.py#L142-L194
train
apply monkey - patches to standard library modules in - place.
teepark/greenhouse
greenhouse/emulation/__init__.py
unpatch
def unpatch(*module_names): """undo :func:`patch`\es to standard library modules this function takes one or more module names and puts back their patched attributes to the standard library originals. valid arguments are the same as for :func:`patch`. with no arguments, undoes all monkeypatches th...
python
def unpatch(*module_names): """undo :func:`patch`\es to standard library modules this function takes one or more module names and puts back their patched attributes to the standard library originals. valid arguments are the same as for :func:`patch`. with no arguments, undoes all monkeypatches th...
[ "def", "unpatch", "(", "*", "module_names", ")", ":", "if", "not", "module_names", ":", "module_names", "=", "_standard", ".", "keys", "(", ")", "log", ".", "info", "(", "\"undoing monkey-patches in-place (%d modules)\"", "%", "len", "(", "module_names", ")", ...
undo :func:`patch`\es to standard library modules this function takes one or more module names and puts back their patched attributes to the standard library originals. valid arguments are the same as for :func:`patch`. with no arguments, undoes all monkeypatches that have been applied :raises: ...
[ "undo", ":", "func", ":", "patch", "\\", "es", "to", "standard", "library", "modules" ]
8fd1be4f5443ba090346b5ec82fdbeb0a060d956
https://github.com/teepark/greenhouse/blob/8fd1be4f5443ba090346b5ec82fdbeb0a060d956/greenhouse/emulation/__init__.py#L197-L222
train
undo monkey - patches to standard library modules
nuclio/nuclio-sdk-py
nuclio_sdk/event.py
Event.from_json
def from_json(data): """Decode event encoded as JSON by processor""" parsed_data = json.loads(data) trigger = TriggerInfo( parsed_data['trigger']['class'], parsed_data['trigger']['kind'], ) # extract content type, needed to decode body content_ty...
python
def from_json(data): """Decode event encoded as JSON by processor""" parsed_data = json.loads(data) trigger = TriggerInfo( parsed_data['trigger']['class'], parsed_data['trigger']['kind'], ) # extract content type, needed to decode body content_ty...
[ "def", "from_json", "(", "data", ")", ":", "parsed_data", "=", "json", ".", "loads", "(", "data", ")", "trigger", "=", "TriggerInfo", "(", "parsed_data", "[", "'trigger'", "]", "[", "'class'", "]", ",", "parsed_data", "[", "'trigger'", "]", "[", "'kind'"...
Decode event encoded as JSON by processor
[ "Decode", "event", "encoded", "as", "JSON", "by", "processor" ]
5af9ffc19a0d96255ff430bc358be9cd7a57f424
https://github.com/nuclio/nuclio-sdk-py/blob/5af9ffc19a0d96255ff430bc358be9cd7a57f424/nuclio_sdk/event.py#L74-L99
train
Decode event encoded as JSON by processor
nuclio/nuclio-sdk-py
nuclio_sdk/event.py
Event.decode_body
def decode_body(body, content_type): """Decode event body""" if isinstance(body, dict): return body else: try: decoded_body = base64.b64decode(body) except: return body if content_type == 'application/json': ...
python
def decode_body(body, content_type): """Decode event body""" if isinstance(body, dict): return body else: try: decoded_body = base64.b64decode(body) except: return body if content_type == 'application/json': ...
[ "def", "decode_body", "(", "body", ",", "content_type", ")", ":", "if", "isinstance", "(", "body", ",", "dict", ")", ":", "return", "body", "else", ":", "try", ":", "decoded_body", "=", "base64", ".", "b64decode", "(", "body", ")", "except", ":", "retu...
Decode event body
[ "Decode", "event", "body" ]
5af9ffc19a0d96255ff430bc358be9cd7a57f424
https://github.com/nuclio/nuclio-sdk-py/blob/5af9ffc19a0d96255ff430bc358be9cd7a57f424/nuclio_sdk/event.py#L102-L119
train
Decode event body
nickpandolfi/Cyther
cyther/commands.py
furtherArgsProcessing
def furtherArgsProcessing(args): """ Converts args, and deals with incongruities that argparse couldn't handle """ if isinstance(args, str): unprocessed = args.strip().split(' ') if unprocessed[0] == 'cyther': del unprocessed[0] args = parser.parse_args(unprocessed)._...
python
def furtherArgsProcessing(args): """ Converts args, and deals with incongruities that argparse couldn't handle """ if isinstance(args, str): unprocessed = args.strip().split(' ') if unprocessed[0] == 'cyther': del unprocessed[0] args = parser.parse_args(unprocessed)._...
[ "def", "furtherArgsProcessing", "(", "args", ")", ":", "if", "isinstance", "(", "args", ",", "str", ")", ":", "unprocessed", "=", "args", ".", "strip", "(", ")", ".", "split", "(", "' '", ")", "if", "unprocessed", "[", "0", "]", "==", "'cyther'", ":"...
Converts args, and deals with incongruities that argparse couldn't handle
[ "Converts", "args", "and", "deals", "with", "incongruities", "that", "argparse", "couldn", "t", "handle" ]
9fb0bd77af594008aa6ee8af460aa8c953abf5bc
https://github.com/nickpandolfi/Cyther/blob/9fb0bd77af594008aa6ee8af460aa8c953abf5bc/cyther/commands.py#L65-L90
train
Converts args and deals with incongruities that argparse couldn t handle