pyJoules/device/device_factory.py
def create_devices(domains: Optional[Domain] = None) -> List[Device]:
        """
        Create and configure the Device instance with the given Domains

        :param domains: a list of Domain instance that as to be monitored (if None, return a list of all
                        monitorable devices)
        :return: a list of device configured with the given Domains
        :raise NoSuchDeviceError: if a domain depend on a device that doesn't exist on the current machine
        :raise NoSuchDomainError: if the given domain is not available on the device
        """
        if domains is None:
            domains = DeviceFactory._gen_all_available_domains()

        grouped_domains = {}
        for device_type, domain in map(lambda d: (d.get_device_type(), d), domains):
            if device_type in grouped_domains:
                grouped_domains[device_type].append(domain)
            else:
                grouped_domains[device_type] = [domain]

        devices = []

        for device_type in grouped_domains:
            device = device_type()
            device.configure(domains=grouped_domains[device_type])
            devices.append(device)
        return devices

        Create and configure the Device instance with the given Domains

        :param domains: a list of Domain instance that as to be monitored (if None, return a list of all
                        monitorable devices)
        :return: a list of device configured with the given Domains
        :raise NoSuchDeviceError: if a domain depend on a device that doesn't exist on the current machine
        :raise NoSuchDomainError: if the given domain is not available on the device
        
Create and configure the Device instance with the given Domains
Create and configure the Device instance with the given Domains
def create_devices(domains: Optional[Domain] = None) -> List[Device]:
        if domains is None:
            domains = DeviceFactory._gen_all_available_domains()
        grouped_domains = {}
        for device_type, domain in map(lambda d: (d.get_device_type(), d), domains):
            if device_type in grouped_domains:
                grouped_domains[device_type].append(domain)
            else:
                grouped_domains[device_type] = [domain]
        devices = []
        for device_type in grouped_domains:
            device = device_type()
            device.configure(domains=grouped_domains[device_type])
            devices.append(device)
        return devices
def create_devices ( domains : Optional [ Domain ] = None ) -> List [ Device ] : if domains is None : domains = DeviceFactory . _gen_all_available_domains ( ) grouped_domains = { } for device_type , domain in map ( lambda d : ( d . get_device_type ( ) , d ) , domains ) : if device_type in grouped_domains : grouped_domains [ device_type ] . append ( domain ) else : grouped_domains [ device_type ] = [ domain ] devices = [ ] for device_type in grouped_domains : device = device_type ( ) device . configure ( domains = grouped_domains [ device_type ] ) devices . append ( device ) return devices
Create and configure the Device instance with the given Domains
Create and configure the Device instance with the given Domains
"""
        Create and configure the Device instance with the given Domains

        :param domains: a list of Domain instance that as to be monitored (if None, return a list of all
                        monitorable devices)
        :return: a list of device configured with the given Domains
        :raise NoSuchDeviceError: if a domain depend on a device that doesn't exist on the current machine
        :raise NoSuchDomainError: if the given domain is not available on the device
        """
a list of device configured with the given Domains
a list of device configured with the given Domains
if a domain depend on a device that doesn't exist on the current machine
if a domain depend on a device that doesn ' t exist on the current machine
NoSuchDeviceError
if the given domain is not available on the device
if the given domain is not available on the device
NoSuchDomainError
domains
Optional[Domain]
a list of Domain instance that as to be monitored (if None, return a list of all
monitorable devices)
a list of Domain instance that as to be monitored ( if None return a list of all monitorable devices )