-
Notifications
You must be signed in to change notification settings - Fork 58
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
Replaced all instances of outdated type annotations (List, Dict, etc.…) #1081
base: master
Are you sure you want to change the base?
Conversation
…) with the current built-in types (list, dict, etc.) .
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.
@CulmoneY okay good work, though overall you were a bit too broad with your find-and-replace (see inline comments).
In addition to the comments I left inline, I have two additional comments:
- You'll need to update your branch since I merged in @Raine-Yang-UofT's PR (see my message on Slack). There will be merge conflicts, so you have a good opportunity to practice resolving those.
- Update the Changelog. This is an internal change.
tests/test_messages_config/test_no_user_config_no_pyta_overwrite.pylintrc
Outdated
Show resolved
Hide resolved
@CulmoneY oh sorry I realized you hadn't yet requested a review, so I may have been a bit premature! Well, keep working :) |
for more information, see https://pre-commit.ci
@@ -29,12 +31,12 @@ | |||
|
|||
DEBUG_CONTRACTS = False | |||
""" | |||
Set to True to display debugging messages when checking contracts. | |||
set to True to display debugging messages when checking contracts. |
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.
This still needs to be reverted (as below)
>>> from typing import List | ||
>>> _display_annotation(List[int]) | ||
'typing.List[int]' | ||
>>> from typing import list |
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.
This entire doctest example needs to be updated (note that you can, and should, run the doctest example manually to ensure it passes)
@@ -478,7 +478,7 @@ def end_setter_from_source(source_code, pred, only_consumables=False): | |||
def set_endings_from_source(node): | |||
# Tuple nodes have an end_col_offset that includes the end paren, | |||
# but their col_offset does not include the start paren. | |||
# To address this, we override the Tuple node's end_col_offset. | |||
# To address this, we override the tuple node's end_col_offset. |
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.
revert this change
) -> List[z3.ExprRef]: | ||
"""Convert an astroid List, Set, Tuple node to a list of z3 expressions.""" | ||
) -> list[z3.ExprRef]: | ||
"""Convert an astroid list, Set, tuple node to a list of z3 expressions.""" |
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.
Revert these changes
@@ -43,7 +43,7 @@ def create_cfg_funcs_only(): | |||
|
|||
This fixture specifies that cfgs will only be created for functions. | |||
""" | |||
# Setup: store the paths of the files being used/created | |||
# setup: store the paths of the files being used/created |
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.
revert this change
Proposed Changes
Updated the PythonTA codebase to use modern type annotations. Specifically, I replaced
List
withlist
,Dict
withdict
,Set
withset
, andTuple
withtuple
. I addressed the following two requirements:from __future__ import annotations
to the top of each file where these type annotations are used, if it wasn't present already.List
,Dict
,Set
, andTuple
to clean up the codebase.Type of Change
(Write an
X
or a brief description next to the type or types that best describe your changes.)Checklist
(Complete each of the following items for your pull request. Indicate that you have completed an item by changing the
[ ]
into a[x]
in the raw text, or by clicking on the checkbox in the rendered description on GitHub.)Before opening your pull request:
After opening your pull request: