reorder-python-imports
reorder-python-imports copied to clipboard
Support for pyi files now types_or is implemented
Further to #103 which was closed at the time.
Would it be possible to update the pre-commit hooks for this repo to allow it to run by default on pyi files?
Or alternatively is there a way to avoid this in my local config:
hooks:
- id: reorder-python-imports
files: \.pyi?$
types: []
... as using types_or e.g.:
hooks:
- id: reorder-python-imports
types_or: [python, pyi]
... doesn't seem to do anything in the .pre-commit-config.yaml. Does this setting only work for the hooks config, not the client side one?
@Greedquest in your own config you'll also have to override types, e.g. I think this should work:
hooks:
- id: reorder-python-imports
types_or: [python, pyi]
types: [text] # overwrite types: [python]
@MarcoGorelli Oh that's kind of crazy but makes sense I suppose, thanks! Is types: [text] the default value of types, equivalent to what happens when you don't specify it in the hooks config? (i.e. I understand we need to override it locally, presumably setting it back to the equivalent of what it would have been if it were never specified in the first place?)