-
-
Notifications
You must be signed in to change notification settings - Fork 471
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
Script for merging stubs into Django source files for testing #408
base: master
Are you sure you want to change the base?
Conversation
kszmigiel
commented
Jun 22, 2020
- Closes Testing stubs against Django source code #405
@mkurnikov @sobolevn I had not much time to sink into libcst docs yet, so here's just initial version on the script, so you can easily check my progress on this in the nearest future :) |
Looks about right. Now we need to add more steps:
|
context = CodemodContext() | ||
visitor = ApplyTypeAnnotationsVisitor(context) | ||
|
||
stubs_dir = '../django-stubs' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, make paths not ..
relative, but with Path(__file__).parent
so that script could be run from other directories too.
for path in stubs_pathlist: | ||
str_path = str(path) | ||
|
||
stubs_dict[str_path.split('/', 2)[-1].split('.')[0]] = str_path |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same thing here, use pathlib.Path
everywhere for filesystem paths.
if key in stubs_dict: | ||
sources_dict[key] = str_path | ||
|
||
for key in stubs_dict: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use enumerate(stubs_dict)
, you're using values of the dict too