Verified Commit 4b1c6db4 authored by Dmitry Volodin's avatar Dmitry Volodin
Browse files

Remove @six.python_2_unicode_compatible and six.with_metaclass

parent b9c3d468
......@@ -2,7 +2,7 @@
# ----------------------------------------------------------------------
# APIKey model
# ----------------------------------------------------------------------
# Copyright (C) 2007-2019 The NOC Project
# Copyright (C) 2007-2020 The NOC Project
# See LICENSE for details
# ----------------------------------------------------------------------
......@@ -10,7 +10,6 @@
import datetime
# Third-party modules
import six
from mongoengine.document import Document, EmbeddedDocument
from mongoengine.fields import (
StringField,
......@@ -24,7 +23,6 @@ from mongoengine.fields import (
from noc.core.acl import match
@six.python_2_unicode_compatible
class APIAccess(EmbeddedDocument):
# Api name
api = StringField()
......@@ -35,7 +33,6 @@ class APIAccess(EmbeddedDocument):
return "%s:%s" % (self.api, self.role)
@six.python_2_unicode_compatible
class APIAccessACL(EmbeddedDocument):
prefix = StringField()
is_active = BooleanField(default=True)
......@@ -47,7 +44,6 @@ class APIAccessACL(EmbeddedDocument):
return "%s (inactive)" % self.prefix
@six.python_2_unicode_compatible
class APIKey(Document):
meta = {"collection": "apikeys", "strict": False, "auto_create_index": False}
......
......@@ -2,7 +2,7 @@
# ----------------------------------------------------------------------
# Group model
# ----------------------------------------------------------------------
# Copyright (C) 2007-2019 The NOC Project
# Copyright (C) 2007-2020 The NOC Project
# See LICENSE for details
# ----------------------------------------------------------------------
......@@ -12,7 +12,6 @@ import operator
# Third-party modules
import cachetools
import six
from django.db import models
# NOC modules
......@@ -23,7 +22,6 @@ id_lock = Lock()
@on_delete_check(check=[("sa.GroupAccess", "group")])
@six.python_2_unicode_compatible
class Group(NOCModel):
class Meta(object):
verbose_name = "Group"
......
......@@ -2,17 +2,16 @@
# ----------------------------------------------------------------------
# ModelProtection Profile
# ----------------------------------------------------------------------
# Copyright (C) 2007-2019 The NOC Project
# Copyright (C) 2007-2020 The NOC Project
# See LICENSE for details
# ----------------------------------------------------------------------
# Python modules
from threading import Lock
import operator
from collections import defaultdict
# Third-party modules
import six
from collections import defaultdict
from mongoengine.document import Document, EmbeddedDocument
from mongoengine.fields import StringField, IntField, ListField, EmbeddedDocumentField
from mongoengine.errors import ValidationError
......@@ -47,7 +46,6 @@ def check_model(model_name):
raise ValidationError
@six.python_2_unicode_compatible
class FieldAccess(EmbeddedDocument):
meta = {"strict": False, "auto_create_index": False}
name = StringField()
......@@ -57,7 +55,6 @@ class FieldAccess(EmbeddedDocument):
return "%s:%s" % (self.name, self.permission)
@six.python_2_unicode_compatible
class ModelProtectionProfile(Document):
meta = {
"collection": "noc.modelprotectionprofile",
......
......@@ -11,7 +11,6 @@ from threading import Lock
import operator
# Third-party modules
import six
from django.db.models import CharField, ManyToManyField
import cachetools
......@@ -24,7 +23,6 @@ perm_lock = Lock()
id_lock = Lock()
@six.python_2_unicode_compatible
class Permission(NOCModel):
"""
Permissions.
......
......@@ -2,7 +2,7 @@
# ----------------------------------------------------------------------
# User model
# ----------------------------------------------------------------------
# Copyright (C) 2007-2019 The NOC Project
# Copyright (C) 2007-2020 The NOC Project
# See LICENSE for details
# ----------------------------------------------------------------------
......@@ -13,7 +13,6 @@ import operator
# Third-party modules
import cachetools
import six
from django.db import models
from django.core import validators
from django.contrib.auth.hashers import check_password, make_password
......@@ -44,7 +43,6 @@ id_lock = Lock()
("main.Favorites", "user"),
]
)
@six.python_2_unicode_compatible
class User(NOCModel):
class Meta(object):
verbose_name = "User"
......
......@@ -2,12 +2,11 @@
# ---------------------------------------------------------------------
# UserContact model
# ---------------------------------------------------------------------
# Copyright (C) 2007-2019 The NOC Project
# Copyright (C) 2007-2020 The NOC Project
# See LICENSE for details
# ---------------------------------------------------------------------
# Third-party modules
import six
from django.db import models
# NOC modules
......@@ -17,7 +16,6 @@ from noc.main.models.notificationgroup import USER_NOTIFICATION_METHOD_CHOICES
from .user import User
@six.python_2_unicode_compatible
class UserContact(NOCModel):
class Meta(object):
verbose_name = "User Profile Contact"
......
......@@ -2,7 +2,7 @@
# ----------------------------------------------------------------------
# Dashboard storage
# ----------------------------------------------------------------------
# Copyright (C) 2007-2019 The NOC Project
# Copyright (C) 2007-2020 The NOC Project
# See LICENSE for details
# ----------------------------------------------------------------------
......@@ -10,7 +10,6 @@
import datetime
# Third-party modules
import six
from mongoengine.document import Document, EmbeddedDocument
from mongoengine.fields import (
StringField,
......@@ -38,7 +37,6 @@ class DashboardAccess(EmbeddedDocument):
level = IntField(choices=[(DAL_RO, "Read-only"), (DAL_MODIFY, "Modify"), (DAL_ADMIN, "Admin")])
@six.python_2_unicode_compatible
class Dashboard(Document):
meta = {
"collection": "noc.dashboards",
......
......@@ -2,12 +2,11 @@
# ----------------------------------------------------------------------
# Dashboard Layout
# ----------------------------------------------------------------------
# Copyright (C) 2007-2019 The NOC Project
# Copyright (C) 2007-2020 The NOC Project
# See LICENSE for details
# ----------------------------------------------------------------------
# Third-party modules
import six
from mongoengine.document import Document, EmbeddedDocument
from mongoengine.fields import StringField, UUIDField, IntField, ListField, EmbeddedDocumentField
......@@ -15,7 +14,6 @@ from mongoengine.fields import StringField, UUIDField, IntField, ListField, Embe
from noc.core.prettyjson import to_json
@six.python_2_unicode_compatible
class DashboardCell(EmbeddedDocument):
name = StringField()
# Row number
......@@ -46,7 +44,6 @@ class DashboardCell(EmbeddedDocument):
}
@six.python_2_unicode_compatible
class DashboardLayout(Document):
meta = {
"collection": "noc.dashboardlayouts",
......
......@@ -2,7 +2,7 @@
# ----------------------------------------------------------------------
# ConfDBQuery model
# ----------------------------------------------------------------------
# Copyright (C) 2007-2019 The NOC Project
# Copyright (C) 2007-2020 The NOC Project
# See LICENSE for details
# ----------------------------------------------------------------------
......@@ -20,7 +20,6 @@ from mongoengine.fields import (
ListField,
EmbeddedDocumentField,
)
import six
import cachetools
# NOC modules
......@@ -33,7 +32,6 @@ id_lock = threading.Lock()
TYPE_MAP = {"str": StringParameter(), "int": IntParameter(), "bool": BooleanParameter()}
@six.python_2_unicode_compatible
class ConfDBQueryParam(EmbeddedDocument):
meta = {"strict": False}
name = StringField()
......@@ -66,7 +64,6 @@ class ConfDBQueryParam(EmbeddedDocument):
# ("cm.ObjectValidationPolicy", "rules.filer_query"),
]
)
@six.python_2_unicode_compatible
class ConfDBQuery(Document):
meta = {
"collection": "confdbqueries",
......
......@@ -2,7 +2,7 @@
# ---------------------------------------------------------------------
# Error Types
# ---------------------------------------------------------------------
# Copyright (C) 2007-2019 The NOC Project
# Copyright (C) 2007-2020 The NOC Project
# See LICENSE for details
# ---------------------------------------------------------------------
......@@ -10,7 +10,6 @@
import os
# Third-party modules
import six
from mongoengine.document import Document
from mongoengine.fields import StringField, UUIDField
......@@ -19,7 +18,6 @@ from noc.core.prettyjson import to_json
from noc.core.text import quote_safe_path
@six.python_2_unicode_compatible
class ErrorType(Document):
meta = {
"collection": "noc.errortypes",
......
......@@ -2,7 +2,7 @@
# ----------------------------------------------------------------------
# InterfaceValidationPolicy
# ----------------------------------------------------------------------
# Copyright (C) 2007-2019 The NOC Project
# Copyright (C) 2007-2020 The NOC Project
# See LICENSE for details
# ----------------------------------------------------------------------
......@@ -20,7 +20,6 @@ from mongoengine.fields import (
DictField,
)
from jinja2 import Template
import six
import cachetools
# NOC modules
......@@ -32,7 +31,6 @@ from .confdbquery import ConfDBQuery
id_lock = threading.Lock()
@six.python_2_unicode_compatible
class InterfaceValidationRule(EmbeddedDocument):
query = PlainReferenceField(ConfDBQuery)
query_params = DictField()
......@@ -48,7 +46,6 @@ class InterfaceValidationRule(EmbeddedDocument):
@on_delete_check(check=[("inv.InterfaceProfile", "interface_validation_policy")])
@six.python_2_unicode_compatible
class InterfaceValidationPolicy(Document):
meta = {
"collection": "interfacevalidationpolicies",
......
......@@ -2,7 +2,7 @@
# ---------------------------------------------------------------------
# Object Facts
# ---------------------------------------------------------------------
# Copyright (C) 2007-2019 The NOC Project
# Copyright (C) 2007-2020 The NOC Project
# See LICENSE for details
# ---------------------------------------------------------------------
......@@ -10,7 +10,6 @@
import datetime
# Third-party modules
import six
from mongoengine.document import Document
from mongoengine.fields import StringField, DictField, DateTimeField, UUIDField
......@@ -19,7 +18,6 @@ from noc.sa.models.managedobject import ManagedObject
from noc.core.mongo.fields import ForeignKeyField
@six.python_2_unicode_compatible
class ObjectFact(Document):
meta = {
"collection": "noc.objectfacts",
......
......@@ -2,12 +2,11 @@
# ---------------------------------------------------------------------
# Object notifications
# ---------------------------------------------------------------------
# Copyright (C) 2007-2019 The NOC Project
# Copyright (C) 2007-2020 The NOC Project
# See LICENSE for details
# ---------------------------------------------------------------------
# Third-party modules
import six
from django.db import models
# NOC modules
......@@ -19,7 +18,6 @@ OBJECT_TYPES = ["config", "dns", "prefix-list", "rpsl"]
OBJECT_TYPE_CHOICES = [(x, x) for x in OBJECT_TYPES if x != "config"]
@six.python_2_unicode_compatible
class ObjectNotify(NOCModel):
class Meta(object):
app_label = "cm"
......
......@@ -2,7 +2,7 @@
# ----------------------------------------------------------------------
# ObjectValidationPolicy
# ----------------------------------------------------------------------
# Copyright (C) 2007-2019 The NOC Project
# Copyright (C) 2007-2020 The NOC Project
# See LICENSE for details
# ----------------------------------------------------------------------
......@@ -20,7 +20,6 @@ from mongoengine.fields import (
DictField,
)
from jinja2 import Template
import six
import cachetools
# NOC modules
......@@ -32,7 +31,6 @@ from .confdbquery import ConfDBQuery
id_lock = threading.Lock()
@six.python_2_unicode_compatible
class ObjectValidationRule(EmbeddedDocument):
query = PlainReferenceField(ConfDBQuery)
query_params = DictField()
......@@ -48,7 +46,6 @@ class ObjectValidationRule(EmbeddedDocument):
@on_delete_check(check=[("sa.ManagedObjectProfile", "object_validation_policy")])
@six.python_2_unicode_compatible
class ObjectValidationPolicy(Document):
meta = {"collection": "objectvalidationpolicies", "strict": False, "auto_create_index": False}
......
......@@ -2,12 +2,11 @@
# ---------------------------------------------------------------------
# Validation Policy
# ---------------------------------------------------------------------
# Copyright (C) 2007-2019 The NOC Project
# Copyright (C) 2007-2020 The NOC Project
# See LICENSE for details
# ---------------------------------------------------------------------
# Third-party modules
import six
from mongoengine.document import Document, EmbeddedDocument
from mongoengine.fields import (
EmbeddedDocumentField,
......@@ -21,7 +20,6 @@ from mongoengine.fields import (
from .validationrule import ValidationRule
@six.python_2_unicode_compatible
class RuleItem(EmbeddedDocument):
rule = ReferenceField(ValidationRule)
is_active = BooleanField(default=True)
......@@ -30,7 +28,6 @@ class RuleItem(EmbeddedDocument):
return self.rule.name
@six.python_2_unicode_compatible
class ValidationPolicy(Document):
meta = {"collection": "noc.validationpolicy", "strict": False, "auto_create_index": False}
......
......@@ -2,12 +2,11 @@
# ---------------------------------------------------------------------
# Policy Settings
# ---------------------------------------------------------------------
# Copyright (C) 2007-2019 The NOC Project
# Copyright (C) 2007-2020 The NOC Project
# See LICENSE for details
# ---------------------------------------------------------------------
# Third-party modules
import six
from mongoengine.document import Document, EmbeddedDocument
from mongoengine.fields import (
StringField,
......@@ -21,7 +20,6 @@ from mongoengine.fields import (
from .validationpolicy import ValidationPolicy
@six.python_2_unicode_compatible
class ValidationPolicyItem(EmbeddedDocument):
policy = ReferenceField(ValidationPolicy)
is_active = BooleanField(default=True)
......@@ -30,7 +28,6 @@ class ValidationPolicyItem(EmbeddedDocument):
return self.policy.name
@six.python_2_unicode_compatible
class ValidationPolicySettings(Document):
meta = {
"collection": "noc.validationpolicysettings",
......
......@@ -2,7 +2,7 @@
# ---------------------------------------------------------------------
# Validation Rule
# ---------------------------------------------------------------------
# Copyright (C) 2007-2019 The NOC Project
# Copyright (C) 2007-2020 The NOC Project
# See LICENSE for details
# ---------------------------------------------------------------------
......@@ -10,7 +10,6 @@
import logging
# Third-party modules
import six
from mongoengine.document import Document, EmbeddedDocument
from mongoengine.fields import (
StringField,
......@@ -36,7 +35,6 @@ A_EXCLUDE = "X"
ACTIONS = [(A_DISABLE, "Disable"), (A_INCLUDE, "Include"), (A_EXCLUDE, "Exclude")]
@six.python_2_unicode_compatible
class SelectorItem(EmbeddedDocument):
selector = ForeignKeyField(ManagedObjectSelector)
action = StringField(choices=ACTIONS)
......@@ -45,7 +43,6 @@ class SelectorItem(EmbeddedDocument):
return "%s: %s" % (self.action, self.selector.name)
@six.python_2_unicode_compatible
class ObjectItem(EmbeddedDocument):
object = ForeignKeyField(ManagedObject)
action = StringField(choices=ACTIONS)
......@@ -54,7 +51,6 @@ class ObjectItem(EmbeddedDocument):
return "%s: %s" % (self.action, self.object.name)
@six.python_2_unicode_compatible
class ValidationRule(Document):
meta = {"collection": "noc.validationrules", "strict": False, "auto_create_index": False}
......
......@@ -10,9 +10,6 @@
import os
import operator
# Third-party modules
import six
# NOC modules
from .fields import BaseField
......@@ -65,7 +62,7 @@ class DictionaryMeta(object):
)
class Dictionary(six.with_metaclass(DictionaryBase)):
class Dictionary(object, metaclass=DictionaryBase):
class Meta:
name = None
layout = None
......
......@@ -9,9 +9,6 @@
# Python modules
import operator
# Third-party modules
import six
# NOC modules
from noc.core.bi.query import to_sql, escape_field
from noc.config import config
......@@ -76,7 +73,7 @@ class ModelMeta(object):
)
class Model(six.with_metaclass(ModelBase)):
class Model(object, metaclass=ModelBase):
class Meta(object):
engine = None
db_table = None
......
......@@ -11,9 +11,6 @@ import itertools
from collections import defaultdict
from functools import partial
# Third-party modules
import six
# NOC modules
from noc.core.ip import IPv4
from ..syntax.patterns import ANY, REST, BOOL, Token, BasePattern
......@@ -168,7 +165,7 @@ class BaseNormalizerMetaclass(type):
setattr(ncls, sdef.gen, ctx[sdef.gen])
class BaseNormalizer(six.with_metaclass(BaseNormalizerMetaclass, object)):
class BaseNormalizer(object, metaclass=BaseNormalizerMetaclass):
# Custom syntax to enrich ConfDB
SYNTAX = []
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment