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

Passing str to functions annotated AnyStr shows squiggly in .pyi files #243

Closed
karthiknadig opened this issue Aug 14, 2020 · 3 comments
Closed
Labels
bug Something isn't working fixed in next version (main) A fix has been implemented and will appear in an upcoming version

Comments

@karthiknadig
Copy link
Member

Environment data

  • Language Server version: 2020.8.1
  • OS and version: Windows 10
  • Python version (& distribution if applicable, e.g. Anaconda): 3.8.3

Expected behaviour

Should not show squiggles

Actual behaviour

This occured in a auto-generated pyi file in strict mode. There might be two problems here:

  1. It is generating actual code in .pyi files
  2. the squiggles

image

image

Contents of the actual generated file below in the code snippet section.

Logs

XXX

Code Snippet / Additional information

Put this in a pyi file. Turn on strict mode.

"""
This type stub file was generated by pyright.
"""

import os

haarcascades = os.path.join(os.path.dirname(__file__), "")
@erictraut
Copy link
Contributor

Thanks for the bug report. I've eliminated the incorrect error.

That said, stub files should not include statements like this. They should include only type information, not logic that's manipulating file names or paths.

@erictraut erictraut added bug Something isn't working fixed in next version (main) A fix has been implemented and will appear in an upcoming version labels Aug 14, 2020
@github-actions github-actions bot removed the triage label Aug 14, 2020
@jakebailey
Copy link
Member

Yep, this code just came out of the stub generator (which is another issue in and of itself).

@jakebailey
Copy link
Member

This issue has been fixed in version 2020.8.2, which we've just released. You can find the changelog here: https://github.com/microsoft/pylance-release/blob/master/CHANGELOG.md#202082-20-august-2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed in next version (main) A fix has been implemented and will appear in an upcoming version
Projects
None yet
Development

No branches or pull requests

3 participants