Python get capabilities
60 Python code examples are found related to "
get capabilities".
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
Example 1
Source File: migration.py From PyU4V with Apache License 2.0 | 6 votes |
def get_array_migration_capabilities(self): """Check what migration facilities are available. :returns: array capabilities -- dict """ capabilities = self.get_resource( category=MIGRATION, resource_level=CAPABILITIES, resource_type=SYMMETRIX) symm_list = ( capabilities.get( 'storageArrayCapability', list()) if capabilities else list()) array_capabilities = dict() for symm in symm_list: if symm['arrayId'] == self.array_id: array_capabilities = symm break return array_capabilities # Environment endpoints
Example 2
Source File: helpers.py From tripleo-ansible with Apache License 2.0 | 6 votes |
def get_node_capabilities(nodes): """Convert the Node's capabilities into a dictionary. :param nodes: List of nodes :type nodes: List :returns: List """ nodes_datas = list() for node in nodes: nodes_data = dict() nodes_data['uuid'] = node['id'] properties = node['properties'] caps = properties.get('capabilities', '') capabilities_dict = dict([key.strip().split(':', 1) for key in caps.split(',')]) nodes_data['hint'] = capabilities_dict.get('node') nodes_datas.append(nodes_data) else: return nodes_datas
Example 3
Source File: user_access.py From misp42splunk with GNU Lesser General Public License v3.0 | 6 votes |
def get_capabilities(self): '''Get app capabilities. :returns: App capabilities. :rtype: ``dict`` :raises AppCapabilityNotExistException: If app capabilities are not registered. ''' try: record = self._collection_data.query_by_id(self._app) except binding.HTTPError as e: if e.status != 404: raise raise AppCapabilityNotExistException( 'App capabilities for %s have not been registered.' % self._app) return record['capabilities']
Example 4
Source File: iw_scan.py From libnl with GNU Lesser General Public License v2.1 | 6 votes |
def get_capabilities(_, data): """http://git.kernel.org/cgit/linux/kernel/git/jberg/iw.git/tree/scan.c?id=v3.17#n796. Positional arguments: data -- bytearray data to read. Returns: List. """ answers = list() for i in range(len(data)): base = i * 8 for bit in range(8): if not data[i] & (1 << bit): continue answers.append(CAPA.get(bit + base, bit)) return answers
Example 5
Source File: poc.py From pub with GNU General Public License v2.0 | 6 votes |
def get_capabilities(self, exist=None, accessible=None): if not self.capabilities: try: self._get_capabilities() except: self._get_capabilities_alternative() # check unavailable, simulate it for c in m.api.keys(): if exist is None and accessible is None: return self.capabilities filtered = {} if exist is not None: exist = "Y" if exist else "N" if accessible is not None: accessible = "Y" if accessible else "N" for cmd, cap in self.capabilities.iteritems(): if (exist is not None and cap["Exists"] == exist) and \ (accessible is not None and cap["Access"] == accessible): filtered[cmd] = cap return filtered
Example 6
Source File: imap4.py From python-for-android with Apache License 2.0 | 6 votes |
def getCapabilities(self, useCache=1): """Request the capabilities available on this server. This command is allowed in any state of connection. @type useCache: C{bool} @param useCache: Specify whether to use the capability-cache or to re-retrieve the capabilities from the server. Server capabilities should never change, so for normal use, this flag should never be false. @rtype: C{Deferred} @return: A deferred whose callback will be invoked with a dictionary mapping capability types to lists of supported mechanisms, or to None if a support list is not applicable. """ if useCache and self._capCache is not None: return defer.succeed(self._capCache) cmd = 'CAPABILITY' resp = ('CAPABILITY',) d = self.sendCommand(Command(cmd, wantResponse=resp)) d.addCallback(self.__cbCapabilities) return d
Example 7
Source File: plugin.py From pytest-cloud with MIT License | 6 votes |
def get_node_capabilities(channel): """Get test node capabilities. Executed on the remote side. :param channel: execnet channel for communication with master node :type channel: execnet.gateway_base.Channel :return: `dict` in form {'cpu_count': 1, 'virtual_memory': {'available': 100, 'total': 200}} :rtype: dict """ import psutil # pylint: disable=C0415 memory = psutil.virtual_memory() caps = dict(cpu_count=psutil.cpu_count(), virtual_memory=dict(available=memory.available, total=memory.total)) channel.send(caps) # pylint: disable=R0913
Example 8
Source File: _gateway.py From threema-msgapi-sdk-python with MIT License | 6 votes |
def get_reception_capabilities(self, id_): """ Get the reception capabilities of a Threema ID. Arguments: - `id_`: A Threema ID. Return a set containing items from :class:`ReceptionCapability`. """ get_coroutine = self._get(self.urls['get_reception_capabilities'].format(id_)) response = yield from get_coroutine if response.status == 200: try: text = yield from response.text() return {ReceptionCapability(capability.strip()) for capability in text.split(',')} except ValueError as exc: yield from response.release() raise ReceptionCapabilitiesError('Invalid reception capability') from exc else: yield from raise_server_error(response, ReceptionCapabilitiesServerError)
Example 9
Source File: terminfo.py From kitty with GNU General Public License v3.0 | 6 votes |
def get_capabilities(query_string: str) -> str: from .fast_data_types import ERROR_PREFIX ans = [] try: for q in query_string.split(';'): name = qname = unhexlify(q).decode('utf-8') if name in ('TN', 'name'): val = names[0] else: try: val = queryable_capabilities[name] except KeyError: try: qname = termcap_aliases[name] val = queryable_capabilities[qname] except Exception: from .utils import log_error log_error(ERROR_PREFIX, 'Unknown terminfo property:', name) raise if qname in string_capabilities and '%' not in val: val = key_as_bytes(qname).decode('ascii') ans.append(q + '=' + hexlify(str(val).encode('utf-8')).decode('ascii')) return '1+r' + ';'.join(ans) except Exception: return '0+r' + query_string
Example 10
Source File: replication.py From PyU4V with Apache License 2.0 | 6 votes |
def get_array_replication_capabilities(self): """Check what replication facilities are available. :returns: replication capability details -- dict """ capabilities = self.get_resource( category=REPLICATION, resource_level=CAPABILITIES, resource_type=SYMMETRIX) symm_list = capabilities.get( 'symmetrixCapability', list()) if capabilities else list() array_capabilities = dict() for symm in symm_list: if symm['symmetrixId'] == self.array_id: array_capabilities = symm break return array_capabilities
Example 11
Source File: server.py From skinnywms with Apache License 2.0 | 6 votes |
def get_capabilities(self, version, service_url, render_template): layers = list(self.availability.layers()) LOG.info("Layers are %s", layers) if self.availability.auto_add_plotter_layers: layers += list(self.plotter.layers()) layers = sorted(layers, key=lambda k: k.zindex) LOG.info("LAYERS are %r", layers) variables = { "service": {"title": "WMS", "url": service_url,}, "crss": self.plotter.supported_crss, "geographic_bounding_box": self.plotter.geographic_bounding_box, "layers": layers, } content_type = "text/xml" content = render_template("getcapabilities_{}.xml".format(version), **variables) return content_type, content
Example 12
Source File: __init__.py From parsedmarc with Apache License 2.0 | 6 votes |
def get_imap_capabilities(server): """ Returns a list of an IMAP server's capabilities Args: server (imapclient.IMAPClient): An instance of imapclient.IMAPClient Returns (list): A list of capabilities """ capabilities = list(map(str, list(server.capabilities()))) for i in range(len(capabilities)): capabilities[i] = str(capabilities[i]).replace("b'", "").replace("'", "") logger.debug("IMAP server supports: {0}".format(capabilities)) return capabilities
Example 13
Source File: handoff.py From tethys with BSD 2-Clause "Simplified" License | 6 votes |
def get_capabilities(self, app_name=None, external_only=False, jsonify=False): """ Gets a list of the valid handoff handlers. Args: app_name (str, optional): The name of another app whose capabilities should be listed. Defaults to None in which case the capabilities of the current app will be listed. external_only (bool, optional): If True only return handlers where the internal attribute is False. Default is False. jsonify (bool, optional): If True return the JSON representation of the handlers is used. Default is False. Returns: A list of valid HandoffHandler objects (or a JSON string if jsonify=True) representing the capabilities of app_name, or None if no app with app_name is found. """ # noqa: E501 manager = self._get_handoff_manager_for_app(app_name) if manager: handlers = manager.valid_handlers if external_only: handlers = [handler for handler in handlers if not handler.internal] if jsonify: handlers = json.dumps([handler.__dict__ for handler in handlers]) return handlers
Example 14
Source File: imap4.py From Safejumper-for-Desktop with GNU General Public License v2.0 | 6 votes |
def getCapabilities(self, useCache=1): """ Request the capabilities available on this server. This command is allowed in any state of connection. @type useCache: C{bool} @param useCache: Specify whether to use the capability-cache or to re-retrieve the capabilities from the server. Server capabilities should never change, so for normal use, this flag should never be false. @rtype: C{Deferred} @return: A deferred whose callback will be invoked with a dictionary mapping capability types to lists of supported mechanisms, or to None if a support list is not applicable. """ if useCache and self._capCache is not None: return defer.succeed(self._capCache) cmd = b'CAPABILITY' resp = (b'CAPABILITY',) d = self.sendCommand(Command(cmd, wantResponse=resp)) d.addCallback(self.__cbCapabilities) return d
Example 15
Source File: Bears.py From coala-quickstart with GNU Affero General Public License v3.0 | 6 votes |
def get_bears_with_given_capabilities(bears, capabilities): """ Returns a list of bears which contain at least one on the capability in ``capabilities`` list. :param bears: list of bears. :param capabilities: A list of bear capabilities that coala supports """ result = set() for bear in bears: can_detect_caps = [c for c in list(bear.CAN_DETECT)] can_fix_caps = [c for c in list(bear.CAN_FIX)] eligible = False for cap in capabilities: if cap in can_fix_caps or cap in can_detect_caps: eligible = True if eligible: result.add(bear) return result
Example 16
Source File: port_property_syntax.py From calvin-base with Apache License 2.0 | 6 votes |
def get_port_property_capabilities(properties): property_capabilities = set([]) for key, values in properties.items(): if isinstance(values, (list, tuple)): value = values[0] else: value = values if key not in port_property_data.keys(): # This should not happen so just ignore it continue ppdata = port_property_sets['all'][key] if ppdata['capability_type'] == "ignore": continue if ppdata['capability_type'] == "category": property_capabilities.add(key + "." + value) elif ppdata['capability_type'] == "propertyname": property_capabilities.add(key) elif ppdata['capability_type'] == "func": category = ppdata['capability_func'](value) property_capabilities.add(key + "." + category) return set(["portproperty." + p for p in property_capabilities])
Example 17
Source File: Nexus2.py From nexus2artifactory with Apache License 2.0 | 6 votes |
def getYumCapabilities(self, xml): if not os.path.isfile(xml): return [] root = ET.parse(xml).getroot() caps = root.find('capabilities') if caps == None: return [] yumrepos = [] for cap in caps.findall('capability'): tid = cap.find('typeId').text if tid not in ('yum.generate', 'yum.proxy', 'yum.merge'): continue props = {} xmlprops = cap.find('properties') if xmlprops == None: xmlprops = [] else: xmlprops = xmlprops.findall('property') for prop in xmlprops: props[prop.find('key').text] = prop.find('value').text yumrepos.append(props['repository']) return yumrepos
Example 18
Source File: plugin.py From robotframework-seleniumtestability with Apache License 2.0 | 5 votes |
def get_default_capabilities(self: "SeleniumTestability", browser_name: str) -> OptionalDictType: """ Returns a set of default capabilities for given ``browser``. """ try: browser = browser_name.lower().replace(" ", "") return self.BROWSERS[browser].copy() except Exception as e: self.logger.debug(e) return None
Example 19
Source File: nodetype.py From tosca-parser with Apache License 2.0 | 5 votes |
def get_capabilities_objects(self): '''Return a list of capability objects.''' typecapabilities = [] caps = self.get_value(self.CAPABILITIES, None, True) if caps: # 'name' is symbolic name of the capability # 'value' is a dict { 'type': <capability type name> } for name, value in caps.items(): ctype = value.get('type') cap = CapabilityTypeDef(name, ctype, self.type, self.custom_def) typecapabilities.append(cap) return typecapabilities
Example 20
Source File: dot11.py From Slackor with GNU General Public License v3.0 | 5 votes |
def get_capabilities(self): 'Return the 802.11 Management Beacon frame \'Capability information\' field. ' b = self.header.get_word(10, "<") return b
Example 21
Source File: smb3.py From Slackor with GNU General Public License v3.0 | 5 votes |
def getIOCapabilities(self): res = dict() res['MaxReadSize'] = self._Connection['MaxReadSize'] res['MaxWriteSize'] = self._Connection['MaxWriteSize'] return res ###################################################################### # Backward compatibility functions and alias for SMB1 and DCE Transports # NOTE: It is strongly recommended not to use these commands # when implementing new client calls.
Example 22
Source File: imap.py From Slackor with GNU General Public License v3.0 | 5 votes |
def getServerCapabilities(self): for key in list(self.activeRelays.keys()): if key != 'data' and key != 'scheme': if 'protocolClient' in self.activeRelays[key]: return self.activeRelays[key]['protocolClient'].session.capabilities
Example 23
Source File: adtn_capabilities_task.py From voltha with Apache License 2.0 | 5 votes |
def perform_get_capabilities(self): """ Perform the MIB Capabilities sequence. The sequence is to perform a Get request with the attribute mask equal to 'me_type_table'. The response to this request will carry the size of (number of get-next sequences). Then a loop is entered and get-next commands are sent for each sequence requested. """ self.log.info('perform-get') if self._omci_managed: # Return generator deferred/results return super(AdtnCapabilitiesTask, self).perform_get_capabilities() # Fixed values, no need to query try: self._supported_entities = self.supported_managed_entities self._supported_msg_types = self.supported_message_types self.log.debug('get-success', supported_entities=self.supported_managed_entities, supported_msg_types=self.supported_message_types) results = { 'supported-managed-entities': self.supported_managed_entities, 'supported-message-types': self.supported_message_types } self.deferred.callback(results) except Exception as e: self.log.exception('get-failed', e=e) self.deferred.errback(failure.Failure(e))
Example 24
Source File: master.py From backdoorme with MIT License | 5 votes |
def get_capabilities(self, category=None, recursive=False): caps = [] if category is None: for cat in self.get_categories(): caps += self.walk("backdoors/"+cat, echo=False, recursive=recursive) return caps else: return self.walk("backdoors/"+category, echo=False, recursive=recursive)
Example 25
Source File: virsh.py From maas with GNU Affero General Public License v3.0 | 5 votes |
def get_domain_capabilities(self): """Return the domain capabilities. Determines the type and emulator of the domain to use. """ # Test for KVM support first. xml = self.run(["domcapabilities", "--virttype", "kvm"]) if xml.startswith("error"): # Fallback to qemu support. Fail if qemu not supported. xml = self.run(["domcapabilities", "--virttype", "qemu"]) emulator_type = "qemu" else: emulator_type = "kvm" # XXX newell 2017-05-18 bug=1690781 # Check to see if the XML output was an error. # See bug for details about why and how this can occur. if xml.startswith("error"): raise VirshError( "`virsh domcapabilities --virttype %s` errored. Please " "verify that package qemu-kvm is installed and restart " "libvirt-bin service." % emulator_type ) doc = etree.XML(xml) evaluator = etree.XPathEvaluator(doc) emulator = evaluator("/domainCapabilities/path")[0].text return {"type": emulator_type, "emulator": emulator}
Example 26
Source File: proxyhandler_api.py From calvin-base with Apache License 2.0 | 5 votes |
def handle_get_proxy_capabilities(self, handle, connection, match, data, hdr): """ GET /proxy/{node-id}/capabilities Get capabilities from proxy peer {node-id} Response status code: Capabilities """ try: data = self.node.proxy_handler.get_capabilities(match.group(1)) status = calvinresponse.OK except: _log.exception("handle_get_proxy_capabilities") status = calvinresponse.NOT_FOUND self.send_response(handle, connection, json.dumps(data) if status == calvinresponse.OK else None, status=status)
Example 27
Source File: peer_pool.py From trinity with MIT License | 5 votes |
def get_protocol_capabilities(self) -> Tuple[Tuple[str, int], ...]: return tuple( (handshaker.protocol_class.name, handshaker.protocol_class.version) for handshaker in await self.get_peer_factory().get_handshakers() )
Example 28
Source File: runtime_api.py From calvin-base with Apache License 2.0 | 5 votes |
def handle_get_node_capabilities(self, handle, connection, match, data, hdr): """ GET /capabilities Get capabilities of this calvin node Response status code: OK Response: list of capabilities """ self.send_response(handle, connection, json.dumps(get_calvinsys().list_capabilities() + get_calvinlib().list_capabilities()))
Example 29
Source File: BDGExRequestHandler.py From DsgTools with GNU General Public License v2.0 | 5 votes |
def requestGetCapabilitiesXML(self, url): """ Gets url capabilities """ self.setUrllibProxy(url) getCapa = urllib.request.Request(url, headers={'User-Agent' : "Magic Browser"}) resp = urllib.request.urlopen(getCapa) response = resp.read() try: myDom=parseString(response) except: raise Exception('Parse Error') return myDom
Example 30
Source File: base.py From aodh with Apache License 2.0 | 5 votes |
def get_storage_capabilities(cls): """Return a dictionary representing the performance capabilities. This is needed to evaluate the performance of each driver. """ return cls.STORAGE_CAPABILITIES
Example 31
Source File: ServerSideExtension_pb2.py From qlik-py-tools with MIT License | 5 votes |
def GetCapabilities(self, request, context): """/ A handshake call for the Qlik engine to retrieve the capability of the plugin. """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!')
Example 32
Source File: BDGExRequestHandler.py From DsgTools with GNU General Public License v2.0 | 5 votes |
def getCapabilitiesDict(self, service, url, service_type='WMS'): capabilities_url = "{url}?service={service_type}&request=GetCapabilities".format( url=self.availableServicesDict[service]['url'], service_type=service_type ) myDom = self.requestGetCapabilitiesXML(capabilities_url) if service_type == 'WMS': return self.parseCapabilitiesXML(myDom) elif service_type == 'WFS': return self.parse_wfs_capabilities(myDom) else: return {}
Example 33
Source File: models.py From GeoHealthCheck with MIT License | 5 votes |
def get_capabilities_url(self): if self.resource_type.startswith('OGC:') \ and self.resource_type not in \ ['OGC:STA', 'OGC:WFS3', 'ESRI:FS']: url = '%s%s' % (bind_url(self.url), RESOURCE_TYPES[self.resource_type]['capabilities']) else: url = self.url return url
Example 34
Source File: win32timezone.py From ironpython2 with Apache License 2.0 | 5 votes |
def GetTZCapabilities(): """Run a few known tests to determine the capabilities of the time zone database on this machine. Note Dynamic Time Zone support is not available on any platform at this time; this is a limitation of this library, not the platform.""" tzi = TimeZoneInfo('Mountain Standard Time') MissingTZPatch = datetime.datetime(2007,11,2,tzinfo=tzi).utctimetuple() != (2007,11,2,6,0,0,4,306,0) DynamicTZSupport = not MissingTZPatch and datetime.datetime(2003,11,2,tzinfo=tzi).utctimetuple() == (2003,11,2,7,0,0,6,306,0) del tzi return vars()
Example 35
Source File: controller.py From PyZwaver with GNU General Public License v3.0 | 5 votes |
def UpdateSerialApiGetCapabilities(self): """ """ def handler(data): self.props.SetSerialCapabilities( *struct.unpack(">HHHH32s", data[4:-1])) self.SendCommand(z.API_SERIAL_API_GET_CAPABILITIES, [], handler)
Example 36
Source File: owncloud.py From pyocclient with MIT License | 5 votes |
def get_capabilities(self): """Gets the ownCloud app capabilities :returns: capabilities dictionary that maps from app name to another dictionary containing the capabilities """ if self._capabilities is None: self._update_capabilities() return self._capabilities
Example 37
Source File: core.py From pina-colada with MIT License | 5 votes |
def get_capabilities(self, category=None): caps = [] if category is None: for cat in self.get_categories(): caps += self.walk("capabilities/"+cat) return caps else: return self.walk("capabilities/"+category)
Example 38
Source File: interface.py From PyTado with GNU General Public License v3.0 | 5 votes |
def getCapabilities(self, zone): """Gets current capabilities of Zone zone.""" # pylint: disable=C0103 cmd = 'zones/%i/capabilities' % zone data = self._apiCall(cmd) return data
Example 39
Source File: mock_bmc.py From OpenDCRE with GNU General Public License v2.0 | 5 votes |
def get_channel_auth_capabilities(self, packet): """ Process a Get Channel Authentication Capabilities request. The bytes in this response are set in the config file which was used to initialize the BMC state. Args: packet (IPMI): the IPMI packet representing the incoming Get Boot Options request. Returns: list[int]: a list of bytes which make up the Get Channel Authentication Capabilities response. """ _channel, _auth = packet.data ac = self.channel_auth_capabilities # check the lower 4 bits for channel number. if the channel number is 0x0e, # we will use the channel in the config, otherwise we will use the provided # channel number. if _channel & 0b1111 == 0x0e: channel = ac['channel'] else: channel = _channel & 0b1111 return [ channel, ac['version_compatibility'], ac['user_capabilities'], ac['supported_connections'] ] + ac['oem_id'] + [ac['oem_auxiliary_data']]
Example 40
Source File: __init__.py From platypush with MIT License | 5 votes |
def get_capabilities(self) -> List[str]: """ Get the capabilities of the controller. """ return list(self._get_controller().capabilities)
Example 41
Source File: state.py From claimchain-core with MIT License | 5 votes |
def get_capabilities(self, reader_dh_pk): """List all labels accessibly by a reader. :param petlib.EcPt reader_dh_pk: Reader's DH public key """ return list(self._caps_by_reader_pk[reader_dh_pk])
Example 42
Source File: rtc_signalling.py From robotstreamer with Apache License 2.0 | 5 votes |
def getRouterRtpCapabilities(self): self.send(json.dumps({ 'request':True, 'id': 1, 'method' : 'getRouterRtpCapabilities', 'data' : {} }))
Example 43
Source File: imap.py From Exchange2domain with MIT License | 5 votes |
def getServerCapabilities(self): for key in self.activeRelays.keys(): if key != 'data' and key != 'scheme': if self.activeRelays[key].has_key('protocolClient'): return self.activeRelays[key]['protocolClient'].session.capabilities
Example 44
Source File: _capabilities.py From tcconfig with MIT License | 5 votes |
def get_required_capabilities(command): required_capabilities_map = { "tc": ["cap_net_admin"], "ip": ["cap_net_raw", "cap_net_admin"], "iptables": ["cap_net_raw", "cap_net_admin"], } return required_capabilities_map[command]
Example 45
Source File: arubaoss.py From aruba-ansible-modules with Apache License 2.0 | 5 votes |
def get_capabilities(self): ''' Get capabilities ''' result = super(Cliconf, self).get_capabilities() return json.dumps(result)
Example 46
Source File: _object_store.py From openstacksdk with Apache License 2.0 | 5 votes |
def get_object_capabilities(self): """Get infomation about the object-storage service The object-storage service publishes a set of capabilities that include metadata about maximum values and thresholds. """ # The endpoint in the catalog has version and project-id in it # To get capabilities, we have to disassemble and reassemble the URL # This logic is taken from swiftclient endpoint = urllib.parse.urlparse(self.object_store.get_endpoint()) url = "{scheme}://{netloc}/info".format( scheme=endpoint.scheme, netloc=endpoint.netloc) return proxy._json_response(self.object_store.get(url))
Example 47
Source File: smartx.py From manila with Apache License 2.0 | 5 votes |
def get_capabilities_opts(self, opts, key): if strutils.bool_from_string(opts[key]): opts[key] = True else: opts[key] = False return opts
Example 48
Source File: InitAppiumDriver.py From AppiumTestProject with Apache License 2.0 | 5 votes |
def get_desired_capabilities(self, sno): device_info = {"udid": sno} try: result = subprocess.Popen("adb -s %s shell getprop" % sno, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE).stdout.readlines() for res in result: if re.search(r"ro\.build\.version\.release", res): device_info["platformVersion"] = (res.split(': ')[-1].strip())[1:-1] elif re.search(r"ro\.product\.model", res): device_info["deviceName"] = (res.split(': ')[-1].strip())[1:-1] if "platformVersion" in device_info.keys() and "deviceName" in device_info.keys(): break except Exception, e: self.log4py.error("获取手机信息时出错 :" + str(e)) return None
Example 49
Source File: common.py From scirius with GNU General Public License v3.0 | 5 votes |
def get_processing_filter_capabilities(fields, action): if action == 'suppress': return { 'fields': sorted(list(PROCESSING_FILTER_FIELDS & set(fields))), 'operators': ['equal'] } elif action == 'threshold': return { 'fields': sorted(list(PROCESSING_THRESHOLD_FIELDS & set(fields))), 'operators': ['equal'] } return { 'fields': [], 'operators': ['equal'] }
Example 50
Source File: probesysfs.py From Tickeys-linux with MIT License | 5 votes |
def get_capabilities(self): path = os.path.join(self.path, "device", "capabilities", "abs") line = read_line(path) capabilities = [] long_bit = getconf("LONG_BIT") for i, word in enumerate(line.split(" ")): word = int(word, 16) subcapabilities = [bool(word & 1 << i) for i in range(long_bit)] capabilities[:0] = subcapabilities return capabilities
Example 51
Source File: get.py From genielibs with Apache License 2.0 | 4 votes |
def get_bgp_neighbor_capabilities( device, neighbor_address, address_family, vrf, output=None ): """ Get neighbor capabilities Args: vrf ('str') : VRF name device ('obg') : Device object output ('dict') : Parsed output address_family ('str') : Address family to be verified neighbor_address ('str') : Neighbor address vrf ('str') : VRF name Returns: Capabilities Raises: None """ if output is None: output = {} if not output: try: output = get_ip_bgp_neighbors( device=device, address_family=address_family, vrf=vrf, neighbor_address=neighbor_address, ) except SchemaEmptyParserError as e: return None address_family = address_family.replace(" ", "_") capabilities = ( output["vrf"] .get(vrf, {}) .get("neighbor", {}) .get(neighbor_address, {}) .get("bgp_negotiated_capabilities", {}) .get(address_family, None) ) return capabilities