_id
stringlengths
2
7
title
stringlengths
1
88
partition
stringclasses
3 values
text
stringlengths
75
19.8k
language
stringclasses
1 value
meta_information
dict
q260300
get
validation
def get(name, default=None, allow_default=True): """ Shortcut method for getting a setting value. :param str name: Setting key name. :param default: Default value of setting if it's not explicitly set. Defaults to `None` :param bool allow_default: If true, use the pa...
python
{ "resource": "" }
q260301
env
validation
def env(key, default): """ Helper to try to get a setting from the environment, or pyconfig, or finally use a provided default. """ value = os.environ.get(key, None) if value is not None: log.info(' %s = %r', key.lower().replace('_', '.'), value) return value key = key.l...
python
{ "resource": "" }
q260302
env_key
validation
def env_key(key, default): """ Try to get `key` from the environment. This mutates `key` to replace dots with underscores and makes it all uppercase. my.database.host => MY_DATABASE_HOST """ env = key.upper().replace('.', '_') return os.environ.get(env, default)
python
{ "resource": "" }
q260303
Config.set
validation
def set(self, name, value): """ Changes a setting value. This implements a locking mechanism to ensure some level of thread safety. :param str name: Setting key name. :param value: Setting value. """ if not self.settings.get('pyconfig.case_sensi...
python
{ "resource": "" }
q260304
Config._update
validation
def _update(self, conf_dict, base_name=None): """ Updates the current configuration with the values in `conf_dict`. :param dict conf_dict: Dictionary of key value settings. :param str base_name: Base namespace for setting keys. """ for name in conf_dict: # S...
python
{ "resource": "" }
q260305
Config.load
validation
def load(self, clear=False): """ Loads all the config plugin modules to build a working configuration. If there is a ``localconfig`` module on the python path, it will be loaded last, overriding other settings. :param bool clear: Clear out the previous settings before loading ...
python
{ "resource": "" }
q260306
Config.get
validation
def get(self, name, default, allow_default=True): """ Return a setting value. :param str name: Setting key name. :param default: Default value of setting if it's not explicitly set. :param bool allow_default: If true, use the parameter default as ...
python
{ "resource": "" }
q260307
etcd.init
validation
def init(self, hosts=None, cacert=None, client_cert=None, client_key=None): """ Handle creating the new etcd client instance and other business. :param hosts: Host string or list of hosts (default: `'127.0.0.1:2379'`) :param cacert: CA cert filename (optional) :param client_cert...
python
{ "resource": "" }
q260308
etcd.load
validation
def load(self, prefix=None, depth=None): """ Return a dictionary of settings loaded from etcd. """ prefix = prefix or self.prefix prefix = '/' + prefix.strip('/') + '/' if depth is None: depth = self.inherit_depth if not self.configured: ...
python
{ "resource": "" }
q260309
etcd.get_watcher
validation
def get_watcher(self): """ Return a etcd watching generator which yields events as they happen. """ if not self.watching: raise StopIteration() return self.client.eternal_watch(self.prefix, recursive=True)
python
{ "resource": "" }
q260310
etcd.start_watching
validation
def start_watching(self): """ Begins watching etcd for changes. """ # Don't create a new watcher thread if we already have one running if self.watcher and self.watcher.is_alive(): return # Create a new watcher thread and start it self.watcher = Watcher() self...
python
{ "resource": "" }
q260311
etcd._parse_hosts
validation
def _parse_hosts(self, hosts): """ Return hosts parsed into a tuple of tuples. :param hosts: String or list of hosts """ # Default host if hosts is None: return # If it's a string, we allow comma separated strings if isinstance(hosts, six.st...
python
{ "resource": "" }
q260312
main
validation
def main(): """ Main script for `pyconfig` command. """ parser = argparse.ArgumentParser(description="Helper for working with " "pyconfigs") target_group = parser.add_mutually_exclusive_group() target_group.add_argument('-f', '--filename', help="parse an individual file ...
python
{ "resource": "" }
q260313
_handle_module
validation
def _handle_module(args): """ Handles the -m argument. """ module = _get_module_filename(args.module) if not module: _error("Could not load module or package: %r", args.module) elif isinstance(module, Unparseable): _error("Could not determine module source: %r", args.module) ...
python
{ "resource": "" }
q260314
_error
validation
def _error(msg, *args): """ Print an error message and exit. :param msg: A message to print :type msg: str """ print(msg % args, file=sys.stderr) sys.exit(1)
python
{ "resource": "" }
q260315
_get_module_filename
validation
def _get_module_filename(module): """ Return the filename of `module` if it can be imported. If `module` is a package, its directory will be returned. If it cannot be imported ``None`` is returned. If the ``__file__`` attribute is missing, or the module or package is a compiled egg, then an :...
python
{ "resource": "" }
q260316
_parse_and_output
validation
def _parse_and_output(filename, args): """ Parse `filename` appropriately and then output calls according to the `args` specified. :param filename: A file or directory :param args: Command arguments :type filename: str """ relpath = os.path.dirname(filename) if os.path.isfile(filen...
python
{ "resource": "" }
q260317
_output
validation
def _output(calls, args): """ Outputs `calls`. :param calls: List of :class:`_PyconfigCall` instances :param args: :class:`~argparse.ArgumentParser` instance :type calls: list :type args: argparse.ArgumentParser """ # Sort the keys appropriately if args.natural_sort or args.source:...
python
{ "resource": "" }
q260318
_format_call
validation
def _format_call(call, args): """ Return `call` formatted appropriately for `args`. :param call: A pyconfig call object :param args: Arguments from the command :type call: :class:`_PyconfigCall` """ out = '' if args.source: out += call.annotation() + '\n' if args.only_keys...
python
{ "resource": "" }
q260319
_colorize
validation
def _colorize(output): """ Return `output` colorized with Pygments, if available. """ if not pygments: return output # Available styles # ['monokai', 'manni', 'rrt', 'perldoc', 'borland', 'colorful', 'default', # 'murphy', 'vs', 'trac', 'tango', 'fruity', 'autumn', 'bw', 'emacs', ...
python
{ "resource": "" }
q260320
_map_arg
validation
def _map_arg(arg): """ Return `arg` appropriately parsed or mapped to a usable value. """ # Grab the easy to parse values if isinstance(arg, _ast.Str): return repr(arg.s) elif isinstance(arg, _ast.Num): return arg.n elif isinstance(arg, _ast.Name): name = arg.id ...
python
{ "resource": "" }
q260321
_PyconfigCall.as_namespace
validation
def as_namespace(self, namespace=None): """ Return this call as if it were being assigned in a pyconfig namespace. If `namespace` is specified and matches the top level of this call's :attr:`key`, then that section of the key will be removed. """ key = self.key ...
python
{ "resource": "" }
q260322
_PyconfigCall.as_live
validation
def as_live(self): """ Return this call as if it were being assigned in a pyconfig namespace, but load the actual value currently available in pyconfig. """ key = self.get_key() default = pyconfig.get(key) if default: default = repr(default) e...
python
{ "resource": "" }
q260323
_PyconfigCall.as_call
validation
def as_call(self): """ Return this call as it is called in its source. """ default = self._default() default = ', ' + default if default else '' return "pyconfig.%s(%r%s)" % (self.method, self.get_key(), default)
python
{ "resource": "" }
q260324
_PyconfigCall.get_key
validation
def get_key(self): """ Return the call key, even if it has to be parsed from the source. """ if not isinstance(self.key, Unparseable): return self.key line = self.source[self.col_offset:] regex = re.compile('''pyconfig\.[eginst]+\(([^,]+).*?\)''') ma...
python
{ "resource": "" }
q260325
_PyconfigCall._default_value_only
validation
def _default_value_only(self): """ Return only the default value, if there is one. """ line = self.source[self.col_offset:] regex = re.compile('''pyconfig\.[eginst]+\(['"][^)]+?['"], ?(.*?)\)''') match = regex.match(line) if not match: return '' ...
python
{ "resource": "" }
q260326
_PyconfigCall._default
validation
def _default(self): """ Return the default argument, formatted nicely. """ try: # Check if it's iterable iter(self.default) except TypeError: return repr(self.default) # This is to look for unparsable values, and if we find one, we tr...
python
{ "resource": "" }
q260327
Pylearn2Estimator._get_param_names
validation
def _get_param_names(self): """ Get mappable parameters from YAML. """ template = Template(self.yaml_string) names = ['yaml_string'] # always include the template for match in re.finditer(template.pattern, template.template): name = match.group('named') or ma...
python
{ "resource": "" }
q260328
Pylearn2Estimator._get_dataset
validation
def _get_dataset(self, X, y=None): """ Construct a pylearn2 dataset. Parameters ---------- X : array_like Training examples. y : array_like, optional Labels. """ from pylearn2.datasets import DenseDesignMatrix X = np.asarr...
python
{ "resource": "" }
q260329
Pylearn2Estimator.fit
validation
def fit(self, X, y=None): """ Build a trainer and run main_loop. Parameters ---------- X : array_like Training examples. y : array_like, optional Labels. """ from pylearn2.config import yaml_parse from pylearn2.train import...
python
{ "resource": "" }
q260330
Pylearn2Estimator._predict
validation
def _predict(self, X, method='fprop'): """ Get model predictions. See pylearn2.scripts.mlp.predict_csv and http://fastml.com/how-to-get-predictions-from-pylearn2/. Parameters ---------- X : array_like Test dataset. method : str Mo...
python
{ "resource": "" }
q260331
Pylearn2DatasetLoader.load
validation
def load(self): """ Load the dataset using pylearn2.config.yaml_parse. """ from pylearn2.config import yaml_parse from pylearn2.datasets import Dataset dataset = yaml_parse.load(self.yaml_string) assert isinstance(dataset, Dataset) data = dataset.iterator...
python
{ "resource": "" }
q260332
GaussianProcessKernel._create_kernel
validation
def _create_kernel(self): """ creates an additive kernel """ # Check kernels kernels = self.kernel_params if not isinstance(kernels, list): raise RuntimeError('Must provide enumeration of kernels') for kernel in kernels: if sorted(list(kern...
python
{ "resource": "" }
q260333
fit_and_score_estimator
validation
def fit_and_score_estimator(estimator, parameters, cv, X, y=None, scoring=None, iid=True, n_jobs=1, verbose=1, pre_dispatch='2*n_jobs'): """Fit and score an estimator with cross-validation This function is basically a copy of sklearn's model_selection...
python
{ "resource": "" }
q260334
dict_merge
validation
def dict_merge(base, top): """Recursively merge two dictionaries, with the elements from `top` taking precedence over elements from `top`. Returns ------- out : dict A new dict, containing the merged records. """ out = dict(top) for key in base: if key in top: ...
python
{ "resource": "" }
q260335
format_timedelta
validation
def format_timedelta(td_object): """Format a timedelta object for display to users Returns ------- str """ def get_total_seconds(td): # timedelta.total_seconds not in py2.6 return (td.microseconds + (td.seconds + td.days * 24 * 3600) * 1e6) / 1e6 seconds = i...
python
{ "resource": "" }
q260336
_assert_all_finite
validation
def _assert_all_finite(X): """Like assert_all_finite, but only for ndarray.""" X = np.asanyarray(X) # First try an O(n) time, O(1) space solution for the common case that # everything is finite; fall back to O(n) space np.isfinite to prevent # false positives from overflow in sum method if (X.dt...
python
{ "resource": "" }
q260337
_warn_if_not_finite
validation
def _warn_if_not_finite(X): """UserWarning if array contains non-finite elements""" X = np.asanyarray(X) # First try an O(n) time, O(1) space solution for the common case that # everything is finite; fall back to O(n) space np.isfinite to prevent # false positives from overflow in sum method if ...
python
{ "resource": "" }
q260338
Config.fromdict
validation
def fromdict(cls, config, check_fields=True): """Create a Config object from config dict directly.""" m = super(Config, cls).__new__(cls) m.path = '.' m.verbose = False m.config = m._merge_defaults(config) if check_fields: m._check_fields() return m
python
{ "resource": "" }
q260339
Config.sha1
validation
def sha1(self): """SHA1 hash of the config file itself.""" with open(self.path, 'rb') as f: return hashlib.sha1(f.read()).hexdigest()
python
{ "resource": "" }
q260340
plot_3
validation
def plot_3(data, ss, *args): """t-SNE embedding of the parameters, colored by score """ if len(data) <= 1: warnings.warn("Only one datapoint. Could not compute t-SNE embedding.") return None scores = np.array([d['mean_test_score'] for d in data]) # maps each parameters to a vector ...
python
{ "resource": "" }
q260341
plot_4
validation
def plot_4(data, *args): """Scatter plot of score vs each param """ params = nonconstant_parameters(data) scores = np.array([d['mean_test_score'] for d in data]) order = np.argsort(scores) for key in params.keys(): if params[key].dtype == np.dtype('bool'): params[key] = para...
python
{ "resource": "" }
q260342
SearchSpace.add_int
validation
def add_int(self, name, min, max, warp=None): """An integer-valued dimension bounded between `min` <= x <= `max`. Note that the right endpoint of the interval includes `max`. When `warp` is None, the base measure associated with this dimension is a categorical distribution with each wei...
python
{ "resource": "" }
q260343
SearchSpace.add_float
validation
def add_float(self, name, min, max, warp=None): """A floating point-valued dimension bounded `min` <= x < `max` When `warp` is None, the base measure associated with this dimension is a uniform distribution on [min, max). With `warp == 'log'`, the base measure is a uniform distribution ...
python
{ "resource": "" }
q260344
SearchSpace.add_enum
validation
def add_enum(self, name, choices): """An enumeration-valued dimension. The base measure associated with this dimension is a categorical distribution with equal weight on each element in `choices`. """ if not isinstance(choices, Iterable): raise ValueError('variable %...
python
{ "resource": "" }
q260345
log_callback
validation
def log_callback(wrapped_function): """Decorator that produces DEBUG level log messages before and after calling a parser method. If a callback raises an IgnoredMatchException the log will show 'IGNORED' instead to indicate that the parser will not create any objects from the matched string. E...
python
{ "resource": "" }
q260346
_Parser.find_match
validation
def find_match(self): """Try to find a pattern that matches the source and calll a parser method to create Python objects. A callback that raises an IgnoredMatchException indicates that the given string data is ignored by the parser and no objects are created. If none of the pa...
python
{ "resource": "" }
q260347
ContainerMixin.add_child
validation
def add_child(self, child): """If the given object is an instance of Child add it to self and register self as a parent. """ if not isinstance(child, ChildMixin): raise TypeError( 'Requires instance of TreeElement. ' 'Got {}'.format(type(child)...
python
{ "resource": "" }
q260348
get_ip_packet
validation
def get_ip_packet(data, client_port, server_port, is_loopback=False): """ if client_port is 0 any client_port is good """ header = _loopback if is_loopback else _ethernet try: header.unpack(data) except Exception as ex: raise ValueError('Bad header: %s' % ex) tcp_p = getattr(header...
python
{ "resource": "" }
q260349
LatencyPrinter.report
validation
def report(self): """ get stats & show them """ self._output.write('\r') sort_by = 'avg' results = {} for key, latencies in self._latencies_by_method.items(): result = {} result['count'] = len(latencies) result['avg'] = sum(latencies) / len(la...
python
{ "resource": "" }
q260350
ThriftDiff.of_structs
validation
def of_structs(cls, a, b): """ Diff two thrift structs and return the result as a ThriftDiff instance """ t_diff = ThriftDiff(a, b) t_diff._do_diff() return t_diff
python
{ "resource": "" }
q260351
ThriftDiff.of_messages
validation
def of_messages(cls, msg_a, msg_b): """ Diff two thrift messages by comparing their args, raises exceptions if for some reason the messages can't be diffed. Only args of type 'struct' are compared. Returns a list of ThriftDiff results - one for each struct arg """ ...
python
{ "resource": "" }
q260352
ThriftDiff.can_diff
validation
def can_diff(msg_a, msg_b): """ Check if two thrift messages are diff ready. Returns a tuple of (boolean, reason_string), i.e. (False, reason_string) if the messages can not be diffed along with the reason and (True, None) for the opposite case """ if msg_a.metho...
python
{ "resource": "" }
q260353
ThriftStruct.is_isomorphic_to
validation
def is_isomorphic_to(self, other): """ Returns true if all fields of other struct are isomorphic to this struct's fields """ return (isinstance(other, self.__class__) and len(self.fields) == len(other.fields) and all...
python
{ "resource": "" }
q260354
ThriftMessage.read
validation
def read(cls, data, protocol=None, fallback_protocol=TBinaryProtocol, finagle_thrift=False, max_fields=MAX_FIELDS, max_list_size=MAX_LIST_SIZE, max_map_size=MAX_MAP_SIZE, max_set_size=MAX_SET_SIZE, read_values=False)...
python
{ "resource": "" }
q260355
Stream.pop
validation
def pop(self, nbytes): """ pops packets with _at least_ nbytes of payload """ size = 0 popped = [] with self._lock_packets: while size < nbytes: try: packet = self._packets.pop(0) size += len(packet.data.data) ...
python
{ "resource": "" }
q260356
Stream.pop_data
validation
def pop_data(self, nbytes): """ similar to pop, but returns payload + last timestamp """ last_timestamp = 0 data = [] for packet in self.pop(nbytes): last_timestamp = packet.timestamp data.append(packet.data.data) return ''.join(data), last_timestamp
python
{ "resource": "" }
q260357
Stream.push
validation
def push(self, ip_packet): """ push the packet into the queue """ data_len = len(ip_packet.data.data) seq_id = ip_packet.data.seq if data_len == 0: self._next_seq_id = seq_id return False # have we seen this packet? if self._next_seq_id != -1 an...
python
{ "resource": "" }
q260358
Dispatcher.run
validation
def run(self, *args, **kwargs): """ Deal with the incoming packets """ while True: try: timestamp, ip_p = self._queue.popleft() src_ip = get_ip(ip_p, ip_p.src) dst_ip = get_ip(ip_p, ip_p.dst) src = intern('%s:%s' % (src_ip, ip...
python
{ "resource": "" }
q260359
get_disk_image_by_name
validation
def get_disk_image_by_name(pbclient, location, image_name): """ Returns all disk images within a location with a given image name. The name must match exactly. The list may be empty. """ all_images = pbclient.list_images() matching = [i for i in all_images['items'] if i['prop...
python
{ "resource": "" }
q260360
ProfitBricksService._read_config
validation
def _read_config(self, filename=None): """ Read the user configuration """ if filename: self._config_filename = filename else: try: import appdirs except ImportError: raise Exception("Missing dependency for deter...
python
{ "resource": "" }
q260361
ProfitBricksService._save_config
validation
def _save_config(self, filename=None): """ Save the given user configuration. """ if filename is None: filename = self._config_filename parent_path = os.path.dirname(filename) if not os.path.isdir(parent_path): os.makedirs(parent_path) with...
python
{ "resource": "" }
q260362
ProfitBricksService._get_username
validation
def _get_username(self, username=None, use_config=True, config_filename=None): """Determine the username If a username is given, this name is used. Otherwise the configuration file will be consulted if `use_config` is set to True. The user is asked for the username if the username is no...
python
{ "resource": "" }
q260363
ProfitBricksService._get_password
validation
def _get_password(self, password, use_config=True, config_filename=None, use_keyring=HAS_KEYRING): """ Determine the user password If the password is given, this password is used. Otherwise this function will try to get the password from the user's keyring ...
python
{ "resource": "" }
q260364
ProfitBricksService.get_datacenter
validation
def get_datacenter(self, datacenter_id, depth=1): """ Retrieves a data center by its ID. :param datacenter_id: The unique ID of the data center. :type datacenter_id: ``str`` :param depth: The depth of the response data. :type depth: ``int`` ...
python
{ "resource": "" }
q260365
ProfitBricksService.get_datacenter_by_name
validation
def get_datacenter_by_name(self, name, depth=1): """ Retrieves a data center by its name. Either returns the data center response or raises an Exception if no or more than one data center was found with the name. The search for the name is done in this relaxing way: - e...
python
{ "resource": "" }
q260366
ProfitBricksService.delete_datacenter
validation
def delete_datacenter(self, datacenter_id): """ Removes the data center and all its components such as servers, NICs, load balancers, volumes. :param datacenter_id: The unique ID of the data center. :type datacenter_id: ``str`` """ response = self._pe...
python
{ "resource": "" }
q260367
ProfitBricksService.get_firewall_rule
validation
def get_firewall_rule(self, datacenter_id, server_id, nic_id, firewall_rule_id): """ Retrieves a single firewall rule by ID. :param datacenter_id: The unique ID of the data center. :type datacenter_id: ``str`` :param server_id: The uniq...
python
{ "resource": "" }
q260368
ProfitBricksService.delete_firewall_rule
validation
def delete_firewall_rule(self, datacenter_id, server_id, nic_id, firewall_rule_id): """ Removes a firewall rule from the NIC. :param datacenter_id: The unique ID of the data center. :type datacenter_id: ``str`` :param server_id: The ...
python
{ "resource": "" }
q260369
ProfitBricksService.create_firewall_rule
validation
def create_firewall_rule(self, datacenter_id, server_id, nic_id, firewall_rule): """ Creates a firewall rule on the specified NIC and server. :param datacenter_id: The unique ID of the data center. :type datacenter_id: ``str`` :param ...
python
{ "resource": "" }
q260370
ProfitBricksService.update_firewall_rule
validation
def update_firewall_rule(self, datacenter_id, server_id, nic_id, firewall_rule_id, **kwargs): """ Updates a firewall rule. :param datacenter_id: The unique ID of the data center. :type datacenter_id: ``str`` :param server_id: The uni...
python
{ "resource": "" }
q260371
ProfitBricksService.delete_image
validation
def delete_image(self, image_id): """ Removes only user created images. :param image_id: The unique ID of the image. :type image_id: ``str`` """ response = self._perform_request(url='/images/' + image_id, method='DELET...
python
{ "resource": "" }
q260372
ProfitBricksService.update_image
validation
def update_image(self, image_id, **kwargs): """ Replace all properties of an image. """ data = {} for attr, value in kwargs.items(): data[self._underscore_to_camelcase(attr)] = value response = self._perform_request(url='/images/' + image_id, ...
python
{ "resource": "" }
q260373
ProfitBricksService.delete_ipblock
validation
def delete_ipblock(self, ipblock_id): """ Removes a single IP block from your account. :param ipblock_id: The unique ID of the IP block. :type ipblock_id: ``str`` """ response = self._perform_request( url='/ipblocks/' + ipblock_id, method='DELETE'...
python
{ "resource": "" }
q260374
ProfitBricksService.reserve_ipblock
validation
def reserve_ipblock(self, ipblock): """ Reserves an IP block within your account. """ properties = { "name": ipblock.name } if ipblock.location: properties['location'] = ipblock.location if ipblock.size: properties['size'] = ...
python
{ "resource": "" }
q260375
ProfitBricksService.get_lan
validation
def get_lan(self, datacenter_id, lan_id, depth=1): """ Retrieves a single LAN by ID. :param datacenter_id: The unique ID of the data center. :type datacenter_id: ``str`` :param lan_id: The unique ID of the LAN. :type lan_id: ``str`` :param...
python
{ "resource": "" }
q260376
ProfitBricksService.list_lans
validation
def list_lans(self, datacenter_id, depth=1): """ Retrieves a list of LANs available in the account. :param datacenter_id: The unique ID of the data center. :type datacenter_id: ``str`` :param depth: The depth of the response data. :type depth: ``in...
python
{ "resource": "" }
q260377
ProfitBricksService.delete_lan
validation
def delete_lan(self, datacenter_id, lan_id): """ Removes a LAN from the data center. :param datacenter_id: The unique ID of the data center. :type datacenter_id: ``str`` :param lan_id: The unique ID of the LAN. :type lan_id: ``str`` """ ...
python
{ "resource": "" }
q260378
ProfitBricksService.create_lan
validation
def create_lan(self, datacenter_id, lan): """ Creates a LAN in the data center. :param datacenter_id: The unique ID of the data center. :type datacenter_id: ``str`` :param lan: The LAN object to be created. :type lan: ``dict`` """ ...
python
{ "resource": "" }
q260379
ProfitBricksService.update_lan
validation
def update_lan(self, datacenter_id, lan_id, name=None, public=None, ip_failover=None): """ Updates a LAN :param datacenter_id: The unique ID of the data center. :type datacenter_id: ``str`` :param lan_id: The unique ID of the LAN. :typ...
python
{ "resource": "" }
q260380
ProfitBricksService.get_lan_members
validation
def get_lan_members(self, datacenter_id, lan_id, depth=1): """ Retrieves the list of NICs that are part of the LAN. :param datacenter_id: The unique ID of the data center. :type datacenter_id: ``str`` :param lan_id: The unique ID of the LAN. :type ...
python
{ "resource": "" }
q260381
ProfitBricksService.get_loadbalancer
validation
def get_loadbalancer(self, datacenter_id, loadbalancer_id): """ Retrieves a single load balancer by ID. :param datacenter_id: The unique ID of the data center. :type datacenter_id: ``str`` :param loadbalancer_id: The unique ID of the load balancer. :type...
python
{ "resource": "" }
q260382
ProfitBricksService.list_loadbalancers
validation
def list_loadbalancers(self, datacenter_id, depth=1): """ Retrieves a list of load balancers in the data center. :param datacenter_id: The unique ID of the data center. :type datacenter_id: ``str`` :param depth: The depth of the response data. :type ...
python
{ "resource": "" }
q260383
ProfitBricksService.delete_loadbalancer
validation
def delete_loadbalancer(self, datacenter_id, loadbalancer_id): """ Removes the load balancer from the data center. :param datacenter_id: The unique ID of the data center. :type datacenter_id: ``str`` :param loadbalancer_id: The unique ID of the load balancer. ...
python
{ "resource": "" }
q260384
ProfitBricksService.create_loadbalancer
validation
def create_loadbalancer(self, datacenter_id, loadbalancer): """ Creates a load balancer within the specified data center. :param datacenter_id: The unique ID of the data center. :type datacenter_id: ``str`` :param loadbalancer: The load balancer object to be cre...
python
{ "resource": "" }
q260385
ProfitBricksService.update_loadbalancer
validation
def update_loadbalancer(self, datacenter_id, loadbalancer_id, **kwargs): """ Updates a load balancer :param datacenter_id: The unique ID of the data center. :type datacenter_id: ``str`` :param loadbalancer_id: The unique ID of the loa...
python
{ "resource": "" }
q260386
ProfitBricksService.get_loadbalancer_members
validation
def get_loadbalancer_members(self, datacenter_id, loadbalancer_id, depth=1): """ Retrieves the list of NICs that are associated with a load balancer. :param datacenter_id: The unique ID of the data center. :type datacenter_id: ``str`` ...
python
{ "resource": "" }
q260387
ProfitBricksService.add_loadbalanced_nics
validation
def add_loadbalanced_nics(self, datacenter_id, loadbalancer_id, nic_id): """ Associates a NIC with the given load balancer. :param datacenter_id: The unique ID of the data center. :type datacenter_id: ``str`` :param loadbalancer_id:...
python
{ "resource": "" }
q260388
ProfitBricksService.get_loadbalanced_nic
validation
def get_loadbalanced_nic(self, datacenter_id, loadbalancer_id, nic_id, depth=1): """ Gets the properties of a load balanced NIC. :param datacenter_id: The unique ID of the data center. :type datacenter_id: ``str`` :param loadbalancer...
python
{ "resource": "" }
q260389
ProfitBricksService.remove_loadbalanced_nic
validation
def remove_loadbalanced_nic(self, datacenter_id, loadbalancer_id, nic_id): """ Removes a NIC from the load balancer. :param datacenter_id: The unique ID of the data center. :type datacenter_id: ``str`` :param loadbalancer_id: The ...
python
{ "resource": "" }
q260390
ProfitBricksService.get_location
validation
def get_location(self, location_id, depth=0): """ Retrieves a single location by ID. :param location_id: The unique ID of the location. :type location_id: ``str`` """ response = self._perform_request('/locations/%s?depth=%s' % (location_id, depth)) re...
python
{ "resource": "" }
q260391
ProfitBricksService.get_nic
validation
def get_nic(self, datacenter_id, server_id, nic_id, depth=1): """ Retrieves a NIC by its ID. :param datacenter_id: The unique ID of the data center. :type datacenter_id: ``str`` :param server_id: The unique ID of the server. :type server_id: ``str`...
python
{ "resource": "" }
q260392
ProfitBricksService.list_nics
validation
def list_nics(self, datacenter_id, server_id, depth=1): """ Retrieves a list of all NICs bound to the specified server. :param datacenter_id: The unique ID of the data center. :type datacenter_id: ``str`` :param server_id: The unique ID of the server. :t...
python
{ "resource": "" }
q260393
ProfitBricksService.delete_nic
validation
def delete_nic(self, datacenter_id, server_id, nic_id): """ Removes a NIC from the server. :param datacenter_id: The unique ID of the data center. :type datacenter_id: ``str`` :param server_id: The unique ID of the server. :type server_id: ``str`` ...
python
{ "resource": "" }
q260394
ProfitBricksService.create_nic
validation
def create_nic(self, datacenter_id, server_id, nic): """ Creates a NIC on the specified server. :param datacenter_id: The unique ID of the data center. :type datacenter_id: ``str`` :param server_id: The unique ID of the server. :type server_id: ``s...
python
{ "resource": "" }
q260395
ProfitBricksService.update_nic
validation
def update_nic(self, datacenter_id, server_id, nic_id, **kwargs): """ Updates a NIC with the parameters provided. :param datacenter_id: The unique ID of the data center. :type datacenter_id: ``str`` :param server_id: The unique ID of the serve...
python
{ "resource": "" }
q260396
ProfitBricksService.get_request
validation
def get_request(self, request_id, status=False): """ Retrieves a single request by ID. :param request_id: The unique ID of the request. :type request_id: ``str`` :param status: Retreive the full status of the request. :type status: ``bool`` ...
python
{ "resource": "" }
q260397
ProfitBricksService.get_server
validation
def get_server(self, datacenter_id, server_id, depth=1): """ Retrieves a server by its ID. :param datacenter_id: The unique ID of the data center. :type datacenter_id: ``str`` :param server_id: The unique ID of the server. :type server_id: ``str`` ...
python
{ "resource": "" }
q260398
ProfitBricksService.list_servers
validation
def list_servers(self, datacenter_id, depth=1): """ Retrieves a list of all servers bound to the specified data center. :param datacenter_id: The unique ID of the data center. :type datacenter_id: ``str`` :param depth: The depth of the response data. :ty...
python
{ "resource": "" }
q260399
ProfitBricksService.delete_server
validation
def delete_server(self, datacenter_id, server_id): """ Removes the server from your data center. :param datacenter_id: The unique ID of the data center. :type datacenter_id: ``str`` :param server_id: The unique ID of the server. :type server_id: ``...
python
{ "resource": "" }