Skip to content

Commit

Permalink
Ruff reformat
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Mar 30, 2024
1 parent f516e76 commit 4719971
Show file tree
Hide file tree
Showing 64 changed files with 187 additions and 173 deletions.
1 change: 1 addition & 0 deletions cssutils/_fetch.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Default URL reading functions"""

__all__ = ['_defaultFetcher']

import functools
Expand Down
1 change: 1 addition & 0 deletions cssutils/_fetchgae.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""GAE specific URL reading functions"""

__all__ = ['_defaultFetcher']

# raises ImportError of not on GAE
Expand Down
1 change: 1 addition & 0 deletions cssutils/css/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
todo
- RGBColor, Rect, Counter
"""

__all__ = [
'CSSStyleSheet',
'CSSRuleList',
Expand Down
1 change: 1 addition & 0 deletions cssutils/css/csscharsetrule.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""CSSCharsetRule implements DOM Level 2 CSS CSSCharsetRule."""

__all__ = ['CSSCharsetRule']

import codecs
Expand Down
1 change: 1 addition & 0 deletions cssutils/css/csscomment.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ class only.
Implements CSSRule which is also extended for a CSSComment rule type.
"""

__all__ = ['CSSComment']

from . import cssrule
Expand Down
1 change: 1 addition & 0 deletions cssutils/css/cssfontfacerule.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
From cssutils 0.9.6 additions from CSS Fonts Module Level 3 are
added http://www.w3.org/TR/css3-fonts/.
"""

__all__ = ['CSSFontFaceRule']

from .cssstyledeclaration import CSSStyleDeclaration
Expand Down
1 change: 1 addition & 0 deletions cssutils/css/cssimportrule.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""CSSImportRule implements DOM Level 2 CSS CSSImportRule plus the
``name`` property from http://www.w3.org/TR/css3-cascade/#cascading."""

__all__ = ['CSSImportRule']

from . import cssrule
Expand Down
1 change: 1 addition & 0 deletions cssutils/css/cssmediarule.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""CSSMediaRule implements DOM Level 2 CSS CSSMediaRule."""

__all__ = ['CSSMediaRule']

from . import cssrule
Expand Down
4 changes: 2 additions & 2 deletions cssutils/css/cssnamespacerule.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""CSSNamespaceRule currently implements http://dev.w3.org/csswg/css3-namespace/
"""
"""CSSNamespaceRule currently implements http://dev.w3.org/csswg/css3-namespace/"""

__all__ = ['CSSNamespaceRule']

from . import cssrule
Expand Down
1 change: 1 addition & 0 deletions cssutils/css/csspagerule.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""CSSPageRule implements DOM Level 2 CSS CSSPageRule."""

__all__ = ['CSSPageRule']

from itertools import chain
Expand Down
1 change: 1 addition & 0 deletions cssutils/css/cssproperties.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
and the version is "2.0".
"""

__all__ = ['CSS2Properties']

import cssutils.profiles
Expand Down
1 change: 1 addition & 0 deletions cssutils/css/cssrule.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""CSSRule implements DOM Level 2 CSS CSSRule."""

__all__ = ['CSSRule']

import cssutils
Expand Down
1 change: 1 addition & 0 deletions cssutils/css/cssrulelist.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""CSSRuleList implements DOM Level 2 CSS CSSRuleList.
Partly also http://dev.w3.org/csswg/cssom/#the-cssrulelist."""

__all__ = ['CSSRuleList']


Expand Down
1 change: 1 addition & 0 deletions cssutils/css/cssstyledeclaration.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
background: no-repeat left url() #fff
-> background: #fff url() no-repeat left
"""

__all__ = ['CSSStyleDeclaration', 'Property']

from .cssproperties import CSS2Properties
Expand Down
6 changes: 4 additions & 2 deletions cssutils/css/cssstylerule.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""CSSStyleRule implements DOM Level 2 CSS CSSStyleRule."""

__all__ = ['CSSStyleRule']

from .cssstyledeclaration import CSSStyleDeclaration
Expand Down Expand Up @@ -156,8 +157,9 @@ def _setCssText(self, cssText): # noqa: C901
)
else:
braceorEOFtoken = styletokens.pop()
val, typ = self._tokenvalue(braceorEOFtoken), self._type(
braceorEOFtoken
val, typ = (
self._tokenvalue(braceorEOFtoken),
self._type(braceorEOFtoken),
)
if val != '}' and typ != 'EOF':
ok = False
Expand Down
1 change: 1 addition & 0 deletions cssutils/css/cssstylesheet.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
TODO:
- ownerRule and ownerNode
"""

__all__ = ['CSSStyleSheet']

from cssutils.helper import Deprecated
Expand Down
1 change: 1 addition & 0 deletions cssutils/css/cssunknownrule.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""CSSUnknownRule implements DOM Level 2 CSS CSSUnknownRule."""

__all__ = ['CSSUnknownRule']

from . import cssrule
Expand Down
1 change: 1 addition & 0 deletions cssutils/css/cssvalue.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- CSSValueList implements DOM Level 2 CSS CSSValueList
"""

__all__ = ['CSSValue', 'CSSPrimitiveValue', 'CSSValueList', 'RGBColor', 'CSSVariable']

from cssutils.prodparser import Choice, PreDef, Prod, ProdParser, Sequence
Expand Down
1 change: 1 addition & 0 deletions cssutils/css/cssvariablesdeclaration.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""CSSVariablesDeclaration
http://disruptive-innovations.com/zoo/cssvariables/#mozTocId496530
"""

__all__ = ['CSSVariablesDeclaration']

from cssutils.prodparser import PreDef, Prod, ProdParser, Sequence
Expand Down
1 change: 1 addition & 0 deletions cssutils/css/cssvariablesrule.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""CSSVariables implements (and only partly) experimental
`CSS Variables <http://disruptive-innovations.com/zoo/cssvariables/>`_
"""

__all__ = ['CSSVariablesRule']

from .cssvariablesdeclaration import CSSVariablesDeclaration
Expand Down
3 changes: 2 additions & 1 deletion cssutils/css/marginrule.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""MarginRule implements DOM Level 2 CSS MarginRule."""

__all__ = ['MarginRule']

from cssutils.prodparser import Choice, PreDef, Prod, ProdParser, Sequence
Expand Down Expand Up @@ -170,7 +171,7 @@ def _setCssText(self, cssText):
name='@ margin',
match=lambda t, v: t == 'ATKEYWORD'
and self._normalize(v) in MarginRule.margins,
toStore='margin'
toStore='margin',
# TODO?
# , exception=xml.dom.InvalidModificationErr
),
Expand Down
1 change: 1 addition & 0 deletions cssutils/css/property.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Property is a single CSS property in a CSSStyleDeclaration."""

__all__ = ['Property']

from cssutils.helper import Deprecated
Expand Down
1 change: 1 addition & 0 deletions cssutils/css/selector.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- .contains(selector)
- .isSubselector(selector)
"""

__all__ = ['Selector']

from cssutils.helper import Deprecated
Expand Down
1 change: 1 addition & 0 deletions cssutils/css/selectorlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
a CSS2 user agent must ignore the whole second line, and not set
the color of H3 to red:
"""

__all__ = ['SelectorList']

from .selector import Selector
Expand Down
1 change: 1 addition & 0 deletions cssutils/css/value.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
DOM Level 2 CSS CSSValue, CSSPrimitiveValue and CSSValueList are **no longer**
supported and are replaced by these new classes.
"""

__all__ = [
'PropertyValue',
'Value',
Expand Down
1 change: 1 addition & 0 deletions cssutils/css2productions.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"""

__all__ = ['CSSProductions', 'MACROS', 'PRODUCTIONS']

# option case-insensitive
Expand Down
3 changes: 2 additions & 1 deletion cssutils/cssproductions.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
CSS2.1: 'nmchar': r'[_a-z0-9-]|{nonascii}|{escape}',
CSS3: 'nmchar': r'[_a-z-]|{nonascii}|{escape}',
"""

__all__ = ['CSSProductions', 'MACROS', 'PRODUCTIONS']

# a complete list of css3 macros
Expand Down Expand Up @@ -86,7 +87,7 @@
('SUBSTRINGMATCH', r'\*\='),
('CDO', r'\<\!\-\-'),
('CDC', r'\-\-\>'),
('CHAR', r'[^"\']') # MUST always be last
('CHAR', r'[^"\']'), # MUST always be last
# valid ony at start so not checked everytime
# ('CHARSET_SYM', r'@charset '), # from Errata includes ending space!
# checked specially if fullsheet is parsed
Expand Down
2 changes: 2 additions & 0 deletions cssutils/errorhandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
- raiseExceptions = [False, True]
- setloglevel(loglevel)
"""

__all__ = ['ErrorHandler']

import logging
Expand Down Expand Up @@ -110,6 +111,7 @@ def setLog(self, log):

class ErrorHandler(_ErrorHandler):
"Singleton, see _ErrorHandler"

instance = None

def __init__(self, log=None, defaultloglevel=logging.INFO, raiseExceptions=True):
Expand Down
3 changes: 1 addition & 2 deletions cssutils/helper.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""cssutils helper TEST
"""
"""cssutils helper TEST"""

import os
import re
Expand Down
1 change: 1 addition & 0 deletions cssutils/parse.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""A validating CSSParser"""

__all__ = ['CSSParser']

from .helper import path2url
Expand Down
1 change: 1 addition & 0 deletions cssutils/prodparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
- opt first(), naive impl for now
"""

__all__ = ['ProdParser', 'Sequence', 'Choice', 'Prod', 'PreDef']

from .helper import pushtoken
Expand Down
66 changes: 32 additions & 34 deletions cssutils/profiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,40 +114,38 @@ def __init__(self, log=None):

self._defaultProfiles = None

self.addProfiles(
[
(
self.CSS_LEVEL_2,
properties[self.CSS_LEVEL_2],
macros[self.CSS_LEVEL_2],
),
(
self.CSS3_BACKGROUNDS_AND_BORDERS,
properties[self.CSS3_BACKGROUNDS_AND_BORDERS],
macros[self.CSS3_BACKGROUNDS_AND_BORDERS],
),
(
self.CSS3_BASIC_USER_INTERFACE,
properties[self.CSS3_BASIC_USER_INTERFACE],
macros[self.CSS3_BASIC_USER_INTERFACE],
),
(self.CSS3_BOX, properties[self.CSS3_BOX], macros[self.CSS3_BOX]),
(self.CSS3_COLOR, properties[self.CSS3_COLOR], macros[self.CSS3_COLOR]),
(self.CSS3_FONTS, properties[self.CSS3_FONTS], macros[self.CSS3_FONTS]),
# new object for font-face only?
(
self.CSS3_FONT_FACE,
properties[self.CSS3_FONT_FACE],
macros[self.CSS3_FONTS],
),
(
self.CSS3_PAGED_MEDIA,
properties[self.CSS3_PAGED_MEDIA],
macros[self.CSS3_PAGED_MEDIA],
),
(self.CSS3_TEXT, properties[self.CSS3_TEXT], macros[self.CSS3_TEXT]),
]
)
self.addProfiles([
(
self.CSS_LEVEL_2,
properties[self.CSS_LEVEL_2],
macros[self.CSS_LEVEL_2],
),
(
self.CSS3_BACKGROUNDS_AND_BORDERS,
properties[self.CSS3_BACKGROUNDS_AND_BORDERS],
macros[self.CSS3_BACKGROUNDS_AND_BORDERS],
),
(
self.CSS3_BASIC_USER_INTERFACE,
properties[self.CSS3_BASIC_USER_INTERFACE],
macros[self.CSS3_BASIC_USER_INTERFACE],
),
(self.CSS3_BOX, properties[self.CSS3_BOX], macros[self.CSS3_BOX]),
(self.CSS3_COLOR, properties[self.CSS3_COLOR], macros[self.CSS3_COLOR]),
(self.CSS3_FONTS, properties[self.CSS3_FONTS], macros[self.CSS3_FONTS]),
# new object for font-face only?
(
self.CSS3_FONT_FACE,
properties[self.CSS3_FONT_FACE],
macros[self.CSS3_FONTS],
),
(
self.CSS3_PAGED_MEDIA,
properties[self.CSS3_PAGED_MEDIA],
macros[self.CSS3_PAGED_MEDIA],
),
(self.CSS3_TEXT, properties[self.CSS3_TEXT], macros[self.CSS3_TEXT]),
])

self.__update_knownNames()

Expand Down
4 changes: 2 additions & 2 deletions cssutils/script.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""classes and functions used by cssutils scripts
"""
"""classes and functions used by cssutils scripts"""

__all__ = ['CSSCapture', 'csscombine']

import html.parser
Expand Down
1 change: 1 addition & 0 deletions cssutils/scripts/csscapture.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- logger class which handles all cases when no log is given...
- saveto: why does urllib2 hang?
"""

__all__ = ['CSSCapture']

from cssutils.script import CSSCapture
Expand Down
1 change: 1 addition & 0 deletions cssutils/scripts/csscombine.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
}
"""

__all__ = ['csscombine']

from cssutils.script import csscombine
Expand Down
3 changes: 1 addition & 2 deletions cssutils/scripts/cssparse.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""utility script to parse given filenames or string
"""
"""utility script to parse given filenames or string"""

import cssutils
import logging
Expand Down

0 comments on commit 4719971

Please sign in to comment.