Skip to content

Commit

Permalink
Clean up latent references to cthedot, cleaned up redundant licensing…
Browse files Browse the repository at this point in the history
… and legacy imports.
  • Loading branch information
jaraco committed Mar 11, 2021
1 parent f0b4235 commit 88552ba
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 71 deletions.
45 changes: 8 additions & 37 deletions cssutils/__init__.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,5 @@
"""cssutils - CSS Cascading Style Sheets library for Python
Copyright (C) 2004-2013 Christof Hoeke
cssutils is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
CSS Cascading Style Sheets library for Python
A Python package to parse and build CSS Cascading Style Sheets. DOM only, not
any rendering facilities!
Expand Down Expand Up @@ -68,19 +53,11 @@
stylesheets "in the wild" while at the same time implement the official APIs
which are well documented. Some minor extensions are provided as well.
Please visit http://cthedot.de/cssutils/ for more details.
Please visit https://cssutils.readthedocs.io/ for more details.
Example::
Tested with Python 2.7.6 and 3.3.3 on Windows 8.1 64bit.
This library may be used ``from cssutils import *`` which
import subpackages ``css`` and ``stylesheets``, CSSParser and
CSSSerializer classes only.
Usage may be::
>>> from cssutils import *
>>> from cssutils import CSSParser
>>> parser = CSSParser()
>>> sheet = parser.parseString('a { color: red}')
Expand Down Expand Up @@ -157,25 +134,19 @@ def createCSSStyleSheet(self, title, media):
"""
import warnings

warning = (
"Deprecated, see "
"https://bitbucket.org/cthedot/cssutils/issues/69#comment-30669799"
)
warnings.warn(warning, DeprecationWarning)
warnings.warn("Deprecated, reason unknown", DeprecationWarning)
return css.CSSStyleSheet(title=title, media=media)

def createDocument(self, *args, **kwargs):
# sometimes cssutils is picked automatically for
# xml.dom.getDOMImplementation, so we should provide an implementation
# see https://bitbucket.org/cthedot/cssutils/issues/69
# xml.dom.getDOMImplementation, so provide an implementation
import xml.dom.minidom as minidom

return minidom.DOMImplementation().createDocument(*args, **kwargs)

def createDocumentType(self, *args, **kwargs):
# sometimes cssutils is picked automatically for
# xml.dom.getDOMImplementation, so we should provide an implementation
# see https://bitbucket.org/cthedot/cssutils/issues/69
# xml.dom.getDOMImplementation, so provide an implementation
import xml.dom.minidom as minidom

return minidom.DOMImplementation().createDocumentType(*args, **kwargs)
Expand Down
3 changes: 1 addition & 2 deletions cssutils/profiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,8 @@ def _compile_regexes(self, dictionary):
for key, value in list(dictionary.items()):
if not hasattr(value, '__call__'):
# Compiling them now will slow down the cssutils import time,
# even if cssutils is not needed. We lazily compile them the
# even if cssutils is not needed. Thus, lazily compile them the
# first time they're needed.
# https://bitbucket.org/cthedot/cssutils/issues/72
value = util.LazyRegex('^(?:%s)$' % value, re.I)
dictionary[key] = value

Expand Down
9 changes: 2 additions & 7 deletions cssutils/script.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,8 @@
import urllib.error
import urllib.parse

try:
import cssutils.encutils as encutils
except ImportError:
try:
import encutils
except ImportError:
sys.exit("You need encutils from http://cthedot.de/encutils/")
import encutils


# types of sheets in HTML
LINK = (
Expand Down
25 changes: 0 additions & 25 deletions encutils/__init__.py
Original file line number Diff line number Diff line change
@@ -1,30 +1,5 @@
"""encutils - encoding detection collection for Python
:Version: 0.9.8
:Author: Christof Hoeke, see http://cthedot.de/encutils/
:Contributor: Robert Siemer, Fredrik Hedman <fredrik.hedman@me.com> ported to python3
:Copyright: 2005-2012: Christof Hoeke
:License: encutils has a dual-license, please choose whatever you prefer:
* encutils is published under the
`LGPL 3 or later <http://cthedot.de/encutils/license/>`__
* encutils is published under the
`Creative Commons License <http://creativecommons.org/licenses/by/3.0/>`__.
encutils is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
encutils is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with encutils. If not, see <http://www.gnu.org/licenses/>.
A collection of helper functions to detect encodings of text files
(like HTML, XHTML, XML, CSS, etc.) retrieved via HTTP, file or string.
Expand Down

0 comments on commit 88552ba

Please sign in to comment.