mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Use __slots__ for easy memory savings
This commit is contained in:
parent
49e4d09cbc
commit
783b1d112b
@ -100,6 +100,9 @@ class AtRule(object):
|
|||||||
the user API.
|
the user API.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
__slots__ = 'at_keyword', 'head', 'body', 'line', 'column'
|
||||||
|
|
||||||
def __init__(self, at_keyword, head, body, line, column):
|
def __init__(self, at_keyword, head, body, line, column):
|
||||||
self.at_keyword = at_keyword
|
self.at_keyword = at_keyword
|
||||||
self.head = TokenList(head)
|
self.head = TokenList(head)
|
||||||
@ -134,6 +137,7 @@ class RuleSet(object):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
at_keyword = None
|
at_keyword = None
|
||||||
|
__slots__ = 'selector', 'declarations', 'line', 'column'
|
||||||
|
|
||||||
def __init__(self, selector, declarations, line, column):
|
def __init__(self, selector, declarations, line, column):
|
||||||
self.selector = TokenList(selector)
|
self.selector = TokenList(selector)
|
||||||
@ -171,6 +175,8 @@ class Declaration(object):
|
|||||||
Either the string ``'important'`` or ``None``.
|
Either the string ``'important'`` or ``None``.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
__slots__ = 'name', 'value', 'priority', 'line', 'column'
|
||||||
|
|
||||||
def __init__(self, name, value, priority, line, column):
|
def __init__(self, name, value, priority, line, column):
|
||||||
self.name = name
|
self.name = name
|
||||||
self.value = TokenList(value)
|
self.value = TokenList(value)
|
||||||
@ -215,6 +221,7 @@ class PageRule(object):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
at_keyword = '@page'
|
at_keyword = '@page'
|
||||||
|
__slots__ = 'selector', 'specificity', 'declarations', 'at_rules', 'line', 'column'
|
||||||
|
|
||||||
def __init__(self, selector, specificity, declarations, at_rules,
|
def __init__(self, selector, specificity, declarations, at_rules,
|
||||||
line, column):
|
line, column):
|
||||||
@ -249,6 +256,7 @@ class MediaRule(object):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
at_keyword = '@media'
|
at_keyword = '@media'
|
||||||
|
__slots__ = 'media', 'rules', 'line', 'column'
|
||||||
|
|
||||||
def __init__(self, media, rules, line, column):
|
def __init__(self, media, rules, line, column):
|
||||||
self.media = media
|
self.media = media
|
||||||
@ -282,6 +290,7 @@ class ImportRule(object):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
at_keyword = '@import'
|
at_keyword = '@import'
|
||||||
|
__slots__ = 'uri', 'media', 'line', 'column'
|
||||||
|
|
||||||
def __init__(self, uri, media, line, column):
|
def __init__(self, uri, media, line, column):
|
||||||
self.uri = uri
|
self.uri = uri
|
||||||
|
@ -12,6 +12,7 @@ from tinycss.css21 import CSS21Parser, ParseError
|
|||||||
class FontFaceRule(object):
|
class FontFaceRule(object):
|
||||||
|
|
||||||
at_keyword = '@font-face'
|
at_keyword = '@font-face'
|
||||||
|
__slots__ = 'declarations', 'line', 'column'
|
||||||
|
|
||||||
def __init__(self, declarations, line, column):
|
def __init__(self, declarations, line, column):
|
||||||
self.declarations = declarations
|
self.declarations = declarations
|
||||||
|
@ -54,6 +54,8 @@ class MarginRule(object):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
__slots__ = 'at_keyword', 'declarations', 'line', 'column'
|
||||||
|
|
||||||
def __init__(self, at_keyword, declarations, line, column):
|
def __init__(self, at_keyword, declarations, line, column):
|
||||||
self.at_keyword = at_keyword
|
self.at_keyword = at_keyword
|
||||||
self.declarations = declarations
|
self.declarations = declarations
|
||||||
|
Loading…
x
Reference in New Issue
Block a user