Closed kshivakumar closed 2 years ago
For some unknown reason, I get the below error on my machine(MacOS x86) during pre-commit/make test
:
Reorder python imports...................................................Failed
- hook id: reorder-python-imports
- exit code: 1
Traceback (most recent call last):
File "/root/.cache/pre-commit/repol5aizj_t/py_env-python3/bin/reorder-python-imports", line 8, in <module>
sys.exit(main())
File "/root/.cache/pre-commit/repol5aizj_t/py_env-python3/lib/python3.7/site-packages/reorder_python_imports.py", line 685, in main
application_directories=args.application_directories.split(':'),
File "/root/.cache/pre-commit/repol5aizj_t/py_env-python3/lib/python3.7/site-packages/reorder_python_imports.py", line 420, in fix_file_contents
partitioned = step(partitioned)
File "/root/.cache/pre-commit/repol5aizj_t/py_env-python3/lib/python3.7/site-packages/reorder_python_imports.py", line 334, in apply_import_sorting
sorted_blocks = sort(import_obj_to_partition.keys(), **sort_kwargs)
File "/root/.cache/pre-commit/repol5aizj_t/py_env-python3/lib/python3.7/site-packages/aspy/refactor_imports/sort.py", line 96, in sort
imports_partitioned[classify_func(import_obj)].append(import_obj)
File "/root/.cache/pre-commit/repol5aizj_t/py_env-python3/lib/python3.7/site-packages/aspy/refactor_imports/sort.py", line 73, in classify_func
return classify_import(obj.import_statement.module, **kwargs)
File "/root/.cache/pre-commit/repol5aizj_t/py_env-python3/lib/python3.7/site-packages/aspy/refactor_imports/classify.py", line 139, in classify_import
base, application_directories,
File "/root/.cache/pre-commit/repol5aizj_t/py_env-python3/lib/python3.7/site-packages/aspy/refactor_imports/classify.py", line 103, in _get_module_info
assert spec.submodule_search_locations is not None
AssertionError
I tried different Python versions (3.7, 3.8, 3.9), but the error doesn't go away. Other hooks and test cases are all passing.
Update: The error occurs in setup.py
file
@dgzlopes Test cases are failing for Python 3.5 because the library for mocking api responses - aresponses
doesn't support Python 3.5. The library uses format
strings which was added in 3.6.
I have to check if there's an alternative library that supports Python 3.5.
@dgzlopes How important is Python 3.5 support? It's officially retired - https://endoflife.date/python. I initially thought of suggesting to remove support for Python 3.6 and below. The asynchronous api in Python kind of stabilised in Python 3.7 and has remained consistent till 3.9.
Not important @kshivakumar :D
Feel free to drop it!
I'll review the PR at the end of the week (I've scheduled it on my personal calendar).
Sorry for my slow pace :smile:
The only thing, while running tox locally, the pre-commit hook step did some fixes on
setup.py
(re-ordering Python import). Do you mind committing those?
@dgzlopes Fixed it and also updated README.
@dgzlopes Can we merge this if there are no further issues?
Sorry for the delay! I had a mess on my GH notifications :(
Merged. I'll cut a new release.
Implements https://github.com/dgzlopes/cloud-detect/issues/11
Uses
asyncio
to check all the cloud providers concurrently and returns back a response as soon as the cloud provider is detected.Important changes:
requests
withaiohttp
in the dependenciesidentifier
class variable to each*Provider
classSUPPORTED_PROVIDERS
api - it's a tuple ofidentifier
values of each Provider classI manually tested the changes in Azure and GCP, it's working fine and the response comes back within a second.