sphinx-doc / sphinxcontrib-django

This is a sphinx extension which improves the documentation of Django apps.
https://pypi.org/project/sphinxcontrib-django/
Apache License 2.0
43 stars 25 forks source link

Add type hints to docstrings module #46

Closed WhyNotHugo closed 1 year ago

codecov-commenter commented 1 year ago

Codecov Report

Merging #46 (5ae6bbc) into main (872cb8d) will not change coverage. The diff coverage is 100.00%.

@@            Coverage Diff            @@
##              main       #46   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           10        10           
  Lines          315       317    +2     
=========================================
+ Hits           315       317    +2     
Files Changed Coverage Δ
sphinxcontrib_django/docstrings/__init__.py 100.00% <100.00%> (ø)

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

WhyNotHugo commented 1 year ago

Updated. I've just realised that I've mis-measuring coverage in a bunch of project too, thanks for the pointer.

WhyNotHugo commented 1 year ago

Rebased with pre-commit hooks applied.

WhyNotHugo commented 1 year ago

Mypy would help make sure that type hints keep making sense. :+1:

Right now sphinxcontrib_django/docstrings/attributes.py is failing due to a quirk in the type system (tuple[X] and tuple[X, X] are different types):

sphinxcontrib_django/docstrings/attributes.py:20: error: Incompatible types in assignment (expression has type "tuple[Any, Any, Any]", variable has type "tuple[Any, Any]")  [assignment]

You might need to use:

FIELD_DESCRIPTORS : tuple[Any,...] = (FileDescriptor, related_descriptors.ForwardManyToOneDescriptor)