- 
                Notifications
    You must be signed in to change notification settings 
- Fork 70
Type modernization #254
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
base: main
Are you sure you want to change the base?
Type modernization #254
Conversation
Fixed remaining ruff errors
f62e6d7    to
    00467fb      
    Compare
  
    | Thanks for tackling this! I agree with updating the type hints as in qiskit-community/qiskit-optimization#676, but I'm not convinced we need to start enforcing an import sorting -- especially since Python imports can be volatile. Is there any bug that would've been avoided with import sorting? If it's merely stylistic I would prefer not to add this. | 
| 
 To be fair, the only reason why I also did the import sorting is because it bugged me that the  AFAIK, I don't see how not sorting the packages may introduce bugs. I don't know whether the PEP8 recommendation is purely aesthetic/for readability purposes or whether something more subtle is going on there. | 
| 
 yeah I think that would be good for now -- if we start enforcing import sorting it would be nice to do this generally in the algorithms and applications packages, not just in a single one 
 I thought there's only a PEP8 for grouping imports as standard imports - 3rd party imports - local imports. But nothing on alphabetical sorting, or is there? | 
| 
 So just to be sure, I should remove the last commit on import sorting but still put the import of the  
 Not that I know of no! | 
| 
 Yes! 🙂 | 
f87f1b1    to
    ad87999      
    Compare
  
    
Summary
This PR modernizes the linting and type hinting of the repository, akin to qiskit-community/qiskit-optimization#676.
Details and comments
ListOrDictwas moved tocustom_types.pyandlist_or_dict.pyhas been removedTranspilerprotocol now distinguishes compiling a singleQuantumCircuitand a list thereof type-wisetestmodule is now correctly imported last, even though pylint doesn't like it, which leads topylint: disable=wrong-import-order, just like in the Qiskit main repository.Note that as shown in the
ruffconfiguration, this modernization has been done with the end of life of Python 3.9 in mind. As such, the tests will only pass once the minimum supported Python version is 3.10.To ease the review process, each task mentioned above has been performed in a separate commit.