Comments (1)
note that sphinx (or docutils?) uses some weird patterns that make this non-trivial.
For example:
class SphinxI18nReader(SphinxBaseReader):
"""
A document reader for i18n.
This returns the source line number of original text as current source line number
to let users know where the error happened.
Because the translated texts are partial and they don't have correct line numbers.
"""
def setup(self, app: Sphinx) -> None:
super().setup(app)
self.transforms = self.transforms + app.registry.get_transforms()
unused = [PreserveTranslatableMessages, Locale, RemoveTranslatableInline,
AutoIndexUpgrader, SphinxDomains, DoctreeReadEvent,
UIDTransform]
for transform in unused:
if transform in self.transforms:
self.transforms.remove(transform)
SphinxI18nReader
subclasses SphinxBaseReader
, which defines a class variable transforms
so in SphinxI18nReader
we're overwriting a class variable with an instance variable. This is definitely an antipattern, and mypy will rightly complain about it.
So this won't just be a simple case of sprinkling ClassVar
annotations around.
Of course once this is done, the ClassVar
annotations will prevent these antipatterns in future
from sphinx.
Related Issues (20)
- py_sig_re dropped without a deprecation warning HOT 4
- When I created my Function, I didn't have the "__ init__. py" file, which prevented me from generating Api documents HOT 1
- get_config fails with any section that is not 'theme' or 'options' HOT 4
- Extension sphinxcontrib-htmlhelp has typo
- [FR] `INCLUDE_PATTERN` for `apidoc`
- Move ``util.typing.restify()`` to ``autodoc`` HOT 1
- Outdated docker images HOT 3
- Remove the recommendation about the bundled package HOT 2
- Search summaries include unwanted anchor content
- [Documentation] mention the existence of the RST `.. code::` directive HOT 1
- Support LibreJS in HTML - machine readable license HOT 1
- Build time is increased by 6x after upgrading from `>=5.1.1` to `5.2.0+` HOT 5
- LaTeX/ImageConverter: Regression with `data:` URIs HOT 1
- Have emoji and U+28FF working in sphinx ``lualatex`` generated for titles and code HOT 6
- Should `defusedxml` be moved to the runtime dependencies? HOT 5
- When compiling linux kernel(drm-tis), failed at module `docutils.nodes` for no attribute ‘reprunicode’ HOT 11
- sphinx-build hard-codes the python path into the exe HOT 7
- ext.napoleon to work with ext.todo HOT 2
- `:loading: embed` on images does not work as expected HOT 7
- ``todo`` directive treat repeated special characters as headers
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sphinx.