clean code
This commit is contained in:
@ -1,5 +1,4 @@
|
|||||||
|
from orm.models.fakepydantic import FakePydantic
|
||||||
from orm.models.model import Model
|
from orm.models.model import Model
|
||||||
|
|
||||||
__all__ = [
|
__all__ = ["FakePydantic", "Model"]
|
||||||
"Model"
|
|
||||||
]
|
|
||||||
|
|||||||
@ -1,14 +1,24 @@
|
|||||||
import inspect
|
import inspect
|
||||||
import json
|
import json
|
||||||
import uuid
|
import uuid
|
||||||
from typing import TYPE_CHECKING, Dict, TypeVar, Type, Any, Optional, Callable, Set, List
|
from typing import (
|
||||||
|
Any,
|
||||||
|
Callable,
|
||||||
|
Dict,
|
||||||
|
List,
|
||||||
|
Optional,
|
||||||
|
Set,
|
||||||
|
TYPE_CHECKING,
|
||||||
|
Type,
|
||||||
|
TypeVar,
|
||||||
|
)
|
||||||
|
|
||||||
import databases
|
import databases
|
||||||
import pydantic
|
import pydantic
|
||||||
import sqlalchemy
|
import sqlalchemy
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
|
|
||||||
import orm
|
import orm # noqa I100
|
||||||
from orm.fields import BaseField
|
from orm.fields import BaseField
|
||||||
from orm.models.metaclass import ModelMetaclass
|
from orm.models.metaclass import ModelMetaclass
|
||||||
from orm.relations import RelationshipManager
|
from orm.relations import RelationshipManager
|
||||||
|
|||||||
@ -1,14 +1,17 @@
|
|||||||
import copy
|
import copy
|
||||||
from typing import Dict, Tuple, Type, Optional, List, Any
|
from typing import Any, Dict, List, Optional, TYPE_CHECKING, Tuple, Type
|
||||||
|
|
||||||
import sqlalchemy
|
import sqlalchemy
|
||||||
from pydantic import BaseConfig, create_model
|
from pydantic import BaseConfig, create_model
|
||||||
from pydantic.fields import ModelField
|
from pydantic.fields import ModelField
|
||||||
|
|
||||||
from orm import ForeignKey, ModelDefinitionError
|
from orm import ForeignKey, ModelDefinitionError # noqa I100
|
||||||
from orm.fields import BaseField
|
from orm.fields import BaseField
|
||||||
from orm.relations import RelationshipManager
|
from orm.relations import RelationshipManager
|
||||||
|
|
||||||
|
if TYPE_CHECKING: # pragma no cover
|
||||||
|
from orm import Model
|
||||||
|
|
||||||
relationship_manager = RelationshipManager()
|
relationship_manager = RelationshipManager()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,15 +1,15 @@
|
|||||||
from typing import List, Any
|
from typing import Any, List
|
||||||
|
|
||||||
import sqlalchemy
|
import sqlalchemy
|
||||||
|
|
||||||
import orm.queryset.queryset
|
import orm.queryset # noqa I100
|
||||||
from orm.models.fakepydantic import FakePydantic
|
from orm.models import FakePydantic # noqa I100
|
||||||
|
|
||||||
|
|
||||||
class Model(FakePydantic):
|
class Model(FakePydantic):
|
||||||
__abstract__ = True
|
__abstract__ = True
|
||||||
|
|
||||||
objects = orm.queryset.queryset.QuerySet()
|
objects = orm.queryset.QuerySet()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_row(
|
def from_row(
|
||||||
|
|||||||
@ -0,0 +1,3 @@
|
|||||||
|
from orm.queryset.queryset import QuerySet
|
||||||
|
|
||||||
|
__all__ = ["QuerySet"]
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
from typing import Type, List, Any, Tuple, Dict, Union, Optional, TYPE_CHECKING
|
from typing import Any, Dict, List, Optional, TYPE_CHECKING, Tuple, Type, Union
|
||||||
|
|
||||||
import sqlalchemy
|
import sqlalchemy
|
||||||
from sqlalchemy import text
|
from sqlalchemy import text
|
||||||
|
|
||||||
import orm
|
import orm # noqa I100
|
||||||
from orm.exceptions import QueryDefinitionError
|
from orm.exceptions import QueryDefinitionError
|
||||||
|
|
||||||
if TYPE_CHECKING: # pragma no cover
|
if TYPE_CHECKING: # pragma no cover
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
from typing import NamedTuple, Type, List, Tuple, TYPE_CHECKING
|
from typing import List, NamedTuple, TYPE_CHECKING, Tuple, Type
|
||||||
|
|
||||||
import sqlalchemy
|
import sqlalchemy
|
||||||
from sqlalchemy import text
|
from sqlalchemy import text
|
||||||
|
|
||||||
import orm
|
import orm # noqa I100
|
||||||
from orm import ForeignKey
|
from orm import ForeignKey
|
||||||
from orm.fields import BaseField
|
from orm.fields import BaseField
|
||||||
|
|
||||||
|
|||||||
@ -1,10 +1,10 @@
|
|||||||
from typing import Type, List, Any, Union, Tuple, TYPE_CHECKING
|
from typing import Any, List, TYPE_CHECKING, Tuple, Type, Union
|
||||||
|
|
||||||
import databases
|
import databases
|
||||||
import sqlalchemy
|
import sqlalchemy
|
||||||
|
|
||||||
import orm # noqa I100
|
import orm # noqa I100
|
||||||
from orm import NoMatch, MultipleMatches
|
from orm import MultipleMatches, NoMatch
|
||||||
from orm.queryset.clause import QueryClause
|
from orm.queryset.clause import QueryClause
|
||||||
from orm.queryset.query import Query
|
from orm.queryset.query import Query
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user