diff options
author | Sebastian Thiel <byronimo@gmail.com> | 2015-01-04 19:50:28 +0100 |
---|---|---|
committer | Sebastian Thiel <byronimo@gmail.com> | 2015-01-04 19:50:28 +0100 |
commit | ae2ff0f9d704dc776a1934f72a339da206a9fff4 (patch) | |
tree | 53b7cb30f47c60bdf38d824f1c729191d1f1f2d9 /git/config.py | |
parent | f6aa8d116eb33293c0a9d6d600eb7c32832758b9 (diff) | |
download | gitpython-ae2ff0f9d704dc776a1934f72a339da206a9fff4.tar.gz |
Dum brute force conversion of all types.
However, StringIO really is ByteIO in most cases, and py2.7 should
run but doesn't.
This should be made work first.
Diffstat (limited to 'git/config.py')
-rw-r--r-- | git/config.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/git/config.py b/git/config.py index 685dbed8..34fe290b 100644 --- a/git/config.py +++ b/git/config.py @@ -17,6 +17,10 @@ import logging from git.odict import OrderedDict from git.util import LockFile +from git.compat import ( + string_types, + FileType +) __all__ = ('GitConfigParser', 'SectionConstraint') @@ -175,7 +179,7 @@ class GitConfigParser(cp.RawConfigParser, object): "Write-ConfigParsers can operate on a single file only, multiple files have been passed") # END single file check - if not isinstance(file_or_files, basestring): + if not isinstance(file_or_files, string_types): file_or_files = file_or_files.name # END get filename from handle/stream # initialize lock base - we want to write @@ -333,7 +337,7 @@ class GitConfigParser(cp.RawConfigParser, object): close_fp = False # we have a physical file on disk, so get a lock - if isinstance(fp, (basestring, file)): + if isinstance(fp, string_types + (FileType, )): self._lock._obtain_lock() # END get lock for physical files @@ -391,7 +395,7 @@ class GitConfigParser(cp.RawConfigParser, object): return default raise - types = (long, float) + types = (int, float) for numtype in types: try: val = numtype(valuestr) @@ -412,7 +416,7 @@ class GitConfigParser(cp.RawConfigParser, object): if vl == 'true': return True - if not isinstance(valuestr, basestring): + if not isinstance(valuestr, string_types): raise TypeError("Invalid value type: only int, long, float and str are allowed", valuestr) return valuestr |