Core
materia.core
¶
cache
¶
CacheError
¶
Bases: Exception
Cache
¶
Cache(url, pool)
PARAMETER | DESCRIPTION |
---|---|
url |
TYPE:
|
pool |
TYPE:
|
Source code in src/materia/core/cache.py
14 15 16 |
|
new
async
staticmethod
¶
new(
url,
encoding="utf-8",
decode_responses=True,
test_connection=True,
)
PARAMETER | DESCRIPTION |
---|---|
url |
TYPE:
|
encoding |
TYPE:
|
decode_responses |
TYPE:
|
test_connection |
TYPE:
|
Source code in src/materia/core/cache.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
|
client
async
¶
client()
Source code in src/materia/core/cache.py
42 43 44 45 46 47 |
|
pipeline
async
¶
pipeline(transaction=True)
PARAMETER | DESCRIPTION |
---|---|
transaction |
TYPE:
|
Source code in src/materia/core/cache.py
49 50 51 52 53 54 55 56 |
|
config
¶
Application
¶
Log
¶
Bases: BaseModel
console_format
class-attribute
instance-attribute
¶
console_format = "<level>{level: <8}</level> <green>{time:YYYY-MM-DD HH:mm:ss.SSS}</green> - {message}"
file_format
class-attribute
instance-attribute
¶
file_format = "<level>{level: <8}</level>: <green>{time:YYYY-MM-DD HH:mm:ss.SSS}</green> - {message}"
Server
¶
Bases: BaseModel
url
¶
url()
Source code in src/materia/core/config.py
41 42 |
|
Database
¶
Bases: BaseModel
url
¶
url()
Source code in src/materia/core/config.py
55 56 57 58 59 60 61 62 63 64 65 66 |
|
Cache
¶
Bases: BaseModel
url
¶
url()
Source code in src/materia/core/config.py
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
|
Security
¶
OAuth2
¶
Bases: BaseModel
Mailer
¶
Bases: BaseModel
Config
¶
Bases: BaseSettings
open
staticmethod
¶
open(path)
PARAMETER | DESCRIPTION |
---|---|
path |
TYPE:
|
Source code in src/materia/core/config.py
165 166 167 168 169 170 171 172 173 |
|
write
¶
write(path)
PARAMETER | DESCRIPTION |
---|---|
path |
TYPE:
|
Source code in src/materia/core/config.py
175 176 177 178 179 180 181 182 183 184 185 |
|
data_dir
staticmethod
¶
data_dir()
Source code in src/materia/core/config.py
187 188 189 190 191 192 193 |
|
cron
¶
CronError
¶
Bases: Exception
Cron
¶
Cron(workers_count, backend)
PARAMETER | DESCRIPTION |
---|---|
workers_count |
TYPE:
|
backend |
TYPE:
|
Source code in src/materia/core/cron.py
15 16 17 18 19 20 21 22 23 24 25 |
|
new
staticmethod
¶
new(
workers_count=1,
backend_url=None,
broker_url=None,
test_connection=True,
**kwargs
)
PARAMETER | DESCRIPTION |
---|---|
workers_count |
TYPE:
|
backend_url |
TYPE:
|
broker_url |
TYPE:
|
test_connection |
TYPE:
|
**kwargs |
DEFAULT:
|
Source code in src/materia/core/cron.py
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 56 57 58 59 60 61 62 |
|
instance
staticmethod
¶
instance()
Source code in src/materia/core/cron.py
64 65 66 |
|
run_workers
¶
run_workers()
Source code in src/materia/core/cron.py
68 69 70 71 72 |
|
database
¶
DatabaseError
¶
Bases: Exception
DatabaseMigrationError
¶
Bases: Exception
Database
¶
Database(url, engine, sessionmaker)
PARAMETER | DESCRIPTION |
---|---|
url |
TYPE:
|
engine |
TYPE:
|
sessionmaker |
TYPE:
|
Source code in src/materia/core/database.py
38 39 40 41 42 43 44 45 46 |
|
new
async
staticmethod
¶
new(
url,
pool_size=100,
poolclass=None,
autocommit=False,
autoflush=False,
expire_on_commit=False,
test_connection=True,
)
PARAMETER | DESCRIPTION |
---|---|
url |
TYPE:
|
pool_size |
TYPE:
|
poolclass |
DEFAULT:
|
autocommit |
TYPE:
|
autoflush |
TYPE:
|
expire_on_commit |
TYPE:
|
test_connection |
TYPE:
|
Source code in src/materia/core/database.py
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
|
dispose
async
¶
dispose()
Source code in src/materia/core/database.py
86 87 |
|
connection
async
¶
connection()
Source code in src/materia/core/database.py
89 90 91 92 93 94 95 96 |
|
session
async
¶
session()
Source code in src/materia/core/database.py
98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
|
run_sync_migrations
¶
run_sync_migrations(connection)
PARAMETER | DESCRIPTION |
---|---|
connection |
TYPE:
|
Source code in src/materia/core/database.py
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 |
|
run_migrations
async
¶
run_migrations()
Source code in src/materia/core/database.py
140 141 142 |
|
rollback_sync_migrations
¶
rollback_sync_migrations(connection)
PARAMETER | DESCRIPTION |
---|---|
connection |
TYPE:
|
Source code in src/materia/core/database.py
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 |
|
rollback_migrations
async
¶
rollback_migrations()
Source code in src/materia/core/database.py
171 172 173 |
|
filesystem
¶
FileSystemError
¶
Bases: Exception
FileSystem
¶
FileSystem(path, isolated_directory=None)
PARAMETER | DESCRIPTION |
---|---|
path |
TYPE:
|
isolated_directory |
TYPE:
|
Source code in src/materia/core/filesystem.py
22 23 24 25 26 27 28 29 30 31 |
|
exists
async
¶
exists()
Source code in src/materia/core/filesystem.py
35 36 |
|
size
async
¶
size()
Source code in src/materia/core/filesystem.py
38 39 |
|
is_file
async
¶
is_file()
Source code in src/materia/core/filesystem.py
41 42 |
|
is_directory
async
¶
is_directory()
Source code in src/materia/core/filesystem.py
44 45 |
|
name
¶
name()
Source code in src/materia/core/filesystem.py
47 48 |
|
check_isolation
async
¶
check_isolation(path)
PARAMETER | DESCRIPTION |
---|---|
path |
TYPE:
|
Source code in src/materia/core/filesystem.py
50 51 52 53 54 55 56 57 58 59 60 |
|
remove
async
¶
remove(shallow=False)
PARAMETER | DESCRIPTION |
---|---|
shallow |
TYPE:
|
Source code in src/materia/core/filesystem.py
62 63 64 65 66 67 68 69 70 71 |
|
generate_name
async
¶
generate_name(target_directory, name)
Generate name based on target directory contents and self type.
PARAMETER | DESCRIPTION |
---|---|
target_directory |
TYPE:
|
name |
TYPE:
|
Source code in src/materia/core/filesystem.py
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
|
move
async
¶
move(
target_directory,
new_name=None,
force=False,
shallow=False,
)
PARAMETER | DESCRIPTION |
---|---|
target_directory |
TYPE:
|
new_name |
TYPE:
|
force |
TYPE:
|
shallow |
TYPE:
|
Source code in src/materia/core/filesystem.py
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 |
|
rename
async
¶
rename(new_name, force=False, shallow=False)
PARAMETER | DESCRIPTION |
---|---|
new_name |
TYPE:
|
force |
TYPE:
|
shallow |
TYPE:
|
Source code in src/materia/core/filesystem.py
139 140 141 142 143 144 |
|
copy
async
¶
copy(
target_directory,
new_name=None,
force=False,
shallow=False,
)
PARAMETER | DESCRIPTION |
---|---|
target_directory |
TYPE:
|
new_name |
TYPE:
|
force |
TYPE:
|
shallow |
TYPE:
|
Source code in src/materia/core/filesystem.py
146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 |
|
make_directory
async
¶
make_directory(force=False)
PARAMETER | DESCRIPTION |
---|---|
force |
TYPE:
|
Source code in src/materia/core/filesystem.py
170 171 172 173 174 175 176 177 |
|
write_file
async
¶
write_file(data, force=False)
PARAMETER | DESCRIPTION |
---|---|
data |
TYPE:
|
force |
TYPE:
|
Source code in src/materia/core/filesystem.py
179 180 181 182 183 184 185 186 187 |
|
check_path
staticmethod
¶
check_path(path)
PARAMETER | DESCRIPTION |
---|---|
path |
TYPE:
|
Source code in src/materia/core/filesystem.py
189 190 191 |
|
normalize
staticmethod
¶
normalize(path)
Resolve path and make it relative.
PARAMETER | DESCRIPTION |
---|---|
path |
TYPE:
|
Source code in src/materia/core/filesystem.py
193 194 195 196 197 198 199 |
|
TemporaryFileTarget
¶
TemporaryFileTarget(
working_directory, allow_overwrite=True, *args, **kwargs
)
Bases: BaseTarget
PARAMETER | DESCRIPTION |
---|---|
working_directory |
TYPE:
|
allow_overwrite |
TYPE:
|
*args |
DEFAULT:
|
**kwargs |
DEFAULT:
|
Source code in src/materia/core/filesystem.py
203 204 205 206 207 208 209 210 211 212 213 |
|
on_start
¶
on_start()
Source code in src/materia/core/filesystem.py
215 216 217 218 219 |
|
on_data_received
¶
on_data_received(chunk)
PARAMETER | DESCRIPTION |
---|---|
chunk |
TYPE:
|
Source code in src/materia/core/filesystem.py
221 222 223 |
|
on_finish
¶
on_finish()
Source code in src/materia/core/filesystem.py
225 226 227 |
|
path
¶
path()
Source code in src/materia/core/filesystem.py
229 230 |
|
remove
¶
remove()
Source code in src/materia/core/filesystem.py
232 233 234 235 |
|
logging
¶
LogLevel
module-attribute
¶
LogLevel = Literal[
"info", "warning", "error", "critical", "debug", "trace"
]
InterceptHandler
¶
Bases: Handler
emit
¶
emit(record)
PARAMETER | DESCRIPTION |
---|---|
record |
TYPE:
|
Source code in src/materia/core/logging.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
|
Logger
¶
Logger()
Source code in src/materia/core/logging.py
35 36 |
|
new
staticmethod
¶
new(
mode="console",
level="info",
console_format="<level>{level: <8}</level> <green>{time:YYYY-MM-DD HH:mm:ss.SSS}</green> - {message}",
file_format="<level>{level: <8}</level>: <green>{time:YYYY-MM-DD HH:mm:ss.SSS}</green> - {message}",
file=None,
file_rotation="3 days",
file_retention="1 week",
interceptions=[
"uvicorn",
"uvicorn.access",
"uvicorn.error",
"uvicorn.asgi",
"fastapi",
],
)
PARAMETER | DESCRIPTION |
---|---|
mode |
TYPE:
|
level |
TYPE:
|
console_format |
TYPE:
|
file_format |
TYPE:
|
file |
TYPE:
|
file_rotation |
TYPE:
|
file_retention |
TYPE:
|
interceptions |
TYPE:
|
Source code in src/materia/core/logging.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 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
|
instance
staticmethod
¶
instance()
Source code in src/materia/core/logging.py
102 103 104 |
|
uvicorn_config
staticmethod
¶
uvicorn_config(level)
PARAMETER | DESCRIPTION |
---|---|
level |
TYPE:
|
Source code in src/materia/core/logging.py
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
|
misc
¶
optional
¶
optional(func, *args, **kwargs)
PARAMETER | DESCRIPTION |
---|---|
func |
|
*args |
TYPE:
|
**kwargs |
TYPE:
|
Source code in src/materia/core/misc.py
8 9 10 11 12 13 14 15 |
|
optional_next
¶
optional_next(it)
PARAMETER | DESCRIPTION |
---|---|
it |
TYPE:
|
Source code in src/materia/core/misc.py
18 19 |
|
optional_string
¶
optional_string(value, format_string=None)
PARAMETER | DESCRIPTION |
---|---|
value |
TYPE:
|
format_string |
TYPE:
|
Source code in src/materia/core/misc.py
22 23 24 25 26 27 28 |
|