typeshed icon indicating copy to clipboard operation
typeshed copied to clipboard

improve type annotations in 'docutils.transforms'

Open danieleades opened this issue 1 year ago • 27 comments

danieleades avatar Feb 27 '24 08:02 danieleades

Diff from mypy_primer, showing the effect of this PR on open source code:

sphinx (https://github.com/sphinx-doc/sphinx)
+ sphinx/transforms/__init__.py:10: note: In module imported here:
- sphinx/transforms/__init__.py: note: In member "apply_transforms" of class "SphinxTransformer":
+ sphinx/transforms/__init__.py: note: In member "apply" of class "ExtraTranslatableNodes":
- sphinx/transforms/__init__.py:83:13: error: "apply_transforms" undefined in superclass  [misc]
+ sphinx/transforms/__init__.py:273:9: error: Incompatible types in assignment (expression has type "Node", variable has type "Element")  [assignment]
+ sphinx/transforms/i18n.py: note: In member "apply" of class "PreserveTranslatableMessages":
+ sphinx/transforms/i18n.py:102:43: error: Only concrete class can be given where "type[translatable]" is expected  [type-abstract]
+ sphinx/transforms/i18n.py: note: In member "apply" of class "TranslationProgressTotaliser":
+ sphinx/transforms/i18n.py:552:9: error: Incompatible types in assignment (expression has type "Node", variable has type "Element")  [assignment]
+ sphinx/transforms/i18n.py: note: In member "apply" of class "AddTranslationClasses":
+ sphinx/transforms/i18n.py:591:9: error: Incompatible types in assignment (expression has type "Node", variable has type "Element")  [assignment]
+ sphinx/transforms/i18n.py: note: In member "apply" of class "RemoveTranslatableInline":
+ sphinx/transforms/i18n.py:613:9: error: Incompatible types in assignment (expression has type "Node", variable has type "inline")  [assignment]
+ sphinx/builders/latex/transforms.py: note: In member "apply" of class "FootnoteDocnameUpdater":
+ sphinx/builders/latex/transforms.py:40:9: error: Incompatible types in assignment (expression has type "Node", variable has type "Element")  [assignment]
+ sphinx/builders/latex/transforms.py: note: At top level:
+ sphinx/builders/latex/transforms.py: note: In member "run" of class "CitationReferenceTransform":
+ sphinx/builders/latex/transforms.py:541:9: error: Incompatible types in assignment (expression has type "Node", variable has type "pending_xref")  [assignment]
- sphinx/builders/latex/transforms.py: note: In member "run" of class "BibliographyTransform":
+ sphinx/builders/latex/transforms.py: note: In member "run" of class "LiteralBlockTransform":
- sphinx/builders/latex/transforms.py:525:13: error: "BibliographyTransform" has no attribute "document"  [attr-defined]
+ sphinx/builders/latex/transforms.py:577:9: error: Incompatible types in assignment (expression has type "Node", variable has type "container")  [assignment]
+ sphinx/builders/html/transforms.py: note: In member "run" of class "KeyboardTransform":
+ sphinx/builders/html/transforms.py:50:9: error: Incompatible types in assignment (expression has type "Node", variable has type "literal")  [assignment]

alectryon (https://github.com/cpitclaudel/alectryon)
+ alectryon/docutils.py:206: error: "Transform" has no attribute "is_post_transform"  [attr-defined]

cwltool (https://github.com/common-workflow-language/cwltool)
+ note: ... from here,
+ note: ... from here,
+ note: ... from here,
+ cwltool/software_requirements.py:32: note: ... from here:

bokeh (https://github.com/bokeh/bokeh)
+ src/bokeh/sphinxext/bokeh_color.py:45: note: ... from here:

github-actions[bot] avatar Feb 27 '24 08:02 github-actions[bot]

Diff from mypy_primer, showing the effect of this PR on open source code:

sphinx (https://github.com/sphinx-doc/sphinx)
- sphinx/transforms/__init__.py: note: In member "apply_transforms" of class "SphinxTransformer":
+ sphinx/transforms/__init__.py: note: In member "apply" of class "ExtraTranslatableNodes":
- sphinx/transforms/__init__.py:83:13: error: "apply_transforms" undefined in superclass  [misc]
+ sphinx/transforms/__init__.py:273:9: error: Incompatible types in assignment (expression has type "Node", variable has type "Element")  [assignment]
+ sphinx/transforms/i18n.py: note: In member "apply" of class "PreserveTranslatableMessages":
+ sphinx/transforms/i18n.py:102:43: error: Only concrete class can be given where "type[translatable]" is expected  [type-abstract]
+ sphinx/transforms/i18n.py: note: In member "apply" of class "TranslationProgressTotaliser":
+ sphinx/transforms/i18n.py:552:9: error: Incompatible types in assignment (expression has type "Node", variable has type "Element")  [assignment]
+ sphinx/transforms/i18n.py: note: In member "apply" of class "AddTranslationClasses":
+ sphinx/transforms/i18n.py:591:9: error: Incompatible types in assignment (expression has type "Node", variable has type "Element")  [assignment]
+ sphinx/transforms/i18n.py: note: In member "apply" of class "RemoveTranslatableInline":
+ sphinx/transforms/i18n.py:613:9: error: Incompatible types in assignment (expression has type "Node", variable has type "inline")  [assignment]
+ sphinx/builders/latex/transforms.py: note: In member "apply" of class "FootnoteDocnameUpdater":
+ sphinx/builders/latex/transforms.py:40:9: error: Incompatible types in assignment (expression has type "Node", variable has type "Element")  [assignment]
+ sphinx/builders/latex/transforms.py: note: At top level:
+ sphinx/builders/latex/transforms.py: note: In member "run" of class "CitationReferenceTransform":
+ sphinx/builders/latex/transforms.py:541:9: error: Incompatible types in assignment (expression has type "Node", variable has type "pending_xref")  [assignment]
- sphinx/builders/latex/transforms.py: note: In member "run" of class "BibliographyTransform":
+ sphinx/builders/latex/transforms.py: note: In member "run" of class "LiteralBlockTransform":
- sphinx/builders/latex/transforms.py:525:13: error: "BibliographyTransform" has no attribute "document"  [attr-defined]
+ sphinx/builders/latex/transforms.py:577:9: error: Incompatible types in assignment (expression has type "Node", variable has type "container")  [assignment]
+ sphinx/builders/html/transforms.py: note: In member "run" of class "KeyboardTransform":
+ sphinx/builders/html/transforms.py:50:9: error: Incompatible types in assignment (expression has type "Node", variable has type "literal")  [assignment]

alectryon (https://github.com/cpitclaudel/alectryon)
+ alectryon/docutils.py:206: error: "Transform" has no attribute "is_post_transform"  [attr-defined]

github-actions[bot] avatar Feb 27 '24 09:02 github-actions[bot]

Diff from mypy_primer, showing the effect of this PR on open source code:

sphinx (https://github.com/sphinx-doc/sphinx)
- sphinx/transforms/__init__.py: note: In member "apply_transforms" of class "SphinxTransformer":
+ sphinx/transforms/__init__.py: note: In member "apply" of class "ExtraTranslatableNodes":
- sphinx/transforms/__init__.py:83:13: error: "apply_transforms" undefined in superclass  [misc]
+ sphinx/transforms/__init__.py:273:9: error: Incompatible types in assignment (expression has type "Node", variable has type "Element")  [assignment]
+ sphinx/transforms/i18n.py: note: In member "apply" of class "PreserveTranslatableMessages":
+ sphinx/transforms/i18n.py:102:43: error: Only concrete class can be given where "type[translatable]" is expected  [type-abstract]
+ sphinx/transforms/i18n.py: note: In member "apply" of class "TranslationProgressTotaliser":
+ sphinx/transforms/i18n.py:552:9: error: Incompatible types in assignment (expression has type "Node", variable has type "Element")  [assignment]
+ sphinx/transforms/i18n.py: note: In member "apply" of class "AddTranslationClasses":
+ sphinx/transforms/i18n.py:591:9: error: Incompatible types in assignment (expression has type "Node", variable has type "Element")  [assignment]
+ sphinx/transforms/i18n.py: note: In member "apply" of class "RemoveTranslatableInline":
+ sphinx/transforms/i18n.py:613:9: error: Incompatible types in assignment (expression has type "Node", variable has type "inline")  [assignment]
+ sphinx/builders/latex/transforms.py: note: In member "apply" of class "FootnoteDocnameUpdater":
+ sphinx/builders/latex/transforms.py:40:9: error: Incompatible types in assignment (expression has type "Node", variable has type "Element")  [assignment]
+ sphinx/builders/latex/transforms.py: note: At top level:
+ sphinx/builders/latex/transforms.py: note: In member "run" of class "CitationReferenceTransform":
+ sphinx/builders/latex/transforms.py:541:9: error: Incompatible types in assignment (expression has type "Node", variable has type "pending_xref")  [assignment]
- sphinx/builders/latex/transforms.py: note: In member "run" of class "BibliographyTransform":
+ sphinx/builders/latex/transforms.py: note: In member "run" of class "LiteralBlockTransform":
- sphinx/builders/latex/transforms.py:525:13: error: "BibliographyTransform" has no attribute "document"  [attr-defined]
+ sphinx/builders/latex/transforms.py:577:9: error: Incompatible types in assignment (expression has type "Node", variable has type "container")  [assignment]
+ sphinx/builders/html/transforms.py: note: In member "run" of class "KeyboardTransform":
+ sphinx/builders/html/transforms.py:50:9: error: Incompatible types in assignment (expression has type "Node", variable has type "literal")  [assignment]

alectryon (https://github.com/cpitclaudel/alectryon)
+ alectryon/docutils.py:206: error: "Transform" has no attribute "is_post_transform"  [attr-defined]

github-actions[bot] avatar Feb 27 '24 10:02 github-actions[bot]

Could you comment on whether the new errors shown in mypy-primer are true positives?

JelleZijlstra avatar Feb 29 '24 06:02 JelleZijlstra

Could you comment on whether the new errors shown in mypy-primer are true positives?

i'll need to revisit this after https://github.com/sphinx-doc/sphinx/pull/12034 is merged.

the NodeMatcher class used by Sphinx confounds the type checking of the Node.find_all method, which results in a lot (though not all) of the errors seen here

danieleades avatar Mar 02 '24 13:03 danieleades

Diff from mypy_primer, showing the effect of this PR on open source code:

sphinx (https://github.com/sphinx-doc/sphinx)
- sphinx/transforms/__init__.py: note: In member "apply_transforms" of class "SphinxTransformer":
+ sphinx/transforms/__init__.py: note: In member "apply" of class "ExtraTranslatableNodes":
- sphinx/transforms/__init__.py:83:13: error: "apply_transforms" undefined in superclass  [misc]
+ sphinx/transforms/__init__.py:273:9: error: Incompatible types in assignment (expression has type "Node", variable has type "Element")  [assignment]
+ sphinx/transforms/i18n.py: note: In member "apply" of class "PreserveTranslatableMessages":
+ sphinx/transforms/i18n.py:102:43: error: Only concrete class can be given where "type[translatable]" is expected  [type-abstract]
- sphinx/builders/latex/transforms.py: note: In member "run" of class "BibliographyTransform":
- sphinx/builders/latex/transforms.py:525:13: error: "BibliographyTransform" has no attribute "document"  [attr-defined]

alectryon (https://github.com/cpitclaudel/alectryon)
+ alectryon/docutils.py:206: error: "Transform" has no attribute "is_post_transform"  [attr-defined]

github-actions[bot] avatar Mar 02 '24 15:03 github-actions[bot]

+ sphinx/transforms/i18n.py:102:43: error: Only concrete class can be given where "type[translatable]" is expected  [type-abstract]

i don't really understand this one. the snippet in sphinx is

        for node in self.document.findall(addnodes.translatable):
            node.preserve_original_messages()

which seems ok, no? addnodes.translatable is indeed a class

danieleades avatar Mar 03 '24 12:03 danieleades

Diff from mypy_primer, showing the effect of this PR on open source code:

sphinx (https://github.com/sphinx-doc/sphinx)
- sphinx/transforms/__init__.py: note: In member "apply_transforms" of class "SphinxTransformer":
+ sphinx/transforms/__init__.py: note: In member "apply" of class "ExtraTranslatableNodes":
- sphinx/transforms/__init__.py:83:13: error: "apply_transforms" undefined in superclass  [misc]

should be fixed in https://github.com/python/typeshed/pull/11471

  • sphinx/transforms/init.py:273:9: error: Incompatible types in assignment (expression has type "Node", variable has type "Element") [assignment]

this will have to be suppressed in sphinx. the implementation is not friendly to type checking

  • sphinx/transforms/i18n.py: note: In member "apply" of class "PreserveTranslatableMessages":
  • sphinx/transforms/i18n.py:102:43: error: Only concrete class can be given where "type[translatable]" is expected [type-abstract]

i don't understand why this is causing an error

  • sphinx/builders/latex/transforms.py: note: In member "run" of class "BibliographyTransform":
  • sphinx/builders/latex/transforms.py:525:13: error: "BibliographyTransform" has no attribute "document" [attr-defined]

should be fixed in https://github.com/python/typeshed/pull/11471

alectryon (https://github.com/cpitclaudel/alectryon)

  • alectryon/docutils.py:206: error: "Transform" has no attribute "is_post_transform" [attr-defined]

should be fixed in https://github.com/python/typeshed/pull/11471

danieleades avatar Mar 03 '24 13:03 danieleades

Diff from mypy_primer, showing the effect of this PR on open source code:

sphinx (https://github.com/sphinx-doc/sphinx)
- sphinx/transforms/__init__.py: note: In member "apply_transforms" of class "SphinxTransformer":
+ sphinx/transforms/__init__.py: note: In member "apply" of class "ExtraTranslatableNodes":
- sphinx/transforms/__init__.py:83:13: error: "apply_transforms" undefined in superclass  [misc]
+ sphinx/transforms/__init__.py:273:9: error: Incompatible types in assignment (expression has type "Node", variable has type "Element")  [assignment]
+ sphinx/transforms/i18n.py: note: In member "apply" of class "PreserveTranslatableMessages":
+ sphinx/transforms/i18n.py:102:43: error: Only concrete class can be given where "type[translatable]" is expected  [type-abstract]
- sphinx/builders/latex/transforms.py: note: In member "run" of class "BibliographyTransform":
- sphinx/builders/latex/transforms.py:525:13: error: "BibliographyTransform" has no attribute "document"  [attr-defined]

alectryon (https://github.com/cpitclaudel/alectryon)
+ alectryon/docutils.py:206: error: "Transform" has no attribute "is_post_transform"  [attr-defined]

github-actions[bot] avatar Mar 03 '24 20:03 github-actions[bot]

Diff from mypy_primer, showing the effect of this PR on open source code:

sphinx (https://github.com/sphinx-doc/sphinx)
- sphinx/transforms/__init__.py: note: In member "apply_transforms" of class "SphinxTransformer":
+ sphinx/transforms/__init__.py: note: In member "apply" of class "ExtraTranslatableNodes":
- sphinx/transforms/__init__.py:83:13: error: "apply_transforms" undefined in superclass  [misc]
+ sphinx/transforms/__init__.py:273:9: error: Incompatible types in assignment (expression has type "Node", variable has type "Element")  [assignment]
+ sphinx/transforms/i18n.py: note: In member "apply" of class "PreserveTranslatableMessages":
+ sphinx/transforms/i18n.py:102:43: error: Only concrete class can be given where "type[translatable]" is expected  [type-abstract]
- sphinx/builders/latex/transforms.py: note: In member "run" of class "BibliographyTransform":
- sphinx/builders/latex/transforms.py:525:13: error: "BibliographyTransform" has no attribute "document"  [attr-defined]

alectryon (https://github.com/cpitclaudel/alectryon)
+ alectryon/docutils.py:206: error: "Transform" has no attribute "is_post_transform"  [attr-defined]

github-actions[bot] avatar Mar 04 '24 07:03 github-actions[bot]

Diff from mypy_primer, showing the effect of this PR on open source code:

sphinx (https://github.com/sphinx-doc/sphinx)
- sphinx/transforms/__init__.py: note: In member "apply_transforms" of class "SphinxTransformer":
+ sphinx/transforms/__init__.py: note: In member "apply" of class "ExtraTranslatableNodes":
- sphinx/transforms/__init__.py:83:13: error: "apply_transforms" undefined in superclass  [misc]
+ sphinx/transforms/__init__.py:273:9: error: Incompatible types in assignment (expression has type "Node", variable has type "Element")  [assignment]
+ sphinx/transforms/i18n.py: note: In member "apply" of class "PreserveTranslatableMessages":
+ sphinx/transforms/i18n.py:102:43: error: Only concrete class can be given where "type[translatable]" is expected  [type-abstract]
- sphinx/builders/latex/transforms.py: note: In member "run" of class "BibliographyTransform":
- sphinx/builders/latex/transforms.py:525:13: error: "BibliographyTransform" has no attribute "document"  [attr-defined]

alectryon (https://github.com/cpitclaudel/alectryon)
+ alectryon/docutils.py:206: error: "Transform" has no attribute "is_post_transform"  [attr-defined]

github-actions[bot] avatar Mar 06 '24 08:03 github-actions[bot]

Diff from mypy_primer, showing the effect of this PR on open source code:

sphinx (https://github.com/sphinx-doc/sphinx)
- sphinx/transforms/__init__.py: note: In member "apply_transforms" of class "SphinxTransformer":
+ sphinx/transforms/__init__.py: note: In member "apply" of class "ExtraTranslatableNodes":
- sphinx/transforms/__init__.py:83:13: error: "apply_transforms" undefined in superclass  [misc]
+ sphinx/transforms/__init__.py:273:9: error: Incompatible types in assignment (expression has type "Node", variable has type "Element")  [assignment]
+ sphinx/transforms/i18n.py: note: In member "apply" of class "PreserveTranslatableMessages":
+ sphinx/transforms/i18n.py:102:43: error: Only concrete class can be given where "type[translatable]" is expected  [type-abstract]
- sphinx/builders/latex/transforms.py: note: In member "run" of class "BibliographyTransform":
- sphinx/builders/latex/transforms.py:525:13: error: "BibliographyTransform" has no attribute "document"  [attr-defined]

alectryon (https://github.com/cpitclaudel/alectryon)
+ alectryon/docutils.py:206: error: "Transform" has no attribute "is_post_transform"  [attr-defined]

github-actions[bot] avatar Mar 07 '24 07:03 github-actions[bot]

Diff from mypy_primer, showing the effect of this PR on open source code:

sphinx (https://github.com/sphinx-doc/sphinx)
- sphinx/transforms/__init__.py: note: In member "apply_transforms" of class "SphinxTransformer":
+ sphinx/transforms/__init__.py: note: In member "apply" of class "ExtraTranslatableNodes":
- sphinx/transforms/__init__.py:83:13: error: "apply_transforms" undefined in superclass  [misc]
+ sphinx/transforms/__init__.py:273:9: error: Incompatible types in assignment (expression has type "Node", variable has type "Element")  [assignment]
+ sphinx/transforms/i18n.py: note: In member "apply" of class "PreserveTranslatableMessages":
+ sphinx/transforms/i18n.py:102:43: error: Only concrete class can be given where "type[translatable]" is expected  [type-abstract]
- sphinx/builders/latex/transforms.py: note: In member "run" of class "BibliographyTransform":
- sphinx/builders/latex/transforms.py:525:13: error: "BibliographyTransform" has no attribute "document"  [attr-defined]

alectryon (https://github.com/cpitclaudel/alectryon)
+ alectryon/docutils.py:206: error: "Transform" has no attribute "is_post_transform"  [attr-defined]

github-actions[bot] avatar Mar 08 '24 06:03 github-actions[bot]

Diff from mypy_primer, showing the effect of this PR on open source code:

sphinx (https://github.com/sphinx-doc/sphinx)
- sphinx/transforms/__init__.py: note: In member "apply_transforms" of class "SphinxTransformer":
+ sphinx/transforms/__init__.py: note: In member "apply" of class "ExtraTranslatableNodes":
- sphinx/transforms/__init__.py:83:13: error: "apply_transforms" undefined in superclass  [misc]
+ sphinx/transforms/__init__.py:273:9: error: Incompatible types in assignment (expression has type "Node", variable has type "Element")  [assignment]
+ sphinx/transforms/i18n.py: note: In member "apply" of class "PreserveTranslatableMessages":
+ sphinx/transforms/i18n.py:102:43: error: Only concrete class can be given where "type[translatable]" is expected  [type-abstract]
- sphinx/builders/latex/transforms.py: note: In member "run" of class "BibliographyTransform":
- sphinx/builders/latex/transforms.py:525:13: error: "BibliographyTransform" has no attribute "document"  [attr-defined]

alectryon (https://github.com/cpitclaudel/alectryon)
+ alectryon/docutils.py:206: error: "Transform" has no attribute "is_post_transform"  [attr-defined]

github-actions[bot] avatar Mar 08 '24 16:03 github-actions[bot]

Diff from mypy_primer, showing the effect of this PR on open source code:

sphinx (https://github.com/sphinx-doc/sphinx)
- sphinx/transforms/__init__.py: note: In member "apply_transforms" of class "SphinxTransformer":
+ sphinx/transforms/__init__.py: note: In member "apply" of class "ExtraTranslatableNodes":
- sphinx/transforms/__init__.py:83:13: error: "apply_transforms" undefined in superclass  [misc]
+ sphinx/transforms/__init__.py:273:9: error: Incompatible types in assignment (expression has type "Node", variable has type "Element")  [assignment]
+ sphinx/transforms/i18n.py: note: In member "apply" of class "PreserveTranslatableMessages":
+ sphinx/transforms/i18n.py:102:43: error: Only concrete class can be given where "type[translatable]" is expected  [type-abstract]
- sphinx/builders/latex/transforms.py: note: In member "run" of class "BibliographyTransform":
- sphinx/builders/latex/transforms.py:525:13: error: "BibliographyTransform" has no attribute "document"  [attr-defined]

alectryon (https://github.com/cpitclaudel/alectryon)
+ alectryon/docutils.py:206: error: "Transform" has no attribute "is_post_transform"  [attr-defined]

github-actions[bot] avatar Mar 09 '24 08:03 github-actions[bot]

Diff from mypy_primer, showing the effect of this PR on open source code:

sphinx (https://github.com/sphinx-doc/sphinx)
- sphinx/transforms/__init__.py: note: In member "apply_transforms" of class "SphinxTransformer":
+ sphinx/transforms/__init__.py: note: In member "apply" of class "ExtraTranslatableNodes":
- sphinx/transforms/__init__.py:83:13: error: "apply_transforms" undefined in superclass  [misc]
+ sphinx/transforms/__init__.py:273:9: error: Incompatible types in assignment (expression has type "Node", variable has type "Element")  [assignment]
+ sphinx/transforms/i18n.py: note: In member "apply" of class "PreserveTranslatableMessages":
+ sphinx/transforms/i18n.py:102:43: error: Only concrete class can be given where "type[translatable]" is expected  [type-abstract]

I don't understand this error

  • sphinx/builders/latex/transforms.py: note: In member "run" of class "BibliographyTransform":
  • sphinx/builders/latex/transforms.py:525:13: error: "BibliographyTransform" has no attribute "document" [attr-defined]

alectryon (https://github.com/cpitclaudel/alectryon)

  • alectryon/docutils.py:206: error: "Transform" has no attribute "is_post_transform" [attr-defined]

danieleades avatar Mar 09 '24 08:03 danieleades

The alceytron error is probably because of the new attribute being set though I don't know why it would raise (maybe because it's untyped?).

As for the error on the Sphinx side, I don't know why it would raise an error for that transform but not for others (maybe is it because of the += that we use?)

picnixz avatar Mar 09 '24 09:03 picnixz

Diff from mypy_primer, showing the effect of this PR on open source code:

sphinx (https://github.com/sphinx-doc/sphinx)
- sphinx/transforms/__init__.py: note: In member "apply_transforms" of class "SphinxTransformer":
+ sphinx/transforms/__init__.py: note: In member "apply" of class "ExtraTranslatableNodes":
- sphinx/transforms/__init__.py:83:13: error: "apply_transforms" undefined in superclass  [misc]
+ sphinx/transforms/__init__.py:273:9: error: Incompatible types in assignment (expression has type "Node", variable has type "Element")  [assignment]
+ sphinx/transforms/i18n.py: note: In member "apply" of class "PreserveTranslatableMessages":
+ sphinx/transforms/i18n.py:102:43: error: Only concrete class can be given where "type[translatable]" is expected  [type-abstract]
- sphinx/builders/latex/transforms.py: note: In member "run" of class "BibliographyTransform":
- sphinx/builders/latex/transforms.py:525:13: error: "BibliographyTransform" has no attribute "document"  [attr-defined]

alectryon (https://github.com/cpitclaudel/alectryon)
+ alectryon/docutils.py:206: error: "Transform" has no attribute "is_post_transform"  [attr-defined]

github-actions[bot] avatar Mar 09 '24 16:03 github-actions[bot]

Diff from mypy_primer, showing the effect of this PR on open source code:

sphinx (https://github.com/sphinx-doc/sphinx)
- sphinx/transforms/__init__.py: note: In member "apply_transforms" of class "SphinxTransformer":
+ sphinx/transforms/__init__.py: note: In member "apply" of class "ExtraTranslatableNodes":
- sphinx/transforms/__init__.py:83:13: error: "apply_transforms" undefined in superclass  [misc]
+ sphinx/transforms/__init__.py:273:9: error: Incompatible types in assignment (expression has type "Node", variable has type "Element")  [assignment]
+ sphinx/transforms/i18n.py: note: In member "apply" of class "PreserveTranslatableMessages":
+ sphinx/transforms/i18n.py:102:43: error: Only concrete class can be given where "type[translatable]" is expected  [type-abstract]
- sphinx/builders/latex/transforms.py: note: In member "run" of class "BibliographyTransform":
- sphinx/builders/latex/transforms.py:525:13: error: "BibliographyTransform" has no attribute "document"  [attr-defined]

alectryon (https://github.com/cpitclaudel/alectryon)
+ alectryon/docutils.py:206: error: "Transform" has no attribute "is_post_transform"  [attr-defined]

github-actions[bot] avatar Mar 13 '24 14:03 github-actions[bot]

Diff from mypy_primer, showing the effect of this PR on open source code:

sphinx (https://github.com/sphinx-doc/sphinx)
- sphinx/transforms/__init__.py: note: In member "apply_transforms" of class "SphinxTransformer":
+ sphinx/transforms/__init__.py: note: In member "apply" of class "ExtraTranslatableNodes":
- sphinx/transforms/__init__.py:83:13: error: "apply_transforms" undefined in superclass  [misc]
+ sphinx/transforms/__init__.py:273:9: error: Incompatible types in assignment (expression has type "Node", variable has type "Element")  [assignment]
+ sphinx/transforms/i18n.py: note: In member "apply" of class "PreserveTranslatableMessages":
+ sphinx/transforms/i18n.py:102:43: error: Only concrete class can be given where "type[translatable]" is expected  [type-abstract]
- sphinx/builders/latex/transforms.py: note: In member "run" of class "BibliographyTransform":
- sphinx/builders/latex/transforms.py:525:13: error: "BibliographyTransform" has no attribute "document"  [attr-defined]

alectryon (https://github.com/cpitclaudel/alectryon)
+ alectryon/docutils.py:206: error: "Transform" has no attribute "is_post_transform"  [attr-defined]

github-actions[bot] avatar Mar 13 '24 19:03 github-actions[bot]

Diff from mypy_primer, showing the effect of this PR on open source code:

sphinx (https://github.com/sphinx-doc/sphinx)
- sphinx/transforms/__init__.py: note: In member "apply_transforms" of class "SphinxTransformer":
+ sphinx/transforms/__init__.py: note: In member "apply" of class "ExtraTranslatableNodes":
- sphinx/transforms/__init__.py:83:13: error: "apply_transforms" undefined in superclass  [misc]
+ sphinx/transforms/__init__.py:273:9: error: Incompatible types in assignment (expression has type "Node", variable has type "Element")  [assignment]
+ sphinx/transforms/i18n.py: note: In member "apply" of class "PreserveTranslatableMessages":
+ sphinx/transforms/i18n.py:102:43: error: Only concrete class can be given where "type[translatable]" is expected  [type-abstract]
- sphinx/builders/latex/transforms.py: note: In member "run" of class "BibliographyTransform":
- sphinx/builders/latex/transforms.py:525:13: error: "BibliographyTransform" has no attribute "document"  [attr-defined]

alectryon (https://github.com/cpitclaudel/alectryon)
+ alectryon/docutils.py:206: error: "Transform" has no attribute "is_post_transform"  [attr-defined]

github-actions[bot] avatar Mar 16 '24 08:03 github-actions[bot]

Diff from mypy_primer, showing the effect of this PR on open source code:

sphinx (https://github.com/sphinx-doc/sphinx)
+ sphinx/transforms/__init__.py:84: error: Unused "type: ignore" comment  [unused-ignore]
+ sphinx/transforms/__init__.py: note: In member "apply" of class "ExtraTranslatableNodes":
+ sphinx/transforms/__init__.py:274:9: error: Incompatible types in assignment (expression has type "Node", variable has type "Element")  [assignment]
+ sphinx/transforms/i18n.py: note: In member "apply" of class "PreserveTranslatableMessages":
+ sphinx/transforms/i18n.py:103:43: error: Only concrete class can be given where "type[translatable]" is expected  [type-abstract]
+ sphinx/builders/latex/transforms.py:526: error: Unused "type: ignore" comment  [unused-ignore]

alectryon (https://github.com/cpitclaudel/alectryon)
+ alectryon/docutils.py:206: error: "Transform" has no attribute "is_post_transform"  [attr-defined]

github-actions[bot] avatar Apr 06 '24 10:04 github-actions[bot]

Diff from mypy_primer, showing the effect of this PR on open source code:

sphinx (https://github.com/sphinx-doc/sphinx)
+ sphinx/transforms/__init__.py:84: error: Unused "type: ignore" comment  [unused-ignore]
+ sphinx/transforms/__init__.py: note: In member "apply" of class "ExtraTranslatableNodes":
+ sphinx/transforms/__init__.py:274:9: error: Incompatible types in assignment (expression has type "Node", variable has type "Element")  [assignment]
+ sphinx/transforms/i18n.py: note: In member "apply" of class "PreserveTranslatableMessages":
+ sphinx/transforms/i18n.py:103:43: error: Only concrete class can be given where "type[translatable]" is expected  [type-abstract]
+ sphinx/io.py: note: In member "setup" of class "SphinxI18nReader":
+ sphinx/io.py:144:40: error: Only concrete class can be given where "type[Transform]" is expected  [type-abstract]
+ sphinx/builders/latex/transforms.py:526: error: Unused "type: ignore" comment  [unused-ignore]

alectryon (https://github.com/cpitclaudel/alectryon)
+ alectryon/docutils.py:206: error: "Transform" has no attribute "is_post_transform"  [attr-defined]

github-actions[bot] avatar Apr 06 '24 10:04 github-actions[bot]

Diff from mypy_primer, showing the effect of this PR on open source code:

sphinx (https://github.com/sphinx-doc/sphinx)
+ sphinx/transforms/__init__.py:94: error: Unused "type: ignore" comment  [unused-ignore]
+ sphinx/transforms/__init__.py: note: In member "apply" of class "ExtraTranslatableNodes":
+ sphinx/transforms/__init__.py:290:13: error: Unsupported target for indexed assignment ("Node")  [index]
+ sphinx/transforms/__init__.py: note: At top level:
+ sphinx/transforms/i18n.py: note: In member "apply" of class "PreserveTranslatableMessages":
+ sphinx/transforms/i18n.py:103:43: error: Only concrete class can be given where "type[translatable]" is expected  [type-abstract]
+ sphinx/io.py: note: In member "setup" of class "SphinxI18nReader":
+ sphinx/io.py:143:40: error: Only concrete class can be given where "type[Transform]" is expected  [type-abstract]
+ sphinx/builders/latex/transforms.py:524: error: Unused "type: ignore" comment  [unused-ignore]
+ sphinx/builders/linkcheck.py: note: In member "run" of class "HyperlinkCollector":
+ sphinx/builders/linkcheck.py:164:37: error: Argument 1 to "find_uri" of "HyperlinkCollector" has incompatible type "Node"; expected "Element"  [arg-type]
+ sphinx/builders/linkcheck.py:165:36: error: Argument 2 to "_add_uri" of "HyperlinkCollector" has incompatible type "Node"; expected "Element"  [arg-type]

github-actions[bot] avatar Oct 02 '24 02:10 github-actions[bot]

Diff from mypy_primer, showing the effect of this PR on open source code:

sphinx (https://github.com/sphinx-doc/sphinx)
+ sphinx/transforms/__init__.py:94: error: Unused "type: ignore" comment  [unused-ignore]
+ sphinx/transforms/__init__.py: note: In member "apply" of class "ExtraTranslatableNodes":
+ sphinx/transforms/__init__.py:290:13: error: Unsupported target for indexed assignment ("Node")  [index]
+ sphinx/transforms/__init__.py: note: At top level:
+ sphinx/transforms/i18n.py: note: In member "apply" of class "PreserveTranslatableMessages":
+ sphinx/transforms/i18n.py:103:43: error: Only concrete class can be given where "type[translatable]" is expected  [type-abstract]
+ sphinx/io.py: note: In member "setup" of class "SphinxI18nReader":
+ sphinx/io.py:143:40: error: Only concrete class can be given where "type[Transform]" is expected  [type-abstract]
+ sphinx/builders/latex/transforms.py:524: error: Unused "type: ignore" comment  [unused-ignore]
+ sphinx/builders/linkcheck.py: note: In member "run" of class "HyperlinkCollector":
+ sphinx/builders/linkcheck.py:164:37: error: Argument 1 to "find_uri" of "HyperlinkCollector" has incompatible type "Node"; expected "Element"  [arg-type]
+ sphinx/builders/linkcheck.py:165:36: error: Argument 2 to "_add_uri" of "HyperlinkCollector" has incompatible type "Node"; expected "Element"  [arg-type]

github-actions[bot] avatar Oct 02 '24 03:10 github-actions[bot]

Diff from mypy_primer, showing the effect of this PR on open source code:

sphinx (https://github.com/sphinx-doc/sphinx)
+ sphinx/transforms/__init__.py:94: error: Unused "type: ignore" comment  [unused-ignore]
+ sphinx/transforms/__init__.py: note: In member "apply" of class "ExtraTranslatableNodes":
+ sphinx/transforms/__init__.py:290:13: error: Unsupported target for indexed assignment ("Node")  [index]
+ sphinx/transforms/__init__.py: note: At top level:
+ sphinx/transforms/i18n.py: note: In member "apply" of class "PreserveTranslatableMessages":
+ sphinx/transforms/i18n.py:103:43: error: Only concrete class can be given where "type[translatable]" is expected  [type-abstract]
+ sphinx/io.py: note: In member "setup" of class "SphinxI18nReader":
+ sphinx/io.py:143:40: error: Only concrete class can be given where "type[Transform]" is expected  [type-abstract]
+ sphinx/builders/latex/transforms.py:524: error: Unused "type: ignore" comment  [unused-ignore]
+ sphinx/builders/linkcheck.py: note: In member "run" of class "HyperlinkCollector":
+ sphinx/builders/linkcheck.py:164:37: error: Argument 1 to "find_uri" of "HyperlinkCollector" has incompatible type "Node"; expected "Element"  [arg-type]
+ sphinx/builders/linkcheck.py:165:36: error: Argument 2 to "_add_uri" of "HyperlinkCollector" has incompatible type "Node"; expected "Element"  [arg-type]

github-actions[bot] avatar Oct 02 '24 03:10 github-actions[bot]

I got CI to pass but some of @picnixz's review has not been addressed.

JelleZijlstra avatar Oct 02 '24 03:10 JelleZijlstra

Diff from mypy_primer, showing the effect of this PR on open source code:

sphinx (https://github.com/sphinx-doc/sphinx)
+ sphinx/transforms/__init__.py:94: error: Unused "type: ignore" comment  [unused-ignore]
+ sphinx/transforms/__init__.py: note: In member "apply" of class "ExtraTranslatableNodes":
+ sphinx/transforms/__init__.py:296:13: error: Unsupported target for indexed assignment ("Node")  [index]
+ sphinx/transforms/__init__.py: note: At top level:
+ sphinx/transforms/i18n.py: note: In member "apply" of class "PreserveTranslatableMessages":
+ sphinx/transforms/i18n.py:110:43: error: Only concrete class can be given where "type[translatable]" is expected  [type-abstract]
+ sphinx/io.py: note: In member "setup" of class "SphinxI18nReader":
+ sphinx/io.py:143:40: error: Only concrete class can be given where "type[Transform]" is expected  [type-abstract]
+ sphinx/builders/latex/transforms.py:529: error: Unused "type: ignore" comment  [unused-ignore]
+ sphinx/builders/linkcheck.py: note: In member "run" of class "HyperlinkCollector":
+ sphinx/builders/linkcheck.py:208:37: error: Argument 1 to "find_uri" of "HyperlinkCollector" has incompatible type "Node"; expected "Element"  [arg-type]
+ sphinx/builders/linkcheck.py:209:36: error: Argument 2 to "_add_uri" of "HyperlinkCollector" has incompatible type "Node"; expected "Element"  [arg-type]

github-actions[bot] avatar Nov 16 '24 15:11 github-actions[bot]

Diff from mypy_primer, showing the effect of this PR on open source code:

sphinx (https://github.com/sphinx-doc/sphinx)
+ sphinx/transforms/__init__.py:94: error: Unused "type: ignore" comment  [unused-ignore]
+ sphinx/transforms/__init__.py: note: In member "apply" of class "ExtraTranslatableNodes":
+ sphinx/transforms/__init__.py:296:13: error: Unsupported target for indexed assignment ("Node")  [index]
+ sphinx/transforms/__init__.py: note: At top level:
+ sphinx/transforms/i18n.py: note: In member "apply" of class "PreserveTranslatableMessages":
+ sphinx/transforms/i18n.py:110:43: error: Only concrete class can be given where "type[translatable]" is expected  [type-abstract]
+ sphinx/io.py: note: In member "setup" of class "SphinxI18nReader":
+ sphinx/io.py:143:40: error: Only concrete class can be given where "type[Transform]" is expected  [type-abstract]
+ sphinx/builders/latex/transforms.py:529: error: Unused "type: ignore" comment  [unused-ignore]
+ sphinx/builders/linkcheck.py: note: In member "run" of class "HyperlinkCollector":
+ sphinx/builders/linkcheck.py:208:37: error: Argument 1 to "find_uri" of "HyperlinkCollector" has incompatible type "Node"; expected "Element"  [arg-type]
+ sphinx/builders/linkcheck.py:209:36: error: Argument 2 to "_add_uri" of "HyperlinkCollector" has incompatible type "Node"; expected "Element"  [arg-type]

github-actions[bot] avatar Nov 17 '24 08:11 github-actions[bot]

@danieleades you moved this back to draft, anything that still needs to get done?

JelleZijlstra avatar Dec 28 '24 04:12 JelleZijlstra