pywurfl.Devices

Package pywurfl :: Class Devices |
[hide private]
[frames] | no frames]

# Class Devices

source code

    object --+
             |
            Devices

Main pywurfl API class.

Instance Methods | [hide private]
__init__(self) x.__init__(...) initializes x; see x.__class__.__doc__ for signature | source code
find_actual_root(self, device=<class 'pywurfl.RootDevice'>) Find an actual device root. | source code
select_ua(self, devua, actual_device_root=False, filter_noise=True, search=None, instance=True) Return a Device object based on the user agent. | source code
select_id(self, devid, actual_device_root=False, instance=True) Return a Device object based on the WURFL ID. | source code
add_group(self, group) Add a group to the WURFL class hierarchy | source code
remove_group(self, group) Remove a group and all its capabilities from the WURFL class hierarchy | source code
_remove_capability(self, device, capability) | source code
_remove_tree(self, devid) | source code
add_capability(self, group, capability, default) Add a capability to the WURFL class hierarchy | source code
remove_capability(self, capability) Remove a capability from the WURFL class hierarchy | source code
add(self, parent, devid, devua, actual_device_root=False, capabilities=None) Add a device to the WURFL class hierarchy | source code
insert_before(self, child, devid, devua, actual_device_root=False, capabilities=None) Create and insert a device before another. | source code
insert_after(self, parent, devid, devua, actual_device_root=False, capabilities=None) Create and insert a device after another. | source code
remove(self, devid) Remove a device from the WURFL class hierarchy | source code
remove_tree(self, devid) Remove a device and all of its children from the WURFL class hierarchy | source code
_capability_generator(self, return_groups=False) | source code
__iter__(self) | source code
__len__(self) | source code
_normalize_types(self) | source code
_name_test(self, name, value) | source code
Inherited from `object`: `__delattr__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__setattr__`, `__str__`

Properties | [hide private]
| groups Yields all group names
| capabilities Yields all capability names
| grouped_capabilities Yields the tuple (group, capability) for all capabilities
| ids Return an iterator of all WURFL device ids
| uas Return an iterator of all device user agents
| md5_hexdigest Return MD5 hex digest for all WURFL data
Inherited from `object`: `__class__`

Method Details | [hide private]

### __init__(self) (Constructor) | source code
x.__init__(...) initializes x; see x.__class__.__doc__ for signature Overrides: object.__init__ (inherited documentation)

### find_actual_root(self, device=<class 'pywurfl.RootDevice'>) | source code
Find an actual device root. Parameters: `device` (Device class) - A Device class. Raises: `ActualDeviceNotFound` -

### select_ua(self, devua, actual_device_root=False, filter_noise=True, search=None, instance=True) | source code
Return a Device object based on the user agent. Parameters: `devua` (string) - The device user agent to search for. `actual_device_root` (boolean) - Return a device that is an actual device root `filter_noise` (boolean) - Remove noise words from devua. `search` (pywurfl.Algorithm) - The algorithm to use for searching. If 'search' is None, a search will not be performed. `instance` (boolean) - Used to select that you want an instance instead of a class object. Raises: `DeviceNotFound` -

### select_id(self, devid, actual_device_root=False, instance=True) | source code
Return a Device object based on the WURFL ID. Parameters: `devid` (string) - The WURFL id to search for. `actual_device_root` - Return a device that is an actual device root. `instance` (boolean) - Used to select that you want an instance instead of a class. Raises: `DeviceNotFound` -

### add_group(self, group) | source code
Add a group to the WURFL class hierarchy Parameters: `group` (string) - The group's name. The group name should match this regexp ^(_|[a-z])(_|[a-z]|[0-9])+$

### remove_group(self, group) | source code
Remove a group and all its capabilities from the WURFL class hierarchy Parameters: `group` (string) - The group name. The group name should match this regex '^[a-z]+(_|[a-z])+$' and be unique.

### add_capability(self, group, capability, default) | source code
Add a capability to the WURFL class hierarchy Parameters: `group` (string) - The group name. The group name should match this regex ^(_|[a-z])(_|[a-z]|[0-9])+$ `capability` (string) - The capability name. The capability name should match this regex ^(_|[a-z])(_|[a-z]|[0-9])+$' and be unique amongst all capabilities.

### remove_capability(self, capability) | source code
Remove a capability from the WURFL class hierarchy Parameters: `capability` (string) - The capability name.

### add(self, parent, devid, devua, actual_device_root=False, capabilities=None) | source code
Add a device to the WURFL class hierarchy Parameters: `parent` (string) - A WURFL ID. `devid` (string) - The device id for the new device. `devua` (string) - The user agent for the new device. `actual_device_root` (boolean) - Whether or not the new device is an actual device. `capabilities` (dict) - The new capabilities for the new device class.

### insert_before(self, child, devid, devua, actual_device_root=False, capabilities=None) | source code
Create and insert a device before another. The parent of the inserted device becomes the parent of the child device. The child device's parent is changed to the inserted device. Parameters: `child` (string) - A WURFL ID. The child device cannot be the generic device. `devid` (string) - The device id for the new device. `devua` (string) - The user agent for the new device. `actual_device_root` (boolean) - Whether or not the new device is an actual device. `capabilities` (dict) - The new capabilities for the new device class.

### insert_after(self, parent, devid, devua, actual_device_root=False, capabilities=None) | source code
Create and insert a device after another. The parent of the inserted device becomes the parent argument. The children of the parent device become the children of the inserted device then the parent device's children attribute is to the inserted device. Parameters: `parent` (string) - A WURFL ID. `devid` (string) - The device id for the new device. `devua` (string) - The user agent for the new device. `actual_device_root` (boolean) - Whether or not the new device is an actual device. `capabilities` (dict) - The new capabilities for the new device class.

### remove(self, devid) | source code
Remove a device from the WURFL class hierarchy Parameters: `devid` (string) - A WURFL ID. The generic device cannot be removed.

### remove_tree(self, devid) | source code
Remove a device and all of its children from the WURFL class hierarchy Parameters: `devid` (string) - A WURFL ID. The generic device cannot be removed.

Property Details | [hide private]

### groups Yields all group names Get Method: unreachable.groups(self) - Yields all group names

### capabilities Yields all capability names Get Method: unreachable.capabilities(self) - Yields all capability names

### grouped_capabilities Yields the tuple (group, capability) for all capabilities Get Method: unreachable.grouped_capabilities(self) - Yields the tuple (group, capability) for all capabilities

### ids Return an iterator of all WURFL device ids Get Method: unreachable.ids(self) - Return an iterator of all WURFL device ids

### uas Return an iterator of all device user agents Get Method: unreachable.uas(self) - Return an iterator of all device user agents

### md5_hexdigest Return MD5 hex digest for all WURFL data Get Method: unreachable.md5_hexdigest(self) - Return MD5 hex digest for all WURFL data