From 33fc381f7df43d7257dd436891d3718af4194676 Mon Sep 17 00:00:00 2001 From: likang Date: Sat, 13 May 2017 12:06:35 +0800 Subject: [PATCH] absolute import --- voluptuous/__init__.py | 14 ++++---------- voluptuous/schema_builder.py | 6 +----- voluptuous/util.py | 11 +++-------- voluptuous/validators.py | 17 +++++------------ 4 files changed, 13 insertions(+), 35 deletions(-) diff --git a/voluptuous/__init__.py b/voluptuous/__init__.py index a3d0567..a12f11c 100644 --- a/voluptuous/__init__.py +++ b/voluptuous/__init__.py @@ -1,15 +1,9 @@ # flake8: noqa -try: - from schema_builder import * - from validators import * - from util import * - from error import * -except ImportError: - from .schema_builder import * - from .validators import * - from .util import * - from .error import * +from voluptuous.schema_builder import * +from voluptuous.validators import * +from voluptuous.util import * +from voluptuous.error import * __version__ = '0.10.5' __author__ = 'tusharmakkar08' diff --git a/voluptuous/schema_builder.py b/voluptuous/schema_builder.py index 671c99e..6e14138 100644 --- a/voluptuous/schema_builder.py +++ b/voluptuous/schema_builder.py @@ -6,11 +6,7 @@ from contextlib import contextmanager import itertools - -try: - import error as er -except ImportError: - from . import error as er +from voluptuous import error as er if sys.version_info >= (3,): long = int diff --git a/voluptuous/util.py b/voluptuous/util.py index 3a09297..434c360 100644 --- a/voluptuous/util.py +++ b/voluptuous/util.py @@ -1,13 +1,8 @@ import sys -try: - from error import LiteralInvalid, TypeInvalid, Invalid - from schema_builder import Schema, default_factory, raises - import validators -except ImportError: - from .error import LiteralInvalid, TypeInvalid, Invalid - from .schema_builder import Schema, default_factory, raises - from . import validators +from voluptuous.error import LiteralInvalid, TypeInvalid, Invalid +from voluptuous.schema_builder import Schema, default_factory, raises +from voluptuous import validators __author__ = 'tusharmakkar08' diff --git a/voluptuous/validators.py b/voluptuous/validators.py index cae7a44..d3ef548 100644 --- a/voluptuous/validators.py +++ b/voluptuous/validators.py @@ -5,18 +5,11 @@ from functools import wraps from decimal import Decimal, InvalidOperation -try: - from schema_builder import Schema, raises, message - from error import (MultipleInvalid, CoerceInvalid, TrueInvalid, FalseInvalid, BooleanInvalid, Invalid, AnyInvalid, - AllInvalid, MatchInvalid, UrlInvalid, EmailInvalid, FileInvalid, DirInvalid, RangeInvalid, - PathInvalid, ExactSequenceInvalid, LengthInvalid, DatetimeInvalid, DateInvalid, InInvalid, - TypeInvalid, NotInInvalid, ContainsInvalid) -except ImportError: - from .schema_builder import Schema, raises, message - from .error import (MultipleInvalid, CoerceInvalid, TrueInvalid, FalseInvalid, BooleanInvalid, Invalid, AnyInvalid, - AllInvalid, MatchInvalid, UrlInvalid, EmailInvalid, FileInvalid, DirInvalid, RangeInvalid, - PathInvalid, ExactSequenceInvalid, LengthInvalid, DatetimeInvalid, DateInvalid, InInvalid, - TypeInvalid, NotInInvalid, ContainsInvalid) +from voluptuous.schema_builder import Schema, raises, message +from voluptuous.error import (MultipleInvalid, CoerceInvalid, TrueInvalid, FalseInvalid, BooleanInvalid, Invalid, + AnyInvalid, AllInvalid, MatchInvalid, UrlInvalid, EmailInvalid, FileInvalid, DirInvalid, + RangeInvalid, PathInvalid, ExactSequenceInvalid, LengthInvalid, DatetimeInvalid, + DateInvalid, InInvalid, TypeInvalid, NotInInvalid, ContainsInvalid) if sys.version_info >= (3,): import urllib.parse as urlparse