https://github.com/asottile/pyupgrade
> A tool to automatically upgrade syntax for newer versions of the
> language.
- Drop u str prefix
- Drop base object inheritance
- Drop args to super()
- Use set literals
- Use dict comprehension
- Use set comprehension
In Python 3, the default encoding of source files is utf-8. The encoding
cookie is now unnecessary and redundant so remove it. For more details,
see the docs:
https://docs.python.org/3/howto/unicode.html#the-string-type
> The default encoding for Python source code is UTF-8, so you can
> simply include a Unicode character in a string literal ...
Includes a fix for the flake8 header checks to stop expecting an
encoding cookie.
For consistency, the `<object>` tag for the SVG output of a
inheritance-diagram should have the same `class="inheritance"` attribute
that the corresponding `<img>` tag for the PNG format has. This allows
to define the CSS attribute
object.inheritance {
max-width: 100%;
}
which for SVG (unlike PNG) actually works and makes sense.
Added a test for inheritance-diagrams in SVG.
The graphviz extension is modified to wrap the `<img>` and `<object>`
tags it creates for diagrams in the png and svg formats in an additional
`<div class="graphviz">...</div>` tag. This allows to apply additional
CSS styling to the the diagrams that cannot be applied to `<img>` and
`<object>` directly. Most notably,
div.graphviz {
overflow: auto;
}
would be a useful style that the standard themes might consider.
In any case, it would allow users to add custom CSS code to their
project that gets around the problems with inheritance-diagrams
discussed in https://github.com/sphinx-doc/sphinx/issues/4865
The tests for the `grahviz` and `inheritance_diagram` have been modified
to test for the presence of the additional `<div>` tag.
Closes#4865