-
Notifications
You must be signed in to change notification settings - Fork 880
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
[WIP] fix incorrect type hints + refactor for impoved consistency #2304
Commits on Feb 16, 2024
-
fix(wip): incorrect type hints for optional params/attributes
Commit was automated using this powerful one-liner: `find . -type f -name "*.py" -print0 | xargs -0 perl -i -pe \ 's/([a-zA-Z_]+): (?!(Optional\[|Any\]))([a-zA-Z_]+) = None/\1: Optional[\3] = None/g'` Which modifies variable annotations initialized with None to use Optional[Type], except when the type is already annotated as Optional[Type] or Any After executing the command, I manually updated modules that didn't already import Optional. issue: 2303
danphenderson committedFeb 16, 2024 Configuration menu - View commit details
-
Copy full SHA for 42afbd7 - Browse repository at this point
Copy the full SHA 42afbd7View commit details -
chore(wip): update Union[Type, None] to Optional[Type]
Changes where automated with this perl one-liner: `perl -pi -e 's/Union\[\s*(\w+)\s*,\s*None\s*\]/Optional[$1]/g' \ $(find . -type f -name '*.py')` WIP, still need to address the case where the union specifies more than two different types. issue: 2303
danphenderson committedFeb 16, 2024 Configuration menu - View commit details
-
Copy full SHA for 4af9951 - Browse repository at this point
Copy the full SHA 4af9951View commit details -
chore: accessing typing module consistently
Changes with created with this perl command: `perl -pi -e 's/typing\.//g' $(find . -type f -name '*.py')` Which removes all instances of '.typing'. I manually had to update the imports. WIP: care should be taken to test that 'generate_api.py' and 'documentation_provider.py' scripts are working properly. issue: 2303
danphenderson committedFeb 16, 2024 Configuration menu - View commit details
-
Copy full SHA for dcc5d7e - Browse repository at this point
Copy the full SHA dcc5d7eView commit details -
fix(wip): incorrect optional type hints
Changes made with perl command: `perl -pi -e 's/: Dict\[(.*?)\] = None/: Optional[Dict[$1]] = None/g' $(find . -type f -name '*.py')` Which replaces ': Dict[..., ...] = None' with ': Optional[Dict[..., ...]] = None', where '...' can be any type. issue: 2303
danphenderson committedFeb 16, 2024 Configuration menu - View commit details
-
Copy full SHA for 728d3ea - Browse repository at this point
Copy the full SHA 728d3eaView commit details -
fix(wip): incorrect optional type hints
Changes made with perl command: `perl -pi -e 's/: Literal\[(.*?)\] = None/: Optional[Literal[$1]] = None/g' $(find . -type f -name '*.py')` Which replaces ': Literal[..., ...] = None' with ': Optional[Literal[..., ...]] = None', where '...' can be any type. issue: 2303
danphenderson committedFeb 16, 2024 Configuration menu - View commit details
-
Copy full SHA for 09f138e - Browse repository at this point
Copy the full SHA 09f138eView commit details -
fix(wip): incorrect optional type hints
Changes made with a perl command (see 09f138e, 728d3ea) with manual intervention to fix unintended modifications. ': Sequence[...] = None' has been corrected to ': Optional[Sequence[...]] = None'. issue: 2303
danphenderson committedFeb 16, 2024 Configuration menu - View commit details
-
Copy full SHA for b642750 - Browse repository at this point
Copy the full SHA b642750View commit details -
Changes made with the perl command: find . -type f -name '*.py' -exec perl -i -pe \ 's/(\s*)(\w+): Union\[(.*?)\] = None,/$1$2: Optional[Union[$3]] = None,/g' {} + Which replaces instances of '<param>: Union[...] = None,' with '<param>: Optional[Union[...]] = None,' Note, this does not modify incorrect class attributes of this form (they don't end with a ','). issue: 2303
danphenderson committedFeb 16, 2024 Configuration menu - View commit details
-
Copy full SHA for f790c80 - Browse repository at this point
Copy the full SHA f790c80View commit details -
chore: consistent decleration of optional params
Changes made with the perl command: find . -type f -name '*.py' -exec perl -i -pe \ 's/Union\[((?:(?![,]).)*), None\]/Optional[$1]/g' {} + Which replaces Union type hints with a single 'TYPE' followed by 'None' are replaced with 'Optional[<TYPE>]'. issue: 2303
danphenderson committedFeb 16, 2024 Configuration menu - View commit details
-
Copy full SHA for 99dcd81 - Browse repository at this point
Copy the full SHA 99dcd81View commit details -
fix: incorrect optional type hints
Changes made with shell command: `perl -pi -e 's/: Callable\[(.*?)\] = None/: Optional[Callable[$1]] = None/g' $(find . -type f -name '*.py')` Which replaces ': Callable[...] = None' with ': Optional[Callable[...]] = None', where '...' can be any type. issue: 2303
danphenderson committedFeb 16, 2024 Configuration menu - View commit details
-
Copy full SHA for 52bc2fa - Browse repository at this point
Copy the full SHA 52bc2faView commit details -
Merge branch 'main' into 2303-fix-type-hints
danphenderson committedFeb 16, 2024 Configuration menu - View commit details
-
Copy full SHA for db25da2 - Browse repository at this point
Copy the full SHA db25da2View commit details