fix(api): fix incorrect adjust to Extensible

`__file__` records the path of the `Extensible` class, not the receiver class
of `scan_extensions` method.

This commit fixes this by switching to `inspect.getfile`.
pull/20699/head
QuantumGhost 12 months ago
parent 312601e964
commit e8de080add

@ -1,5 +1,6 @@
import enum import enum
import importlib.util import importlib.util
import inspect
import json import json
import logging import logging
import os import os
@ -42,7 +43,7 @@ class Extensible:
position_map: dict[str, int] = {} position_map: dict[str, int] = {}
# get the path of the current class # get the path of the current class
current_path = os.path.abspath(__file__) current_path = os.path.abspath(inspect.getfile(cls))
current_dir_path = os.path.dirname(current_path) current_dir_path = os.path.dirname(current_path)
# traverse subdirectories # traverse subdirectories

Loading…
Cancel
Save