From 5eb0f2c241718bc7462be44e5e8e1e36e35f9b15 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Tue, 13 Oct 2009 17:50:26 +0200 Subject: unified name of utils module, recently it was named util and utils in different packages --- lib/git/objects/tag.py | 2 +- lib/git/objects/util.py | 36 ------------------------------------ lib/git/objects/utils.py | 36 ++++++++++++++++++++++++++++++++++++ lib/git/refs.py | 2 +- test/git/test_base.py | 2 +- 5 files changed, 39 insertions(+), 39 deletions(-) delete mode 100644 lib/git/objects/util.py create mode 100644 lib/git/objects/utils.py diff --git a/lib/git/objects/tag.py b/lib/git/objects/tag.py index af1022f0..261d835f 100644 --- a/lib/git/objects/tag.py +++ b/lib/git/objects/tag.py @@ -8,7 +8,7 @@ Module containing all object based types. """ import base import commit -from util import get_object_type_by_name +from utils import get_object_type_by_name class TagObject(base.Object): """ diff --git a/lib/git/objects/util.py b/lib/git/objects/util.py deleted file mode 100644 index 15c1d114..00000000 --- a/lib/git/objects/util.py +++ /dev/null @@ -1,36 +0,0 @@ -# util.py -# Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors -# -# This module is part of GitPython and is released under -# the BSD License: http://www.opensource.org/licenses/bsd-license.php -""" -Module for general utility functions -""" -import commit, tag, blob, tree - -def get_object_type_by_name(object_type_name): - """ - Returns - type suitable to handle the given object type name. - Use the type to create new instances. - - ``object_type_name`` - Member of TYPES - - Raises - ValueError: In case object_type_name is unknown - """ - if object_type_name == "commit": - import commit - return commit.Commit - elif object_type_name == "tag": - import tag - return tag.TagObject - elif object_type_name == "blob": - import blob - return blob.Blob - elif object_type_name == "tree": - import tree - return tree.Tree - else: - raise ValueError("Cannot handle unknown object type: %s" % object_type_name) diff --git a/lib/git/objects/utils.py b/lib/git/objects/utils.py new file mode 100644 index 00000000..15c1d114 --- /dev/null +++ b/lib/git/objects/utils.py @@ -0,0 +1,36 @@ +# util.py +# Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors +# +# This module is part of GitPython and is released under +# the BSD License: http://www.opensource.org/licenses/bsd-license.php +""" +Module for general utility functions +""" +import commit, tag, blob, tree + +def get_object_type_by_name(object_type_name): + """ + Returns + type suitable to handle the given object type name. + Use the type to create new instances. + + ``object_type_name`` + Member of TYPES + + Raises + ValueError: In case object_type_name is unknown + """ + if object_type_name == "commit": + import commit + return commit.Commit + elif object_type_name == "tag": + import tag + return tag.TagObject + elif object_type_name == "blob": + import blob + return blob.Blob + elif object_type_name == "tree": + import tree + return tree.Tree + else: + raise ValueError("Cannot handle unknown object type: %s" % object_type_name) diff --git a/lib/git/refs.py b/lib/git/refs.py index bc5cc005..bdfff6f4 100644 --- a/lib/git/refs.py +++ b/lib/git/refs.py @@ -7,7 +7,7 @@ Module containing all ref based objects """ from objects.base import Object -from objects.util import get_object_type_by_name +from objects.utils import get_object_type_by_name from utils import LazyMixin class Ref(LazyMixin): diff --git a/test/git/test_base.py b/test/git/test_base.py index aff0947d..97dfc255 100644 --- a/test/git/test_base.py +++ b/test/git/test_base.py @@ -10,7 +10,7 @@ from git import * import git.objects.base as base import git.refs as refs from itertools import chain -from git.objects.util import get_object_type_by_name +from git.objects.utils import get_object_type_by_name class TestBase(object): -- cgit v1.2.1