mirror of
https://github.com/RapidAI/RapidOCR.git
synced 2026-11-11 21:40:52 +08:00
Format by black
This commit is contained in:
1 parent
ad4631fdd4
commit
f4fd5cdcba
40 files changed
+908
-854
No files matched your search
@@ -8,25 +8,25 @@ from pathlib import Path
|
||||
import yaml
|
||||
|
||||
|
||||
class BaseModule():
|
||||
def __init__(self, package_name: str = 'rapidocr_onnxruntime'):
|
||||
class BaseModule:
|
||||
def __init__(self, package_name: str = "rapidocr_onnxruntime"):
|
||||
self.package_name = package_name
|
||||
self.root_dir = Path(__file__).resolve().parent.parent
|
||||
self.package_dir = self.root_dir / self.package_name
|
||||
self.tests_dir = self.root_dir / 'tests'
|
||||
self.tests_dir = self.root_dir / "tests"
|
||||
|
||||
sys.path.append(str(self.root_dir))
|
||||
sys.path.append(str(self.package_dir))
|
||||
|
||||
def init_module(self, module_name: str, class_name: str = None):
|
||||
if class_name is None:
|
||||
module_part = importlib.import_module(f'{self.package_name}')
|
||||
module_part = importlib.import_module(f"{self.package_name}")
|
||||
return module_part
|
||||
module_part = importlib.import_module(f'{self.package_name}.{module_name}')
|
||||
module_part = importlib.import_module(f"{self.package_name}.{module_name}")
|
||||
return getattr(module_part, class_name)
|
||||
|
||||
@staticmethod
|
||||
def read_yaml(yaml_path: str):
|
||||
with open(yaml_path, 'rb') as f:
|
||||
with open(yaml_path, "rb") as f:
|
||||
data = yaml.load(f, Loader=yaml.Loader)
|
||||
return data
|
||||
Reference in new issue
Block a user