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

type.Annotated (3.9.0) error - Unexpected token at end of expression #479

Closed
EdLipson5117 opened this issue Oct 12, 2020 · 2 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

@EdLipson5117
Copy link

Just started to play with python 3.9.0, and the attr package. I'm not sure if I have the correct syntax as I get the error messages. Program works.

`import pathlib as PP
from typing import Annotated as Ann

import attr

@attr.s
class GpxDist():
"""
get the distances in the gpx files
"""
gpxfilelist: Ann[list, "list of pathLib files, including paths",
[Ann[PP.Path, "PathLib file name with path"]]]
gpxfilename: Ann[PP.Path, "PathLib file name with path"]
stoppedsec: Ann[int, "number of seconds between points to be considered not moving"]
= attr.ib(default=90)

`
Is there a valid syntax?

@erictraut
Copy link
Contributor

Thanks for reporting.

Normally, string literals within a type would be interpreted as forward references, but Annotated needs to be handled specially. I've addressed the problem, and the fix will be in the next version.

@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 Oct 12, 2020
@github-actions github-actions bot removed the triage label Oct 12, 2020
@jakebailey
Copy link
Member

This issue has been fixed in version 2020.10.1, which we've just released. You can find the changelog here: https://github.com/microsoft/pylance-release/blob/master/CHANGELOG.md#2020101-14-october-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