Package mobi :: Package mtld :: Package da :: Package device :: Module tree :: Class Tree
[hide private]
[frames] | no frames]

Class Tree

object --+
         |
        Tree

Instance Methods [hide private]
 
__init__(self, json, config)
Load the JSON tree into a dict.
 
set_config(self, config)
Sets a new configuration instance to the tree :return:
 
property_names(self)
Get the list of all available property names from the tree (not contains client side props)
 
data_version(self)
Get data file version.
 
data_creation_timestamp(self)
Get data file creation timestamp.
 
put_properties(self, user_agent, stock_user_agents, client_side_properties, properties)
Get properties from tree walk/ua/client-side and put them in the tree.properties
 
put_tree_walk_properties(self, user_agent, stock_user_agents, properties)
Get properties from tree walk/ua and put them in the tree.properties
 
property_name_by_id(self, property_id)
 
property_value_by_id(self, value_id)
 
__seek_properties(self, node, string, props_to_vals, matched, regex_rules)

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

Class Variables [hide private]
  MIN_JSON_VERSION = 0.7
  MAP_INITIAL_CAPACITY = 100
  KEY_DEVICE_ID = u'iid'
  KEY_META = u'$'
  KEY_META_VERSION = u'Ver'
  KEY_GOTO = u'g'
  KEY_META_REVISION = u'Rev'
  KEY_META_TIMESTAMP = u'Utc'
  KEY_PROPERTY_NAMES = u'p'
  KEY_VALUES = u'v'
  KEY_REGEX = u'r'
  KEY_COMPILED_REGEX = u'creg'
  KEY_HEADERS = u'h'
  KEY_UA_STOCK_HEADERS = u'sl'
  KEY_MAIN = u't'
  KEY_DATA = u'd'
  KEY_CHILDREN = u'c'
  KEY_MASKED = u'm'
  tree = None
hash(x)
  data_revision = None
hash(x)
  stock_ua_headers = []
  __ua_props = None
hash(x)
  __client_props = None
hash(x)
  __device_id_prop_name_id = None
hash(x)
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, json, config)
(Constructor)

 

Load the JSON tree into a dict.

Overrides: object.__init__

put_properties(self, user_agent, stock_user_agents, client_side_properties, properties)

 

Get properties from tree walk/ua/client-side and put them in the tree.properties

Parameters:
  • user_agent - user-agent string (from the original User-Agent header) to be used for detecting ua-props
  • stock_user_agents - list of candidate user-agent strings to be used for tree walk
  • client_side_properties - optional client side properties @param properties

put_tree_walk_properties(self, user_agent, stock_user_agents, properties)

 

Get properties from tree walk/ua and put them in the tree.properties

if stock_user_agents is not None:

  • iterate over stock_user_agents for each item: tree-walk and stop iteration if result has deviceId
  • use userAgent for detecting the ua-props

if stock_user_agents is None:

  • use userAgent for tree walk
  • use userAgent for detecting the ua-props
Parameters:
  • user_agent - user-agent string (from the original User-Agent header)
  • stock_user_agents - list of candidate user-agent strings to be used for tree walk