_id stringlengths 2 7 | title stringlengths 1 88 | partition stringclasses 3
values | text stringlengths 75 19.8k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q232700 | Pool._format_monitor_parameter | train | def _format_monitor_parameter(param):
"""This is a workaround for a known issue ID645289, which affects
all versions of TMOS at this time.
"""
if '{' in param and '}':
tmp = param.strip('}').split('{')
monitor = ''.join(tmp).rstrip()
return monitor
... | python | {
"resource": ""
} |
q232701 | Pool.create | train | def create(self, **kwargs):
"""Custom create method to implement monitor parameter formatting."""
if 'monitor' in kwargs:
value = self._format_monitor_parameter(kwargs['monitor'])
kwargs['monitor'] = value
return super(Pool, self)._create(**kwargs) | python | {
"resource": ""
} |
q232702 | Pool.update | train | def update(self, **kwargs):
"""Custom update method to implement monitor parameter formatting."""
if 'monitor' in kwargs:
value = self._format_monitor_parameter(kwargs['monitor'])
kwargs['monitor'] = value
elif 'monitor' in self.__dict__:
value = self._format_... | python | {
"resource": ""
} |
q232703 | Pool.modify | train | def modify(self, **patch):
"""Custom modify method to implement monitor parameter formatting."""
if 'monitor' in patch:
value = self._format_monitor_parameter(patch['monitor'])
patch['monitor'] = value
return super(Pool, self)._modify(**patch) | python | {
"resource": ""
} |
q232704 | Members.exists | train | def exists(self, **kwargs):
"""Check for the existence of the named object on the BigIP
Sends an HTTP GET to the URI of the named object and if it fails with
a :exc:~requests.HTTPError` exception it checks the exception for
status code of 404 and returns :obj:`False` in that case.
... | python | {
"resource": ""
} |
q232705 | Ucs.exec_cmd | train | def exec_cmd(self, command, **kwargs):
"""Due to ID476518 the load command need special treatment."""
self._is_allowed_command(command)
self._check_command_parameters(**kwargs)
if command == 'load':
kwargs['command'] = command
self._check_exclusive_parameters(**k... | python | {
"resource": ""
} |
q232706 | Ucs.load | train | def load(self, **kwargs):
"""Method to list the UCS on the system
Since this is only fixed in 12.1.0 and up
we implemented version check here
"""
# Check if we are using 12.1.0 version or above when using this method
self._is_version_supported_method('12.1.0')
n... | python | {
"resource": ""
} |
q232707 | DeviceGroup._set_attributes | train | def _set_attributes(self, **kwargs):
'''Set instance attributes based on kwargs
:param kwargs: dict -- kwargs to set as attributes
'''
try:
self.devices = kwargs['devices'][:]
self.name = kwargs['device_group_name']
self.type = kwargs['device_group_t... | python | {
"resource": ""
} |
q232708 | DeviceGroup.validate | train | def validate(self, **kwargs):
'''Validate device group state among given devices.
:param kwargs: dict -- keyword args of device group information
:raises: UnexpectedDeviceGroupType, UnexpectedDeviceGroupDevices
'''
self._set_attributes(**kwargs)
self._check_type()
... | python | {
"resource": ""
} |
q232709 | DeviceGroup._check_type | train | def _check_type(self):
'''Check that the device group type is correct.
:raises: DeviceGroupOperationNotSupported, DeviceGroupNotSupported
'''
if self.type not in self.available_types:
msg = 'Unsupported cluster type was given: %s' % self.type
raise DeviceGroupNo... | python | {
"resource": ""
} |
q232710 | DeviceGroup.create | train | def create(self, **kwargs):
'''Create the device service cluster group and add devices to it.'''
self._set_attributes(**kwargs)
self._check_type()
pollster(self._check_all_devices_in_sync)()
dg = self.devices[0].tm.cm.device_groups.device_group
dg.create(name=self.name, ... | python | {
"resource": ""
} |
q232711 | DeviceGroup.teardown | train | def teardown(self):
'''Teardown device service cluster group.'''
self.ensure_all_devices_in_sync()
for device in self.devices:
self._delete_device_from_device_group(device)
self._sync_to_group(device)
pollster(self._ensure_device_active)(device)
s... | python | {
"resource": ""
} |
q232712 | DeviceGroup._get_device_group | train | def _get_device_group(self, device):
'''Get the device group through a device.
:param device: bigip object -- device
:returns: tm.cm.device_groups.device_group object
'''
return device.tm.cm.device_groups.device_group.load(
name=self.name, partition=self.partition
... | python | {
"resource": ""
} |
q232713 | DeviceGroup._add_device_to_device_group | train | def _add_device_to_device_group(self, device):
'''Add device to device service cluster group.
:param device: bigip object -- device to add to group
'''
device_name = get_device_info(device).name
dg = pollster(self._get_device_group)(device)
dg.devices_s.devices.create(n... | python | {
"resource": ""
} |
q232714 | DeviceGroup._check_device_exists_in_device_group | train | def _check_device_exists_in_device_group(self, device_name):
'''Check whether a device exists in the device group
:param device: ManagementRoot object -- device to look for
'''
dg = self._get_device_group(self.devices[0])
dg.devices_s.devices.load(name=device_name, partition=se... | python | {
"resource": ""
} |
q232715 | DeviceGroup._delete_device_from_device_group | train | def _delete_device_from_device_group(self, device):
'''Remove device from device service cluster group.
:param device: ManagementRoot object -- device to delete from group
'''
device_name = get_device_info(device).name
dg = pollster(self._get_device_group)(device)
devic... | python | {
"resource": ""
} |
q232716 | DeviceGroup._ensure_device_active | train | def _ensure_device_active(self, device):
'''Ensure a single device is in an active state
:param device: ManagementRoot object -- device to inspect
:raises: UnexpectedClusterState
'''
act = device.tm.cm.devices.device.load(
name=get_device_info(device).name,
... | python | {
"resource": ""
} |
q232717 | DeviceGroup._sync_to_group | train | def _sync_to_group(self, device):
'''Sync the device to the cluster group
:param device: bigip object -- device to sync to group
'''
config_sync_cmd = 'config-sync to-group %s' % self.name
device.tm.cm.exec_cmd('run', utilCmdArgs=config_sync_cmd) | python | {
"resource": ""
} |
q232718 | DeviceGroup._check_all_devices_in_sync | train | def _check_all_devices_in_sync(self):
'''Wait until all devices have failover status of 'In Sync'.
:raises: UnexpectedClusterState
'''
if len(self._get_devices_by_failover_status('In Sync')) != \
len(self.devices):
msg = "Expected all devices in group to hav... | python | {
"resource": ""
} |
q232719 | DeviceGroup._get_devices_by_failover_status | train | def _get_devices_by_failover_status(self, status):
'''Get a list of bigips by failover status.
:param status: str -- status to filter the returned list of devices
:returns: list -- list of devices that have the given status
'''
devices_with_status = []
for device in sel... | python | {
"resource": ""
} |
q232720 | DeviceGroup._check_device_failover_status | train | def _check_device_failover_status(self, device, status):
'''Determine if a device has a specific failover status.
:param status: str -- status to check against
:returns: bool -- True is it has status, False otherwise
'''
sync_status = device.tm.cm.sync_status
sync_statu... | python | {
"resource": ""
} |
q232721 | DeviceGroup._get_devices_by_activation_state | train | def _get_devices_by_activation_state(self, state):
'''Get a list of bigips by activation statue.
:param state: str -- state to filter the returned list of devices
:returns: list -- list of devices that are in the given state
'''
devices_with_state = []
for device in sel... | python | {
"resource": ""
} |
q232722 | Policy._set_attr_reg | train | def _set_attr_reg(self):
"""Helper method.
Appends correct attribute registry, depending on TMOS version
"""
tmos_v = self._meta_data['bigip']._meta_data['tmos_version']
attributes = self._meta_data['attribute_registry']
v12kind = 'tm:asm:policies:blocking-settings:bloc... | python | {
"resource": ""
} |
q232723 | Policy.create | train | def create(self, **kwargs):
"""Custom creation logic to handle edge cases
This shouldn't be needed, but ASM has a tendency to raise various errors that
are painful to handle from a customer point-of-view
The error itself are described in their exception handler
To address thes... | python | {
"resource": ""
} |
q232724 | Policy.delete | train | def delete(self, **kwargs):
"""Custom deletion logic to handle edge cases
This shouldn't be needed, but ASM has a tendency to raise various errors that
are painful to handle from a customer point-of-view
The error itself are described in their exception handler
To address thes... | python | {
"resource": ""
} |
q232725 | CausalModel.reset | train | def reset(self):
"""
Reinitializes data to original inputs, and drops any estimated
results.
"""
Y, D, X = self.old_data['Y'], self.old_data['D'], self.old_data['X']
self.raw_data = Data(Y, D, X)
self.summary_stats = Summary(self.raw_data)
self.propensity = None
self.cutoff = None
self.blocks = No... | python | {
"resource": ""
} |
q232726 | CausalModel.est_propensity | train | def est_propensity(self, lin='all', qua=None):
"""
Estimates the propensity scores given list of covariates to
include linearly or quadratically.
The propensity score is the conditional probability of
receiving the treatment given the observed covariates.
Estimation is done via a logistic regression.
P... | python | {
"resource": ""
} |
q232727 | CausalModel.trim | train | def trim(self):
"""
Trims data based on propensity score to create a subsample with
better covariate balance.
The default cutoff value is set to 0.1. To set a custom cutoff
value, modify the object attribute named cutoff directly.
This method should only be executed after the propensity score
has bee... | python | {
"resource": ""
} |
q232728 | CausalModel.stratify | train | def stratify(self):
"""
Stratifies the sample based on propensity score.
By default the sample is divided into five equal-sized bins.
The number of bins can be set by modifying the object
attribute named blocks. Alternatively, custom-sized bins can
be created by setting blocks equal to a sorted list of ... | python | {
"resource": ""
} |
q232729 | CausalModel.est_via_matching | train | def est_via_matching(self, weights='inv', matches=1, bias_adj=False):
"""
Estimates average treatment effects using nearest-
neighborhood matching.
Matching is done with replacement. Method supports multiple
matching. Correcting bias that arise due to imperfect matches
is also supported. For details on me... | python | {
"resource": ""
} |
q232730 | random_data | train | def random_data(N=5000, K=3, unobservables=False, **kwargs):
"""
Function that generates data according to one of two simple models that
satisfies the unconfoundedness assumption.
The covariates and error terms are generated according to
X ~ N(mu, Sigma), epsilon ~ N(0, Gamma).
The counterfactual outcomes are... | python | {
"resource": ""
} |
q232731 | Summary._summarize_pscore | train | def _summarize_pscore(self, pscore_c, pscore_t):
"""
Called by Strata class during initialization.
"""
self._dict['p_min'] = min(pscore_c.min(), pscore_t.min())
self._dict['p_max'] = max(pscore_c.max(), pscore_t.max())
self._dict['p_c_mean'] = pscore_c.mean()
self._dict['p_t_mean'] = pscore_t.mean() | python | {
"resource": ""
} |
q232732 | AmazonAPI.lookup_bulk | train | def lookup_bulk(self, ResponseGroup="Large", **kwargs):
"""Lookup Amazon Products in bulk.
Returns all products matching requested ASINs, ignoring invalid
entries.
:return:
A list of :class:`~.AmazonProduct` instances.
"""
response = self.api.ItemLookup(Res... | python | {
"resource": ""
} |
q232733 | AmazonAPI.similarity_lookup | train | def similarity_lookup(self, ResponseGroup="Large", **kwargs):
"""Similarty Lookup.
Returns up to ten products that are similar to all items
specified in the request.
Example:
>>> api.similarity_lookup(ItemId='B002L3XLBO,B000LQTBKI')
"""
response = self.api.S... | python | {
"resource": ""
} |
q232734 | AmazonAPI.browse_node_lookup | train | def browse_node_lookup(self, ResponseGroup="BrowseNodeInfo", **kwargs):
"""Browse Node Lookup.
Returns the specified browse node's name, children, and ancestors.
Example:
>>> api.browse_node_lookup(BrowseNodeId='163357')
"""
response = self.api.BrowseNodeLookup(
... | python | {
"resource": ""
} |
q232735 | AmazonAPI.search_n | train | def search_n(self, n, **kwargs):
"""Search and return first N results..
:param n:
An integer specifying the number of results to return.
:return:
A list of :class:`~.AmazonProduct`.
"""
region = kwargs.get('region', self.region)
kwargs.update({'re... | python | {
"resource": ""
} |
q232736 | LXMLWrapper._safe_get_element_date | train | def _safe_get_element_date(self, path, root=None):
"""Safe get elemnent date.
Get element as datetime.date or None,
:param root:
Lxml element.
:param path:
String path (i.e. 'Items.Item.Offers.Offer').
:return:
datetime.date or None.
"... | python | {
"resource": ""
} |
q232737 | AmazonSearch.iterate_pages | train | def iterate_pages(self):
"""Iterate Pages.
A generator which iterates over all pages.
Keep in mind that Amazon limits the number of pages it makes available.
:return:
Yields lxml root elements.
"""
try:
while not self.is_last_page:
... | python | {
"resource": ""
} |
q232738 | AmazonBrowseNode.ancestor | train | def ancestor(self):
"""This browse node's immediate ancestor in the browse node tree.
:return:
The ancestor as an :class:`~.AmazonBrowseNode`, or None.
"""
ancestors = getattr(self.parsed_response, 'Ancestors', None)
if hasattr(ancestors, 'BrowseNode'):
r... | python | {
"resource": ""
} |
q232739 | AmazonBrowseNode.ancestors | train | def ancestors(self):
"""A list of this browse node's ancestors in the browse node tree.
:return:
List of :class:`~.AmazonBrowseNode` objects.
"""
ancestors = []
node = self.ancestor
while node is not None:
ancestors.append(node)
node =... | python | {
"resource": ""
} |
q232740 | AmazonBrowseNode.children | train | def children(self):
"""This browse node's children in the browse node tree.
:return:
A list of this browse node's children in the browse node tree.
"""
children = []
child_nodes = getattr(self.parsed_response, 'Children')
for child in getattr(child_nodes, 'BrowseNode', []):
... | python | {
"resource": ""
} |
q232741 | AmazonProduct.price_and_currency | train | def price_and_currency(self):
"""Get Offer Price and Currency.
Return price according to the following process:
* If product has a sale return Sales Price, otherwise,
* Return Price, otherwise,
* Return lowest offer price, otherwise,
* Return None.
:return:
... | python | {
"resource": ""
} |
q232742 | AmazonProduct.reviews | train | def reviews(self):
"""Customer Reviews.
Get a iframe URL for customer reviews.
:return:
A tuple of: has_reviews (bool), reviews url (string)
"""
iframe = self._safe_get_element_text('CustomerReviews.IFrameURL')
has_reviews = self._safe_get_element_text('Cust... | python | {
"resource": ""
} |
q232743 | AmazonProduct.editorial_reviews | train | def editorial_reviews(self):
"""Editorial Review.
Returns a list of all editorial reviews.
:return:
A list containing:
Editorial Review (string)
"""
result = []
reviews_node = self._safe_get_element('EditorialReviews')
if reviews_no... | python | {
"resource": ""
} |
q232744 | AmazonProduct.list_price | train | def list_price(self):
"""List Price.
:return:
A tuple containing:
1. Decimal representation of price.
2. ISO Currency code (string).
"""
price = self._safe_get_element_text('ItemAttributes.ListPrice.Amount')
currency = self._safe_get_... | python | {
"resource": ""
} |
q232745 | AmazonProduct.get_parent | train | def get_parent(self):
"""Get Parent.
Fetch parent product if it exists.
Use `parent_asin` to check if a parent exist before fetching.
:return:
An instance of :class:`~.AmazonProduct` representing the
parent product.
"""
if not self.parent:
... | python | {
"resource": ""
} |
q232746 | AmazonProduct.browse_nodes | train | def browse_nodes(self):
"""Browse Nodes.
:return:
A list of :class:`~.AmazonBrowseNode` objects.
"""
root = self._safe_get_element('BrowseNodes')
if root is None:
return []
return [AmazonBrowseNode(child) for child in root.iterchildren()] | python | {
"resource": ""
} |
q232747 | AmazonProduct.images | train | def images(self):
"""List of images for a response.
When using lookup with RespnoseGroup 'Images', you'll get a
list of images. Parse them so they are returned in an easily
used list format.
:return:
A list of `ObjectifiedElement` images
"""
try:
... | python | {
"resource": ""
} |
q232748 | AmazonProduct.actors | train | def actors(self):
"""Movie Actors.
:return:
A list of actors names.
"""
result = []
actors = self._safe_get_element('ItemAttributes.Actor') or []
for actor in actors:
result.append(actor.text)
return result | python | {
"resource": ""
} |
q232749 | AmazonProduct.directors | train | def directors(self):
"""Movie Directors.
:return:
A list of directors for a movie.
"""
result = []
directors = self._safe_get_element('ItemAttributes.Director') or []
for director in directors:
result.append(director.text)
return result | python | {
"resource": ""
} |
q232750 | ObjectIdentity.getMibSymbol | train | def getMibSymbol(self):
"""Returns MIB variable symbolic identification.
Returns
-------
str
MIB module name
str
MIB variable symbolic name
: :py:class:`~pysnmp.proto.rfc1902.ObjectName`
class instance representing MIB variable inst... | python | {
"resource": ""
} |
q232751 | ObjectIdentity.getOid | train | def getOid(self):
"""Returns OID identifying MIB variable.
Returns
-------
: :py:class:`~pysnmp.proto.rfc1902.ObjectName`
full OID identifying MIB variable including possible index part.
Raises
------
SmiError
If MIB variable conversion ha... | python | {
"resource": ""
} |
q232752 | ObjectIdentity.getLabel | train | def getLabel(self):
"""Returns symbolic path to this MIB variable.
Meaning a sequence of symbolic identifications for each of parent
MIB objects in MIB tree.
Returns
-------
tuple
sequence of names of nodes in a MIB tree from the top of the tree
... | python | {
"resource": ""
} |
q232753 | ObjectIdentity.addMibSource | train | def addMibSource(self, *mibSources):
"""Adds path to repository to search PySNMP MIB files.
Parameters
----------
*mibSources :
one or more paths to search or Python package names to import
and search for PySNMP MIB modules.
Returns
-------
... | python | {
"resource": ""
} |
q232754 | ObjectIdentity.loadMibs | train | def loadMibs(self, *modNames):
"""Schedules search and load of given MIB modules.
Parameters
----------
*modNames:
one or more MIB module names to load up and use for MIB
variables resolution purposes.
Returns
-------
: :py:class:`~pysnmp... | python | {
"resource": ""
} |
q232755 | ObjectType.resolveWithMib | train | def resolveWithMib(self, mibViewController):
"""Perform MIB variable ID and associated value conversion.
Parameters
----------
mibViewController : :py:class:`~pysnmp.smi.view.MibViewController`
class instance representing MIB browsing functionality.
Returns
... | python | {
"resource": ""
} |
q232756 | NotificationType.addVarBinds | train | def addVarBinds(self, *varBinds):
"""Appends variable-binding to notification.
Parameters
----------
*varBinds : :py:class:`~pysnmp.smi.rfc1902.ObjectType`
One or more :py:class:`~pysnmp.smi.rfc1902.ObjectType` class
instances.
Returns
-------
... | python | {
"resource": ""
} |
q232757 | NotificationType.resolveWithMib | train | def resolveWithMib(self, mibViewController):
"""Perform MIB variable ID conversion and notification objects expansion.
Parameters
----------
mibViewController : :py:class:`~pysnmp.smi.view.MibViewController`
class instance representing MIB browsing functionality.
Re... | python | {
"resource": ""
} |
q232758 | Integer32.withValues | train | def withValues(cls, *values):
"""Creates a subclass with discreet values constraint.
"""
class X(cls):
subtypeSpec = cls.subtypeSpec + constraint.SingleValueConstraint(
*values)
X.__name__ = cls.__name__
return X | python | {
"resource": ""
} |
q232759 | Integer32.withRange | train | def withRange(cls, minimum, maximum):
"""Creates a subclass with value range constraint.
"""
class X(cls):
subtypeSpec = cls.subtypeSpec + constraint.ValueRangeConstraint(
minimum, maximum)
X.__name__ = cls.__name__
return X | python | {
"resource": ""
} |
q232760 | Integer.withNamedValues | train | def withNamedValues(cls, **values):
"""Create a subclass with discreet named values constraint.
Reduce fully duplicate enumerations along the way.
"""
enums = set(cls.namedValues.items())
enums.update(values.items())
class X(cls):
namedValues = namedval.Name... | python | {
"resource": ""
} |
q232761 | OctetString.withSize | train | def withSize(cls, minimum, maximum):
"""Creates a subclass with value size constraint.
"""
class X(cls):
subtypeSpec = cls.subtypeSpec + constraint.ValueSizeConstraint(
minimum, maximum)
X.__name__ = cls.__name__
return X | python | {
"resource": ""
} |
q232762 | Bits.withNamedBits | train | def withNamedBits(cls, **values):
"""Creates a subclass with discreet named bits constraint.
Reduce fully duplicate enumerations along the way.
"""
enums = set(cls.namedValues.items())
enums.update(values.items())
class X(cls):
namedValues = namedval.NamedVa... | python | {
"resource": ""
} |
q232763 | MibBuilder.loadModule | train | def loadModule(self, modName, **userCtx):
"""Load and execute MIB modules as Python code"""
for mibSource in self._mibSources:
debug.logger & debug.FLAG_BLD and debug.logger(
'loadModule: trying %s at %s' % (modName, mibSource))
try:
codeObj, sfx ... | python | {
"resource": ""
} |
q232764 | nextCmd | train | def nextCmd(snmpDispatcher, authData, transportTarget,
*varBinds, **options):
"""Create a generator to perform one or more SNMP GETNEXT queries.
On each iteration, new SNMP GETNEXT request is send
(:RFC:`1905#section-4.2.2`). The iterator blocks waiting for response
to arrive or error to oc... | python | {
"resource": ""
} |
q232765 | MsgAndPduDispatcher.registerContextEngineId | train | def registerContextEngineId(self, contextEngineId, pduTypes, processPdu):
"""Register application with dispatcher"""
# 4.3.2 -> no-op
# 4.3.3
for pduType in pduTypes:
k = contextEngineId, pduType
if k in self._appsRegistration:
raise error.Protoco... | python | {
"resource": ""
} |
q232766 | MsgAndPduDispatcher.unregisterContextEngineId | train | def unregisterContextEngineId(self, contextEngineId, pduTypes):
"""Unregister application with dispatcher"""
# 4.3.4
if contextEngineId is None:
# Default to local snmpEngineId
contextEngineId, = self.mibInstrumController.mibBuilder.importSymbols(
'__SNMP... | python | {
"resource": ""
} |
q232767 | sendNotification | train | def sendNotification(snmpEngine, authData, transportTarget, contextData,
notifyType, *varBinds, **options):
"""Sends SNMP notification.
Based on passed parameters, prepares SNMP TRAP or INFORM message
(:RFC:`1905#section-4.2.6`) and schedules its transmission by
:mod:`twisted` I/O ... | python | {
"resource": ""
} |
q232768 | nextCmd | train | def nextCmd(snmpEngine, authData, transportTarget, contextData,
*varBinds, **options):
"""Performs SNMP GETNEXT query.
Based on passed parameters, prepares SNMP GETNEXT packet
(:RFC:`1905#section-4.2.2`) and schedules its transmission by
:mod:`twisted` I/O framework at a later point of time... | python | {
"resource": ""
} |
q232769 | ManagedMibObject.getBranch | train | def getBranch(self, name, **context):
"""Return a branch of this tree where the 'name' OID may reside"""
for keyLen in self._vars.getKeysLens():
subName = name[:keyLen]
if subName in self._vars:
return self._vars[subName]
raise error.NoSuchObjectError(nam... | python | {
"resource": ""
} |
q232770 | ManagedMibObject.getNode | train | def getNode(self, name, **context):
"""Return tree node found by name"""
if name == self.name:
return self
else:
return self.getBranch(name, **context).getNode(name, **context) | python | {
"resource": ""
} |
q232771 | ManagedMibObject.getNextNode | train | def getNextNode(self, name, **context):
"""Return tree node next to name"""
try:
nextNode = self.getBranch(name, **context)
except (error.NoSuchInstanceError, error.NoSuchObjectError):
return self.getNextBranch(name, **context)
else:
try:
... | python | {
"resource": ""
} |
q232772 | ManagedMibObject.writeCommit | train | def writeCommit(self, varBind, **context):
"""Commit new value of the Managed Object Instance.
Implements the second of the multi-step workflow of the SNMP SET
command processing (:RFC:`1905#section-4.2.5`).
The goal of the second phase is to actually modify the requested Managed
... | python | {
"resource": ""
} |
q232773 | MibScalar.readGet | train | def readGet(self, varBind, **context):
"""Read Managed Object Instance.
Implements the second of the two phases of the SNMP GET command
processing (:RFC:`1905#section-4.2.1`).
The goal of the second phase is to actually read the requested Managed
Object Instance. When multiple ... | python | {
"resource": ""
} |
q232774 | MibScalar.readGetNext | train | def readGetNext(self, varBind, **context):
"""Read the next Managed Object Instance.
Implements the second of the two phases of the SNMP GETNEXT command
processing (:RFC:`1905#section-4.2.2`).
The goal of the second phase is to actually read the Managed Object
Instance which is... | python | {
"resource": ""
} |
q232775 | MibScalar.createCommit | train | def createCommit(self, varBind, **context):
"""Create Managed Object Instance.
Implements the second of the multi-step workflow similar to the SNMP SET
command processing (:RFC:`1905#section-4.2.5`).
The goal of the second phase is to actually create requested Managed
Object In... | python | {
"resource": ""
} |
q232776 | MibScalar.createCleanup | train | def createCleanup(self, varBind, **context):
"""Finalize Managed Object Instance creation.
Implements the successful third step of the multi-step workflow similar to
the SNMP SET command processing (:RFC:`1905#section-4.2.5`).
The goal of the third (successful) phase is to seal the new... | python | {
"resource": ""
} |
q232777 | MibTableColumn.destroyCommit | train | def destroyCommit(self, varBind, **context):
"""Destroy Managed Object Instance.
Implements the second of the multi-step workflow similar to the SNMP SET
command processing (:RFC:`1905#section-4.2.5`).
The goal of the second phase is to actually remove requested Managed
Object ... | python | {
"resource": ""
} |
q232778 | MibTableRow.oidToValue | train | def oidToValue(self, syntax, identifier, impliedFlag=False, parentIndices=None):
"""Turn SMI table instance identifier into a value object.
SNMP SMI table objects are identified by OIDs composed of columnar
object ID and instance index. The index part can be composed
from the values of ... | python | {
"resource": ""
} |
q232779 | MibTableRow.valueToOid | train | def valueToOid(self, value, impliedFlag=False, parentIndices=None):
"""Turn value object into SMI table instance identifier.
SNMP SMI table objects are identified by OIDs composed of columnar
object ID and instance index. The index part can be composed
from the values of one or more tab... | python | {
"resource": ""
} |
q232780 | MibTableRow.announceManagementEvent | train | def announceManagementEvent(self, action, varBind, **context):
"""Announce mass operation on parent table's row.
SNMP SMI provides a way to extend already existing SMI table with
another table. Whenever a mass operation on parent table's column
is performed (e.g. row creation or destruc... | python | {
"resource": ""
} |
q232781 | MibTableRow.receiveManagementEvent | train | def receiveManagementEvent(self, action, varBind, **context):
"""Apply mass operation on extending table's row.
SNMP SMI provides a way to extend already existing SMI table with
another table. Whenever a mass operation on parent table's column
is performed (e.g. row creation or destruct... | python | {
"resource": ""
} |
q232782 | MibTableRow.registerAugmentation | train | def registerAugmentation(self, *names):
"""Register table extension.
SNMP SMI provides a way to extend already existing SMI table with
another table. This method registers dependent (extending) table
(or type :py:class:`MibTableRow`) to already existing table.
Whenever a row of... | python | {
"resource": ""
} |
q232783 | MibTableRow._manageColumns | train | def _manageColumns(self, action, varBind, **context):
"""Apply a management action on all columns
Parameters
----------
action: :py:class:`str` any of :py:class:`MibInstrumController`'s states
to apply on all columns but the one passed in `varBind`
varBind: :py:clas... | python | {
"resource": ""
} |
q232784 | MibTableRow._checkColumns | train | def _checkColumns(self, varBind, **context):
"""Check the consistency of all columns.
Parameters
----------
varBind: :py:class:`~pysnmp.smi.rfc1902.ObjectType` object representing
new :py:class:`RowStatus` Managed Object Instance value being set
on table row
... | python | {
"resource": ""
} |
q232785 | MibTableRow.getIndicesFromInstId | train | def getIndicesFromInstId(self, instId):
"""Return index values for instance identification"""
if instId in self._idToIdxCache:
return self._idToIdxCache[instId]
indices = []
for impliedFlag, modName, symName in self._indexNames:
mibObj, = mibBuilder.importSymbols... | python | {
"resource": ""
} |
q232786 | MibTableRow.getInstIdFromIndices | train | def getInstIdFromIndices(self, *indices):
"""Return column instance identification from indices"""
try:
return self._idxToIdCache[indices]
except TypeError:
cacheable = False
except KeyError:
cacheable = True
idx = 0
instId = ()
... | python | {
"resource": ""
} |
q232787 | MibTableRow.getInstNameByIndex | train | def getInstNameByIndex(self, colId, *indices):
"""Build column instance name from components"""
return self.name + (colId,) + self.getInstIdFromIndices(*indices) | python | {
"resource": ""
} |
q232788 | MibTableRow.getInstNamesByIndex | train | def getInstNamesByIndex(self, *indices):
"""Build column instance names from indices"""
instNames = []
for columnName in self._vars.keys():
instNames.append(
self.getInstNameByIndex(*(columnName[-1],) + indices)
)
return tuple(instNames) | python | {
"resource": ""
} |
q232789 | nextCmd | train | def nextCmd(snmpEngine, authData, transportTarget, contextData,
*varBinds, **options):
"""Creates a generator to perform one or more SNMP GETNEXT queries.
On each iteration, new SNMP GETNEXT request is send
(:RFC:`1905#section-4.2.2`). The iterator blocks waiting for response
to arrive or e... | python | {
"resource": ""
} |
q232790 | CommandResponderBase._storeAccessContext | train | def _storeAccessContext(snmpEngine):
"""Copy received message metadata while it lasts"""
execCtx = snmpEngine.observer.getExecutionContext('rfc3412.receiveMessage:request')
return {
'securityModel': execCtx['securityModel'],
'securityName': execCtx['securityName'],
... | python | {
"resource": ""
} |
q232791 | NextCommandResponder._getManagedObjectsInstances | train | def _getManagedObjectsInstances(self, varBinds, **context):
"""Iterate over Managed Objects fulfilling SNMP query.
Returns
-------
:py:class:`list` - List of Managed Objects Instances to respond with or
`None` to indicate that not all objects have been gathered
s... | python | {
"resource": ""
} |
q232792 | NetworkAddress.clone | train | def clone(self, value=univ.noValue, **kwargs):
"""Clone this instance.
If *value* is specified, use its tag as the component type selector,
and itself as the component value.
:param value: (Optional) the component value.
:type value: :py:obj:`pyasn1.type.base.Asn1ItemBase`
... | python | {
"resource": ""
} |
q232793 | MibInstrumController._defaultErrorHandler | train | def _defaultErrorHandler(varBinds, **context):
"""Raise exception on any error if user callback is missing"""
errors = context.get('errors')
if errors:
err = errors[-1]
raise err['error'] | python | {
"resource": ""
} |
q232794 | MibInstrumController.readMibObjects | train | def readMibObjects(self, *varBinds, **context):
"""Read Managed Objects Instances.
Given one or more py:class:`~pysnmp.smi.rfc1902.ObjectType` objects, read
all or none of the referenced Managed Objects Instances.
Parameters
----------
varBinds: :py:class:`tuple` of :py... | python | {
"resource": ""
} |
q232795 | MibInstrumController.readNextMibObjects | train | def readNextMibObjects(self, *varBinds, **context):
"""Read Managed Objects Instances next to the given ones.
Given one or more py:class:`~pysnmp.smi.rfc1902.ObjectType` objects, read
all or none of the Managed Objects Instances next to the referenced ones.
Parameters
---------... | python | {
"resource": ""
} |
q232796 | MibInstrumController.writeMibObjects | train | def writeMibObjects(self, *varBinds, **context):
"""Create, destroy or modify Managed Objects Instances.
Given one or more py:class:`~pysnmp.smi.rfc1902.ObjectType` objects, create,
destroy or modify all or none of the referenced Managed Objects Instances.
If a non-existing Managed Ob... | python | {
"resource": ""
} |
q232797 | bulkCmd | train | def bulkCmd(snmpDispatcher, authData, transportTarget,
nonRepeaters, maxRepetitions, *varBinds, **options):
"""Initiate SNMP GETBULK query over SNMPv2c.
Based on passed parameters, prepares SNMP GETBULK packet
(:RFC:`1905#section-4.2.3`) and schedules its transmission by
I/O framework at a ... | python | {
"resource": ""
} |
q232798 | AAFFile.save | train | def save(self):
"""
Writes current changes to disk and flushes modified objects in the
AAFObjectManager
"""
if self.mode in ("wb+", 'rb+'):
if not self.is_open:
raise IOError("file closed")
self.write_reference_properties()
self... | python | {
"resource": ""
} |
q232799 | AAFFile.close | train | def close(self):
"""
Close the file. A closed file cannot be read or written any more.
"""
self.save()
self.manager.remove_temp()
self.cfb.close()
self.is_open = False
self.f.close() | python | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.