Describe the bug
The following snippet results in a traceback.
To Reproduce
def _execute_raw_query(self, query):
# type: (str) -> List[tuple]
query_func = self._query_funcs.get(query)
if query_func is None:
# QueryManager only supports `str` queries.
# So here's the workaround: we make `query` refer to the import paths of query functions, then import here.
# Cache the results so imports only happen on the first check run.
module_name, _, func_name = query.partition(':')
module = importlib.import_module(module_name, package='datadog_checks.rethinkdb')
query_func = getattr(module, func_name)
self._query_funcs[query] = query_func
init__.py", line 119, in visit
visitor_fn(node.children)
File "/Users/ericwb/workspace/precli-thirdparty/.tox/py312/lib/python3.12/site-packages/precli/parsers/__init__.py", line 119, in visit
visitor_fn(node.children)
[Previous line repeated 2 more times]
File "/Users/ericwb/workspace/precli-thirdparty/.tox/py312/lib/python3.12/site-packages/precli/parsers/python.py", line 142, in visit_assignment
self.visit(nodes)
File "/Users/ericwb/workspace/precli-thirdparty/.tox/py312/lib/python3.12/site-packages/precli/parsers/__init__.py", line 119, in visit
visitor_fn(node.children)
File "/Users/ericwb/workspace/precli-thirdparty/.tox/py312/lib/python3.12/site-packages/precli/parsers/python.py", line 160, in visit_call
module = self.importlib_import_module(call)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/ericwb/workspace/precli-thirdparty/.tox/py312/lib/python3.12/site-packages/precli/parsers/python.py", line 322, in importlib_import_module
subpkg = len(name) - len(name.lstrip(".")) - 1
^^^^^^^^^
TypeError: object of type 'NoneType' has no len()
Expected behavior
No tracebacks
Version
precli 0.4.3
python version = 3.12.1 (main, Dec 12 2023, 13:19:17) [Clang 15.0.0 (clang-1500.0.40.1)]
Describe the bug The following snippet results in a traceback.
To Reproduce
Expected behavior No tracebacks
Version
Additional context n/a