-
-
Notifications
You must be signed in to change notification settings - Fork 294
Add nodes.Const.kind
for r
prefix and Python < 3.8
#1156
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
Comments
Thank you for creating the issue :) |
Unfortunately, I don't think this is possible at the moment. The import ast
import sys
code = """
a_string = r"Test string"
"""
if __name__ == '__main__':
ast_node = ast.parse(code)
if sys.version_info >= (3, 9):
print(ast.dump(ast_node, indent=2))
else:
print(ast.dump(ast_node)) -- |
I was thinking of looking for the column number of the string and doing |
It might work although there might be issues to be aware of. Just to name one: The If you like, you can take a look at it yourself. The logic should probably be part of |
Uh oh!
There was an error while loading. Please reload this page.
Current behavior
Following discussion in pylint-dev/pylint#4787 additional functionality for the
nodes.Const.kind
attribute would be helpful.See documentation for current behaviour, which only supports the
u
prefix and Python =< 3.8Expected behavior
For the following code, inferring
a_string
and checking itskind
should returnr
.Note: at the same time making
kind
work with thef
prefix or combined prefixes such asfr
might be possibleThe text was updated successfully, but these errors were encountered: