Skip to content

Commit

Permalink
👹 Feed the hobgoblins (delint).
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Dec 23, 2024
1 parent a4f914d commit b71fc01
Show file tree
Hide file tree
Showing 23 changed files with 60 additions and 64 deletions.
4 changes: 2 additions & 2 deletions cssutils/css/csscharsetrule.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def _setEncoding(self, encoding):
or self._prods.IDENT != self._type(encodingtoken)
):
self._log.error(
'CSSCharsetRule: Syntax Error in encoding value ' '%r.' % encoding
'CSSCharsetRule: Syntax Error in encoding value %r.' % encoding
)
else:
try:
Expand All @@ -167,7 +167,7 @@ def _setEncoding(self, encoding):

type = property(
lambda self: self.CHARSET_RULE,
doc="The type of this rule, as defined by a CSSRule " "type constant.",
doc="The type of this rule, as defined by a CSSRule type constant.",
)

wellformed = property(lambda self: bool(self.encoding))
2 changes: 1 addition & 1 deletion cssutils/css/csscomment.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def _setCssText(self, cssText):

type = property(
lambda self: self.COMMENT,
doc="The type of this rule, as defined by a CSSRule " "type constant.",
doc="The type of this rule, as defined by a CSSRule type constant.",
)

# constant but needed:
Expand Down
4 changes: 2 additions & 2 deletions cssutils/css/cssfontfacerule.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def _setCssText(self, cssText):
cssText = property(
_getCssText,
_setCssText,
doc="(DOM) The parsable textual representation of this " "rule.",
doc="(DOM) The parsable textual representation of this rule.",
)

def _setStyle(self, style):
Expand All @@ -173,7 +173,7 @@ def _setStyle(self, style):

type = property(
lambda self: self.FONT_FACE_RULE,
doc="The type of this rule, as defined by a CSSRule " "type constant.",
doc="The type of this rule, as defined by a CSSRule type constant.",
)

def _getValid(self):
Expand Down
4 changes: 2 additions & 2 deletions cssutils/css/cssimportrule.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,12 +410,12 @@ def _getName(self):

styleSheet = property(
lambda self: self._styleSheet,
doc="(readonly) The style sheet referred to by this " "rule.",
doc="(readonly) The style sheet referred to by this rule.",
)

type = property(
lambda self: self.IMPORT_RULE,
doc="The type of this rule, as defined by a CSSRule " "type constant.",
doc="The type of this rule, as defined by a CSSRule type constant.",
)

def _getWellformed(self):
Expand Down
4 changes: 2 additions & 2 deletions cssutils/css/cssmediarule.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ def atrule(expected, seq, token, tokenizer):
cssText = property(
_getCssText,
_setCssText,
doc="(DOM) The parsable textual representation of this " "rule.",
doc="(DOM) The parsable textual representation of this rule.",
)

@property
Expand Down Expand Up @@ -336,7 +336,7 @@ def insertRule(self, rule, index=None):

type = property(
lambda self: self.MEDIA_RULE,
doc="The type of this rule, as defined by a CSSRule " "type constant.",
doc="The type of this rule, as defined by a CSSRule type constant.",
)

wellformed = property(lambda self: self.media.wellformed)
4 changes: 2 additions & 2 deletions cssutils/css/cssnamespacerule.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def _char(expected, seq, token, tokenizer=None):
cssText = property(
fget=_getCssText,
fset=_setCssText,
doc="(DOM) The parsable textual representation of this " "rule.",
doc="(DOM) The parsable textual representation of this rule.",
)

def _setNamespaceURI(self, namespaceURI):
Expand Down Expand Up @@ -308,7 +308,7 @@ def _setPrefix(self, prefix=None):

type = property(
lambda self: self.NAMESPACE_RULE,
doc="The type of this rule, as defined by a CSSRule " "type constant.",
doc="The type of this rule, as defined by a CSSRule type constant.",
)

wellformed = property(lambda self: self.namespaceURI is not None)
4 changes: 2 additions & 2 deletions cssutils/css/csspagerule.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ def IDENT(expected, seq, token, tokenizer=None):
else:
new['wellformed'] = False
self._log.error(
'CSSPageRule selectorText: Unexpected IDENT: ' '%r' % val, token
'CSSPageRule selectorText: Unexpected IDENT: %r' % val, token
)
return expected

Expand Down Expand Up @@ -456,7 +456,7 @@ def insertRule(self, rule, index=None):

type = property(
lambda self: self.PAGE_RULE,
doc="The type of this rule, as defined by a CSSRule " "type constant.",
doc="The type of this rule, as defined by a CSSRule type constant.",
)

# constant but needed:
Expand Down
4 changes: 2 additions & 2 deletions cssutils/css/cssrule.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def _getParentStyleSheet(self):

type = property(
lambda self: self.UNKNOWN_RULE,
doc="The type of this rule, as defined by a CSSRule " "type constant.",
doc="The type of this rule, as defined by a CSSRule type constant.",
)

typeString = property(
Expand Down Expand Up @@ -185,7 +185,7 @@ def _setCssRules(self, cssRules):
cssRules = property(
lambda self: self._cssRules,
_setCssRules,
"All Rules in this style sheet, a " ":class:`~cssutils.css.CSSRuleList`.",
"All Rules in this style sheet, a :class:`~cssutils.css.CSSRuleList`.",
)

def deleteRule(self, index):
Expand Down
2 changes: 1 addition & 1 deletion cssutils/css/cssstyledeclaration.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ def unexpected(expected, seq, token, tokenizer=None):
self._tokensupto2(tokenizer, propertyvalueendonly=True)
)
self._log.error(
'CSSStyleDeclaration: Unexpected token, ignoring ' 'upto %r.' % ignored,
'CSSStyleDeclaration: Unexpected token, ignoring upto %r.' % ignored,
token,
)
# does not matter in this case
Expand Down
6 changes: 3 additions & 3 deletions cssutils/css/cssstylerule.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ def _setCssText(self, cssText): # noqa: C901
cssText = property(
_getCssText,
_setCssText,
doc="(DOM) The parsable textual representation of this " "rule.",
doc="(DOM) The parsable textual representation of this rule.",
)

def __getNamespaces(self):
Expand Down Expand Up @@ -241,7 +241,7 @@ def _setSelectorText(self, selectorText):
selectorText = property(
lambda self: self._selectorList.selectorText,
_setSelectorText,
doc="(DOM) The textual representation of the " "selector for the rule set.",
doc="(DOM) The textual representation of the selector for the rule set.",
)

def _setStyle(self, style):
Expand All @@ -264,7 +264,7 @@ def _setStyle(self, style):

type = property(
lambda self: self.STYLE_RULE,
doc="The type of this rule, as defined by a CSSRule " "type constant.",
doc="The type of this rule, as defined by a CSSRule type constant.",
)

wellformed = property(lambda self: self.selectorList.wellformed)
Expand Down
10 changes: 5 additions & 5 deletions cssutils/css/cssstylesheet.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ def importrule(expected, seq, token, tokenizer):

if expected > 1:
self._log.error(
'CSSStylesheet: CSSImportRule not allowed ' 'here.',
'CSSStylesheet: CSSImportRule not allowed here.',
token,
xml.dom.HierarchyRequestErr,
)
Expand All @@ -222,7 +222,7 @@ def namespacerule(expected, seq, token, tokenizer):

if expected > 2:
self._log.error(
'CSSStylesheet: CSSNamespaceRule not allowed ' 'here.',
'CSSStylesheet: CSSNamespaceRule not allowed here.',
token,
xml.dom.HierarchyRequestErr,
)
Expand All @@ -248,7 +248,7 @@ def variablesrule(expected, seq, token, tokenizer):

if expected > 2:
self._log.error(
'CSSStylesheet: CSSVariablesRule not allowed ' 'here.',
'CSSStylesheet: CSSVariablesRule not allowed here.',
token,
xml.dom.HierarchyRequestErr,
)
Expand Down Expand Up @@ -868,7 +868,7 @@ def insertRule(self, rule, index=None, inOrder=False, _clean=True): # noqa: C90

ownerRule = property(
lambda self: self._ownerRule,
doc='A ref to an @import rule if it is imported, ' 'else ``None``.',
doc='A ref to an @import rule if it is imported, else ``None``.',
)

def _getValid(self):
Expand All @@ -888,7 +888,7 @@ def setSerializer(self, cssserializer):
cssutils.ser = cssserializer
else:
raise ValueError(
'Serializer must be an instance of ' 'cssutils.CSSSerializer.'
'Serializer must be an instance of cssutils.CSSSerializer.'
)

@Deprecated('Set pref in ``cssutils.ser.prefs`` instead.')
Expand Down
4 changes: 2 additions & 2 deletions cssutils/css/cssunknownrule.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def CHAR(expected, seq, token, tokenizer=None):
except IndexError:
new['wellformed'] = False
self._log.error(
'CSSUnknownRule: Wrong nesting of ' '{, [ or (.',
'CSSUnknownRule: Wrong nesting of {, [ or (.',
token=token,
)

Expand Down Expand Up @@ -219,7 +219,7 @@ def default(expected, seq, token, tokenizer=None):

type = property(
lambda self: self.UNKNOWN_RULE,
doc="The type of this rule, as defined by a CSSRule " "type constant.",
doc="The type of this rule, as defined by a CSSRule type constant.",
)

wellformed = property(lambda self: bool(self.atkeyword))
11 changes: 6 additions & 5 deletions cssutils/css/cssvalue.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,11 @@ def __repr__(self):
return f"cssutils.css.{self.__class__.__name__}({self.cssText!r})"

def __str__(self):
return (
"<cssutils.css.%s object cssValueTypeString=%r cssText=%r at "
"0x%x>"
% (self.__class__.__name__, self.cssValueTypeString, self.cssText, id(self))
return "<cssutils.css.%s object cssValueTypeString=%r cssText=%r at 0x%x>" % (
self.__class__.__name__,
self.cssValueTypeString,
self.cssText,
id(self),
)

def _setCssText(self, cssText): # noqa: C901
Expand Down Expand Up @@ -977,7 +978,7 @@ def item(self, index):

length = property(
lambda self: len(self.__items()),
doc="(DOM attribute) The number of CSSValues in the " "list.",
doc="(DOM attribute) The number of CSSValues in the list.",
)


Expand Down
20 changes: 8 additions & 12 deletions cssutils/css/cssvariablesrule.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,12 @@ def __repr__(self):
return f"cssutils.css.{self.__class__.__name__}(mediaText={self._media.mediaText!r}, variables={self.variables.cssText!r})"

def __str__(self):
return (
"<cssutils.css.%s object mediaText=%r variables=%r valid=%r "
"at 0x%x>"
% (
self.__class__.__name__,
self._media.mediaText,
self.variables.cssText,
self.valid,
id(self),
)
return "<cssutils.css.%s object mediaText=%r variables=%r valid=%r at 0x%x>" % (
self.__class__.__name__,
self._media.mediaText,
self.variables.cssText,
self.valid,
id(self),
)

def _getCssText(self):
Expand Down Expand Up @@ -184,7 +180,7 @@ def _setCssText(self, cssText):
cssText = property(
_getCssText,
_setCssText,
doc="(DOM) The parsable textual representation of this " "rule.",
doc="(DOM) The parsable textual representation of this rule.",
)

media = property(
Expand Down Expand Up @@ -215,7 +211,7 @@ def _setVariables(self, variables):

type = property(
lambda self: self.VARIABLES_RULE,
doc="The type of this rule, as defined by a CSSRule " "type constant.",
doc="The type of this rule, as defined by a CSSRule type constant.",
)

valid = property(lambda self: True, doc='NOT IMPLEMTED REALLY (TODO)')
Expand Down
4 changes: 2 additions & 2 deletions cssutils/css/marginrule.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def __repr__(self):
return f"cssutils.css.{self.__class__.__name__}(margin={self.margin!r}, style={self.style.cssText!r})"

def __str__(self):
return "<cssutils.css.%s object margin=%r style=%r " "at 0x%x>" % (
return "<cssutils.css.%s object margin=%r style=%r at 0x%x>" % (
self.__class__.__name__,
self.margin,
self.style.cssText,
Expand Down Expand Up @@ -227,7 +227,7 @@ def _setStyle(self, style):

type = property(
lambda self: self.MARGIN_RULE,
doc="The type of this rule, as defined by a CSSRule " "type constant.",
doc="The type of this rule, as defined by a CSSRule type constant.",
)

wellformed = property(lambda self: bool(self.atkeyword))
6 changes: 3 additions & 3 deletions cssutils/css/property.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ def _ident(expected, seq, token, tokenizer=None):

literalname = property(
lambda self: self._literalname,
doc="Readonly literal (not normalized) name " "of this property",
doc="Readonly literal (not normalized) name of this property",
)

def _setPropertyValue(self, cssText):
Expand Down Expand Up @@ -314,7 +314,7 @@ def priority(self, priority): # noqa: C901
self._priority = ''
self._literalpriority = ''
if priority:
self._log.error('Property: No priority in a MediaQuery - ' 'ignored.')
self._log.error('Property: No priority in a MediaQuery - ignored.')
return

if isinstance(priority, str) and 'important' == self._normalize(priority):
Expand Down Expand Up @@ -513,7 +513,7 @@ def validate(self): # noqa: C901

valid = property(
validate,
doc="Check if value of this property is valid " "in the properties context.",
doc="Check if value of this property is valid in the properties context.",
)

@Deprecated('Use ``property.propertyValue`` instead.')
Expand Down
6 changes: 3 additions & 3 deletions cssutils/css/selector.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Constants:
S = ' '

simple_selector_sequence = (
'type_selector universal HASH class ' 'attrib pseudo negation '
'type_selector universal HASH class attrib pseudo negation '
)
simple_selector_sequence2 = 'HASH class attrib pseudo negation '

Expand Down Expand Up @@ -119,7 +119,7 @@ def append(self, seq, val, typ=None, token=None): # noqa: C901
if namespaceURI is None:
self.wellformed = False
self._log.error(
'Selector: No namespaceURI found ' 'for prefix %r' % prefix,
'Selector: No namespaceURI found for prefix %r' % prefix,
token=token,
error=xml.dom.NamespaceErr,
)
Expand Down Expand Up @@ -856,7 +856,7 @@ def _prepare_tokens(self, tokenizer): # noqa: C901
selectorText = property(
_getSelectorText,
_setSelectorText,
doc="(DOM) The parsable textual representation of " "the selector.",
doc="(DOM) The parsable textual representation of the selector.",
)

specificity = property(
Expand Down
6 changes: 3 additions & 3 deletions cssutils/css/selectorlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def __repr__(self):
return f"cssutils.css.{self.__class__.__name__}(selectorText={st!r})"

def __str__(self):
return "<cssutils.css.%s object selectorText=%r _namespaces=%r at " "0x%x>" % (
return "<cssutils.css.%s object selectorText=%r _namespaces=%r at 0x%x>" % (
self.__class__.__name__,
self.selectorText,
self._namespaces,
Expand Down Expand Up @@ -225,12 +225,12 @@ def _setSelectorText(self, selectorText):
selectorText = property(
_getSelectorText,
_setSelectorText,
doc="(cssutils) The textual representation of the " "selector for a rule set.",
doc="(cssutils) The textual representation of the selector for a rule set.",
)

length = property(
lambda self: len(self),
doc="The number of :class:`~cssutils.css.Selector` " "objects in the list.",
doc="The number of :class:`~cssutils.css.Selector` objects in the list.",
)

parentRule = property(
Expand Down
Loading

0 comments on commit b71fc01

Please sign in to comment.