common
songbirdcore.common
find_file(path, filename)
Simple glob search for a file
Parameters:
-
path(str) –the path to the root folder to search within
-
filename(str) –the filename (supports glob patterns)
Returns:
-
List[str]–List[str]: list of paths found that match
Source code in songbirdcore/common.py
114 115 116 117 118 119 120 121 122 123 124 125 | |
fname_duper(fname, limit, count, dup_key)
Generates a duplicate filename for when a filename already exists
Parameters:
-
fname(str) –filename
-
limit(int) –a limit of dups before quitting the attempt
-
count(int) –recursive count tracker
-
dup_key(str) –the key to use as the duplicate addon
Returns:
-
Optional[str]–Optional[str]: the modified filename, or None if the limit has been reached.
Source code in songbirdcore/common.py
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | |
name_plate(entries)
renders the songbird entrypoint name plate
Parameters:
-
entries(List[str]) –add additional entries to the nameplate via this list
Source code in songbirdcore/common.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | |
pretty_list_of_basemodel_printer(list_of_models, ignore_keys=None)
renders a list to stdio given a list of pydantic BaseModel objects
Parameters:
-
list_of_models(List[BaseModel]) –list of pydantic models to print
-
ignore_keys(Optional[List[str]], default:None) –any keys/fields in BaseModel not to print
Source code in songbirdcore/common.py
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 | |
pretty_lst_printer(lyst)
print a list to stdio
Parameters:
-
lyst(List) –the list to print
Source code in songbirdcore/common.py
155 156 157 158 159 160 161 162 | |
remove_illegal_characters(filename)
Used for stripping file names of illegal characters used for saving
Parameters:
-
filename(str) –the file's name to strip illegal characters from
Returns:
-
str(str) –stripped file name
Source code in songbirdcore/common.py
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | |
set_logger_config_globally(log_level=logging.INFO)
Sets the python logging module settings for output to stdout and to file.
Parameters:
-
log_level(str, default:INFO) –the log level
Source code in songbirdcore/common.py
23 24 25 26 27 28 29 30 31 32 33 34 35 | |