initial commit

This commit is contained in:
2024-03-28 23:11:30 -07:00
commit 9218f4a404
199 changed files with 10051 additions and 0 deletions

47
tests/co4_example.py Normal file
View File

@@ -0,0 +1,47 @@
'''
content -> converted
state -> transformed
'''
from co3 import CO3, collate
from co3.databases import SQLiteDatabase
from co3 import Mapper
class Tomato(CO3):
def __init__(self, size, ripe):
self.size = size
self.ripe = ripe
@property
def attributes(self):
return vars(self)
@collate('diced')
def dice(self):
return self.size / 2
@collate('roasted')
def roast(self):
return self.size / 2
tomato_table = sa.Table()
mapper = Mapper()
mapper.attach(
Tomato,
tomato_table
)
tomato = Tomato(5, False)
mapper.collect(tomato, for='diced')
db = SQLiteDatabse('resource.sqlite')
db.sync(mapper)
dict_results = db.select(
mapper.compose(Tomato),
tomato_table.c.size == 5
)

20
tests/imports.py Normal file
View File

@@ -0,0 +1,20 @@
from co3 import Accessor
from co3 import CO3
from co3 import Collector
from co3 import Composer
from co3 import Database
from co3 import Indexer
from co3 import Manager
from co3 import Mapper
from co3 import Relation
from co3.accessors import SQLAccessor
from co3.databases import SQLDatabase
from co3.databases import SQLiteDatabase
from co3.managers import SQLManager
from co3.relations import TabularRelation
from co3.relations import SQLTable