Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Badly formatted generated stub #3500

Closed
gramster opened this issue May 24, 2022 · 2 comments
Closed

Badly formatted generated stub #3500

gramster opened this issue May 24, 2022 · 2 comments
Labels
addressed in next version Issue is fixed and will appear in next published version bug Something isn't working

Comments

@gramster
Copy link
Member

gramster commented May 24, 2022

Describe the bug

When using pyright to generate a type stub the output is getting mangled.

To Reproduce

  1. Install pyright and matplotlib
  2. Run pyright --createstub matplotlib.axis
  3. Look at the resulting typings/matplotlib.axis file; there are issues with multi-line strings. I'm not sure if there are any other issues or if it is just this.

Expected behavior

Output should preserve the docstrings.

Screenshots or Code

Excerpt from the output:

"""
Classes for the ticks and x and"""
_log = ...
GRIDLINE_INTERPOLATION_STEPS = ...
_line_inspector = ...
_line_param_names = ...
_line_param_aliases = ...
_gridline_param_names = ...
class Tick(martist.Artist):
    """
    Abstract base class for the"""
    def __init__(self, axes, loc, *, size=..., width=..., color=..., tickdir=..., pad=..., labelsize=..., labelcolor=..., zorder=..., gridOn=..., tick1On=..., tick2On=..., label1On=..., label2On=..., major=..., labelrotation=..., grid_color=..., grid_linestyle=..., grid_linewidth=..., grid_alpha=..., **kw) -> None:
        """
        bbox is the Bound2D bou"""
        ...
    

This was with pyright 1.1.248

@erictraut
Copy link
Collaborator

The current logic truncates string literal expressions to 32 characters. This was done for the benefit of logging and error messages that include expressions. Truncating in the context of stub generate isn't appropriate, so I've updated the expression printing code to perform truncation conditionally based on a flag passed by the caller. This will be addressed in the next release.

@erictraut erictraut added bug Something isn't working addressed in next version Issue is fixed and will appear in next published version labels May 24, 2022
@erictraut
Copy link
Collaborator

This is addressed in pyright 1.1.249, which I just published. It will also be included in the next release of pylance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addressed in next version Issue is fixed and will appear in next published version bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants