Package cssutils :: Module util :: Class Base |
[hide private]
[frames] | no frames]

# Class Base

source code

    object --+
             |
            Base

Known Subclasses:
  css.cssrule.CSSRule, css.cssvalue.CSSValue, css.cssstyledeclaration.CSSStyleDeclaration, stylesheets.stylesheet.StyleSheet, css.property.Property, stylesheets.medialist.MediaList, stylesheets.mediaquery.MediaQuery, css.selectorlist.SelectorList, css.selector.Selector

Base class for most CSS and StyleSheets classes

Contains helper methods for inheriting classes helping parsing

`_normalize` is static as used be Preferences.

Nested Classes | [hide private]
| _prods most attributes are set later

Instance Methods | [hide private]
__escapes(...) sub(repl, string[, count = 0]) --> newstring Return the string obtained by replacing the leftmost non-overlapping occurrences of pattern in string by the replacement repl. | source code
__unicodes(...) sub(repl, string[, count = 0]) --> newstring Return the string obtained by replacing the leftmost non-overlapping occurrences of pattern in string by the replacement repl. | source code
_checkReadonly(self) raises xml.dom.NoModificationAllowedErr if rule/... | source code
_newseq(self) | source code
_valuestr(self, t) returns string value of t (t may be a string, a list of token tuples or a single tuple in format (type, value, line, col) or a tokenlist[old]) | source code
_tokenize2(self, textortokens, aslist=False, fullsheet=False) returns tokens of textortokens which may already be tokens in which case simply returns input | source code
_nexttoken(self, tokenizer, default=None) returns next token in generator tokenizer or the default value | source code
_type(self, token) type of Tokenizer token | source code
_tokenvalue(self, token, normalize=False) value of Tokenizer token | source code
_tokensupto2(self, tokenizer, starttoken=None, blockstartonly=False, blockendonly=False, mediaendonly=False, semicolon=False, propertynameendonly=False, propertyvalueendonly=False, propertypriorityendonly=False, selectorattendonly=False, funcendonly=False, listseponly=False, keepEnd=False, keepEOF=False) returns tokens upto end of atrule and end index end is defined by parameters, might be ; } ) or other | source code
_getProductions(self, productions) each production should return the next expected token normaly a name like "uri" or "EOF" some have no expectation like S or COMMENT, so simply return the current value of self.__expected | source code
_parse(self, expected, seq, tokenizer, productions, default=None) (seq, tokenizer, token) | source code
Inherited from `object`: `__delattr__`, `__getattribute__`, `__hash__`, `__init__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__setattr__`, `__str__`

Static Methods | [hide private]
_normalize(x) normalizes x, namely: | source code

Class Variables | [hide private]
| __tokenizer2 = `<cssutils.tokenize2.Tokenizer object at 0x0211A`...``
| _log = `errorhandler.ErrorHandler()`
| _SHORTHANDPROPERTIES = ``{``u'``background``'``:` `[``]``,` `u'``border``'``:` `[``]``,` `u'``bo``...``

Properties | [hide private]
Inherited from `object`: `__class__`

Method Details | [hide private]

### _normalize(x) Static Method | source code
normalizes x, namely: remove any before non unicode sequences (0-9a-zA-Z) so for x=="color" return "color" (unicode escape sequences should have been resolved by the tokenizer already) lowercase

### _checkReadonly(self) | source code
raises xml.dom.NoModificationAllowedErr if rule/... is readonly

### _tokensupto2(self, tokenizer, starttoken=None, blockstartonly=False, blockendonly=False, mediaendonly=False, semicolon=False, propertynameendonly=False, propertyvalueendonly=False, propertypriorityendonly=False, selectorattendonly=False, funcendonly=False, listseponly=False, keepEnd=False, keepEOF=False) | source code
returns tokens upto end of atrule and end index end is defined by parameters, might be ; } ) or other default looks for ending "}" and ";"

### _parse(self, expected, seq, tokenizer, productions, default=None) | source code
puts parsed tokens in seq by calling a production with (seq, tokenizer, token) expected a name what token or value is expected next, e.g. 'uri' seq to add rules etc to tokenizer call tokenizer.next() to get next token productions callbacks {tokentype: callback} default default callback if tokentype not in productions returns (wellformed, expected) which the last prod might have set

Class Variable Details | [hide private]

  ### __tokenizer2 Value:
      Tokenizer()

  ### _SHORTHANDPROPERTIES Value:
      {u'background': [],
       u'border': [],
       u'border-bottom': [],
       u'border-color': [],
       u'border-left': [],
       u'border-right': [],
       u'border-style': [],
       u'border-top': [],
      ...