From 3e5a9564546454c34cfb5fda1ac9212322fc0542 Mon Sep 17 00:00:00 2001 From: Nick Hall Date: Mon, 20 Feb 2017 18:15:25 +0000 Subject: [PATCH] Convert some imports from absolute to relative --- gramps/gen/const.py | 6 ++-- gramps/gen/datehandler/_datehandler.py | 2 +- gramps/gen/datehandler/_datestrings.py | 2 +- gramps/gen/datehandler/_grampslocale.py | 2 +- gramps/gen/db/dummydb.py | 8 ++--- gramps/gen/db/exceptions.py | 4 +-- gramps/gen/db/generic.py | 33 +++++++++---------- gramps/gen/db/utils.py | 2 +- gramps/gen/dbstate.py | 4 +-- gramps/gen/filters/_searchfilter.py | 2 -- gramps/gen/filters/rules/_changedsincebase.py | 4 +-- gramps/gen/filters/rules/_ispublic.py | 4 +-- .../gen/filters/rules/_matchesfilterbase.py | 4 +-- .../gen/filters/rules/event/_hasdayofweek.py | 10 ++---- gramps/gen/filters/rules/family/_hastwins.py | 4 +-- gramps/gen/filters/rules/note/_hastype.py | 2 +- .../filters/rules/person/_hassoundexname.py | 12 ++----- .../filters/rules/test/event_rules_test.py | 8 ++--- .../filters/rules/test/family_rules_test.py | 8 ++--- .../filters/rules/test/media_rules_test.py | 8 ++--- .../gen/filters/rules/test/note_rules_test.py | 8 ++--- .../filters/rules/test/person_rules_test.py | 8 ++--- .../filters/rules/test/place_rules_test.py | 8 ++--- .../rules/test/repository_rules_test.py | 8 ++--- gramps/gen/lib/handle.py | 4 +-- gramps/gen/lib/tableobj.py | 2 +- gramps/gen/lib/test/serialize_test.py | 4 +-- gramps/gen/merge/test/merge_ref_test.py | 8 ++--- gramps/gen/plug/_pluginreg.py | 2 +- gramps/gen/plug/docgen/paperstyle.py | 2 +- gramps/gen/plug/menu/_enumeratedlist.py | 2 +- gramps/gen/plug/report/_options.py | 2 +- gramps/gen/plug/report/_reportbase.py | 6 ++-- gramps/gen/plug/report/stdoptions.py | 11 +++---- gramps/gen/plug/utils.py | 4 +-- gramps/gen/proxy/cache.py | 2 +- gramps/gen/proxy/living.py | 2 +- gramps/gen/recentfiles.py | 2 +- gramps/gen/utils/grampslocale.py | 8 ++--- gramps/gen/utils/keyword.py | 2 +- gramps/gen/utils/test/file_test.py | 6 ++-- gramps/gen/utils/test/place_test.py | 2 +- 42 files changed, 108 insertions(+), 124 deletions(-) diff --git a/gramps/gen/const.py b/gramps/gen/const.py index 8c04a94d7..614829f71 100644 --- a/gramps/gen/const.py +++ b/gramps/gen/const.py @@ -41,9 +41,9 @@ import uuid #------------------------------------------------------------------------- from .git_revision import get_git_revision from .constfunc import get_env_var -from gramps.version import VERSION, VERSION_TUPLE, major_version -from gramps.gen.utils.resourcepath import ResourcePath -from gramps.gen.utils.grampslocale import GrampsLocale +from ..version import VERSION, VERSION_TUPLE, major_version +from .utils.resourcepath import ResourcePath +from .utils.grampslocale import GrampsLocale #------------------------------------------------------------------------- # diff --git a/gramps/gen/datehandler/_datehandler.py b/gramps/gen/datehandler/_datehandler.py index 558251e14..f1d7998b8 100644 --- a/gramps/gen/datehandler/_datehandler.py +++ b/gramps/gen/datehandler/_datehandler.py @@ -46,7 +46,7 @@ from ._dateparser import DateParser from ._datedisplay import DateDisplay, DateDisplayEn from ..constfunc import win from ..const import GRAMPS_LOCALE as glocale -from gramps.gen.utils.grampslocale import GrampsLocale +from ..utils.grampslocale import GrampsLocale #------------------------------------------------------------------------- # diff --git a/gramps/gen/datehandler/_datestrings.py b/gramps/gen/datehandler/_datestrings.py index ff0ab63b6..f819a0d0c 100644 --- a/gramps/gen/datehandler/_datestrings.py +++ b/gramps/gen/datehandler/_datestrings.py @@ -251,7 +251,7 @@ class DateStrings: if __name__ == '__main__': import sys from ..utils.grampslocale import GrampsLocale - from gramps.gen.const import GRAMPS_LOCALE as glocale + from ..const import GRAMPS_LOCALE as glocale from ._grampslocale import (_deprecated_long_months as old_long, _deprecated_short_months as old_short, _deprecated_long_days as old_days) diff --git a/gramps/gen/datehandler/_grampslocale.py b/gramps/gen/datehandler/_grampslocale.py index 439a42ef4..df59a2883 100644 --- a/gramps/gen/datehandler/_grampslocale.py +++ b/gramps/gen/datehandler/_grampslocale.py @@ -21,7 +21,7 @@ # import locale -from gramps.gen.const import GRAMPS_LOCALE as glocale +from ..const import GRAMPS_LOCALE as glocale """ Some OS environments do not support the locale.nl_langinfo() method diff --git a/gramps/gen/db/dummydb.py b/gramps/gen/db/dummydb.py index c9c561360..cdd19b759 100644 --- a/gramps/gen/db/dummydb.py +++ b/gramps/gen/db/dummydb.py @@ -63,10 +63,10 @@ from functools import wraps # Gramps libraries # #------------------------------------------------------------------------- -from gramps.gen.db.base import DbReadBase -from gramps.gen.db.dbconst import DBLOGNAME -from gramps.gen.errors import HandleError -from gramps.gen.utils.callback import Callback +from .base import DbReadBase +from .dbconst import DBLOGNAME +from ..errors import HandleError +from ..utils.callback import Callback LOG = logging.getLogger(DBLOGNAME) diff --git a/gramps/gen/db/exceptions.py b/gramps/gen/db/exceptions.py index 9307842d4..f01a9948f 100644 --- a/gramps/gen/db/exceptions.py +++ b/gramps/gen/db/exceptions.py @@ -25,8 +25,8 @@ # Gramps modules # #------------------------------------------------------------------------- -from gramps.gen.const import URL_WIKISTRING, URL_MANUAL_PAGE -from gramps.gen.const import GRAMPS_LOCALE as glocale +from ..const import URL_WIKISTRING, URL_MANUAL_PAGE +from ..const import GRAMPS_LOCALE as glocale _ = glocale.translation.gettext #------------------------------------------------------------------------- diff --git a/gramps/gen/db/generic.py b/gramps/gen/db/generic.py index 7100e8376..c29ebe342 100644 --- a/gramps/gen/db/generic.py +++ b/gramps/gen/db/generic.py @@ -41,24 +41,23 @@ import glob # Gramps Modules # #------------------------------------------------------------------------ -from gramps.gen.db import (DbReadBase, DbWriteBase, DbUndo, DBLOGNAME, - DBUNDOFN, KEY_TO_CLASS_MAP, REFERENCE_KEY, - PERSON_KEY, FAMILY_KEY, CITATION_KEY, - SOURCE_KEY, EVENT_KEY, MEDIA_KEY, - PLACE_KEY, REPOSITORY_KEY, NOTE_KEY, TAG_KEY) -from gramps.gen.errors import HandleError -from gramps.gen.utils.callback import Callback -from gramps.gen.updatecallback import UpdateCallback -from gramps.gen.db.bookmarks import DbBookmarks -from gramps.gen.db import exceptions +from . import (DbReadBase, DbWriteBase, DbUndo, DBLOGNAME, DBUNDOFN, + KEY_TO_CLASS_MAP, REFERENCE_KEY, PERSON_KEY, FAMILY_KEY, + CITATION_KEY, SOURCE_KEY, EVENT_KEY, MEDIA_KEY, PLACE_KEY, + REPOSITORY_KEY, NOTE_KEY, TAG_KEY) +from ..errors import HandleError +from ..utils.callback import Callback +from ..updatecallback import UpdateCallback +from .bookmarks import DbBookmarks +from . import exceptions -from gramps.gen.utils.id import create_id -from gramps.gen.lib.researcher import Researcher -from gramps.gen.lib import (Tag, Media, Person, Family, Source, Citation, Event, - Place, Repository, Note, NameOriginType) -from gramps.gen.lib.genderstats import GenderStats -from gramps.gen.config import config -from gramps.gen.const import GRAMPS_LOCALE as glocale +from ..utils.id import create_id +from ..lib.researcher import Researcher +from ..lib import (Tag, Media, Person, Family, Source, Citation, Event, + Place, Repository, Note, NameOriginType) +from ..lib.genderstats import GenderStats +from ..config import config +from ..const import GRAMPS_LOCALE as glocale _ = glocale.translation.gettext LOG = logging.getLogger(DBLOGNAME) diff --git a/gramps/gen/db/utils.py b/gramps/gen/db/utils.py index 9d0bff81b..10cfe7c3d 100644 --- a/gramps/gen/db/utils.py +++ b/gramps/gen/db/utils.py @@ -172,7 +172,7 @@ def __index_surname(surn_list): pa/matronymic not as they change for every generation! returns a byte string """ - from gramps.gen.lib import NameOriginType + from ..lib import NameOriginType if surn_list: surn = " ".join([x[0] for x in surn_list if not (x[3][0] in [ NameOriginType.PATRONYMIC, NameOriginType.MATRONYMIC])]) diff --git a/gramps/gen/dbstate.py b/gramps/gen/dbstate.py index 36e8af0bf..21e7e4a5b 100644 --- a/gramps/gen/dbstate.py +++ b/gramps/gen/dbstate.py @@ -42,8 +42,8 @@ from .db import DbReadBase from .proxy.proxybase import ProxyDbBase from .utils.callback import Callback from .config import config -from gramps.gen.db.dbconst import DBLOGNAME -from gramps.gen.db.dummydb import DummyDb +from .db.dbconst import DBLOGNAME +from .db.dummydb import DummyDb #------------------------------------------------------------------------- # diff --git a/gramps/gen/filters/_searchfilter.py b/gramps/gen/filters/_searchfilter.py index 348e6bcfb..6b8cc9954 100644 --- a/gramps/gen/filters/_searchfilter.py +++ b/gramps/gen/filters/_searchfilter.py @@ -22,8 +22,6 @@ Package providing filtering framework for GRAMPS. """ -from gramps.gen.constfunc import win - class SearchFilter: def __init__(self, func, text, invert): self.func = func diff --git a/gramps/gen/filters/rules/_changedsincebase.py b/gramps/gen/filters/rules/_changedsincebase.py index 8ce389497..17a86758d 100644 --- a/gramps/gen/filters/rules/_changedsincebase.py +++ b/gramps/gen/filters/rules/_changedsincebase.py @@ -33,10 +33,10 @@ import time # Gramps modules # #------------------------------------------------------------------------- +from . import Rule +from ...errors import FilterError from ...const import GRAMPS_LOCALE as glocale _ = glocale.translation.gettext -from . import Rule -from gramps.gen.errors import FilterError #------------------------------------------------------------------------- # diff --git a/gramps/gen/filters/rules/_ispublic.py b/gramps/gen/filters/rules/_ispublic.py index e2afbec6b..f06d18503 100644 --- a/gramps/gen/filters/rules/_ispublic.py +++ b/gramps/gen/filters/rules/_ispublic.py @@ -24,9 +24,9 @@ # Gramps modules # #------------------------------------------------------------------------- -from gramps.gen.const import GRAMPS_LOCALE as glocale -_ = glocale.translation.gettext from . import Rule +from ...const import GRAMPS_LOCALE as glocale +_ = glocale.translation.gettext #------------------------------------------------------------------------- # "People marked public" diff --git a/gramps/gen/filters/rules/_matchesfilterbase.py b/gramps/gen/filters/rules/_matchesfilterbase.py index bd54a8ae0..57aaa48d1 100644 --- a/gramps/gen/filters/rules/_matchesfilterbase.py +++ b/gramps/gen/filters/rules/_matchesfilterbase.py @@ -33,10 +33,10 @@ LOG = logging.getLogger(".filter") #------------------------------------------------------------------------- # we need global variableCustomFilters, so we need to query gramps.gen.filters # when we need this variable, not import it at the start! -from gramps.gen.const import GRAMPS_LOCALE as glocale -_ = glocale.translation.gettext import gramps.gen.filters from . import Rule +from ...const import GRAMPS_LOCALE as glocale +_ = glocale.translation.gettext #------------------------------------------------------------------------- # diff --git a/gramps/gen/filters/rules/event/_hasdayofweek.py b/gramps/gen/filters/rules/event/_hasdayofweek.py index 5560e7ce0..ec3555df5 100644 --- a/gramps/gen/filters/rules/event/_hasdayofweek.py +++ b/gramps/gen/filters/rules/event/_hasdayofweek.py @@ -18,20 +18,14 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # -#------------------------------------------------------------------------- -# -# Standard Python modules -# -#------------------------------------------------------------------------- -from gramps.gen.const import GRAMPS_LOCALE as glocale -_ = glocale.translation.sgettext - #------------------------------------------------------------------------- # # Gramps modules # #------------------------------------------------------------------------- from .. import Rule +from ....const import GRAMPS_LOCALE as glocale +_ = glocale.translation.gettext #------------------------------------------------------------------------- # diff --git a/gramps/gen/filters/rules/family/_hastwins.py b/gramps/gen/filters/rules/family/_hastwins.py index 5cc06db78..b1c8654e0 100644 --- a/gramps/gen/filters/rules/family/_hastwins.py +++ b/gramps/gen/filters/rules/family/_hastwins.py @@ -30,9 +30,9 @@ # #------------------------------------------------------------------------- from .. import Rule -from gramps.gen.const import GRAMPS_LOCALE as glocale -_ = glocale.translation.gettext from ....lib.childreftype import ChildRefType +from ....const import GRAMPS_LOCALE as glocale +_ = glocale.translation.gettext #------------------------------------------------------------------------- # diff --git a/gramps/gen/filters/rules/note/_hastype.py b/gramps/gen/filters/rules/note/_hastype.py index 3475b1d40..25ab96972 100644 --- a/gramps/gen/filters/rules/note/_hastype.py +++ b/gramps/gen/filters/rules/note/_hastype.py @@ -31,7 +31,7 @@ #------------------------------------------------------------------------- from ....lib.notetype import NoteType from .. import Rule -from gramps.gen.const import GRAMPS_LOCALE as glocale +from ....const import GRAMPS_LOCALE as glocale _ = glocale.translation.gettext #------------------------------------------------------------------------- diff --git a/gramps/gen/filters/rules/person/_hassoundexname.py b/gramps/gen/filters/rules/person/_hassoundexname.py index ae280dbda..9cb6ec500 100644 --- a/gramps/gen/filters/rules/person/_hassoundexname.py +++ b/gramps/gen/filters/rules/person/_hassoundexname.py @@ -18,14 +18,6 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # -#------------------------------------------------------------------------- -# -# Standard Python modules -# -#------------------------------------------------------------------------- -from ....const import GRAMPS_LOCALE as glocale -_ = glocale.translation.sgettext - #------------------------------------------------------------------------- # # Gramps modules @@ -33,7 +25,9 @@ _ = glocale.translation.sgettext #------------------------------------------------------------------------- from .. import Rule from ....lib.nameorigintype import NameOriginType -from gramps.gen.soundex import soundex +from ....soundex import soundex +from ....const import GRAMPS_LOCALE as glocale +_ = glocale.translation.sgettext #------------------------------------------------------------------------- diff --git a/gramps/gen/filters/rules/test/event_rules_test.py b/gramps/gen/filters/rules/test/event_rules_test.py index 261092d5a..56125ed7c 100644 --- a/gramps/gen/filters/rules/test/event_rules_test.py +++ b/gramps/gen/filters/rules/test/event_rules_test.py @@ -24,12 +24,12 @@ Unittest that tests event-specific filter rules import unittest import os -from gramps.gen.db.utils import import_as_dict +from ....db.utils import import_as_dict +from ....filters import GenericFilterFactory +from ....const import DATA_DIR from gramps.cli.user import User -from gramps.gen.filters import GenericFilterFactory -from gramps.gen.const import DATA_DIR -from gramps.gen.filters.rules.event import ( +from ..event import ( AllEvents, HasType, HasIdOf, HasGallery, RegExpIdOf, HasCitation, HasNote, HasNoteRegexp, HasReferenceCountOf, HasSourceCount, EventPrivate, MatchesSourceConfidence, HasAttribute, HasData, ChangedSince, HasTag, diff --git a/gramps/gen/filters/rules/test/family_rules_test.py b/gramps/gen/filters/rules/test/family_rules_test.py index 9800c755d..a5e4d7716 100644 --- a/gramps/gen/filters/rules/test/family_rules_test.py +++ b/gramps/gen/filters/rules/test/family_rules_test.py @@ -24,12 +24,12 @@ Unittest that tests family-specific filter rules import unittest import os -from gramps.gen.db.utils import import_as_dict +from ....db.utils import import_as_dict +from ....filters import GenericFilterFactory +from ....const import DATA_DIR from gramps.cli.user import User -from gramps.gen.filters import GenericFilterFactory -from gramps.gen.const import DATA_DIR -from gramps.gen.filters.rules.family import ( +from ..family import ( AllFamilies, HasRelType, HasGallery, HasIdOf, HasLDS, HasNote, RegExpIdOf, HasNoteRegexp, HasReferenceCountOf, HasSourceCount, HasSourceOf, HasCitation, FamilyPrivate, HasEvent, HasAttribute, IsBookmarked, diff --git a/gramps/gen/filters/rules/test/media_rules_test.py b/gramps/gen/filters/rules/test/media_rules_test.py index 32ef2533e..e2877c48e 100644 --- a/gramps/gen/filters/rules/test/media_rules_test.py +++ b/gramps/gen/filters/rules/test/media_rules_test.py @@ -24,12 +24,12 @@ Unittest that tests media-specific filter rules import unittest import os -from gramps.gen.db.utils import import_as_dict +from ....db.utils import import_as_dict +from ....filters import GenericFilterFactory +from ....const import DATA_DIR from gramps.cli.user import User -from gramps.gen.filters import GenericFilterFactory -from gramps.gen.const import DATA_DIR -from gramps.gen.filters.rules.media import ( +from ..media import ( AllMedia, HasIdOf, RegExpIdOf, HasCitation, HasNoteRegexp, HasNoteMatchingSubstringOf, HasReferenceCountOf, HasSourceCount, HasSourceOf, MediaPrivate, MatchesSourceConfidence, HasMedia, diff --git a/gramps/gen/filters/rules/test/note_rules_test.py b/gramps/gen/filters/rules/test/note_rules_test.py index da4e0c6c2..df06fddff 100644 --- a/gramps/gen/filters/rules/test/note_rules_test.py +++ b/gramps/gen/filters/rules/test/note_rules_test.py @@ -24,12 +24,12 @@ Unittest that tests note-specific filter rules import unittest import os -from gramps.gen.db.utils import import_as_dict +from ....db.utils import import_as_dict +from ....filters import GenericFilterFactory +from ....const import DATA_DIR from gramps.cli.user import User -from gramps.gen.filters import GenericFilterFactory -from gramps.gen.const import DATA_DIR -from gramps.gen.filters.rules.note import ( +from ..note import ( AllNotes, HasIdOf, RegExpIdOf, HasNote, MatchesRegexpOf, HasReferenceCountOf, NotePrivate, ChangedSince, HasTag, HasType) diff --git a/gramps/gen/filters/rules/test/person_rules_test.py b/gramps/gen/filters/rules/test/person_rules_test.py index f97d5bcca..eb234009f 100644 --- a/gramps/gen/filters/rules/test/person_rules_test.py +++ b/gramps/gen/filters/rules/test/person_rules_test.py @@ -24,12 +24,12 @@ Unittest that tests person-specific filter rules import unittest import os -from gramps.gen.db.utils import import_as_dict +from ....db.utils import import_as_dict +from ....filters import GenericFilter +from ....const import DATA_DIR from gramps.cli.user import User -from gramps.gen.filters import GenericFilter -from gramps.gen.const import DATA_DIR -from gramps.gen.filters.rules.person import ( +from ..person import ( Disconnected, Everyone, FamilyWithIncompleteEvent, HasAlternateName, HasCommonAncestorWith, HasNickname, HasUnknownGender, HasSourceOf, HaveAltFamilies, HaveChildren, IncompleteNames, IsBookmarked, diff --git a/gramps/gen/filters/rules/test/place_rules_test.py b/gramps/gen/filters/rules/test/place_rules_test.py index ae44d76b7..947c59c56 100644 --- a/gramps/gen/filters/rules/test/place_rules_test.py +++ b/gramps/gen/filters/rules/test/place_rules_test.py @@ -24,12 +24,12 @@ Unittest that tests place-specific filter rules import unittest import os -from gramps.gen.db.utils import import_as_dict +from ....db.utils import import_as_dict +from ....filters import GenericFilterFactory +from ....const import DATA_DIR from gramps.cli.user import User -from gramps.gen.filters import GenericFilterFactory -from gramps.gen.const import DATA_DIR -from gramps.gen.filters.rules.place import ( +from ..place import ( AllPlaces, HasCitation, HasGallery, HasIdOf, RegExpIdOf, HasNote, HasNoteRegexp, HasReferenceCountOf, HasSourceCount, HasSourceOf, PlacePrivate, MatchesSourceConfidence, HasData, HasNoLatOrLon, diff --git a/gramps/gen/filters/rules/test/repository_rules_test.py b/gramps/gen/filters/rules/test/repository_rules_test.py index 2ed6ae793..7ebeeb0bf 100644 --- a/gramps/gen/filters/rules/test/repository_rules_test.py +++ b/gramps/gen/filters/rules/test/repository_rules_test.py @@ -24,12 +24,12 @@ Unittest that tests repository-specific filter rules import unittest import os -from gramps.gen.db.utils import import_as_dict +from ....db.utils import import_as_dict +from ....filters import GenericFilterFactory +from ....const import DATA_DIR from gramps.cli.user import User -from gramps.gen.filters import GenericFilterFactory -from gramps.gen.const import DATA_DIR -from gramps.gen.filters.rules.repository import ( +from ..repository import ( AllRepos, HasIdOf, RegExpIdOf, HasNoteRegexp, HasReferenceCountOf, RepoPrivate, ChangedSince, MatchesNameSubstringOf, HasTag) diff --git a/gramps/gen/lib/handle.py b/gramps/gen/lib/handle.py index e8fbb14b6..e2fbdcb50 100644 --- a/gramps/gen/lib/handle.py +++ b/gramps/gen/lib/handle.py @@ -27,8 +27,8 @@ class HandleClass(str): @classmethod def get_schema(cls): - from gramps.gen.lib import (Person, Family, Event, Place, Source, - Media, Repository, Note, Citation, Tag) + from . import (Person, Family, Event, Place, Source, Media, Repository, + Note, Citation, Tag) tables = { "Person": Person, "Family": Family, diff --git a/gramps/gen/lib/tableobj.py b/gramps/gen/lib/tableobj.py index 373bfb9d0..c40e4da1a 100644 --- a/gramps/gen/lib/tableobj.py +++ b/gramps/gen/lib/tableobj.py @@ -37,7 +37,7 @@ import time # #------------------------------------------------------------------------- from .baseobj import BaseObject -from gramps.gen.errors import HandleError +from ..errors import HandleError #------------------------------------------------------------------------- # diff --git a/gramps/gen/lib/test/serialize_test.py b/gramps/gen/lib/test/serialize_test.py index aa644b85f..04eb1d242 100644 --- a/gramps/gen/lib/test/serialize_test.py +++ b/gramps/gen/lib/test/serialize_test.py @@ -26,9 +26,9 @@ import os from .. import (Person, Family, Event, Source, Place, Citation, Repository, Media, Note, Tag) from ..serialize import to_json, from_json -from gramps.gen.db.utils import import_as_dict +from ...db.utils import import_as_dict +from ...const import DATA_DIR from gramps.cli.user import User -from gramps.gen.const import DATA_DIR TEST_DIR = os.path.abspath(os.path.join(DATA_DIR, "tests")) EXAMPLE = os.path.join(TEST_DIR, "example.gramps") diff --git a/gramps/gen/merge/test/merge_ref_test.py b/gramps/gen/merge/test/merge_ref_test.py index c8e0520f4..c76314400 100644 --- a/gramps/gen/merge/test/merge_ref_test.py +++ b/gramps/gen/merge/test/merge_ref_test.py @@ -31,12 +31,12 @@ import copy import lxml.etree as ET from gramps.plugins.lib.libgrampsxml import GRAMPS_XML_VERSION -from gramps.gen.const import DATA_DIR, USER_PLUGINS, TEMP_DIR -from gramps.version import VERSION -from gramps.gen.lib import Name, Surname from gramps.test.test_util import Gramps from gramps.cli.user import User -from gramps.gen.const import GRAMPS_LOCALE as glocale +from ...const import DATA_DIR, USER_PLUGINS, TEMP_DIR +from ....version import VERSION +from ...lib import Name, Surname +from ...const import GRAMPS_LOCALE as glocale _ = glocale.translation.sgettext HAS_CLIMERGE = os.path.isdir(os.path.join(USER_PLUGINS, 'CliMerge')) diff --git a/gramps/gen/plug/_pluginreg.py b/gramps/gen/plug/_pluginreg.py index ec61caab9..1fd84262f 100644 --- a/gramps/gen/plug/_pluginreg.py +++ b/gramps/gen/plug/_pluginreg.py @@ -39,7 +39,7 @@ import traceback # Gramps modules # #------------------------------------------------------------------------- -from gramps.version import VERSION as GRAMPSVERSION, VERSION_TUPLE +from ...version import VERSION as GRAMPSVERSION, VERSION_TUPLE from ..const import IMAGE_DIR from ..const import GRAMPS_LOCALE as glocale _ = glocale.translation.gettext diff --git a/gramps/gen/plug/docgen/paperstyle.py b/gramps/gen/plug/docgen/paperstyle.py index 466dae6af..d291563e2 100644 --- a/gramps/gen/plug/docgen/paperstyle.py +++ b/gramps/gen/plug/docgen/paperstyle.py @@ -34,7 +34,7 @@ # Gramps modules # #------------------------------------------------------------------------- -from gramps.gen.const import GRAMPS_LOCALE as glocale +from ...const import GRAMPS_LOCALE as glocale _ = glocale.translation.sgettext #------------------------------------------------------------------------- diff --git a/gramps/gen/plug/menu/_enumeratedlist.py b/gramps/gen/plug/menu/_enumeratedlist.py index 136f5b392..be1f5718d 100644 --- a/gramps/gen/plug/menu/_enumeratedlist.py +++ b/gramps/gen/plug/menu/_enumeratedlist.py @@ -29,7 +29,7 @@ Option class representing an enumerated list of possible values. # #------------------------------------------------------------------------- from . import Option -from gramps.gen.const import GRAMPS_LOCALE as glocale +from ...const import GRAMPS_LOCALE as glocale _ = glocale.translation.sgettext #------------------------------------------------------------------------- diff --git a/gramps/gen/plug/report/_options.py b/gramps/gen/plug/report/_options.py index 1affbae70..3093153c7 100644 --- a/gramps/gen/plug/report/_options.py +++ b/gramps/gen/plug/report/_options.py @@ -64,7 +64,7 @@ from ...config import config from ..docgen import PAPER_PORTRAIT from .. import _options from .. import MenuOptions -from gramps.gen.utils.cast import get_type_converter +from ...utils.cast import get_type_converter def escxml(word): return escape(word, {'"' : '"'}) diff --git a/gramps/gen/plug/report/_reportbase.py b/gramps/gen/plug/report/_reportbase.py index 760eaabb4..239d72605 100644 --- a/gramps/gen/plug/report/_reportbase.py +++ b/gramps/gen/plug/report/_reportbase.py @@ -26,9 +26,9 @@ # Gramps modules # #------------------------------------------------------------------------- -from gramps.gen.utils.grampslocale import GrampsLocale -from gramps.gen.display.name import NameDisplay -from gramps.gen.config import config +from ...utils.grampslocale import GrampsLocale +from ...display.name import NameDisplay +from ...config import config #------------------------------------------------------------------------- # diff --git a/gramps/gen/plug/report/stdoptions.py b/gramps/gen/plug/report/stdoptions.py index 7d34bac26..879bef06e 100644 --- a/gramps/gen/plug/report/stdoptions.py +++ b/gramps/gen/plug/report/stdoptions.py @@ -28,13 +28,12 @@ Commonly used report options. Call the function, don't copy the code! # gramps modules # #------------------------------------------------------------------------- -from gramps.gen.const import GRAMPS_LOCALE as glocale +from ...config import config +from ...display.name import displayer as global_name_display +from ..menu import EnumeratedListOption, BooleanOption, NumberOption +from ...proxy import PrivateProxyDb, LivingProxyDb +from ...const import GRAMPS_LOCALE as glocale _ = glocale.translation.sgettext -from gramps.gen.config import config -from gramps.gen.display.name import displayer as global_name_display -from gramps.gen.plug.menu import (EnumeratedListOption, BooleanOption, - NumberOption) -from gramps.gen.proxy import PrivateProxyDb, LivingProxyDb # _T_ is a gramps-defined keyword -- see po/update_po.py and po/genpot.sh def _T_(value): # enable deferred translations (see Python docs 22.1.3.4) diff --git a/gramps/gen/plug/utils.py b/gramps/gen/plug/utils.py index 5750fe8e9..b2ff26bc6 100644 --- a/gramps/gen/plug/utils.py +++ b/gramps/gen/plug/utils.py @@ -47,13 +47,13 @@ LOG = logging.getLogger(".gen.plug") #------------------------------------------------------------------------- from ._pluginreg import make_environment from ..const import USER_PLUGINS -from gramps.version import VERSION_TUPLE +from ...version import VERSION_TUPLE from . import BasePluginManager from ..utils.configmanager import safe_eval from ..config import config +from ..constfunc import mac from ..const import GRAMPS_LOCALE as glocale _ = glocale.translation.sgettext -from ..constfunc import mac #------------------------------------------------------------------------- # diff --git a/gramps/gen/proxy/cache.py b/gramps/gen/proxy/cache.py index 6e72a5bde..c2a0d3447 100644 --- a/gramps/gen/proxy/cache.py +++ b/gramps/gen/proxy/cache.py @@ -22,7 +22,7 @@ Proxy class for the Gramps databases. Caches lookups from handles. """ -from gramps.gen.utils.lru import LRU +from ..utils.lru import LRU class CacheProxyDb: """ diff --git a/gramps/gen/proxy/living.py b/gramps/gen/proxy/living.py index 4dd55f87a..0827f5c2a 100644 --- a/gramps/gen/proxy/living.py +++ b/gramps/gen/proxy/living.py @@ -33,7 +33,7 @@ from ..lib import (Date, Person, Name, Surname, NameOriginType, Family, Source, Citation, Event, Media, Place, Repository, Note, Tag) from ..utils.alive import probably_alive from ..config import config -from gramps.gen.const import GRAMPS_LOCALE as glocale +from ..const import GRAMPS_LOCALE as glocale #------------------------------------------------------------------------- # diff --git a/gramps/gen/recentfiles.py b/gramps/gen/recentfiles.py index bfdc0f28f..3ce3aa2e8 100644 --- a/gramps/gen/recentfiles.py +++ b/gramps/gen/recentfiles.py @@ -37,7 +37,7 @@ try: except ImportError: USE_LOCK = False -from gramps.gen.const import HOME_DIR, GRAMPS_LOCALE as glocale +from .const import HOME_DIR, GRAMPS_LOCALE as glocale _ = glocale.translation.gettext #------------------------------------------------------------------------- diff --git a/gramps/gen/utils/grampslocale.py b/gramps/gen/utils/grampslocale.py index 95e04238f..c86e0fefb 100644 --- a/gramps/gen/utils/grampslocale.py +++ b/gramps/gen/utils/grampslocale.py @@ -654,13 +654,13 @@ class GrampsLocale: if self._dd: return self._dd - from gramps.gen.config import config + from ..config import config try: val = config.get('preferences.date-format') except AttributeError: val = 0; - from gramps.gen.datehandler import LANG_TO_DISPLAY as displayers + from ..datehandler import LANG_TO_DISPLAY as displayers _first = self._GrampsLocale__first_instance if self.calendar in displayers: self._dd = displayers[self.calendar](val) @@ -688,7 +688,7 @@ class GrampsLocale: if self._dp: return self._dp - from gramps.gen.datehandler import LANG_TO_PARSER as parsers + from ..datehandler import LANG_TO_PARSER as parsers _first = self._GrampsLocale__first_instance if self.calendar in parsers: self._dp = parsers[self.calendar]() @@ -904,7 +904,7 @@ class GrampsLocale: :returns: The name as text in the proper language. :rtype: unicode """ - from gramps.gen.lib.grampstype import GrampsType + from ..lib.grampstype import GrampsType return GrampsType.xml_str(name) def format(self, format, val, grouping=False, monetary=False): diff --git a/gramps/gen/utils/keyword.py b/gramps/gen/utils/keyword.py index c294cb061..9eaccaa7b 100644 --- a/gramps/gen/utils/keyword.py +++ b/gramps/gen/utils/keyword.py @@ -48,7 +48,7 @@ Keyword translation interface # 'n' : nickname = nick name # 'g' : familynick = family nick name -from gramps.gen.const import GRAMPS_LOCALE as glocale +from ..const import GRAMPS_LOCALE as glocale _ = glocale.translation.gettext KEYWORDS = [("title", "t", _("Person|Title"), _("Person|TITLE")), diff --git a/gramps/gen/utils/test/file_test.py b/gramps/gen/utils/test/file_test.py index e405df051..5dfb0d055 100644 --- a/gramps/gen/utils/test/file_test.py +++ b/gramps/gen/utils/test/file_test.py @@ -38,9 +38,9 @@ import unittest # Gramps modules # #------------------------------------------------------------------------- -from gramps.gen.const import TEMP_DIR, USER_HOME, USER_PLUGINS, VERSION -from gramps.gen.utils.file import media_path, get_empty_tempdir -from gramps.gen.db.utils import make_database +from ...const import TEMP_DIR, USER_HOME, USER_PLUGINS, VERSION +from ...utils.file import media_path, get_empty_tempdir +from ...db.utils import make_database #------------------------------------------------------------------------- # diff --git a/gramps/gen/utils/test/place_test.py b/gramps/gen/utils/test/place_test.py index 17f978499..f59043afc 100644 --- a/gramps/gen/utils/test/place_test.py +++ b/gramps/gen/utils/test/place_test.py @@ -34,7 +34,7 @@ import math # Gramps modules # #------------------------------------------------------------------------- -from gramps.gen.utils.place import conv_lat_lon +from ..place import conv_lat_lon #------------------------------------------------------------------------- #