feat: file class
@@ -27,7 +27,10 @@ class FindFilePath:
find_file_path = FindFilePath
-def file_path() -> str:
+class File:
+
+ @property
+ def path(self) -> str:
"""
Returns the absolute path to the directory where the current file resides
For example:
@@ -38,8 +41,8 @@ def file_path() -> str:
ins = inspect.getframeinfo(stack_t[1][0])
return os.path.abspath(ins.filename)
-
-def file_dir() -> str:
+ @property
+ def dir(self) -> str:
"""
Returns the absolute path to the directory where the current file resides
For example:
@@ -50,8 +53,8 @@ def file_dir() -> str:
ins = inspect.getframeinfo(stack_t[1][0])
return os.path.dirname(os.path.abspath(ins.filename))
-
-def file_dir_dir() -> str:
+ @property
+ def dir_dir(self) -> str:
"""
Returns the absolute directory path of the current file directory.
For example:
@@ -62,8 +65,8 @@ def file_dir_dir() -> str:
ins = inspect.getframeinfo(stack_t[1][0])
return os.path.dirname(os.path.dirname(os.path.abspath(ins.filename)))
-
-def file_dir_dir_dir() -> str:
+ @property
+ def dir_dir_dir(self) -> str:
"""
Returns the absolute directory path of the current file directory
For example:
@@ -74,17 +77,20 @@ def file_dir_dir_dir() -> str:
ins = inspect.getframeinfo(stack_t[1][0])
return os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(ins.filename))))
-
-def init_env_path(path=None) -> None:
+ @staticmethod
+ def add_to_path(path=None) -> None:
"""
add path to environment variable path.
"""
if path is None:
- sys.path.insert(1, file_dir_dir())
- else:
+ raise FileNotFoundError("Please setting the File Path")
+
sys.path.insert(1, path)
+file = File()
+
+
class AssertInfo:
data = []
