l.h.s.t.t.T.MockSubmissionParser(SubmissionParser) : class documentation

Part of lp.hardwaredb.scripts.tests.test_hwdb_submission_parser.TestHWDBSubmissionParser View In Hierarchy

A SubmissionParser variant for testing checkCOnsistentData()

All "method substitutes" return a valid result.

Method findDuplicateIDs Return the set of duplicate IDs.
Method findInvalidIDReferences Return the set of invalid references to IDs.
Method getUDIDeviceMap Return a dictionary which maps UDIs to HAL devices.
Method getUDIChildren Build lists of all children of a UDI.
Method checkHALDevicesParentChildConsistency Ensure that HAL devices are represented in exactly one tree.
Method checkConsistentUdevDeviceData Consistency checks for udev data.

Inherited from SubmissionParser:

Method __init__ Undocumented
Method fixFrequentErrors Fixes for frequent formal errors in the submissions.
Method parseMainSections Undocumented
Method parseSubmission Parse the data of a HWDB submission.
Method checkUdevDictsHavePathKey Ensure that each udev dictionary has a 'P' key.
Method checkUdevPciProperties Validation of udev PCI devices.
Method checkUdevUsbProperties Validation of udev USB devices.
Method checkUdevScsiProperties Validation of udev SCSI devices.
Method checkUdevDmiData Consistency check for DMI data.
Method checkConsistency Run consistency checks on the submitted data.
Method buildDeviceList Create a list of devices from a submission.
Method buildHalDeviceList Create a list of devices from the HAL data of a submission.
Method buildUdevDeviceList Create a list of devices from the udev data of a submission.
Method kernel_package_name The kernel package name for the submission.
Method processSubmission Process a submisson.
Method root_device The HALDevice of UdevDevice node of the root device.
Method _logError Log message for an error in submission submission_key`.
Method _logWarning Log message for a warning in submission submission_key`.
Method _getValidatedEtree Create an etree doc from the XML string submission and validate it.
Method _getValueAttributeAsBoolean Return the value of the attribute "value" as a boolean.
Method _getValueAttributeAsString Return the value of the attribute "value".
Method _getValueAttributeAsDateTime Convert a "value" attribute into a datetime object.
Method _getClientData Parse the <client> node in the <summary> section.
Method _parseSummary Parse the <summary> part of a submission.
Method _getValueAndType Return (value, type) of a <property> or <value> node.
Method _parseProperty Parse a <property> node.
Method _parseProperties Parse <property> sub-nodes of properties_node.
Method _parseDevice Parse a HAL <device> node.
Method _parseHAL Parse the <hal> section of a submission.
Method _parseProcessors Parse the <processors> node.
Method _parseAliases Parse the <aliases> node.
Method _parseUdev Parse the <udev> node.
Method _parseDmi Parse the <dmi> node.
Method _parseSysfsAttributes Parse the <sysfs-attributes> node.
Method _setHardwareSectionParsers Undocumented
Method _parseHardware Parse the <hardware> part of a submission.
Method _parseLSBRelease Parse the <lsb_release> part of a submission.
Method _parsePackages Parse the <packages> part of a submission.
Method _parseXOrg Parse the <xorg> part of a submission.
Method _setSoftwareSectionParsers Undocumented
Method _parseSoftware Parse the <software> section of a submission.
Method _parseQuestions Parse the <questions> part of a submission.
Method _parseContext Parse the <context> part of a submission.
Method _setMainSectionParsers Undocumented
Method _findDuplicates Search for duplicate elements in test_ids.
Method _getIDMap Return a dictionary ID -> devices, processors and packages.
Method _getIDUDIMaps Return two mappings describing the relation between IDs and UDIs.
Method _removeChildren Remove recursively all children of the device named udi.
def findDuplicateIDs(self, parsed_data):
Return the set of duplicate IDs.

The IDs of devices, processors and software packages should be unique; this method returns a list of duplicate IDs found in a submission.

def findInvalidIDReferences(self, parsed_data):
Return the set of invalid references to IDs.

The sub-tag <target> of <question> references a device, processor of package node by its ID; the submission must contain a <device>, <processor> or <software> tag with this ID. This method returns a set of those IDs mentioned in <target> nodes that have no corresponding device or processor node.

def getUDIDeviceMap(self, devices):
Return a dictionary which maps UDIs to HAL devices.

Also check, if a UDI is used more than once.

Generally, a duplicate UDI indicates a bad or bogus submission, but we have some UDIs where the duplicate UDI is caused by a bug in HAL, see http://lists.freedesktop.org/archives/hal/2009-April/013250.html In these cases, we simply remove the duplicates, otherwise, a ValueError is raised.

def getUDIChildren(self, udi_device_map):
Build lists of all children of a UDI.

If any info.parent property points to a non-existing existing device, a ValueError is raised.

ReturnsA dictionary that maps UDIs to lists of children.
def checkHALDevicesParentChildConsistency(self, udi_children):
Ensure that HAL devices are represented in exactly one tree.

HAL devices "know" their parent device; each device has a parent, except the root element. This means that it is possible to traverse all existing devices, beginning at the root node.

Several inconsistencies are possible:

  1. we may have more than one root device (i.e., one without a parent)
  2. we may have no root element
  3. circular parent/child references may exist.

(a) and (b) are already checked in _getUDIChildren; this method implements (c),

ReturnsA list of those UDIs that are not "connected" to the root node /org/freedesktop/Hal/devices/computer
def checkConsistentUdevDeviceData(self, udev_data, sysfs_data, dmi_data):
Consistency checks for udev data.
API Documentation for Launchpad, generated by pydoctor at 2019-11-14 00:00:13.