Utils
clean_dir(path_to_clean, exception)
Removes all files and directories in the given path if they don't match the exception list.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path_to_clean |
Union[str, Path]
|
Directory path to clean. If it is a string, it will be converted to a Path object. |
required |
exception |
List[str]
|
List of files and directories to keep. If a file or directory is in this list, it will not be removed. |
required |
Source code in make_us_rich/utils/directory_cleaning.py
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
|
directory_cleaning
clean_dir(path_to_clean, exception)
Removes all files and directories in the given path if they don't match the exception list.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path_to_clean |
Union[str, Path]
|
Directory path to clean. If it is a string, it will be converted to a Path object. |
required |
exception |
List[str]
|
List of files and directories to keep. If a file or directory is in this list, it will not be removed. |
required |
Source code in make_us_rich/utils/directory_cleaning.py
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
|
load_env
All utility functions for the make_us_rich project.
load_env(file_name, config_dir=None)
Loads the environment variables from the specified .env file.
You don't need to specify .env-
prefix for the file name.
e.g. load_env("my_env")
will load .env-my_env
file.
You can also specify the directory where the .env file is located. You need to provide the full path to the directory.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
file_name |
str
|
Name of the .env file. |
required |
config_dir |
Optional[str]
|
Full path to the config directory. |
None
|
Source code in make_us_rich/utils/load_env.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
|
random_string
random_string(length=25)
Generate a random string of the specified length.
Parameters:
length: int The length of the string. Default is 25.
Returns:
str: The random generated string.
Source code in make_us_rich/utils/random_string.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
|