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
  find_actual_root(self, device=<class 'pywurfl.RootDevice'>)
Find an actual device root.
  select_ua(self, devua, actual_device_root=False, filter_noise=True, search=None, instance=True)
Return a Device object based on the user agent.
  select_id(self, devid, actual_device_root=False, instance=True)
Return a Device object based on the WURFL ID.
  add_group(self, group)
Add a group to the WURFL class hierarchy
  remove_group(self, group)
Remove a group and all its capabilities from the WURFL class hierarchy
  _remove_capability(self, device, capability)
  _remove_tree(self, devid)
  add_capability(self, group, capability, default)
Add a capability to the WURFL class hierarchy
  remove_capability(self, capability)
Remove a capability from the WURFL class hierarchy
  add(self, parent, devid, devua, actual_device_root=False, capabilities=None)
Add a device to the WURFL class hierarchy
  insert_before(self, child, devid, devua, actual_device_root=False, capabilities=None)
Create and insert a device before another.
  insert_after(self, parent, devid, devua, actual_device_root=False, capabilities=None)
Create and insert a device after another.
  remove(self, devid)
Remove a device from the WURFL class hierarchy
  remove_tree(self, devid)
Remove a device and all of its children from the WURFL class hierarchy
  _capability_generator(self, return_groups=False)
  __iter__(self)
  __len__(self)
  _normalize_types(self)
  _name_test(self, name, value)

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__


Properties [hide private]
  groups
  capabilities
  grouped_capabilities
  ids
  uas

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:

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:

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.

_remove_capability(self, device, capability)

source code 
None

_remove_tree(self, devid)

source code 
None

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.

_capability_generator(self, return_groups=False)

source code 
None

__iter__(self)

source code 
None

__len__(self)
(Length operator)

source code 
None

_normalize_types(self)

source code 
None

_name_test(self, name, value)

source code 
None

Property Details [hide private]

groups

None
Get Method:
unreachable.groups(self) - Yields all group names
Set Method:
None                                                                  
Delete Method:
None                                                                  

capabilities

None
Get Method:
unreachable.capabilities(self) - Yields all capability names
Set Method:
None                                                                  
Delete Method:
None                                                                  

grouped_capabilities

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

ids

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

uas

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