id
int32
0
252k
repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
1,800
softlayer/softlayer-python
SoftLayer/managers/hardware.py
HardwareManager.get_create_options
def get_create_options(self): """Returns valid options for ordering hardware.""" package = self._get_package() # Locations locations = [] for region in package['regions']: locations.append({ 'name': region['location']['location']['longName'], ...
python
def get_create_options(self): """Returns valid options for ordering hardware.""" package = self._get_package() # Locations locations = [] for region in package['regions']: locations.append({ 'name': region['location']['location']['longName'], ...
[ "def", "get_create_options", "(", "self", ")", ":", "package", "=", "self", ".", "_get_package", "(", ")", "# Locations", "locations", "=", "[", "]", "for", "region", "in", "package", "[", "'regions'", "]", ":", "locations", ".", "append", "(", "{", "'na...
Returns valid options for ordering hardware.
[ "Returns", "valid", "options", "for", "ordering", "hardware", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/hardware.py#L377-L435
1,801
softlayer/softlayer-python
SoftLayer/managers/hardware.py
HardwareManager._get_package
def _get_package(self): """Get the package related to simple hardware ordering.""" mask = ''' items[ keyName, capacity, description, attributes[id,attributeTypeKeyName], itemCategory[id,categoryCode], ...
python
def _get_package(self): """Get the package related to simple hardware ordering.""" mask = ''' items[ keyName, capacity, description, attributes[id,attributeTypeKeyName], itemCategory[id,categoryCode], ...
[ "def", "_get_package", "(", "self", ")", ":", "mask", "=", "'''\n items[\n keyName,\n capacity,\n description,\n attributes[id,attributeTypeKeyName],\n itemCategory[id,categoryCode],\n softwareDescri...
Get the package related to simple hardware ordering.
[ "Get", "the", "package", "related", "to", "simple", "hardware", "ordering", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/hardware.py#L438-L457
1,802
softlayer/softlayer-python
SoftLayer/managers/hardware.py
HardwareManager._generate_create_dict
def _generate_create_dict(self, size=None, hostname=None, domain=None, location=None, os=None, port_speed=None, ...
python
def _generate_create_dict(self, size=None, hostname=None, domain=None, location=None, os=None, port_speed=None, ...
[ "def", "_generate_create_dict", "(", "self", ",", "size", "=", "None", ",", "hostname", "=", "None", ",", "domain", "=", "None", ",", "location", "=", "None", ",", "os", "=", "None", ",", "port_speed", "=", "None", ",", "ssh_keys", "=", "None", ",", ...
Translates arguments into a dictionary for creating a server.
[ "Translates", "arguments", "into", "a", "dictionary", "for", "creating", "a", "server", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/hardware.py#L459-L523
1,803
softlayer/softlayer-python
SoftLayer/managers/hardware.py
HardwareManager._get_ids_from_hostname
def _get_ids_from_hostname(self, hostname): """Returns list of matching hardware IDs for a given hostname.""" results = self.list_hardware(hostname=hostname, mask="id") return [result['id'] for result in results]
python
def _get_ids_from_hostname(self, hostname): """Returns list of matching hardware IDs for a given hostname.""" results = self.list_hardware(hostname=hostname, mask="id") return [result['id'] for result in results]
[ "def", "_get_ids_from_hostname", "(", "self", ",", "hostname", ")", ":", "results", "=", "self", ".", "list_hardware", "(", "hostname", "=", "hostname", ",", "mask", "=", "\"id\"", ")", "return", "[", "result", "[", "'id'", "]", "for", "result", "in", "r...
Returns list of matching hardware IDs for a given hostname.
[ "Returns", "list", "of", "matching", "hardware", "IDs", "for", "a", "given", "hostname", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/hardware.py#L525-L528
1,804
softlayer/softlayer-python
SoftLayer/managers/hardware.py
HardwareManager._get_ids_from_ip
def _get_ids_from_ip(self, ip): # pylint: disable=inconsistent-return-statements """Returns list of matching hardware IDs for a given ip address.""" try: # Does it look like an ip address? socket.inet_aton(ip) except socket.error: return [] # Find th...
python
def _get_ids_from_ip(self, ip): # pylint: disable=inconsistent-return-statements """Returns list of matching hardware IDs for a given ip address.""" try: # Does it look like an ip address? socket.inet_aton(ip) except socket.error: return [] # Find th...
[ "def", "_get_ids_from_ip", "(", "self", ",", "ip", ")", ":", "# pylint: disable=inconsistent-return-statements", "try", ":", "# Does it look like an ip address?", "socket", ".", "inet_aton", "(", "ip", ")", "except", "socket", ".", "error", ":", "return", "[", "]", ...
Returns list of matching hardware IDs for a given ip address.
[ "Returns", "list", "of", "matching", "hardware", "IDs", "for", "a", "given", "ip", "address", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/hardware.py#L530-L545
1,805
softlayer/softlayer-python
SoftLayer/managers/hardware.py
HardwareManager.edit
def edit(self, hardware_id, userdata=None, hostname=None, domain=None, notes=None, tags=None): """Edit hostname, domain name, notes, user data of the hardware. Parameters set to None will be ignored and not attempted to be updated. :param integer hardware_id: the instance ID to ed...
python
def edit(self, hardware_id, userdata=None, hostname=None, domain=None, notes=None, tags=None): """Edit hostname, domain name, notes, user data of the hardware. Parameters set to None will be ignored and not attempted to be updated. :param integer hardware_id: the instance ID to ed...
[ "def", "edit", "(", "self", ",", "hardware_id", ",", "userdata", "=", "None", ",", "hostname", "=", "None", ",", "domain", "=", "None", ",", "notes", "=", "None", ",", "tags", "=", "None", ")", ":", "obj", "=", "{", "}", "if", "userdata", ":", "s...
Edit hostname, domain name, notes, user data of the hardware. Parameters set to None will be ignored and not attempted to be updated. :param integer hardware_id: the instance ID to edit :param string userdata: user data on the hardware to edit. If none exist it ...
[ "Edit", "hostname", "domain", "name", "notes", "user", "data", "of", "the", "hardware", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/hardware.py#L547-L588
1,806
softlayer/softlayer-python
SoftLayer/managers/hardware.py
HardwareManager.update_firmware
def update_firmware(self, hardware_id, ipmi=True, raid_controller=True, bios=True, hard_drive=True): """Update hardware firmware. This will cause the server to be unavailable for ~20 ...
python
def update_firmware(self, hardware_id, ipmi=True, raid_controller=True, bios=True, hard_drive=True): """Update hardware firmware. This will cause the server to be unavailable for ~20 ...
[ "def", "update_firmware", "(", "self", ",", "hardware_id", ",", "ipmi", "=", "True", ",", "raid_controller", "=", "True", ",", "bios", "=", "True", ",", "hard_drive", "=", "True", ")", ":", "return", "self", ".", "hardware", ".", "createFirmwareUpdateTransac...
Update hardware firmware. This will cause the server to be unavailable for ~20 minutes. :param int hardware_id: The ID of the hardware to have its firmware updated. :param bool ipmi: Update the ipmi firmware. :param bool raid_controller: Update the raid ...
[ "Update", "hardware", "firmware", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/hardware.py#L590-L614
1,807
softlayer/softlayer-python
SoftLayer/managers/hardware.py
HardwareManager.reflash_firmware
def reflash_firmware(self, hardware_id, ipmi=True, raid_controller=True, bios=True): """Reflash hardware firmware. This will cause the server to be unavailable for ~60 minutes. The firmware will ...
python
def reflash_firmware(self, hardware_id, ipmi=True, raid_controller=True, bios=True): """Reflash hardware firmware. This will cause the server to be unavailable for ~60 minutes. The firmware will ...
[ "def", "reflash_firmware", "(", "self", ",", "hardware_id", ",", "ipmi", "=", "True", ",", "raid_controller", "=", "True", ",", "bios", "=", "True", ")", ":", "return", "self", ".", "hardware", ".", "createFirmwareReflashTransaction", "(", "bool", "(", "ipmi...
Reflash hardware firmware. This will cause the server to be unavailable for ~60 minutes. The firmware will not be upgraded but rather reflashed to the version installed. :param int hardware_id: The ID of the hardware to have its firmware reflashed. :para...
[ "Reflash", "hardware", "firmware", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/hardware.py#L616-L639
1,808
softlayer/softlayer-python
SoftLayer/managers/hardware.py
HardwareManager.wait_for_ready
def wait_for_ready(self, instance_id, limit=14400, delay=10, pending=False): """Determine if a Server is ready. A server is ready when no transactions are running on it. :param int instance_id: The instance ID with the pending transaction :param int limit: The maximum amount of seconds...
python
def wait_for_ready(self, instance_id, limit=14400, delay=10, pending=False): """Determine if a Server is ready. A server is ready when no transactions are running on it. :param int instance_id: The instance ID with the pending transaction :param int limit: The maximum amount of seconds...
[ "def", "wait_for_ready", "(", "self", ",", "instance_id", ",", "limit", "=", "14400", ",", "delay", "=", "10", ",", "pending", "=", "False", ")", ":", "now", "=", "time", ".", "time", "(", ")", "until", "=", "now", "+", "limit", "mask", "=", "\"mas...
Determine if a Server is ready. A server is ready when no transactions are running on it. :param int instance_id: The instance ID with the pending transaction :param int limit: The maximum amount of seconds to wait. :param int delay: The number of seconds to sleep before checks. Defaul...
[ "Determine", "if", "a", "Server", "is", "ready", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/hardware.py#L641-L665
1,809
softlayer/softlayer-python
SoftLayer/CLI/hardware/cancel.py
cli
def cli(env, identifier, immediate, comment, reason): """Cancel a dedicated server.""" mgr = SoftLayer.HardwareManager(env.client) hw_id = helpers.resolve_id(mgr.resolve_ids, identifier, 'hardware') if not (env.skip_confirmations or formatting.no_going_back(hw_id)): raise exceptions.CLIAbort('...
python
def cli(env, identifier, immediate, comment, reason): """Cancel a dedicated server.""" mgr = SoftLayer.HardwareManager(env.client) hw_id = helpers.resolve_id(mgr.resolve_ids, identifier, 'hardware') if not (env.skip_confirmations or formatting.no_going_back(hw_id)): raise exceptions.CLIAbort('...
[ "def", "cli", "(", "env", ",", "identifier", ",", "immediate", ",", "comment", ",", "reason", ")", ":", "mgr", "=", "SoftLayer", ".", "HardwareManager", "(", "env", ".", "client", ")", "hw_id", "=", "helpers", ".", "resolve_id", "(", "mgr", ".", "resol...
Cancel a dedicated server.
[ "Cancel", "a", "dedicated", "server", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/hardware/cancel.py#L24-L33
1,810
softlayer/softlayer-python
SoftLayer/CLI/virt/reload.py
cli
def cli(env, identifier, postinstall, key, image): """Reload operating system on a virtual server.""" vsi = SoftLayer.VSManager(env.client) vs_id = helpers.resolve_id(vsi.resolve_ids, identifier, 'VS') keys = [] if key: for single_key in key: resolver = SoftLayer.SshKeyManager(e...
python
def cli(env, identifier, postinstall, key, image): """Reload operating system on a virtual server.""" vsi = SoftLayer.VSManager(env.client) vs_id = helpers.resolve_id(vsi.resolve_ids, identifier, 'VS') keys = [] if key: for single_key in key: resolver = SoftLayer.SshKeyManager(e...
[ "def", "cli", "(", "env", ",", "identifier", ",", "postinstall", ",", "key", ",", "image", ")", ":", "vsi", "=", "SoftLayer", ".", "VSManager", "(", "env", ".", "client", ")", "vs_id", "=", "helpers", ".", "resolve_id", "(", "vsi", ".", "resolve_ids", ...
Reload operating system on a virtual server.
[ "Reload", "operating", "system", "on", "a", "virtual", "server", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/virt/reload.py#L23-L40
1,811
softlayer/softlayer-python
SoftLayer/CLI/virt/capacity/detail.py
cli
def cli(env, identifier, columns): """Reserved Capacity Group details. Will show which guests are assigned to a reservation.""" manager = CapacityManager(env.client) mask = """mask[instances[id,createDate,guestId,billingItem[id, description, recurringFee, category[name]], guest[modifyDate,id,...
python
def cli(env, identifier, columns): """Reserved Capacity Group details. Will show which guests are assigned to a reservation.""" manager = CapacityManager(env.client) mask = """mask[instances[id,createDate,guestId,billingItem[id, description, recurringFee, category[name]], guest[modifyDate,id,...
[ "def", "cli", "(", "env", ",", "identifier", ",", "columns", ")", ":", "manager", "=", "CapacityManager", "(", "env", ".", "client", ")", "mask", "=", "\"\"\"mask[instances[id,createDate,guestId,billingItem[id, description, recurringFee, category[name]],\n guest[...
Reserved Capacity Group details. Will show which guests are assigned to a reservation.
[ "Reserved", "Capacity", "Group", "details", ".", "Will", "show", "which", "guests", "are", "assigned", "to", "a", "reservation", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/virt/capacity/detail.py#L36-L57
1,812
softlayer/softlayer-python
SoftLayer/config.py
get_client_settings_args
def get_client_settings_args(**kwargs): """Retrieve client settings from user-supplied arguments. :param \\*\\*kwargs: Arguments that are passed into the client instance """ timeout = kwargs.get('timeout') if timeout is not None: timeout = float(timeout) return { 'endpoint_...
python
def get_client_settings_args(**kwargs): """Retrieve client settings from user-supplied arguments. :param \\*\\*kwargs: Arguments that are passed into the client instance """ timeout = kwargs.get('timeout') if timeout is not None: timeout = float(timeout) return { 'endpoint_...
[ "def", "get_client_settings_args", "(", "*", "*", "kwargs", ")", ":", "timeout", "=", "kwargs", ".", "get", "(", "'timeout'", ")", "if", "timeout", "is", "not", "None", ":", "timeout", "=", "float", "(", "timeout", ")", "return", "{", "'endpoint_url'", "...
Retrieve client settings from user-supplied arguments. :param \\*\\*kwargs: Arguments that are passed into the client instance
[ "Retrieve", "client", "settings", "from", "user", "-", "supplied", "arguments", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/config.py#L14-L29
1,813
softlayer/softlayer-python
SoftLayer/config.py
get_client_settings_env
def get_client_settings_env(**_): """Retrieve client settings from environment settings. :param \\*\\*kwargs: Arguments that are passed into the client instance """ return { 'proxy': os.environ.get('https_proxy'), 'username': os.environ.get('SL_USERNAME'), 'api_key': os.env...
python
def get_client_settings_env(**_): """Retrieve client settings from environment settings. :param \\*\\*kwargs: Arguments that are passed into the client instance """ return { 'proxy': os.environ.get('https_proxy'), 'username': os.environ.get('SL_USERNAME'), 'api_key': os.env...
[ "def", "get_client_settings_env", "(", "*", "*", "_", ")", ":", "return", "{", "'proxy'", ":", "os", ".", "environ", ".", "get", "(", "'https_proxy'", ")", ",", "'username'", ":", "os", ".", "environ", ".", "get", "(", "'SL_USERNAME'", ")", ",", "'api_...
Retrieve client settings from environment settings. :param \\*\\*kwargs: Arguments that are passed into the client instance
[ "Retrieve", "client", "settings", "from", "environment", "settings", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/config.py#L32-L42
1,814
softlayer/softlayer-python
SoftLayer/config.py
get_client_settings_config_file
def get_client_settings_config_file(**kwargs): # pylint: disable=inconsistent-return-statements """Retrieve client settings from the possible config file locations. :param \\*\\*kwargs: Arguments that are passed into the client instance """ config_files = ['/etc/softlayer.conf', '~/.softlayer'] ...
python
def get_client_settings_config_file(**kwargs): # pylint: disable=inconsistent-return-statements """Retrieve client settings from the possible config file locations. :param \\*\\*kwargs: Arguments that are passed into the client instance """ config_files = ['/etc/softlayer.conf', '~/.softlayer'] ...
[ "def", "get_client_settings_config_file", "(", "*", "*", "kwargs", ")", ":", "# pylint: disable=inconsistent-return-statements", "config_files", "=", "[", "'/etc/softlayer.conf'", ",", "'~/.softlayer'", "]", "if", "kwargs", ".", "get", "(", "'config_file'", ")", ":", ...
Retrieve client settings from the possible config file locations. :param \\*\\*kwargs: Arguments that are passed into the client instance
[ "Retrieve", "client", "settings", "from", "the", "possible", "config", "file", "locations", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/config.py#L45-L70
1,815
softlayer/softlayer-python
SoftLayer/config.py
get_client_settings
def get_client_settings(**kwargs): """Parse client settings. Parses settings from various input methods, preferring earlier values to later ones. The settings currently come from explicit user arguments, environmental variables and config files. :param \\*\\*kwargs: Arguments that are passed i...
python
def get_client_settings(**kwargs): """Parse client settings. Parses settings from various input methods, preferring earlier values to later ones. The settings currently come from explicit user arguments, environmental variables and config files. :param \\*\\*kwargs: Arguments that are passed i...
[ "def", "get_client_settings", "(", "*", "*", "kwargs", ")", ":", "all_settings", "=", "{", "}", "for", "setting_method", "in", "SETTING_RESOLVERS", ":", "settings", "=", "setting_method", "(", "*", "*", "kwargs", ")", "if", "settings", ":", "settings", ".", ...
Parse client settings. Parses settings from various input methods, preferring earlier values to later ones. The settings currently come from explicit user arguments, environmental variables and config files. :param \\*\\*kwargs: Arguments that are passed into the client instance
[ "Parse", "client", "settings", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/config.py#L78-L94
1,816
softlayer/softlayer-python
SoftLayer/CLI/order/category_list.py
cli
def cli(env, package_keyname, required): """List the categories of a package. :: # List the categories of Bare Metal servers slcli order category-list BARE_METAL_SERVER # List the required categories for Bare Metal servers slcli order category-list BARE_METAL_SERVER --required...
python
def cli(env, package_keyname, required): """List the categories of a package. :: # List the categories of Bare Metal servers slcli order category-list BARE_METAL_SERVER # List the required categories for Bare Metal servers slcli order category-list BARE_METAL_SERVER --required...
[ "def", "cli", "(", "env", ",", "package_keyname", ",", "required", ")", ":", "client", "=", "env", ".", "client", "manager", "=", "ordering", ".", "OrderingManager", "(", "client", ")", "table", "=", "formatting", ".", "Table", "(", "COLUMNS", ")", "cate...
List the categories of a package. :: # List the categories of Bare Metal servers slcli order category-list BARE_METAL_SERVER # List the required categories for Bare Metal servers slcli order category-list BARE_METAL_SERVER --required
[ "List", "the", "categories", "of", "a", "package", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/order/category_list.py#L19-L47
1,817
softlayer/softlayer-python
SoftLayer/managers/ssl.py
SSLManager.list_certs
def list_certs(self, method='all'): """List all certificates. :param string method: The type of certificates to list. Options are 'all', 'expired', and 'valid'. :returns: A list of dictionaries representing the requested SSL certs. Example:: #...
python
def list_certs(self, method='all'): """List all certificates. :param string method: The type of certificates to list. Options are 'all', 'expired', and 'valid'. :returns: A list of dictionaries representing the requested SSL certs. Example:: #...
[ "def", "list_certs", "(", "self", ",", "method", "=", "'all'", ")", ":", "ssl", "=", "self", ".", "client", "[", "'Account'", "]", "methods", "=", "{", "'all'", ":", "'getSecurityCertificates'", ",", "'expired'", ":", "'getExpiredSecurityCertificates'", ",", ...
List all certificates. :param string method: The type of certificates to list. Options are 'all', 'expired', and 'valid'. :returns: A list of dictionaries representing the requested SSL certs. Example:: # Get all valid SSL certs certs = mg...
[ "List", "all", "certificates", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/ssl.py#L34-L57
1,818
softlayer/softlayer-python
SoftLayer/CLI/dns/zone_list.py
cli
def cli(env): """List all zones.""" manager = SoftLayer.DNSManager(env.client) zones = manager.list_zones() table = formatting.Table(['id', 'zone', 'serial', 'updated']) table.align['serial'] = 'c' table.align['updated'] = 'c' for zone in zones: table.add_row([ zone['id...
python
def cli(env): """List all zones.""" manager = SoftLayer.DNSManager(env.client) zones = manager.list_zones() table = formatting.Table(['id', 'zone', 'serial', 'updated']) table.align['serial'] = 'c' table.align['updated'] = 'c' for zone in zones: table.add_row([ zone['id...
[ "def", "cli", "(", "env", ")", ":", "manager", "=", "SoftLayer", ".", "DNSManager", "(", "env", ".", "client", ")", "zones", "=", "manager", ".", "list_zones", "(", ")", "table", "=", "formatting", ".", "Table", "(", "[", "'id'", ",", "'zone'", ",", ...
List all zones.
[ "List", "all", "zones", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/dns/zone_list.py#L13-L30
1,819
softlayer/softlayer-python
SoftLayer/managers/file.py
FileStorageManager.list_file_volumes
def list_file_volumes(self, datacenter=None, username=None, storage_type=None, **kwargs): """Returns a list of file volumes. :param datacenter: Datacenter short name (e.g.: dal09) :param username: Name of volume. :param storage_type: Type of volume: Endurance o...
python
def list_file_volumes(self, datacenter=None, username=None, storage_type=None, **kwargs): """Returns a list of file volumes. :param datacenter: Datacenter short name (e.g.: dal09) :param username: Name of volume. :param storage_type: Type of volume: Endurance o...
[ "def", "list_file_volumes", "(", "self", ",", "datacenter", "=", "None", ",", "username", "=", "None", ",", "storage_type", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "'mask'", "not", "in", "kwargs", ":", "items", "=", "[", "'id'", ",", "'...
Returns a list of file volumes. :param datacenter: Datacenter short name (e.g.: dal09) :param username: Name of volume. :param storage_type: Type of volume: Endurance or Performance :param kwargs: :return: Returns a list of file volumes.
[ "Returns", "a", "list", "of", "file", "volumes", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/file.py#L22-L66
1,820
softlayer/softlayer-python
SoftLayer/managers/file.py
FileStorageManager.get_file_volume_details
def get_file_volume_details(self, volume_id, **kwargs): """Returns details about the specified volume. :param volume_id: ID of volume. :param kwargs: :return: Returns details about the specified volume. """ if 'mask' not in kwargs: items = [ ...
python
def get_file_volume_details(self, volume_id, **kwargs): """Returns details about the specified volume. :param volume_id: ID of volume. :param kwargs: :return: Returns details about the specified volume. """ if 'mask' not in kwargs: items = [ ...
[ "def", "get_file_volume_details", "(", "self", ",", "volume_id", ",", "*", "*", "kwargs", ")", ":", "if", "'mask'", "not", "in", "kwargs", ":", "items", "=", "[", "'id'", ",", "'username'", ",", "'password'", ",", "'capacityGb'", ",", "'bytesUsed'", ",", ...
Returns details about the specified volume. :param volume_id: ID of volume. :param kwargs: :return: Returns details about the specified volume.
[ "Returns", "details", "about", "the", "specified", "volume", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/file.py#L68-L106
1,821
softlayer/softlayer-python
SoftLayer/managers/file.py
FileStorageManager.order_replicant_volume
def order_replicant_volume(self, volume_id, snapshot_schedule, location, tier=None): """Places an order for a replicant file volume. :param volume_id: The ID of the primary volume to be replicated :param snapshot_schedule: The primary volume's snapshot ...
python
def order_replicant_volume(self, volume_id, snapshot_schedule, location, tier=None): """Places an order for a replicant file volume. :param volume_id: The ID of the primary volume to be replicated :param snapshot_schedule: The primary volume's snapshot ...
[ "def", "order_replicant_volume", "(", "self", ",", "volume_id", ",", "snapshot_schedule", ",", "location", ",", "tier", "=", "None", ")", ":", "file_mask", "=", "'billingItem[activeChildren,hourlyFlag],'", "'storageTierLevel,osType,staasVersion,'", "'hasEncryptionAtRest,snaps...
Places an order for a replicant file volume. :param volume_id: The ID of the primary volume to be replicated :param snapshot_schedule: The primary volume's snapshot schedule to use for replication :param location: The location for the ordered replicant volume ...
[ "Places", "an", "order", "for", "a", "replicant", "file", "volume", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/file.py#L205-L229
1,822
softlayer/softlayer-python
SoftLayer/managers/file.py
FileStorageManager.order_duplicate_volume
def order_duplicate_volume(self, origin_volume_id, origin_snapshot_id=None, duplicate_size=None, duplicate_iops=None, duplicate_tier_level=None, duplicate_snapshot_size=None, hourly_billing_flag=F...
python
def order_duplicate_volume(self, origin_volume_id, origin_snapshot_id=None, duplicate_size=None, duplicate_iops=None, duplicate_tier_level=None, duplicate_snapshot_size=None, hourly_billing_flag=F...
[ "def", "order_duplicate_volume", "(", "self", ",", "origin_volume_id", ",", "origin_snapshot_id", "=", "None", ",", "duplicate_size", "=", "None", ",", "duplicate_iops", "=", "None", ",", "duplicate_tier_level", "=", "None", ",", "duplicate_snapshot_size", "=", "Non...
Places an order for a duplicate file volume. :param origin_volume_id: The ID of the origin volume to be duplicated :param origin_snapshot_id: Origin snapshot ID to use for duplication :param duplicate_size: Size/capacity for the duplicate volume :param duplicate_iops: The IOPS per GB fo...
[ "Places", "an", "order", "for", "a", "duplicate", "file", "volume", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/file.py#L251-L285
1,823
softlayer/softlayer-python
SoftLayer/managers/file.py
FileStorageManager.order_modified_volume
def order_modified_volume(self, volume_id, new_size=None, new_iops=None, new_tier_level=None): """Places an order for modifying an existing file volume. :param volume_id: The ID of the volume to be modified :param new_size: The new size/capacity for the volume :param new_iops: The new I...
python
def order_modified_volume(self, volume_id, new_size=None, new_iops=None, new_tier_level=None): """Places an order for modifying an existing file volume. :param volume_id: The ID of the volume to be modified :param new_size: The new size/capacity for the volume :param new_iops: The new I...
[ "def", "order_modified_volume", "(", "self", ",", "volume_id", ",", "new_size", "=", "None", ",", "new_iops", "=", "None", ",", "new_tier_level", "=", "None", ")", ":", "mask_items", "=", "[", "'id'", ",", "'billingItem'", ",", "'storageType[keyName]'", ",", ...
Places an order for modifying an existing file volume. :param volume_id: The ID of the volume to be modified :param new_size: The new size/capacity for the volume :param new_iops: The new IOPS for the volume :param new_tier_level: The new tier level for the volume :return: Retur...
[ "Places", "an", "order", "for", "modifying", "an", "existing", "file", "volume", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/file.py#L287-L314
1,824
softlayer/softlayer-python
SoftLayer/managers/file.py
FileStorageManager.order_snapshot_space
def order_snapshot_space(self, volume_id, capacity, tier, upgrade, **kwargs): """Orders snapshot space for the given file volume. :param integer volume_id: The ID of the volume :param integer capacity: The capacity to order, in GB :param float tier: The tier level of the file volume, in...
python
def order_snapshot_space(self, volume_id, capacity, tier, upgrade, **kwargs): """Orders snapshot space for the given file volume. :param integer volume_id: The ID of the volume :param integer capacity: The capacity to order, in GB :param float tier: The tier level of the file volume, in...
[ "def", "order_snapshot_space", "(", "self", ",", "volume_id", ",", "capacity", ",", "tier", ",", "upgrade", ",", "*", "*", "kwargs", ")", ":", "file_mask", "=", "'id,billingItem[location,hourlyFlag],'", "'storageType[keyName],storageTierLevel,provisionedIops,'", "'staasVe...
Orders snapshot space for the given file volume. :param integer volume_id: The ID of the volume :param integer capacity: The capacity to order, in GB :param float tier: The tier level of the file volume, in IOPS per GB :param boolean upgrade: Flag to indicate if this order is an upgrade...
[ "Orders", "snapshot", "space", "for", "the", "given", "file", "volume", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/file.py#L406-L425
1,825
softlayer/softlayer-python
SoftLayer/CLI/dns/zone_print.py
cli
def cli(env, zone): """Print zone in BIND format.""" manager = SoftLayer.DNSManager(env.client) zone_id = helpers.resolve_id(manager.resolve_ids, zone, name='zone') env.fout(manager.dump_zone(zone_id))
python
def cli(env, zone): """Print zone in BIND format.""" manager = SoftLayer.DNSManager(env.client) zone_id = helpers.resolve_id(manager.resolve_ids, zone, name='zone') env.fout(manager.dump_zone(zone_id))
[ "def", "cli", "(", "env", ",", "zone", ")", ":", "manager", "=", "SoftLayer", ".", "DNSManager", "(", "env", ".", "client", ")", "zone_id", "=", "helpers", ".", "resolve_id", "(", "manager", ".", "resolve_ids", ",", "zone", ",", "name", "=", "'zone'", ...
Print zone in BIND format.
[ "Print", "zone", "in", "BIND", "format", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/dns/zone_print.py#L14-L19
1,826
softlayer/softlayer-python
SoftLayer/CLI/virt/power.py
rescue
def rescue(env, identifier): """Reboot into a rescue image.""" vsi = SoftLayer.VSManager(env.client) vs_id = helpers.resolve_id(vsi.resolve_ids, identifier, 'VS') if not (env.skip_confirmations or formatting.confirm("This action will reboot this VSI. Continue?")): raise exceptions.C...
python
def rescue(env, identifier): """Reboot into a rescue image.""" vsi = SoftLayer.VSManager(env.client) vs_id = helpers.resolve_id(vsi.resolve_ids, identifier, 'VS') if not (env.skip_confirmations or formatting.confirm("This action will reboot this VSI. Continue?")): raise exceptions.C...
[ "def", "rescue", "(", "env", ",", "identifier", ")", ":", "vsi", "=", "SoftLayer", ".", "VSManager", "(", "env", ".", "client", ")", "vs_id", "=", "helpers", ".", "resolve_id", "(", "vsi", ".", "resolve_ids", ",", "identifier", ",", "'VS'", ")", "if", ...
Reboot into a rescue image.
[ "Reboot", "into", "a", "rescue", "image", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/virt/power.py#L16-L25
1,827
softlayer/softlayer-python
SoftLayer/CLI/virt/power.py
reboot
def reboot(env, identifier, hard): """Reboot an active virtual server.""" virtual_guest = env.client['Virtual_Guest'] mgr = SoftLayer.HardwareManager(env.client) vs_id = helpers.resolve_id(mgr.resolve_ids, identifier, 'VS') if not (env.skip_confirmations or formatting.confirm('This will...
python
def reboot(env, identifier, hard): """Reboot an active virtual server.""" virtual_guest = env.client['Virtual_Guest'] mgr = SoftLayer.HardwareManager(env.client) vs_id = helpers.resolve_id(mgr.resolve_ids, identifier, 'VS') if not (env.skip_confirmations or formatting.confirm('This will...
[ "def", "reboot", "(", "env", ",", "identifier", ",", "hard", ")", ":", "virtual_guest", "=", "env", ".", "client", "[", "'Virtual_Guest'", "]", "mgr", "=", "SoftLayer", ".", "HardwareManager", "(", "env", ".", "client", ")", "vs_id", "=", "helpers", ".",...
Reboot an active virtual server.
[ "Reboot", "an", "active", "virtual", "server", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/virt/power.py#L34-L50
1,828
softlayer/softlayer-python
SoftLayer/CLI/virt/power.py
power_off
def power_off(env, identifier, hard): """Power off an active virtual server.""" virtual_guest = env.client['Virtual_Guest'] vsi = SoftLayer.VSManager(env.client) vs_id = helpers.resolve_id(vsi.resolve_ids, identifier, 'VS') if not (env.skip_confirmations or formatting.confirm('This will...
python
def power_off(env, identifier, hard): """Power off an active virtual server.""" virtual_guest = env.client['Virtual_Guest'] vsi = SoftLayer.VSManager(env.client) vs_id = helpers.resolve_id(vsi.resolve_ids, identifier, 'VS') if not (env.skip_confirmations or formatting.confirm('This will...
[ "def", "power_off", "(", "env", ",", "identifier", ",", "hard", ")", ":", "virtual_guest", "=", "env", ".", "client", "[", "'Virtual_Guest'", "]", "vsi", "=", "SoftLayer", ".", "VSManager", "(", "env", ".", "client", ")", "vs_id", "=", "helpers", ".", ...
Power off an active virtual server.
[ "Power", "off", "an", "active", "virtual", "server", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/virt/power.py#L57-L71
1,829
softlayer/softlayer-python
SoftLayer/CLI/virt/power.py
power_on
def power_on(env, identifier): """Power on a virtual server.""" vsi = SoftLayer.VSManager(env.client) vs_id = helpers.resolve_id(vsi.resolve_ids, identifier, 'VS') env.client['Virtual_Guest'].powerOn(id=vs_id)
python
def power_on(env, identifier): """Power on a virtual server.""" vsi = SoftLayer.VSManager(env.client) vs_id = helpers.resolve_id(vsi.resolve_ids, identifier, 'VS') env.client['Virtual_Guest'].powerOn(id=vs_id)
[ "def", "power_on", "(", "env", ",", "identifier", ")", ":", "vsi", "=", "SoftLayer", ".", "VSManager", "(", "env", ".", "client", ")", "vs_id", "=", "helpers", ".", "resolve_id", "(", "vsi", ".", "resolve_ids", ",", "identifier", ",", "'VS'", ")", "env...
Power on a virtual server.
[ "Power", "on", "a", "virtual", "server", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/virt/power.py#L77-L82
1,830
softlayer/softlayer-python
SoftLayer/CLI/virt/power.py
pause
def pause(env, identifier): """Pauses an active virtual server.""" vsi = SoftLayer.VSManager(env.client) vs_id = helpers.resolve_id(vsi.resolve_ids, identifier, 'VS') if not (env.skip_confirmations or formatting.confirm('This will pause the VS with id %s. Continue?' ...
python
def pause(env, identifier): """Pauses an active virtual server.""" vsi = SoftLayer.VSManager(env.client) vs_id = helpers.resolve_id(vsi.resolve_ids, identifier, 'VS') if not (env.skip_confirmations or formatting.confirm('This will pause the VS with id %s. Continue?' ...
[ "def", "pause", "(", "env", ",", "identifier", ")", ":", "vsi", "=", "SoftLayer", ".", "VSManager", "(", "env", ".", "client", ")", "vs_id", "=", "helpers", ".", "resolve_id", "(", "vsi", ".", "resolve_ids", ",", "identifier", ",", "'VS'", ")", "if", ...
Pauses an active virtual server.
[ "Pauses", "an", "active", "virtual", "server", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/virt/power.py#L88-L99
1,831
softlayer/softlayer-python
SoftLayer/CLI/virt/power.py
resume
def resume(env, identifier): """Resumes a paused virtual server.""" vsi = SoftLayer.VSManager(env.client) vs_id = helpers.resolve_id(vsi.resolve_ids, identifier, 'VS') env.client['Virtual_Guest'].resume(id=vs_id)
python
def resume(env, identifier): """Resumes a paused virtual server.""" vsi = SoftLayer.VSManager(env.client) vs_id = helpers.resolve_id(vsi.resolve_ids, identifier, 'VS') env.client['Virtual_Guest'].resume(id=vs_id)
[ "def", "resume", "(", "env", ",", "identifier", ")", ":", "vsi", "=", "SoftLayer", ".", "VSManager", "(", "env", ".", "client", ")", "vs_id", "=", "helpers", ".", "resolve_id", "(", "vsi", ".", "resolve_ids", ",", "identifier", ",", "'VS'", ")", "env",...
Resumes a paused virtual server.
[ "Resumes", "a", "paused", "virtual", "server", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/virt/power.py#L105-L110
1,832
softlayer/softlayer-python
SoftLayer/CLI/account/summary.py
cli
def cli(env): """Prints some various bits of information about an account""" manager = AccountManager(env.client) summary = manager.get_summary() env.fout(get_snapshot_table(summary))
python
def cli(env): """Prints some various bits of information about an account""" manager = AccountManager(env.client) summary = manager.get_summary() env.fout(get_snapshot_table(summary))
[ "def", "cli", "(", "env", ")", ":", "manager", "=", "AccountManager", "(", "env", ".", "client", ")", "summary", "=", "manager", ".", "get_summary", "(", ")", "env", ".", "fout", "(", "get_snapshot_table", "(", "summary", ")", ")" ]
Prints some various bits of information about an account
[ "Prints", "some", "various", "bits", "of", "information", "about", "an", "account" ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/account/summary.py#L13-L18
1,833
softlayer/softlayer-python
SoftLayer/CLI/account/summary.py
get_snapshot_table
def get_snapshot_table(account): """Generates a table for printing account summary data""" table = formatting.KeyValueTable(["Name", "Value"], title="Account Snapshot") table.align['Name'] = 'r' table.align['Value'] = 'l' table.add_row(['Company Name', account.get('companyName', '-')]) table.add...
python
def get_snapshot_table(account): """Generates a table for printing account summary data""" table = formatting.KeyValueTable(["Name", "Value"], title="Account Snapshot") table.align['Name'] = 'r' table.align['Value'] = 'l' table.add_row(['Company Name', account.get('companyName', '-')]) table.add...
[ "def", "get_snapshot_table", "(", "account", ")", ":", "table", "=", "formatting", ".", "KeyValueTable", "(", "[", "\"Name\"", ",", "\"Value\"", "]", ",", "title", "=", "\"Account Snapshot\"", ")", "table", ".", "align", "[", "'Name'", "]", "=", "'r'", "ta...
Generates a table for printing account summary data
[ "Generates", "a", "table", "for", "printing", "account", "summary", "data" ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/account/summary.py#L21-L39
1,834
softlayer/softlayer-python
SoftLayer/CLI/metadata.py
cli
def cli(env, prop): """Find details about this machine.""" try: if prop == 'network': env.fout(get_network()) return meta_prop = META_MAPPING.get(prop) or prop env.fout(SoftLayer.MetadataManager().get(meta_prop)) except SoftLayer.TransportError: rais...
python
def cli(env, prop): """Find details about this machine.""" try: if prop == 'network': env.fout(get_network()) return meta_prop = META_MAPPING.get(prop) or prop env.fout(SoftLayer.MetadataManager().get(meta_prop)) except SoftLayer.TransportError: rais...
[ "def", "cli", "(", "env", ",", "prop", ")", ":", "try", ":", "if", "prop", "==", "'network'", ":", "env", ".", "fout", "(", "get_network", "(", ")", ")", "return", "meta_prop", "=", "META_MAPPING", ".", "get", "(", "prop", ")", "or", "prop", "env",...
Find details about this machine.
[ "Find", "details", "about", "this", "machine", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/metadata.py#L50-L64
1,835
softlayer/softlayer-python
SoftLayer/CLI/metadata.py
get_network
def get_network(): """Returns a list of tables with public and private network details.""" meta = SoftLayer.MetadataManager() network_tables = [] for network_func in [meta.public_network, meta.private_network]: network = network_func() table = formatting.KeyValueTable(['name', 'value'])...
python
def get_network(): """Returns a list of tables with public and private network details.""" meta = SoftLayer.MetadataManager() network_tables = [] for network_func in [meta.public_network, meta.private_network]: network = network_func() table = formatting.KeyValueTable(['name', 'value'])...
[ "def", "get_network", "(", ")", ":", "meta", "=", "SoftLayer", ".", "MetadataManager", "(", ")", "network_tables", "=", "[", "]", "for", "network_func", "in", "[", "meta", ".", "public_network", ",", "meta", ".", "private_network", "]", ":", "network", "="...
Returns a list of tables with public and private network details.
[ "Returns", "a", "list", "of", "tables", "with", "public", "and", "private", "network", "details", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/metadata.py#L67-L87
1,836
softlayer/softlayer-python
SoftLayer/CLI/columns.py
get_formatter
def get_formatter(columns): """This function returns a callback to use with click options. The returned function parses a comma-separated value and returns a new ColumnFormatter. :param columns: a list of Column instances """ column_map = dict((column.name, column) for column in columns) ...
python
def get_formatter(columns): """This function returns a callback to use with click options. The returned function parses a comma-separated value and returns a new ColumnFormatter. :param columns: a list of Column instances """ column_map = dict((column.name, column) for column in columns) ...
[ "def", "get_formatter", "(", "columns", ")", ":", "column_map", "=", "dict", "(", "(", "column", ".", "name", ",", "column", ")", "for", "column", "in", "columns", ")", "def", "validate", "(", "ctx", ",", "param", ",", "value", ")", ":", "\"\"\"Click v...
This function returns a callback to use with click options. The returned function parses a comma-separated value and returns a new ColumnFormatter. :param columns: a list of Column instances
[ "This", "function", "returns", "a", "callback", "to", "use", "with", "click", "options", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/columns.py#L57-L82
1,837
softlayer/softlayer-python
SoftLayer/CLI/columns.py
ColumnFormatter.add_column
def add_column(self, column): """Add a new column along with a formatting function.""" self.columns.append(column.name) self.column_funcs.append(column.path) if column.mask is not None: self.mask_parts.add(column.mask)
python
def add_column(self, column): """Add a new column along with a formatting function.""" self.columns.append(column.name) self.column_funcs.append(column.path) if column.mask is not None: self.mask_parts.add(column.mask)
[ "def", "add_column", "(", "self", ",", "column", ")", ":", "self", ".", "columns", ".", "append", "(", "column", ".", "name", ")", "self", ".", "column_funcs", ".", "append", "(", "column", ".", "path", ")", "if", "column", ".", "mask", "is", "not", ...
Add a new column along with a formatting function.
[ "Add", "a", "new", "column", "along", "with", "a", "formatting", "function", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/columns.py#L36-L42
1,838
softlayer/softlayer-python
SoftLayer/CLI/columns.py
ColumnFormatter.row
def row(self, data): """Return a formatted row for the given data.""" for column in self.column_funcs: if callable(column): yield column(data) else: yield utils.lookup(data, *column)
python
def row(self, data): """Return a formatted row for the given data.""" for column in self.column_funcs: if callable(column): yield column(data) else: yield utils.lookup(data, *column)
[ "def", "row", "(", "self", ",", "data", ")", ":", "for", "column", "in", "self", ".", "column_funcs", ":", "if", "callable", "(", "column", ")", ":", "yield", "column", "(", "data", ")", "else", ":", "yield", "utils", ".", "lookup", "(", "data", ",...
Return a formatted row for the given data.
[ "Return", "a", "formatted", "row", "for", "the", "given", "data", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/columns.py#L44-L50
1,839
softlayer/softlayer-python
SoftLayer/CLI/cdn/origin_remove.py
cli
def cli(env, account_id, origin_id): """Remove an origin pull mapping.""" manager = SoftLayer.CDNManager(env.client) manager.remove_origin(account_id, origin_id)
python
def cli(env, account_id, origin_id): """Remove an origin pull mapping.""" manager = SoftLayer.CDNManager(env.client) manager.remove_origin(account_id, origin_id)
[ "def", "cli", "(", "env", ",", "account_id", ",", "origin_id", ")", ":", "manager", "=", "SoftLayer", ".", "CDNManager", "(", "env", ".", "client", ")", "manager", ".", "remove_origin", "(", "account_id", ",", "origin_id", ")" ]
Remove an origin pull mapping.
[ "Remove", "an", "origin", "pull", "mapping", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/cdn/origin_remove.py#L14-L18
1,840
softlayer/softlayer-python
SoftLayer/CLI/cdn/list.py
cli
def cli(env, sortby): """List all CDN accounts.""" manager = SoftLayer.CDNManager(env.client) accounts = manager.list_accounts() table = formatting.Table(['id', 'account_name', 'type', 'created', ...
python
def cli(env, sortby): """List all CDN accounts.""" manager = SoftLayer.CDNManager(env.client) accounts = manager.list_accounts() table = formatting.Table(['id', 'account_name', 'type', 'created', ...
[ "def", "cli", "(", "env", ",", "sortby", ")", ":", "manager", "=", "SoftLayer", ".", "CDNManager", "(", "env", ".", "client", ")", "accounts", "=", "manager", ".", "list_accounts", "(", ")", "table", "=", "formatting", ".", "Table", "(", "[", "'id'", ...
List all CDN accounts.
[ "List", "all", "CDN", "accounts", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/cdn/list.py#L22-L43
1,841
softlayer/softlayer-python
SoftLayer/CLI/file/snapshot/list.py
cli
def cli(env, volume_id, sortby, columns): """List file storage snapshots.""" file_manager = SoftLayer.FileStorageManager(env.client) snapshots = file_manager.get_file_volume_snapshot_list( volume_id, mask=columns.mask() ) table = formatting.Table(columns.columns) table.sortby = ...
python
def cli(env, volume_id, sortby, columns): """List file storage snapshots.""" file_manager = SoftLayer.FileStorageManager(env.client) snapshots = file_manager.get_file_volume_snapshot_list( volume_id, mask=columns.mask() ) table = formatting.Table(columns.columns) table.sortby = ...
[ "def", "cli", "(", "env", ",", "volume_id", ",", "sortby", ",", "columns", ")", ":", "file_manager", "=", "SoftLayer", ".", "FileStorageManager", "(", "env", ".", "client", ")", "snapshots", "=", "file_manager", ".", "get_file_volume_snapshot_list", "(", "volu...
List file storage snapshots.
[ "List", "file", "storage", "snapshots", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/file/snapshot/list.py#L38-L53
1,842
softlayer/softlayer-python
SoftLayer/managers/vs.py
VSManager.list_instances
def list_instances(self, hourly=True, monthly=True, tags=None, cpus=None, memory=None, hostname=None, domain=None, local_disk=None, datacenter=None, nic_speed=None, public_ip=None, private_ip=None, **kwargs): """Retrieve a list of all virtual ...
python
def list_instances(self, hourly=True, monthly=True, tags=None, cpus=None, memory=None, hostname=None, domain=None, local_disk=None, datacenter=None, nic_speed=None, public_ip=None, private_ip=None, **kwargs): """Retrieve a list of all virtual ...
[ "def", "list_instances", "(", "self", ",", "hourly", "=", "True", ",", "monthly", "=", "True", ",", "tags", "=", "None", ",", "cpus", "=", "None", ",", "memory", "=", "None", ",", "hostname", "=", "None", ",", "domain", "=", "None", ",", "local_disk"...
Retrieve a list of all virtual servers on the account. Example:: # Print out a list of hourly instances in the DAL05 data center. for vsi in mgr.list_instances(hourly=True, datacenter='dal05'): print vsi['fullyQualifiedDomainName'], vsi['primaryIpAddress'] ...
[ "Retrieve", "a", "list", "of", "all", "virtual", "servers", "on", "the", "account", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/vs.py#L61-L162
1,843
softlayer/softlayer-python
SoftLayer/managers/vs.py
VSManager.get_instance
def get_instance(self, instance_id, **kwargs): """Get details about a virtual server instance. :param integer instance_id: the instance ID :returns: A dictionary containing a large amount of information about the specified instance. Example:: # Print out ...
python
def get_instance(self, instance_id, **kwargs): """Get details about a virtual server instance. :param integer instance_id: the instance ID :returns: A dictionary containing a large amount of information about the specified instance. Example:: # Print out ...
[ "def", "get_instance", "(", "self", ",", "instance_id", ",", "*", "*", "kwargs", ")", ":", "if", "'mask'", "not", "in", "kwargs", ":", "kwargs", "[", "'mask'", "]", "=", "(", "'id,'", "'globalIdentifier,'", "'fullyQualifiedDomainName,'", "'hostname,'", "'domai...
Get details about a virtual server instance. :param integer instance_id: the instance ID :returns: A dictionary containing a large amount of information about the specified instance. Example:: # Print out instance ID 12345. vsi = mgr.get_instance(1234...
[ "Get", "details", "about", "a", "virtual", "server", "instance", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/vs.py#L165-L240
1,844
softlayer/softlayer-python
SoftLayer/managers/vs.py
VSManager.reload_instance
def reload_instance(self, instance_id, post_uri=None, ssh_keys=None, image_id=None): """Perform an OS reload of an instance. :param integer instance_id: the instance ID to reload :param string post_url: The URI of the post-...
python
def reload_instance(self, instance_id, post_uri=None, ssh_keys=None, image_id=None): """Perform an OS reload of an instance. :param integer instance_id: the instance ID to reload :param string post_url: The URI of the post-...
[ "def", "reload_instance", "(", "self", ",", "instance_id", ",", "post_uri", "=", "None", ",", "ssh_keys", "=", "None", ",", "image_id", "=", "None", ")", ":", "config", "=", "{", "}", "if", "post_uri", ":", "config", "[", "'customProvisionScriptUri'", "]",...
Perform an OS reload of an instance. :param integer instance_id: the instance ID to reload :param string post_url: The URI of the post-install script to run after reload :param list ssh_keys: The SSH keys to add to the root user :param int image_id: The G...
[ "Perform", "an", "OS", "reload", "of", "an", "instance", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/vs.py#L269-L305
1,845
softlayer/softlayer-python
SoftLayer/managers/vs.py
VSManager.wait_for_transaction
def wait_for_transaction(self, instance_id, limit, delay=10): """Waits on a VS transaction for the specified amount of time. This is really just a wrapper for wait_for_ready(pending=True). Provided for backwards compatibility. :param int instance_id: The instance ID with the pending tr...
python
def wait_for_transaction(self, instance_id, limit, delay=10): """Waits on a VS transaction for the specified amount of time. This is really just a wrapper for wait_for_ready(pending=True). Provided for backwards compatibility. :param int instance_id: The instance ID with the pending tr...
[ "def", "wait_for_transaction", "(", "self", ",", "instance_id", ",", "limit", ",", "delay", "=", "10", ")", ":", "return", "self", ".", "wait_for_ready", "(", "instance_id", ",", "limit", ",", "delay", "=", "delay", ",", "pending", "=", "True", ")" ]
Waits on a VS transaction for the specified amount of time. This is really just a wrapper for wait_for_ready(pending=True). Provided for backwards compatibility. :param int instance_id: The instance ID with the pending transaction :param int limit: The maximum amount of time to wait. ...
[ "Waits", "on", "a", "VS", "transaction", "for", "the", "specified", "amount", "of", "time", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/vs.py#L442-L453
1,846
softlayer/softlayer-python
SoftLayer/managers/vs.py
VSManager.verify_create_instance
def verify_create_instance(self, **kwargs): """Verifies an instance creation command. Without actually placing an order. See :func:`create_instance` for a list of available options. Example:: new_vsi = { 'domain': u'test01.labs.sftlyr.ws', '...
python
def verify_create_instance(self, **kwargs): """Verifies an instance creation command. Without actually placing an order. See :func:`create_instance` for a list of available options. Example:: new_vsi = { 'domain': u'test01.labs.sftlyr.ws', '...
[ "def", "verify_create_instance", "(", "self", ",", "*", "*", "kwargs", ")", ":", "kwargs", ".", "pop", "(", "'tags'", ",", "None", ")", "create_options", "=", "self", ".", "_generate_create_dict", "(", "*", "*", "kwargs", ")", "return", "self", ".", "gue...
Verifies an instance creation command. Without actually placing an order. See :func:`create_instance` for a list of available options. Example:: new_vsi = { 'domain': u'test01.labs.sftlyr.ws', 'hostname': u'minion05', 'datacenter': u...
[ "Verifies", "an", "instance", "creation", "command", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/vs.py#L493-L524
1,847
softlayer/softlayer-python
SoftLayer/managers/vs.py
VSManager.create_instance
def create_instance(self, **kwargs): """Creates a new virtual server instance. .. warning:: This will add charges to your account Example:: new_vsi = { 'domain': u'test01.labs.sftlyr.ws', 'hostname': u'minion05', 'datace...
python
def create_instance(self, **kwargs): """Creates a new virtual server instance. .. warning:: This will add charges to your account Example:: new_vsi = { 'domain': u'test01.labs.sftlyr.ws', 'hostname': u'minion05', 'datace...
[ "def", "create_instance", "(", "self", ",", "*", "*", "kwargs", ")", ":", "tags", "=", "kwargs", ".", "pop", "(", "'tags'", ",", "None", ")", "inst", "=", "self", ".", "guest", ".", "createObject", "(", "self", ".", "_generate_create_dict", "(", "*", ...
Creates a new virtual server instance. .. warning:: This will add charges to your account Example:: new_vsi = { 'domain': u'test01.labs.sftlyr.ws', 'hostname': u'minion05', 'datacenter': u'hkg02', 'flavor': 'BL1_...
[ "Creates", "a", "new", "virtual", "server", "instance", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/vs.py#L526-L584
1,848
softlayer/softlayer-python
SoftLayer/managers/vs.py
VSManager.set_tags
def set_tags(self, tags, guest_id): """Sets tags on a guest with a retry decorator Just calls guest.setTags, but if it fails from an APIError will retry """ self.guest.setTags(tags, id=guest_id)
python
def set_tags(self, tags, guest_id): """Sets tags on a guest with a retry decorator Just calls guest.setTags, but if it fails from an APIError will retry """ self.guest.setTags(tags, id=guest_id)
[ "def", "set_tags", "(", "self", ",", "tags", ",", "guest_id", ")", ":", "self", ".", "guest", ".", "setTags", "(", "tags", ",", "id", "=", "guest_id", ")" ]
Sets tags on a guest with a retry decorator Just calls guest.setTags, but if it fails from an APIError will retry
[ "Sets", "tags", "on", "a", "guest", "with", "a", "retry", "decorator" ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/vs.py#L587-L592
1,849
softlayer/softlayer-python
SoftLayer/managers/vs.py
VSManager.create_instances
def create_instances(self, config_list): """Creates multiple virtual server instances. This takes a list of dictionaries using the same arguments as create_instance(). .. warning:: This will add charges to your account Example:: # Define the instance ...
python
def create_instances(self, config_list): """Creates multiple virtual server instances. This takes a list of dictionaries using the same arguments as create_instance(). .. warning:: This will add charges to your account Example:: # Define the instance ...
[ "def", "create_instances", "(", "self", ",", "config_list", ")", ":", "tags", "=", "[", "conf", ".", "pop", "(", "'tags'", ",", "None", ")", "for", "conf", "in", "config_list", "]", "resp", "=", "self", ".", "guest", ".", "createObjects", "(", "[", "...
Creates multiple virtual server instances. This takes a list of dictionaries using the same arguments as create_instance(). .. warning:: This will add charges to your account Example:: # Define the instance we want to create. new_vsi = { ...
[ "Creates", "multiple", "virtual", "server", "instances", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/vs.py#L594-L644
1,850
softlayer/softlayer-python
SoftLayer/managers/vs.py
VSManager.change_port_speed
def change_port_speed(self, instance_id, public, speed): """Allows you to change the port speed of a virtual server's NICs. Example:: #change the Public interface to 10Mbps on instance 12345 result = mgr.change_port_speed(instance_id=12345, ...
python
def change_port_speed(self, instance_id, public, speed): """Allows you to change the port speed of a virtual server's NICs. Example:: #change the Public interface to 10Mbps on instance 12345 result = mgr.change_port_speed(instance_id=12345, ...
[ "def", "change_port_speed", "(", "self", ",", "instance_id", ",", "public", ",", "speed", ")", ":", "if", "public", ":", "return", "self", ".", "client", ".", "call", "(", "'Virtual_Guest'", ",", "'setPublicNetworkInterfaceSpeed'", ",", "speed", ",", "id", "...
Allows you to change the port speed of a virtual server's NICs. Example:: #change the Public interface to 10Mbps on instance 12345 result = mgr.change_port_speed(instance_id=12345, public=True, speed=10) # result will be True or an Ex...
[ "Allows", "you", "to", "change", "the", "port", "speed", "of", "a", "virtual", "server", "s", "NICs", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/vs.py#L646-L670
1,851
softlayer/softlayer-python
SoftLayer/managers/vs.py
VSManager._get_ids_from_hostname
def _get_ids_from_hostname(self, hostname): """List VS ids which match the given hostname.""" results = self.list_instances(hostname=hostname, mask="id") return [result['id'] for result in results]
python
def _get_ids_from_hostname(self, hostname): """List VS ids which match the given hostname.""" results = self.list_instances(hostname=hostname, mask="id") return [result['id'] for result in results]
[ "def", "_get_ids_from_hostname", "(", "self", ",", "hostname", ")", ":", "results", "=", "self", ".", "list_instances", "(", "hostname", "=", "hostname", ",", "mask", "=", "\"id\"", ")", "return", "[", "result", "[", "'id'", "]", "for", "result", "in", "...
List VS ids which match the given hostname.
[ "List", "VS", "ids", "which", "match", "the", "given", "hostname", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/vs.py#L672-L675
1,852
softlayer/softlayer-python
SoftLayer/managers/vs.py
VSManager._get_ids_from_ip
def _get_ids_from_ip(self, ip_address): # pylint: disable=inconsistent-return-statements """List VS ids which match the given ip address.""" try: # Does it look like an ip address? socket.inet_aton(ip_address) except socket.error: return [] # Find th...
python
def _get_ids_from_ip(self, ip_address): # pylint: disable=inconsistent-return-statements """List VS ids which match the given ip address.""" try: # Does it look like an ip address? socket.inet_aton(ip_address) except socket.error: return [] # Find th...
[ "def", "_get_ids_from_ip", "(", "self", ",", "ip_address", ")", ":", "# pylint: disable=inconsistent-return-statements", "try", ":", "# Does it look like an ip address?", "socket", ".", "inet_aton", "(", "ip_address", ")", "except", "socket", ".", "error", ":", "return"...
List VS ids which match the given ip address.
[ "List", "VS", "ids", "which", "match", "the", "given", "ip", "address", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/vs.py#L677-L692
1,853
softlayer/softlayer-python
SoftLayer/managers/vs.py
VSManager.upgrade
def upgrade(self, instance_id, cpus=None, memory=None, nic_speed=None, public=True, preset=None): """Upgrades a VS instance. Example:: # Upgrade instance 12345 to 4 CPUs and 4 GB of memory import SoftLayer client = SoftLayer.create_client_from_env() mgr = So...
python
def upgrade(self, instance_id, cpus=None, memory=None, nic_speed=None, public=True, preset=None): """Upgrades a VS instance. Example:: # Upgrade instance 12345 to 4 CPUs and 4 GB of memory import SoftLayer client = SoftLayer.create_client_from_env() mgr = So...
[ "def", "upgrade", "(", "self", ",", "instance_id", ",", "cpus", "=", "None", ",", "memory", "=", "None", ",", "nic_speed", "=", "None", ",", "public", "=", "True", ",", "preset", "=", "None", ")", ":", "upgrade_prices", "=", "self", ".", "_get_upgrade_...
Upgrades a VS instance. Example:: # Upgrade instance 12345 to 4 CPUs and 4 GB of memory import SoftLayer client = SoftLayer.create_client_from_env() mgr = SoftLayer.VSManager(client) mgr.upgrade(12345, cpus=4, memory=4) :param int instance_id: In...
[ "Upgrades", "a", "VS", "instance", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/vs.py#L801-L867
1,854
softlayer/softlayer-python
SoftLayer/managers/vs.py
VSManager._get_package_items
def _get_package_items(self): """Following Method gets all the item ids related to VS. Deprecated in favor of _get_upgrade_prices() """ warnings.warn("use _get_upgrade_prices() instead", DeprecationWarning) mask = [ 'description', 'c...
python
def _get_package_items(self): """Following Method gets all the item ids related to VS. Deprecated in favor of _get_upgrade_prices() """ warnings.warn("use _get_upgrade_prices() instead", DeprecationWarning) mask = [ 'description', 'c...
[ "def", "_get_package_items", "(", "self", ")", ":", "warnings", ".", "warn", "(", "\"use _get_upgrade_prices() instead\"", ",", "DeprecationWarning", ")", "mask", "=", "[", "'description'", ",", "'capacity'", ",", "'units'", ",", "'prices[id,locationGroupId,categories[n...
Following Method gets all the item ids related to VS. Deprecated in favor of _get_upgrade_prices()
[ "Following", "Method", "gets", "all", "the", "item", "ids", "related", "to", "VS", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/vs.py#L927-L946
1,855
softlayer/softlayer-python
SoftLayer/managers/vs.py
VSManager._get_upgrade_prices
def _get_upgrade_prices(self, instance_id, include_downgrade_options=True): """Following Method gets all the price ids related to upgrading a VS. :param int instance_id: Instance id of the VS to be upgraded :returns: list """ mask = [ 'id', 'locationGrou...
python
def _get_upgrade_prices(self, instance_id, include_downgrade_options=True): """Following Method gets all the price ids related to upgrading a VS. :param int instance_id: Instance id of the VS to be upgraded :returns: list """ mask = [ 'id', 'locationGrou...
[ "def", "_get_upgrade_prices", "(", "self", ",", "instance_id", ",", "include_downgrade_options", "=", "True", ")", ":", "mask", "=", "[", "'id'", ",", "'locationGroupId'", ",", "'categories[name,id,categoryCode]'", ",", "'item[description,capacity,units]'", "]", "mask",...
Following Method gets all the price ids related to upgrading a VS. :param int instance_id: Instance id of the VS to be upgraded :returns: list
[ "Following", "Method", "gets", "all", "the", "price", "ids", "related", "to", "upgrading", "a", "VS", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/vs.py#L948-L962
1,856
softlayer/softlayer-python
SoftLayer/managers/vs.py
VSManager._get_price_id_for_upgrade_option
def _get_price_id_for_upgrade_option(self, upgrade_prices, option, value, public=True): """Find the price id for the option and value to upgrade. This :param list upgrade_prices: Contains all the prices related to a VS upgrade :param string option: Describes type of parameter to be upgraded ...
python
def _get_price_id_for_upgrade_option(self, upgrade_prices, option, value, public=True): """Find the price id for the option and value to upgrade. This :param list upgrade_prices: Contains all the prices related to a VS upgrade :param string option: Describes type of parameter to be upgraded ...
[ "def", "_get_price_id_for_upgrade_option", "(", "self", ",", "upgrade_prices", ",", "option", ",", "value", ",", "public", "=", "True", ")", ":", "option_category", "=", "{", "'memory'", ":", "'ram'", ",", "'cpus'", ":", "'guest_core'", ",", "'nic_speed'", ":"...
Find the price id for the option and value to upgrade. This :param list upgrade_prices: Contains all the prices related to a VS upgrade :param string option: Describes type of parameter to be upgraded :param int value: The value of the parameter to be upgraded :param bool public: CPU wi...
[ "Find", "the", "price", "id", "for", "the", "option", "and", "value", "to", "upgrade", ".", "This" ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/vs.py#L965-L1003
1,857
softlayer/softlayer-python
SoftLayer/managers/vs.py
VSManager._get_price_id_for_upgrade
def _get_price_id_for_upgrade(self, package_items, option, value, public=True): """Find the price id for the option and value to upgrade. Deprecated in favor of _get_price_id_for_upgrade_option() :param list package_items: Contains all the items related to an VS :param string option: D...
python
def _get_price_id_for_upgrade(self, package_items, option, value, public=True): """Find the price id for the option and value to upgrade. Deprecated in favor of _get_price_id_for_upgrade_option() :param list package_items: Contains all the items related to an VS :param string option: D...
[ "def", "_get_price_id_for_upgrade", "(", "self", ",", "package_items", ",", "option", ",", "value", ",", "public", "=", "True", ")", ":", "warnings", ".", "warn", "(", "\"use _get_price_id_for_upgrade_option() instead\"", ",", "DeprecationWarning", ")", "option_catego...
Find the price id for the option and value to upgrade. Deprecated in favor of _get_price_id_for_upgrade_option() :param list package_items: Contains all the items related to an VS :param string option: Describes type of parameter to be upgraded :param int value: The value of the parame...
[ "Find", "the", "price", "id", "for", "the", "option", "and", "value", "to", "upgrade", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/vs.py#L1006-L1048
1,858
softlayer/softlayer-python
SoftLayer/CLI/securitygroup/interface.py
interface_list
def interface_list(env, securitygroup_id, sortby): """List interfaces associated with security groups.""" mgr = SoftLayer.NetworkManager(env.client) table = formatting.Table(COLUMNS) table.sortby = sortby mask = ( '''networkComponentBindings[ networkComponentId, net...
python
def interface_list(env, securitygroup_id, sortby): """List interfaces associated with security groups.""" mgr = SoftLayer.NetworkManager(env.client) table = formatting.Table(COLUMNS) table.sortby = sortby mask = ( '''networkComponentBindings[ networkComponentId, net...
[ "def", "interface_list", "(", "env", ",", "securitygroup_id", ",", "sortby", ")", ":", "mgr", "=", "SoftLayer", ".", "NetworkManager", "(", "env", ".", "client", ")", "table", "=", "formatting", ".", "Table", "(", "COLUMNS", ")", "table", ".", "sortby", ...
List interfaces associated with security groups.
[ "List", "interfaces", "associated", "with", "security", "groups", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/securitygroup/interface.py#L26-L75
1,859
softlayer/softlayer-python
SoftLayer/CLI/securitygroup/interface.py
add
def add(env, securitygroup_id, network_component, server, interface): """Attach an interface to a security group.""" _validate_args(network_component, server, interface) mgr = SoftLayer.NetworkManager(env.client) component_id = _get_component_id(env, network_component, server, interface) ret = mgr...
python
def add(env, securitygroup_id, network_component, server, interface): """Attach an interface to a security group.""" _validate_args(network_component, server, interface) mgr = SoftLayer.NetworkManager(env.client) component_id = _get_component_id(env, network_component, server, interface) ret = mgr...
[ "def", "add", "(", "env", ",", "securitygroup_id", ",", "network_component", ",", "server", ",", "interface", ")", ":", "_validate_args", "(", "network_component", ",", "server", ",", "interface", ")", "mgr", "=", "SoftLayer", ".", "NetworkManager", "(", "env"...
Attach an interface to a security group.
[ "Attach", "an", "interface", "to", "a", "security", "group", "." ]
9f181be08cc3668353b05a6de0cb324f52cff6fa
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/securitygroup/interface.py#L88-L103
1,860
edx/XBlock
xblock/plugin.py
default_select
def default_select(identifier, all_entry_points): # pylint: disable=inconsistent-return-statements """ Raise an exception when we have ambiguous entry points. """ if len(all_entry_points) == 0: raise PluginMissingError(identifier) elif len(all_entry_points) == 1: return all_entry_...
python
def default_select(identifier, all_entry_points): # pylint: disable=inconsistent-return-statements """ Raise an exception when we have ambiguous entry points. """ if len(all_entry_points) == 0: raise PluginMissingError(identifier) elif len(all_entry_points) == 1: return all_entry_...
[ "def", "default_select", "(", "identifier", ",", "all_entry_points", ")", ":", "# pylint: disable=inconsistent-return-statements", "if", "len", "(", "all_entry_points", ")", "==", "0", ":", "raise", "PluginMissingError", "(", "identifier", ")", "elif", "len", "(", "...
Raise an exception when we have ambiguous entry points.
[ "Raise", "an", "exception", "when", "we", "have", "ambiguous", "entry", "points", "." ]
368bf46e2c0ee69bbb21817f428c4684936e18ee
https://github.com/edx/XBlock/blob/368bf46e2c0ee69bbb21817f428c4684936e18ee/xblock/plugin.py#L34-L46
1,861
edx/XBlock
xblock/plugin.py
Plugin._load_class_entry_point
def _load_class_entry_point(cls, entry_point): """ Load `entry_point`, and set the `entry_point.name` as the attribute `plugin_name` on the loaded object """ class_ = entry_point.load() setattr(class_, 'plugin_name', entry_point.name) return class_
python
def _load_class_entry_point(cls, entry_point): """ Load `entry_point`, and set the `entry_point.name` as the attribute `plugin_name` on the loaded object """ class_ = entry_point.load() setattr(class_, 'plugin_name', entry_point.name) return class_
[ "def", "_load_class_entry_point", "(", "cls", ",", "entry_point", ")", ":", "class_", "=", "entry_point", ".", "load", "(", ")", "setattr", "(", "class_", ",", "'plugin_name'", ",", "entry_point", ".", "name", ")", "return", "class_" ]
Load `entry_point`, and set the `entry_point.name` as the attribute `plugin_name` on the loaded object
[ "Load", "entry_point", "and", "set", "the", "entry_point", ".", "name", "as", "the", "attribute", "plugin_name", "on", "the", "loaded", "object" ]
368bf46e2c0ee69bbb21817f428c4684936e18ee
https://github.com/edx/XBlock/blob/368bf46e2c0ee69bbb21817f428c4684936e18ee/xblock/plugin.py#L70-L77
1,862
edx/XBlock
xblock/plugin.py
Plugin.load_class
def load_class(cls, identifier, default=None, select=None): """Load a single class specified by identifier. If `identifier` specifies more than a single class, and `select` is not None, then call `select` on the list of entry_points. Otherwise, choose the first one and log a warning. ...
python
def load_class(cls, identifier, default=None, select=None): """Load a single class specified by identifier. If `identifier` specifies more than a single class, and `select` is not None, then call `select` on the list of entry_points. Otherwise, choose the first one and log a warning. ...
[ "def", "load_class", "(", "cls", ",", "identifier", ",", "default", "=", "None", ",", "select", "=", "None", ")", ":", "identifier", "=", "identifier", ".", "lower", "(", ")", "key", "=", "(", "cls", ".", "entry_point", ",", "identifier", ")", "if", ...
Load a single class specified by identifier. If `identifier` specifies more than a single class, and `select` is not None, then call `select` on the list of entry_points. Otherwise, choose the first one and log a warning. If `default` is provided, return it if no entry_point matching ...
[ "Load", "a", "single", "class", "specified", "by", "identifier", "." ]
368bf46e2c0ee69bbb21817f428c4684936e18ee
https://github.com/edx/XBlock/blob/368bf46e2c0ee69bbb21817f428c4684936e18ee/xblock/plugin.py#L80-L122
1,863
edx/XBlock
xblock/plugin.py
Plugin.load_classes
def load_classes(cls, fail_silently=True): """Load all the classes for a plugin. Produces a sequence containing the identifiers and their corresponding classes for all of the available instances of this plugin. fail_silently causes the code to simply log warnings if a plugin ca...
python
def load_classes(cls, fail_silently=True): """Load all the classes for a plugin. Produces a sequence containing the identifiers and their corresponding classes for all of the available instances of this plugin. fail_silently causes the code to simply log warnings if a plugin ca...
[ "def", "load_classes", "(", "cls", ",", "fail_silently", "=", "True", ")", ":", "all_classes", "=", "itertools", ".", "chain", "(", "pkg_resources", ".", "iter_entry_points", "(", "cls", ".", "entry_point", ")", ",", "(", "entry_point", "for", "identifier", ...
Load all the classes for a plugin. Produces a sequence containing the identifiers and their corresponding classes for all of the available instances of this plugin. fail_silently causes the code to simply log warnings if a plugin cannot import. The goal is to be able to use part of ...
[ "Load", "all", "the", "classes", "for", "a", "plugin", "." ]
368bf46e2c0ee69bbb21817f428c4684936e18ee
https://github.com/edx/XBlock/blob/368bf46e2c0ee69bbb21817f428c4684936e18ee/xblock/plugin.py#L125-L151
1,864
edx/XBlock
xblock/plugin.py
Plugin.register_temp_plugin
def register_temp_plugin(cls, class_, identifier=None, dist='xblock'): """Decorate a function to run with a temporary plugin available. Use it like this in tests:: @register_temp_plugin(MyXBlockClass): def test_the_thing(): # Here I can load MyXBlockClass by nam...
python
def register_temp_plugin(cls, class_, identifier=None, dist='xblock'): """Decorate a function to run with a temporary plugin available. Use it like this in tests:: @register_temp_plugin(MyXBlockClass): def test_the_thing(): # Here I can load MyXBlockClass by nam...
[ "def", "register_temp_plugin", "(", "cls", ",", "class_", ",", "identifier", "=", "None", ",", "dist", "=", "'xblock'", ")", ":", "from", "mock", "import", "Mock", "if", "identifier", "is", "None", ":", "identifier", "=", "class_", ".", "__name__", ".", ...
Decorate a function to run with a temporary plugin available. Use it like this in tests:: @register_temp_plugin(MyXBlockClass): def test_the_thing(): # Here I can load MyXBlockClass by name.
[ "Decorate", "a", "function", "to", "run", "with", "a", "temporary", "plugin", "available", "." ]
368bf46e2c0ee69bbb21817f428c4684936e18ee
https://github.com/edx/XBlock/blob/368bf46e2c0ee69bbb21817f428c4684936e18ee/xblock/plugin.py#L154-L192
1,865
edx/XBlock
xblock/django/request.py
webob_to_django_response
def webob_to_django_response(webob_response): """Returns a django response to the `webob_response`""" from django.http import HttpResponse django_response = HttpResponse( webob_response.app_iter, content_type=webob_response.content_type, status=webob_response.status_code, ) f...
python
def webob_to_django_response(webob_response): """Returns a django response to the `webob_response`""" from django.http import HttpResponse django_response = HttpResponse( webob_response.app_iter, content_type=webob_response.content_type, status=webob_response.status_code, ) f...
[ "def", "webob_to_django_response", "(", "webob_response", ")", ":", "from", "django", ".", "http", "import", "HttpResponse", "django_response", "=", "HttpResponse", "(", "webob_response", ".", "app_iter", ",", "content_type", "=", "webob_response", ".", "content_type"...
Returns a django response to the `webob_response`
[ "Returns", "a", "django", "response", "to", "the", "webob_response" ]
368bf46e2c0ee69bbb21817f428c4684936e18ee
https://github.com/edx/XBlock/blob/368bf46e2c0ee69bbb21817f428c4684936e18ee/xblock/django/request.py#L14-L24
1,866
edx/XBlock
xblock/django/request.py
querydict_to_multidict
def querydict_to_multidict(query_dict, wrap=None): """ Returns a new `webob.MultiDict` from a `django.http.QueryDict`. If `wrap` is provided, it's used to wrap the values. """ wrap = wrap or (lambda val: val) return MultiDict(chain.from_iterable( six.moves.zip(repeat(key), (wrap(v) for...
python
def querydict_to_multidict(query_dict, wrap=None): """ Returns a new `webob.MultiDict` from a `django.http.QueryDict`. If `wrap` is provided, it's used to wrap the values. """ wrap = wrap or (lambda val: val) return MultiDict(chain.from_iterable( six.moves.zip(repeat(key), (wrap(v) for...
[ "def", "querydict_to_multidict", "(", "query_dict", ",", "wrap", "=", "None", ")", ":", "wrap", "=", "wrap", "or", "(", "lambda", "val", ":", "val", ")", "return", "MultiDict", "(", "chain", ".", "from_iterable", "(", "six", ".", "moves", ".", "zip", "...
Returns a new `webob.MultiDict` from a `django.http.QueryDict`. If `wrap` is provided, it's used to wrap the values.
[ "Returns", "a", "new", "webob", ".", "MultiDict", "from", "a", "django", ".", "http", ".", "QueryDict", "." ]
368bf46e2c0ee69bbb21817f428c4684936e18ee
https://github.com/edx/XBlock/blob/368bf46e2c0ee69bbb21817f428c4684936e18ee/xblock/django/request.py#L76-L87
1,867
edx/XBlock
xblock/django/request.py
HeaderDict._meta_name
def _meta_name(self, name): """ Translate HTTP header names to the format used by Django request objects. See https://docs.djangoproject.com/en/1.4/ref/request-response/#django.http.HttpRequest.META """ name = name.upper().replace('-', '_') if name not in self.UNPREFIXED...
python
def _meta_name(self, name): """ Translate HTTP header names to the format used by Django request objects. See https://docs.djangoproject.com/en/1.4/ref/request-response/#django.http.HttpRequest.META """ name = name.upper().replace('-', '_') if name not in self.UNPREFIXED...
[ "def", "_meta_name", "(", "self", ",", "name", ")", ":", "name", "=", "name", ".", "upper", "(", ")", ".", "replace", "(", "'-'", ",", "'_'", ")", "if", "name", "not", "in", "self", ".", "UNPREFIXED_HEADERS", ":", "name", "=", "'HTTP_'", "+", "name...
Translate HTTP header names to the format used by Django request objects. See https://docs.djangoproject.com/en/1.4/ref/request-response/#django.http.HttpRequest.META
[ "Translate", "HTTP", "header", "names", "to", "the", "format", "used", "by", "Django", "request", "objects", "." ]
368bf46e2c0ee69bbb21817f428c4684936e18ee
https://github.com/edx/XBlock/blob/368bf46e2c0ee69bbb21817f428c4684936e18ee/xblock/django/request.py#L39-L48
1,868
edx/XBlock
xblock/django/request.py
HeaderDict._un_meta_name
def _un_meta_name(self, name): """ Reverse of _meta_name """ if name.startswith('HTTP_'): name = name[5:] return name.replace('_', '-').title()
python
def _un_meta_name(self, name): """ Reverse of _meta_name """ if name.startswith('HTTP_'): name = name[5:] return name.replace('_', '-').title()
[ "def", "_un_meta_name", "(", "self", ",", "name", ")", ":", "if", "name", ".", "startswith", "(", "'HTTP_'", ")", ":", "name", "=", "name", "[", "5", ":", "]", "return", "name", ".", "replace", "(", "'_'", ",", "'-'", ")", ".", "title", "(", ")" ...
Reverse of _meta_name
[ "Reverse", "of", "_meta_name" ]
368bf46e2c0ee69bbb21817f428c4684936e18ee
https://github.com/edx/XBlock/blob/368bf46e2c0ee69bbb21817f428c4684936e18ee/xblock/django/request.py#L50-L56
1,869
edx/XBlock
xblock/django/request.py
DjangoWebobRequest.environ
def environ(self): """ Add path_info to the request's META dictionary. """ environ = dict(self._request.META) environ['PATH_INFO'] = self._request.path_info return environ
python
def environ(self): """ Add path_info to the request's META dictionary. """ environ = dict(self._request.META) environ['PATH_INFO'] = self._request.path_info return environ
[ "def", "environ", "(", "self", ")", ":", "environ", "=", "dict", "(", "self", ".", "_request", ".", "META", ")", "environ", "[", "'PATH_INFO'", "]", "=", "self", ".", "_request", ".", "path_info", "return", "environ" ]
Add path_info to the request's META dictionary.
[ "Add", "path_info", "to", "the", "request", "s", "META", "dictionary", "." ]
368bf46e2c0ee69bbb21817f428c4684936e18ee
https://github.com/edx/XBlock/blob/368bf46e2c0ee69bbb21817f428c4684936e18ee/xblock/django/request.py#L119-L127
1,870
edx/XBlock
xblock/runtime.py
KvsFieldData._getfield
def _getfield(self, block, name): """ Return the field with the given `name` from `block`. If no field with `name` exists in any namespace, raises a KeyError. :param block: xblock to retrieve the field from :type block: :class:`~xblock.core.XBlock` :param name: name of t...
python
def _getfield(self, block, name): """ Return the field with the given `name` from `block`. If no field with `name` exists in any namespace, raises a KeyError. :param block: xblock to retrieve the field from :type block: :class:`~xblock.core.XBlock` :param name: name of t...
[ "def", "_getfield", "(", "self", ",", "block", ",", "name", ")", ":", "# First, get the field from the class, if defined", "block_field", "=", "getattr", "(", "block", ".", "__class__", ",", "name", ",", "None", ")", "if", "block_field", "is", "not", "None", "...
Return the field with the given `name` from `block`. If no field with `name` exists in any namespace, raises a KeyError. :param block: xblock to retrieve the field from :type block: :class:`~xblock.core.XBlock` :param name: name of the field to retrieve :type name: str :...
[ "Return", "the", "field", "with", "the", "given", "name", "from", "block", ".", "If", "no", "field", "with", "name", "exists", "in", "any", "namespace", "raises", "a", "KeyError", "." ]
368bf46e2c0ee69bbb21817f428c4684936e18ee
https://github.com/edx/XBlock/blob/368bf46e2c0ee69bbb21817f428c4684936e18ee/xblock/runtime.py#L130-L149
1,871
edx/XBlock
xblock/runtime.py
KvsFieldData.get
def get(self, block, name): """ Retrieve the value for the field named `name`. If a value is provided for `default`, then it will be returned if no value is set """ return self._kvs.get(self._key(block, name))
python
def get(self, block, name): """ Retrieve the value for the field named `name`. If a value is provided for `default`, then it will be returned if no value is set """ return self._kvs.get(self._key(block, name))
[ "def", "get", "(", "self", ",", "block", ",", "name", ")", ":", "return", "self", ".", "_kvs", ".", "get", "(", "self", ".", "_key", "(", "block", ",", "name", ")", ")" ]
Retrieve the value for the field named `name`. If a value is provided for `default`, then it will be returned if no value is set
[ "Retrieve", "the", "value", "for", "the", "field", "named", "name", "." ]
368bf46e2c0ee69bbb21817f428c4684936e18ee
https://github.com/edx/XBlock/blob/368bf46e2c0ee69bbb21817f428c4684936e18ee/xblock/runtime.py#L193-L200
1,872
edx/XBlock
xblock/runtime.py
KvsFieldData.set
def set(self, block, name, value): """ Set the value of the field named `name` """ self._kvs.set(self._key(block, name), value)
python
def set(self, block, name, value): """ Set the value of the field named `name` """ self._kvs.set(self._key(block, name), value)
[ "def", "set", "(", "self", ",", "block", ",", "name", ",", "value", ")", ":", "self", ".", "_kvs", ".", "set", "(", "self", ".", "_key", "(", "block", ",", "name", ")", ",", "value", ")" ]
Set the value of the field named `name`
[ "Set", "the", "value", "of", "the", "field", "named", "name" ]
368bf46e2c0ee69bbb21817f428c4684936e18ee
https://github.com/edx/XBlock/blob/368bf46e2c0ee69bbb21817f428c4684936e18ee/xblock/runtime.py#L202-L206
1,873
edx/XBlock
xblock/runtime.py
KvsFieldData.delete
def delete(self, block, name): """ Reset the value of the field named `name` to the default """ self._kvs.delete(self._key(block, name))
python
def delete(self, block, name): """ Reset the value of the field named `name` to the default """ self._kvs.delete(self._key(block, name))
[ "def", "delete", "(", "self", ",", "block", ",", "name", ")", ":", "self", ".", "_kvs", ".", "delete", "(", "self", ".", "_key", "(", "block", ",", "name", ")", ")" ]
Reset the value of the field named `name` to the default
[ "Reset", "the", "value", "of", "the", "field", "named", "name", "to", "the", "default" ]
368bf46e2c0ee69bbb21817f428c4684936e18ee
https://github.com/edx/XBlock/blob/368bf46e2c0ee69bbb21817f428c4684936e18ee/xblock/runtime.py#L208-L212
1,874
edx/XBlock
xblock/runtime.py
KvsFieldData.has
def has(self, block, name): """ Return whether or not the field named `name` has a non-default value """ try: return self._kvs.has(self._key(block, name)) except KeyError: return False
python
def has(self, block, name): """ Return whether or not the field named `name` has a non-default value """ try: return self._kvs.has(self._key(block, name)) except KeyError: return False
[ "def", "has", "(", "self", ",", "block", ",", "name", ")", ":", "try", ":", "return", "self", ".", "_kvs", ".", "has", "(", "self", ".", "_key", "(", "block", ",", "name", ")", ")", "except", "KeyError", ":", "return", "False" ]
Return whether or not the field named `name` has a non-default value
[ "Return", "whether", "or", "not", "the", "field", "named", "name", "has", "a", "non", "-", "default", "value" ]
368bf46e2c0ee69bbb21817f428c4684936e18ee
https://github.com/edx/XBlock/blob/368bf46e2c0ee69bbb21817f428c4684936e18ee/xblock/runtime.py#L214-L221
1,875
edx/XBlock
xblock/runtime.py
KvsFieldData.set_many
def set_many(self, block, update_dict): """Update the underlying model with the correct values.""" updated_dict = {} # Generate a new dict with the correct mappings. for (key, value) in six.iteritems(update_dict): updated_dict[self._key(block, key)] = value self._kv...
python
def set_many(self, block, update_dict): """Update the underlying model with the correct values.""" updated_dict = {} # Generate a new dict with the correct mappings. for (key, value) in six.iteritems(update_dict): updated_dict[self._key(block, key)] = value self._kv...
[ "def", "set_many", "(", "self", ",", "block", ",", "update_dict", ")", ":", "updated_dict", "=", "{", "}", "# Generate a new dict with the correct mappings.", "for", "(", "key", ",", "value", ")", "in", "six", ".", "iteritems", "(", "update_dict", ")", ":", ...
Update the underlying model with the correct values.
[ "Update", "the", "underlying", "model", "with", "the", "correct", "values", "." ]
368bf46e2c0ee69bbb21817f428c4684936e18ee
https://github.com/edx/XBlock/blob/368bf46e2c0ee69bbb21817f428c4684936e18ee/xblock/runtime.py#L223-L231
1,876
edx/XBlock
xblock/runtime.py
MemoryIdManager.create_aside
def create_aside(self, definition_id, usage_id, aside_type): """Create the aside.""" return ( self.ASIDE_DEFINITION_ID(definition_id, aside_type), self.ASIDE_USAGE_ID(usage_id, aside_type), )
python
def create_aside(self, definition_id, usage_id, aside_type): """Create the aside.""" return ( self.ASIDE_DEFINITION_ID(definition_id, aside_type), self.ASIDE_USAGE_ID(usage_id, aside_type), )
[ "def", "create_aside", "(", "self", ",", "definition_id", ",", "usage_id", ",", "aside_type", ")", ":", "return", "(", "self", ".", "ASIDE_DEFINITION_ID", "(", "definition_id", ",", "aside_type", ")", ",", "self", ".", "ASIDE_USAGE_ID", "(", "usage_id", ",", ...
Create the aside.
[ "Create", "the", "aside", "." ]
368bf46e2c0ee69bbb21817f428c4684936e18ee
https://github.com/edx/XBlock/blob/368bf46e2c0ee69bbb21817f428c4684936e18ee/xblock/runtime.py#L385-L390
1,877
edx/XBlock
xblock/runtime.py
MemoryIdManager.create_usage
def create_usage(self, def_id): """Make a usage, storing its definition id.""" usage_id = self._next_id("u") self._usages[usage_id] = def_id return usage_id
python
def create_usage(self, def_id): """Make a usage, storing its definition id.""" usage_id = self._next_id("u") self._usages[usage_id] = def_id return usage_id
[ "def", "create_usage", "(", "self", ",", "def_id", ")", ":", "usage_id", "=", "self", ".", "_next_id", "(", "\"u\"", ")", "self", ".", "_usages", "[", "usage_id", "]", "=", "def_id", "return", "usage_id" ]
Make a usage, storing its definition id.
[ "Make", "a", "usage", "storing", "its", "definition", "id", "." ]
368bf46e2c0ee69bbb21817f428c4684936e18ee
https://github.com/edx/XBlock/blob/368bf46e2c0ee69bbb21817f428c4684936e18ee/xblock/runtime.py#L400-L404
1,878
edx/XBlock
xblock/runtime.py
MemoryIdManager.get_definition_id
def get_definition_id(self, usage_id): """Get a definition_id by its usage id.""" try: return self._usages[usage_id] except KeyError: raise NoSuchUsage(repr(usage_id))
python
def get_definition_id(self, usage_id): """Get a definition_id by its usage id.""" try: return self._usages[usage_id] except KeyError: raise NoSuchUsage(repr(usage_id))
[ "def", "get_definition_id", "(", "self", ",", "usage_id", ")", ":", "try", ":", "return", "self", ".", "_usages", "[", "usage_id", "]", "except", "KeyError", ":", "raise", "NoSuchUsage", "(", "repr", "(", "usage_id", ")", ")" ]
Get a definition_id by its usage id.
[ "Get", "a", "definition_id", "by", "its", "usage", "id", "." ]
368bf46e2c0ee69bbb21817f428c4684936e18ee
https://github.com/edx/XBlock/blob/368bf46e2c0ee69bbb21817f428c4684936e18ee/xblock/runtime.py#L406-L411
1,879
edx/XBlock
xblock/runtime.py
MemoryIdManager.create_definition
def create_definition(self, block_type, slug=None): """Make a definition, storing its block type.""" prefix = "d" if slug: prefix += "_" + slug def_id = self._next_id(prefix) self._definitions[def_id] = block_type return def_id
python
def create_definition(self, block_type, slug=None): """Make a definition, storing its block type.""" prefix = "d" if slug: prefix += "_" + slug def_id = self._next_id(prefix) self._definitions[def_id] = block_type return def_id
[ "def", "create_definition", "(", "self", ",", "block_type", ",", "slug", "=", "None", ")", ":", "prefix", "=", "\"d\"", "if", "slug", ":", "prefix", "+=", "\"_\"", "+", "slug", "def_id", "=", "self", ".", "_next_id", "(", "prefix", ")", "self", ".", ...
Make a definition, storing its block type.
[ "Make", "a", "definition", "storing", "its", "block", "type", "." ]
368bf46e2c0ee69bbb21817f428c4684936e18ee
https://github.com/edx/XBlock/blob/368bf46e2c0ee69bbb21817f428c4684936e18ee/xblock/runtime.py#L413-L420
1,880
edx/XBlock
xblock/runtime.py
MemoryIdManager.get_block_type
def get_block_type(self, def_id): """Get a block_type by its definition id.""" try: return self._definitions[def_id] except KeyError: try: return def_id.aside_type except AttributeError: raise NoSuchDefinition(repr(def_id))
python
def get_block_type(self, def_id): """Get a block_type by its definition id.""" try: return self._definitions[def_id] except KeyError: try: return def_id.aside_type except AttributeError: raise NoSuchDefinition(repr(def_id))
[ "def", "get_block_type", "(", "self", ",", "def_id", ")", ":", "try", ":", "return", "self", ".", "_definitions", "[", "def_id", "]", "except", "KeyError", ":", "try", ":", "return", "def_id", ".", "aside_type", "except", "AttributeError", ":", "raise", "N...
Get a block_type by its definition id.
[ "Get", "a", "block_type", "by", "its", "definition", "id", "." ]
368bf46e2c0ee69bbb21817f428c4684936e18ee
https://github.com/edx/XBlock/blob/368bf46e2c0ee69bbb21817f428c4684936e18ee/xblock/runtime.py#L422-L430
1,881
edx/XBlock
xblock/runtime.py
Runtime.field_data
def field_data(self, field_data): """ Set field_data. Deprecated in favor of a 'field-data' service. """ warnings.warn("Runtime.field_data is deprecated", FieldDataDeprecationWarning, stacklevel=2) self._deprecated_per_instance_field_data = field_data
python
def field_data(self, field_data): """ Set field_data. Deprecated in favor of a 'field-data' service. """ warnings.warn("Runtime.field_data is deprecated", FieldDataDeprecationWarning, stacklevel=2) self._deprecated_per_instance_field_data = field_data
[ "def", "field_data", "(", "self", ",", "field_data", ")", ":", "warnings", ".", "warn", "(", "\"Runtime.field_data is deprecated\"", ",", "FieldDataDeprecationWarning", ",", "stacklevel", "=", "2", ")", "self", ".", "_deprecated_per_instance_field_data", "=", "field_d...
Set field_data. Deprecated in favor of a 'field-data' service.
[ "Set", "field_data", "." ]
368bf46e2c0ee69bbb21817f428c4684936e18ee
https://github.com/edx/XBlock/blob/368bf46e2c0ee69bbb21817f428c4684936e18ee/xblock/runtime.py#L593-L600
1,882
edx/XBlock
xblock/runtime.py
Runtime.construct_xblock_from_class
def construct_xblock_from_class(self, cls, scope_ids, field_data=None, *args, **kwargs): """ Construct a new xblock of type cls, mixing in the mixins defined for this application. """ return self.mixologist.mix(cls)( runtime=self, field_data=field_data, ...
python
def construct_xblock_from_class(self, cls, scope_ids, field_data=None, *args, **kwargs): """ Construct a new xblock of type cls, mixing in the mixins defined for this application. """ return self.mixologist.mix(cls)( runtime=self, field_data=field_data, ...
[ "def", "construct_xblock_from_class", "(", "self", ",", "cls", ",", "scope_ids", ",", "field_data", "=", "None", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "mixologist", ".", "mix", "(", "cls", ")", "(", "runtime", "=",...
Construct a new xblock of type cls, mixing in the mixins defined for this application.
[ "Construct", "a", "new", "xblock", "of", "type", "cls", "mixing", "in", "the", "mixins", "defined", "for", "this", "application", "." ]
368bf46e2c0ee69bbb21817f428c4684936e18ee
https://github.com/edx/XBlock/blob/368bf46e2c0ee69bbb21817f428c4684936e18ee/xblock/runtime.py#L626-L636
1,883
edx/XBlock
xblock/runtime.py
Runtime.get_block
def get_block(self, usage_id, for_parent=None): """ Create an XBlock instance in this runtime. The `usage_id` is used to find the XBlock class and data. """ def_id = self.id_reader.get_definition_id(usage_id) try: block_type = self.id_reader.get_block_type(de...
python
def get_block(self, usage_id, for_parent=None): """ Create an XBlock instance in this runtime. The `usage_id` is used to find the XBlock class and data. """ def_id = self.id_reader.get_definition_id(usage_id) try: block_type = self.id_reader.get_block_type(de...
[ "def", "get_block", "(", "self", ",", "usage_id", ",", "for_parent", "=", "None", ")", ":", "def_id", "=", "self", ".", "id_reader", ".", "get_definition_id", "(", "usage_id", ")", "try", ":", "block_type", "=", "self", ".", "id_reader", ".", "get_block_ty...
Create an XBlock instance in this runtime. The `usage_id` is used to find the XBlock class and data.
[ "Create", "an", "XBlock", "instance", "in", "this", "runtime", "." ]
368bf46e2c0ee69bbb21817f428c4684936e18ee
https://github.com/edx/XBlock/blob/368bf46e2c0ee69bbb21817f428c4684936e18ee/xblock/runtime.py#L638-L651
1,884
edx/XBlock
xblock/runtime.py
Runtime.get_aside
def get_aside(self, aside_usage_id): """ Create an XBlockAside in this runtime. The `aside_usage_id` is used to find the Aside class and data. """ aside_type = self.id_reader.get_aside_type_from_usage(aside_usage_id) xblock_usage = self.id_reader.get_usage_id_from_aside(...
python
def get_aside(self, aside_usage_id): """ Create an XBlockAside in this runtime. The `aside_usage_id` is used to find the Aside class and data. """ aside_type = self.id_reader.get_aside_type_from_usage(aside_usage_id) xblock_usage = self.id_reader.get_usage_id_from_aside(...
[ "def", "get_aside", "(", "self", ",", "aside_usage_id", ")", ":", "aside_type", "=", "self", ".", "id_reader", ".", "get_aside_type_from_usage", "(", "aside_usage_id", ")", "xblock_usage", "=", "self", ".", "id_reader", ".", "get_usage_id_from_aside", "(", "aside_...
Create an XBlockAside in this runtime. The `aside_usage_id` is used to find the Aside class and data.
[ "Create", "an", "XBlockAside", "in", "this", "runtime", "." ]
368bf46e2c0ee69bbb21817f428c4684936e18ee
https://github.com/edx/XBlock/blob/368bf46e2c0ee69bbb21817f428c4684936e18ee/xblock/runtime.py#L653-L666
1,885
edx/XBlock
xblock/runtime.py
Runtime.parse_xml_string
def parse_xml_string(self, xml, id_generator=None): """Parse a string of XML, returning a usage id.""" if id_generator is not None: warnings.warn( "Passing an id_generator directly is deprecated " "in favor of constructing the Runtime with the id_generator", ...
python
def parse_xml_string(self, xml, id_generator=None): """Parse a string of XML, returning a usage id.""" if id_generator is not None: warnings.warn( "Passing an id_generator directly is deprecated " "in favor of constructing the Runtime with the id_generator", ...
[ "def", "parse_xml_string", "(", "self", ",", "xml", ",", "id_generator", "=", "None", ")", ":", "if", "id_generator", "is", "not", "None", ":", "warnings", ".", "warn", "(", "\"Passing an id_generator directly is deprecated \"", "\"in favor of constructing the Runtime w...
Parse a string of XML, returning a usage id.
[ "Parse", "a", "string", "of", "XML", "returning", "a", "usage", "id", "." ]
368bf46e2c0ee69bbb21817f428c4684936e18ee
https://github.com/edx/XBlock/blob/368bf46e2c0ee69bbb21817f428c4684936e18ee/xblock/runtime.py#L670-L685
1,886
edx/XBlock
xblock/runtime.py
Runtime.parse_xml_file
def parse_xml_file(self, fileobj, id_generator=None): """Parse an open XML file, returning a usage id.""" root = etree.parse(fileobj).getroot() usage_id = self._usage_id_from_node(root, None, id_generator) return usage_id
python
def parse_xml_file(self, fileobj, id_generator=None): """Parse an open XML file, returning a usage id.""" root = etree.parse(fileobj).getroot() usage_id = self._usage_id_from_node(root, None, id_generator) return usage_id
[ "def", "parse_xml_file", "(", "self", ",", "fileobj", ",", "id_generator", "=", "None", ")", ":", "root", "=", "etree", ".", "parse", "(", "fileobj", ")", ".", "getroot", "(", ")", "usage_id", "=", "self", ".", "_usage_id_from_node", "(", "root", ",", ...
Parse an open XML file, returning a usage id.
[ "Parse", "an", "open", "XML", "file", "returning", "a", "usage", "id", "." ]
368bf46e2c0ee69bbb21817f428c4684936e18ee
https://github.com/edx/XBlock/blob/368bf46e2c0ee69bbb21817f428c4684936e18ee/xblock/runtime.py#L687-L691
1,887
edx/XBlock
xblock/runtime.py
Runtime._usage_id_from_node
def _usage_id_from_node(self, node, parent_id, id_generator=None): """Create a new usage id from an XML dom node. Args: node (lxml.etree.Element): The DOM node to interpret. parent_id: The usage ID of the parent block id_generator (IdGenerator): The :class:`.IdGenera...
python
def _usage_id_from_node(self, node, parent_id, id_generator=None): """Create a new usage id from an XML dom node. Args: node (lxml.etree.Element): The DOM node to interpret. parent_id: The usage ID of the parent block id_generator (IdGenerator): The :class:`.IdGenera...
[ "def", "_usage_id_from_node", "(", "self", ",", "node", ",", "parent_id", ",", "id_generator", "=", "None", ")", ":", "if", "id_generator", "is", "not", "None", ":", "warnings", ".", "warn", "(", "\"Passing an id_generator directly is deprecated \"", "\"in favor of ...
Create a new usage id from an XML dom node. Args: node (lxml.etree.Element): The DOM node to interpret. parent_id: The usage ID of the parent block id_generator (IdGenerator): The :class:`.IdGenerator` to use for creating ids
[ "Create", "a", "new", "usage", "id", "from", "an", "XML", "dom", "node", "." ]
368bf46e2c0ee69bbb21817f428c4684936e18ee
https://github.com/edx/XBlock/blob/368bf46e2c0ee69bbb21817f428c4684936e18ee/xblock/runtime.py#L693-L736
1,888
edx/XBlock
xblock/runtime.py
Runtime._aside_from_xml
def _aside_from_xml(self, node, block_def_id, block_usage_id, id_generator): """ Create an aside from the xml and attach it to the given block """ id_generator = id_generator or self.id_generator aside_type = node.tag aside_class = self.load_aside_type(aside_type) ...
python
def _aside_from_xml(self, node, block_def_id, block_usage_id, id_generator): """ Create an aside from the xml and attach it to the given block """ id_generator = id_generator or self.id_generator aside_type = node.tag aside_class = self.load_aside_type(aside_type) ...
[ "def", "_aside_from_xml", "(", "self", ",", "node", ",", "block_def_id", ",", "block_usage_id", ",", "id_generator", ")", ":", "id_generator", "=", "id_generator", "or", "self", ".", "id_generator", "aside_type", "=", "node", ".", "tag", "aside_class", "=", "s...
Create an aside from the xml and attach it to the given block
[ "Create", "an", "aside", "from", "the", "xml", "and", "attach", "it", "to", "the", "given", "block" ]
368bf46e2c0ee69bbb21817f428c4684936e18ee
https://github.com/edx/XBlock/blob/368bf46e2c0ee69bbb21817f428c4684936e18ee/xblock/runtime.py#L738-L749
1,889
edx/XBlock
xblock/runtime.py
Runtime.add_node_as_child
def add_node_as_child(self, block, node, id_generator=None): """ Called by XBlock.parse_xml to treat a child node as a child block. """ usage_id = self._usage_id_from_node(node, block.scope_ids.usage_id, id_generator) block.children.append(usage_id)
python
def add_node_as_child(self, block, node, id_generator=None): """ Called by XBlock.parse_xml to treat a child node as a child block. """ usage_id = self._usage_id_from_node(node, block.scope_ids.usage_id, id_generator) block.children.append(usage_id)
[ "def", "add_node_as_child", "(", "self", ",", "block", ",", "node", ",", "id_generator", "=", "None", ")", ":", "usage_id", "=", "self", ".", "_usage_id_from_node", "(", "node", ",", "block", ".", "scope_ids", ".", "usage_id", ",", "id_generator", ")", "bl...
Called by XBlock.parse_xml to treat a child node as a child block.
[ "Called", "by", "XBlock", ".", "parse_xml", "to", "treat", "a", "child", "node", "as", "a", "child", "block", "." ]
368bf46e2c0ee69bbb21817f428c4684936e18ee
https://github.com/edx/XBlock/blob/368bf46e2c0ee69bbb21817f428c4684936e18ee/xblock/runtime.py#L751-L756
1,890
edx/XBlock
xblock/runtime.py
Runtime.export_to_xml
def export_to_xml(self, block, xmlfile): """ Export the block to XML, writing the XML to `xmlfile`. """ root = etree.Element("unknown_root", nsmap=XML_NAMESPACES) tree = etree.ElementTree(root) block.add_xml_to_node(root) # write asides as children for asi...
python
def export_to_xml(self, block, xmlfile): """ Export the block to XML, writing the XML to `xmlfile`. """ root = etree.Element("unknown_root", nsmap=XML_NAMESPACES) tree = etree.ElementTree(root) block.add_xml_to_node(root) # write asides as children for asi...
[ "def", "export_to_xml", "(", "self", ",", "block", ",", "xmlfile", ")", ":", "root", "=", "etree", ".", "Element", "(", "\"unknown_root\"", ",", "nsmap", "=", "XML_NAMESPACES", ")", "tree", "=", "etree", ".", "ElementTree", "(", "root", ")", "block", "."...
Export the block to XML, writing the XML to `xmlfile`.
[ "Export", "the", "block", "to", "XML", "writing", "the", "XML", "to", "xmlfile", "." ]
368bf46e2c0ee69bbb21817f428c4684936e18ee
https://github.com/edx/XBlock/blob/368bf46e2c0ee69bbb21817f428c4684936e18ee/xblock/runtime.py#L760-L773
1,891
edx/XBlock
xblock/runtime.py
Runtime.add_block_as_child_node
def add_block_as_child_node(self, block, node): """ Export `block` as a child node of `node`. """ child = etree.SubElement(node, "unknown") block.add_xml_to_node(child)
python
def add_block_as_child_node(self, block, node): """ Export `block` as a child node of `node`. """ child = etree.SubElement(node, "unknown") block.add_xml_to_node(child)
[ "def", "add_block_as_child_node", "(", "self", ",", "block", ",", "node", ")", ":", "child", "=", "etree", ".", "SubElement", "(", "node", ",", "\"unknown\"", ")", "block", ".", "add_xml_to_node", "(", "child", ")" ]
Export `block` as a child node of `node`.
[ "Export", "block", "as", "a", "child", "node", "of", "node", "." ]
368bf46e2c0ee69bbb21817f428c4684936e18ee
https://github.com/edx/XBlock/blob/368bf46e2c0ee69bbb21817f428c4684936e18ee/xblock/runtime.py#L775-L780
1,892
edx/XBlock
xblock/runtime.py
Runtime.render
def render(self, block, view_name, context=None): """ Render a block by invoking its view. Finds the view named `view_name` on `block`. The default view will be used if a specific view hasn't be registered. If there is no default view, an exception will be raised. The...
python
def render(self, block, view_name, context=None): """ Render a block by invoking its view. Finds the view named `view_name` on `block`. The default view will be used if a specific view hasn't be registered. If there is no default view, an exception will be raised. The...
[ "def", "render", "(", "self", ",", "block", ",", "view_name", ",", "context", "=", "None", ")", ":", "# Set the active view so that :function:`render_child` can use it", "# as a default", "old_view_name", "=", "self", ".", "_view_name", "self", ".", "_view_name", "=",...
Render a block by invoking its view. Finds the view named `view_name` on `block`. The default view will be used if a specific view hasn't be registered. If there is no default view, an exception will be raised. The view is invoked, passing it `context`. The value returned by the ...
[ "Render", "a", "block", "by", "invoking", "its", "view", "." ]
368bf46e2c0ee69bbb21817f428c4684936e18ee
https://github.com/edx/XBlock/blob/368bf46e2c0ee69bbb21817f428c4684936e18ee/xblock/runtime.py#L784-L818
1,893
edx/XBlock
xblock/runtime.py
Runtime.render_child
def render_child(self, child, view_name=None, context=None): """A shortcut to render a child block. Use this method to render your children from your own view function. If `view_name` is not provided, it will default to the view name you're being rendered with. Returns the sam...
python
def render_child(self, child, view_name=None, context=None): """A shortcut to render a child block. Use this method to render your children from your own view function. If `view_name` is not provided, it will default to the view name you're being rendered with. Returns the sam...
[ "def", "render_child", "(", "self", ",", "child", ",", "view_name", "=", "None", ",", "context", "=", "None", ")", ":", "return", "child", ".", "render", "(", "view_name", "or", "self", ".", "_view_name", ",", "context", ")" ]
A shortcut to render a child block. Use this method to render your children from your own view function. If `view_name` is not provided, it will default to the view name you're being rendered with. Returns the same value as :func:`render`.
[ "A", "shortcut", "to", "render", "a", "child", "block", "." ]
368bf46e2c0ee69bbb21817f428c4684936e18ee
https://github.com/edx/XBlock/blob/368bf46e2c0ee69bbb21817f428c4684936e18ee/xblock/runtime.py#L820-L831
1,894
edx/XBlock
xblock/runtime.py
Runtime.render_children
def render_children(self, block, view_name=None, context=None): """Render a block's children, returning a list of results. Each child of `block` will be rendered, just as :func:`render_child` does. Returns a list of values, each as provided by :func:`render`. """ results = [] ...
python
def render_children(self, block, view_name=None, context=None): """Render a block's children, returning a list of results. Each child of `block` will be rendered, just as :func:`render_child` does. Returns a list of values, each as provided by :func:`render`. """ results = [] ...
[ "def", "render_children", "(", "self", ",", "block", ",", "view_name", "=", "None", ",", "context", "=", "None", ")", ":", "results", "=", "[", "]", "for", "child_id", "in", "block", ".", "children", ":", "child", "=", "self", ".", "get_block", "(", ...
Render a block's children, returning a list of results. Each child of `block` will be rendered, just as :func:`render_child` does. Returns a list of values, each as provided by :func:`render`.
[ "Render", "a", "block", "s", "children", "returning", "a", "list", "of", "results", "." ]
368bf46e2c0ee69bbb21817f428c4684936e18ee
https://github.com/edx/XBlock/blob/368bf46e2c0ee69bbb21817f428c4684936e18ee/xblock/runtime.py#L833-L846
1,895
edx/XBlock
xblock/runtime.py
Runtime.wrap_xblock
def wrap_xblock(self, block, view, frag, context): # pylint: disable=W0613 """ Creates a div which identifies the xblock and writes out the json_init_args into a script tag. If there's a `wrap_child` method, it calls that with a deprecation warning. The default implementation creates ...
python
def wrap_xblock(self, block, view, frag, context): # pylint: disable=W0613 """ Creates a div which identifies the xblock and writes out the json_init_args into a script tag. If there's a `wrap_child` method, it calls that with a deprecation warning. The default implementation creates ...
[ "def", "wrap_xblock", "(", "self", ",", "block", ",", "view", ",", "frag", ",", "context", ")", ":", "# pylint: disable=W0613", "if", "hasattr", "(", "self", ",", "'wrap_child'", ")", ":", "log", ".", "warning", "(", "\"wrap_child is deprecated in favor of wrap_...
Creates a div which identifies the xblock and writes out the json_init_args into a script tag. If there's a `wrap_child` method, it calls that with a deprecation warning. The default implementation creates a frag to wraps frag w/ a div identifying the xblock. If you have javascript, you'll nee...
[ "Creates", "a", "div", "which", "identifies", "the", "xblock", "and", "writes", "out", "the", "json_init_args", "into", "a", "script", "tag", "." ]
368bf46e2c0ee69bbb21817f428c4684936e18ee
https://github.com/edx/XBlock/blob/368bf46e2c0ee69bbb21817f428c4684936e18ee/xblock/runtime.py#L848-L862
1,896
edx/XBlock
xblock/runtime.py
Runtime.wrap_aside
def wrap_aside(self, block, aside, view, frag, context): # pylint: disable=unused-argument """ Creates a div which identifies the aside, points to the original block, and writes out the json_init_args into a script tag. The default implementation creates a frag to wraps frag w/ a div i...
python
def wrap_aside(self, block, aside, view, frag, context): # pylint: disable=unused-argument """ Creates a div which identifies the aside, points to the original block, and writes out the json_init_args into a script tag. The default implementation creates a frag to wraps frag w/ a div i...
[ "def", "wrap_aside", "(", "self", ",", "block", ",", "aside", ",", "view", ",", "frag", ",", "context", ")", ":", "# pylint: disable=unused-argument", "return", "self", ".", "_wrap_ele", "(", "aside", ",", "view", ",", "frag", ",", "{", "'block_id'", ":", ...
Creates a div which identifies the aside, points to the original block, and writes out the json_init_args into a script tag. The default implementation creates a frag to wraps frag w/ a div identifying the xblock. If you have javascript, you'll need to override this impl
[ "Creates", "a", "div", "which", "identifies", "the", "aside", "points", "to", "the", "original", "block", "and", "writes", "out", "the", "json_init_args", "into", "a", "script", "tag", "." ]
368bf46e2c0ee69bbb21817f428c4684936e18ee
https://github.com/edx/XBlock/blob/368bf46e2c0ee69bbb21817f428c4684936e18ee/xblock/runtime.py#L864-L876
1,897
edx/XBlock
xblock/runtime.py
Runtime._wrap_ele
def _wrap_ele(self, block, view, frag, extra_data=None): """ Does the guts of the wrapping the same way for both xblocks and asides. Their wrappers provide other info in extra_data which gets put into the dom data- attrs. """ wrapped = Fragment() data = { 'usa...
python
def _wrap_ele(self, block, view, frag, extra_data=None): """ Does the guts of the wrapping the same way for both xblocks and asides. Their wrappers provide other info in extra_data which gets put into the dom data- attrs. """ wrapped = Fragment() data = { 'usa...
[ "def", "_wrap_ele", "(", "self", ",", "block", ",", "view", ",", "frag", ",", "extra_data", "=", "None", ")", ":", "wrapped", "=", "Fragment", "(", ")", "data", "=", "{", "'usage'", ":", "block", ".", "scope_ids", ".", "usage_id", ",", "'block-type'", ...
Does the guts of the wrapping the same way for both xblocks and asides. Their wrappers provide other info in extra_data which gets put into the dom data- attrs.
[ "Does", "the", "guts", "of", "the", "wrapping", "the", "same", "way", "for", "both", "xblocks", "and", "asides", ".", "Their", "wrappers", "provide", "other", "info", "in", "extra_data", "which", "gets", "put", "into", "the", "dom", "data", "-", "attrs", ...
368bf46e2c0ee69bbb21817f428c4684936e18ee
https://github.com/edx/XBlock/blob/368bf46e2c0ee69bbb21817f428c4684936e18ee/xblock/runtime.py#L878-L919
1,898
edx/XBlock
xblock/runtime.py
Runtime.get_asides
def get_asides(self, block): """ Return instances for all of the asides that will decorate this `block`. Arguments: block (:class:`.XBlock`): The block to render retrieve asides for. Returns: List of XBlockAside instances """ aside_instances = [ ...
python
def get_asides(self, block): """ Return instances for all of the asides that will decorate this `block`. Arguments: block (:class:`.XBlock`): The block to render retrieve asides for. Returns: List of XBlockAside instances """ aside_instances = [ ...
[ "def", "get_asides", "(", "self", ",", "block", ")", ":", "aside_instances", "=", "[", "self", ".", "get_aside_of_type", "(", "block", ",", "aside_type", ")", "for", "aside_type", "in", "self", ".", "applicable_aside_types", "(", "block", ")", "]", "return",...
Return instances for all of the asides that will decorate this `block`. Arguments: block (:class:`.XBlock`): The block to render retrieve asides for. Returns: List of XBlockAside instances
[ "Return", "instances", "for", "all", "of", "the", "asides", "that", "will", "decorate", "this", "block", "." ]
368bf46e2c0ee69bbb21817f428c4684936e18ee
https://github.com/edx/XBlock/blob/368bf46e2c0ee69bbb21817f428c4684936e18ee/xblock/runtime.py#L930-L947
1,899
edx/XBlock
xblock/runtime.py
Runtime.get_aside_of_type
def get_aside_of_type(self, block, aside_type): """ Return the aside of the given aside_type which might be decorating this `block`. Arguments: block (:class:`.XBlock`): The block to retrieve asides for. aside_type (`str`): the type of the aside """ # TOD...
python
def get_aside_of_type(self, block, aside_type): """ Return the aside of the given aside_type which might be decorating this `block`. Arguments: block (:class:`.XBlock`): The block to retrieve asides for. aside_type (`str`): the type of the aside """ # TOD...
[ "def", "get_aside_of_type", "(", "self", ",", "block", ",", "aside_type", ")", ":", "# TODO: This function will need to be extended if we want to allow:", "# a) XBlockAsides to statically indicated which types of blocks they can comment on", "# b) XBlockRuntimes to limit the selection of...
Return the aside of the given aside_type which might be decorating this `block`. Arguments: block (:class:`.XBlock`): The block to retrieve asides for. aside_type (`str`): the type of the aside
[ "Return", "the", "aside", "of", "the", "given", "aside_type", "which", "might", "be", "decorating", "this", "block", "." ]
368bf46e2c0ee69bbb21817f428c4684936e18ee
https://github.com/edx/XBlock/blob/368bf46e2c0ee69bbb21817f428c4684936e18ee/xblock/runtime.py#L958-L980