-
Notifications
You must be signed in to change notification settings - Fork 70
[WIP] Type hints #131
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
Merged
Merged
[WIP] Type hints #131
Changes from 45 commits
Commits
Show all changes
57 commits
Select commit
Hold shift + click to select a range
7f14e0c
Started annotating
eliotwrobson 8794171
Update utils.py
eliotwrobson 075934e
More generic annotations
eliotwrobson b6341dc
Add NFA annotations
eliotwrobson 39314f7
More type annotations
eliotwrobson e9cb1c3
Mapping change
eliotwrobson 6ac8088
Type move
eliotwrobson a0406a8
Update requirements.txt
eliotwrobson 49e6da4
Changing PDA stuff
eliotwrobson 4075e12
Remove trailing space after decorator
caleb531 c0a8f31
Add explicit return type annotation for copy()
caleb531 621b981
Fix import order to appease isort
caleb531 e9e081f
Fix compatibility with Python versions older than 3.11
caleb531 a117ee6
Solve "missing import: frozendict" error from Pylance
caleb531 db58ba3
Remove leftover TODO comment
caleb531 b822a25
Add mypy to dev dependencies for project
caleb531 5a0a227
Correct order of dependencies in requirements.txt
caleb531 fc64a3d
Format Python files on save using black
caleb531 1f6cc19
Remove leftover flake8-isort package
caleb531 c402831
Connect isort with black to sort imports on file save
caleb531 d138412
Add GitHub Action CI job for black
caleb531 8f1877d
Revert "Add GitHub Action CI job for black"
caleb531 123b1b4
Resurrect flake8, this time with proper black integration
caleb531 56fe804
Reflow comment in Automaton class to fix line length
caleb531 130f690
Drop Python 3.7 support
caleb531 dcdf664
Disable auto-formatting for now
caleb531 148911e
Started adding regex annotations
eliotwrobson b98185b
Adding more regex type hints
eliotwrobson d22af3f
Finished adding type annotations
eliotwrobson d7b37d9
Add types to abstract PDA class
caleb531 811d148
Format changed files with black
caleb531 260fcd9
Merge remote-tracking branch 'upstream/develop' into type-hints
caleb531 a05fef8
Fix flake8 warnings
caleb531 6ae4083
Fix minor drop in branch coverage due to merge
caleb531 46e207f
Fix ... being flagged as missing coverage
caleb531 410f1c4
Add types to DPDA class
caleb531 c96265d
Fix Python 3.8 compatibility via Tuple type
caleb531 8f12309
Remove rendundant type annotations
caleb531 ace0d2b
Add type annotations to NPDA class
caleb531 da62df4
Prefer Set[] type instead of set[]
caleb531 fe6f9c8
Add types for TM abstract base class
caleb531 958b31a
Add explicit return type signatures for __init__ methods
caleb531 0f230cb
Add type annotation for PDAStack input elements
caleb531 363971c
Simplify stack/configuration types using Sequence type
caleb531 7114701
Remove unused types from TM class
caleb531 2e4f7fa
Simplify PDAAcceptanceModeT type definition
caleb531 486680f
Ensure PDAStack stack tuple is typed to be of variable length
caleb531 d9452a5
Fix leftover code from 2e4f7fa changes
caleb531 0c6c5a1
Add type annotations for DTM, TMTape, and TMConfiguration
caleb531 f0e9144
Add type annotations to NTM class
caleb531 27c901a
Add missing type annotations to TM utilities/primitives
caleb531 fad817b
Add type annotations to MNTM class
caleb531 2cff9f8
More named tuple cleanup + rework weird function
eliotwrobson 8c87a21
Fix flake8/black warnings in DTM class
caleb531 ffd0575
Add mypy type checking to CI
caleb531 cb6e99a
Added py.typed
eliotwrobson ae04a63
Remove redundant return type on subclass validate() methods
caleb531 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,8 @@ exclude_lines = | |
|
||
pass | ||
|
||
... | ||
|
||
# Only check coverage for source files | ||
include = | ||
automata/*/*.py |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
"""Global configuration for the library and its primitives""" | ||
|
||
|
||
should_validate_automata = True | ||
should_validate_automata: bool = True | ||
# When set to True, it disables the freeze_value step | ||
# -> You must guarantee that your code does not modify the automata | ||
allow_mutable_automata = False | ||
allow_mutable_automata: bool = False |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.