forked from shaba/openuds
refactoring and updating models for python 3.7
This commit is contained in:
parent
1b3e1d9bcc
commit
e836a142fe
@ -35,7 +35,7 @@ import logging
|
||||
|
||||
from django.db import models, transaction
|
||||
|
||||
from uds.models.util import getSqlDatetime
|
||||
from .util import getSqlDatetime
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
@ -32,8 +32,8 @@
|
||||
import logging
|
||||
|
||||
from django.db import models
|
||||
from uds.models.uuid_model import UUIDModel
|
||||
from uds.models.tag import TaggingMixin
|
||||
from .uuid_model import UUIDModel
|
||||
from .tag import TaggingMixin
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
@ -35,9 +35,11 @@ import logging
|
||||
import typing
|
||||
|
||||
from django.db import models
|
||||
from uds.models.uuid_model import UUIDModel
|
||||
from uds.core.util import encoders
|
||||
|
||||
from .uuid_model import UUIDModel
|
||||
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
@ -33,18 +33,20 @@ import logging
|
||||
import typing
|
||||
|
||||
|
||||
from PIL import Image as PILImage
|
||||
|
||||
from django.db import models
|
||||
from django.db.models import signals
|
||||
from django.http import HttpResponse
|
||||
|
||||
from PIL import Image as PILImage
|
||||
|
||||
from uds.models.uuid_model import UUIDModel
|
||||
from uds.models.util import getSqlDatetime
|
||||
|
||||
from uds.core.util import encoders
|
||||
|
||||
|
||||
from .uuid_model import UUIDModel
|
||||
from .util import getSqlDatetime
|
||||
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
|
@ -62,4 +62,4 @@ class Log(models.Model):
|
||||
app_label = 'uds'
|
||||
|
||||
def __str__(self):
|
||||
return u"Log of {}({}): {} - {} - {} - {}".format(self.owner_type, self.owner_id, self.created, self.source, self.level, self.data)
|
||||
return "Log of {}({}): {} - {} - {} - {}".format(self.owner_type, self.owner_id, self.created, self.source, self.level, self.data)
|
||||
|
@ -38,7 +38,7 @@ from django.db import models
|
||||
from uds.core.environment import Environment
|
||||
from uds.core import Module
|
||||
|
||||
from uds.models.uuid_model import UUIDModel
|
||||
from .uuid_model import UUIDModel
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
@ -39,16 +39,17 @@ from django.utils.translation import ugettext_noop as _
|
||||
|
||||
from uds.core.util import log
|
||||
from uds.core.util import states
|
||||
from uds.models.uuid_model import UUIDModel
|
||||
from uds.models.tag import TaggingMixin
|
||||
from uds.models.util import getSqlDatetime
|
||||
from uds.core.util.calendar import CalendarChecker
|
||||
|
||||
from uds.models.image import Image
|
||||
from uds.models.service_pool_group import ServicePoolGroup
|
||||
from uds.models.service_pool import ServicePool
|
||||
from uds.models.group import Group
|
||||
from uds.models.calendar import Calendar
|
||||
from .uuid_model import UUIDModel
|
||||
from .tag import TaggingMixin
|
||||
from .util import getSqlDatetime
|
||||
|
||||
from .image import Image
|
||||
from .service_pool_group import ServicePoolGroup
|
||||
from .service_pool import ServicePool
|
||||
from .group import Group
|
||||
from .calendar import Calendar
|
||||
|
||||
if typing.TYPE_CHECKING:
|
||||
import datetime
|
||||
|
@ -36,10 +36,11 @@ import typing
|
||||
from django.db import models
|
||||
from django.db.models import signals
|
||||
|
||||
from uds.models.transport import Transport
|
||||
from uds.core.util import net
|
||||
from uds.models.uuid_model import UUIDModel
|
||||
from uds.models.tag import TaggingMixin
|
||||
|
||||
from .transport import Transport
|
||||
from .uuid_model import UUIDModel
|
||||
from .tag import TaggingMixin
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
@ -36,8 +36,8 @@ import typing
|
||||
from django.db import IntegrityError
|
||||
from django.db.models import signals
|
||||
|
||||
from uds.models.managed_object_model import ManagedObjectModel
|
||||
from uds.models.tag import TaggingMixin
|
||||
from .managed_object_model import ManagedObjectModel
|
||||
from .tag import TaggingMixin
|
||||
|
||||
# Not imported in runtime, just for type checking
|
||||
if typing.TYPE_CHECKING:
|
||||
|
@ -36,10 +36,10 @@ from django.utils.translation import ugettext as _
|
||||
from django.db import models
|
||||
from django.db.models import Q
|
||||
|
||||
from uds.models.uuid_model import UUIDModel
|
||||
from uds.models.user import User
|
||||
from uds.models.group import Group
|
||||
from uds.models.util import getSqlDatetime
|
||||
from .uuid_model import UUIDModel
|
||||
from .user import User
|
||||
from .group import Group
|
||||
from .util import getSqlDatetime
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
@ -37,8 +37,8 @@ from django.db import models
|
||||
from django.db.models import signals
|
||||
|
||||
from uds.core.util import log
|
||||
from uds.models.managed_object_model import ManagedObjectModel
|
||||
from uds.models.tag import TaggingMixin
|
||||
from .managed_object_model import ManagedObjectModel
|
||||
from .tag import TaggingMixin
|
||||
|
||||
# Not imported in runtime, just for type checking
|
||||
if typing.TYPE_CHECKING:
|
||||
|
@ -36,8 +36,8 @@ import requests
|
||||
|
||||
from django.db import models
|
||||
|
||||
from uds.models.uuid_model import UUIDModel
|
||||
from uds.models.tag import TaggingMixin
|
||||
from .uuid_model import UUIDModel
|
||||
from .tag import TaggingMixin
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
@ -39,7 +39,7 @@ from uds.core.util.State import State
|
||||
from uds.core.environment import Environment
|
||||
from uds.core import jobs
|
||||
|
||||
from uds.models.util import NEVER
|
||||
from .util import NEVER
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
@ -39,12 +39,12 @@ from django.db.models import signals
|
||||
from uds.core.environment import Environment
|
||||
from uds.core.util import log
|
||||
from uds.core.util import unique
|
||||
from uds.models.managed_object_model import ManagedObjectModel
|
||||
from uds.models.tag import TaggingMixin
|
||||
from uds.models.proxy import Proxy
|
||||
from uds.core.util import connection
|
||||
|
||||
from uds.models.provider import Provider
|
||||
from .managed_object_model import ManagedObjectModel
|
||||
from .tag import TaggingMixin
|
||||
from .proxy import Proxy
|
||||
from .provider import Provider
|
||||
|
||||
# Not imported in runtime, just for type checking
|
||||
if typing.TYPE_CHECKING:
|
||||
|
@ -35,10 +35,11 @@ import logging
|
||||
from django.db import models
|
||||
from django.utils.translation import ugettext as _
|
||||
|
||||
from uds.models.uuid_model import UUIDModel
|
||||
from uds.models.image import Image
|
||||
from uds.core.ui.images import DEFAULT_THUMB_BASE64
|
||||
|
||||
from .uuid_model import UUIDModel
|
||||
from .image import Image
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
@ -152,7 +152,7 @@ class ServicePoolPublication(UUIDModel):
|
||||
self.data = publication.serialize()
|
||||
self.save(update_fields=['data'])
|
||||
|
||||
def setState(self, state: str):
|
||||
def setState(self, state: str) -> None:
|
||||
"""
|
||||
Updates the state of this object and, optionally, saves it
|
||||
|
||||
|
@ -36,9 +36,9 @@ import logging
|
||||
|
||||
from django.db import models
|
||||
|
||||
from uds.models.util import NEVER_UNIX
|
||||
from uds.models.util import getSqlDatetime
|
||||
from uds.models.util import getSqlFnc
|
||||
from .util import NEVER_UNIX
|
||||
from .util import getSqlDatetime
|
||||
from .util import getSqlFnc
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
@ -36,8 +36,8 @@ import types
|
||||
|
||||
from django.db import models
|
||||
|
||||
from uds.models.util import NEVER_UNIX
|
||||
from uds.models.util import getSqlDatetime
|
||||
from .util import NEVER_UNIX
|
||||
from .util import getSqlDatetime
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
@ -34,7 +34,7 @@ import logging
|
||||
|
||||
|
||||
from django.db import models
|
||||
from uds.models.uuid_model import UUIDModel
|
||||
from .uuid_model import UUIDModel
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
@ -34,10 +34,11 @@ import logging
|
||||
|
||||
from django.db import models
|
||||
|
||||
from uds.models.uuid_model import UUIDModel
|
||||
from uds.models.util import getSqlDatetime
|
||||
from uds.core.managers import cryptoManager
|
||||
|
||||
from .uuid_model import UUIDModel
|
||||
from .util import getSqlDatetime
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
@ -40,8 +40,8 @@ from uds.core import transports
|
||||
|
||||
from uds.core.util import net
|
||||
|
||||
from uds.models.managed_object_model import ManagedObjectModel
|
||||
from uds.models.tag import TaggingMixin
|
||||
from .managed_object_model import ManagedObjectModel
|
||||
from .tag import TaggingMixin
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
@ -36,12 +36,13 @@ import typing
|
||||
from django.db import models
|
||||
from django.db.models import signals
|
||||
|
||||
from uds.models.authenticator import Authenticator
|
||||
from uds.models.util import UnsavedForeignKey
|
||||
from uds.models.util import NEVER
|
||||
from uds.models.util import getSqlDatetime
|
||||
from uds.core.util import log
|
||||
from uds.models.uuid_model import UUIDModel
|
||||
|
||||
from .authenticator import Authenticator
|
||||
from .util import UnsavedForeignKey
|
||||
from .util import NEVER
|
||||
from .util import getSqlDatetime
|
||||
from .uuid_model import UUIDModel
|
||||
|
||||
# Not imported in runtime, just for type checking
|
||||
if typing.TYPE_CHECKING:
|
||||
|
Loading…
Reference in New Issue
Block a user