diff options
author | Guido Günther <agx@sigxcpu.org> | 2016-09-09 10:41:19 +0200 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2016-09-12 08:52:07 +0200 |
commit | d1c163401153329363a010373cb512f8e59ef1e2 (patch) | |
tree | 4360253804301e13b626a47d3ee9b7740dc9fbec /gbp/git | |
parent | f7db3b77c491e5f76f441a1155aa87b1e5dedde6 (diff) |
pep8/pyflakes cleanups
Diffstat (limited to 'gbp/git')
-rw-r--r-- | gbp/git/__init__.py | 15 | ||||
-rw-r--r-- | gbp/git/args.py | 2 | ||||
-rw-r--r-- | gbp/git/commit.py | 3 | ||||
-rw-r--r-- | gbp/git/errors.py | 2 | ||||
-rw-r--r-- | gbp/git/fastimport.py | 5 | ||||
-rw-r--r-- | gbp/git/modifier.py | 14 | ||||
-rw-r--r-- | gbp/git/vfs.py | 3 |
7 files changed, 24 insertions, 20 deletions
diff --git a/gbp/git/__init__.py b/gbp/git/__init__.py index 81e1422d..5e5240df 100644 --- a/gbp/git/__init__.py +++ b/gbp/git/__init__.py @@ -19,13 +19,14 @@ import calendar import dateutil.parser -from gbp.git.modifier import GitModifier -from gbp.git.commit import GitCommit -from gbp.git.errors import GitError -from gbp.git.repository import GitRepository, GitRepositoryError -from gbp.git.fastimport import FastImport -from gbp.git.args import GitArgs -from gbp.git.vfs import GitVfs +from gbp.git.modifier import GitModifier # noqa: F401 +from gbp.git.commit import GitCommit # noqa: F401 +from gbp.git.errors import GitError # noqa: F401 +from gbp.git.repository import ( # noqa: F401 + GitRepository, GitRepositoryError) +from gbp.git.fastimport import FastImport # noqa: F401 +from gbp.git.args import GitArgs # noqa: F401 +from gbp.git.vfs import GitVfs # noqa: F401 def rfc822_date_to_git(rfc822_date): diff --git a/gbp/git/args.py b/gbp/git/args.py index 197097f4..95e50116 100644 --- a/gbp/git/args.py +++ b/gbp/git/args.py @@ -21,6 +21,7 @@ Git command argument handling helpers import six import collections + class GitArgs(object): """ Handle arguments to git commands @@ -106,4 +107,3 @@ class GitArgs(object): else: self.add(noopt) return self - diff --git a/gbp/git/commit.py b/gbp/git/commit.py index cfc5d0c7..1a9912f8 100644 --- a/gbp/git/commit.py +++ b/gbp/git/commit.py @@ -18,7 +18,6 @@ import re -from gbp.git.errors import GitError class GitCommit(object): """A git commit""" @@ -44,5 +43,3 @@ class GitCommit(object): @rtype: C{bool} """ return True if GitCommit.sha1_re.match(value) else False - - diff --git a/gbp/git/errors.py b/gbp/git/errors.py index 47122b8e..377e468a 100644 --- a/gbp/git/errors.py +++ b/gbp/git/errors.py @@ -16,7 +16,7 @@ # <http://www.gnu.org/licenses/> """Git base error exception""" + class GitError(Exception): """Exception thrown by Git related classes""" pass - diff --git a/gbp/git/fastimport.py b/gbp/git/fastimport.py index 1195fee6..f5a6b678 100644 --- a/gbp/git/fastimport.py +++ b/gbp/git/fastimport.py @@ -21,12 +21,13 @@ import subprocess import time from gbp.errors import GbpError + class FastImport(object): """Add data to a git repository using I{git fast-import}""" _bufsize = 1024 m_regular = 644 - m_exec = 755 + m_exec = 755 m_symlink = 120000 def __init__(self, repo): @@ -36,7 +37,7 @@ class FastImport(object): """ self._repo = repo try: - self._fi = subprocess.Popen([ 'git', 'fast-import', '--quiet'], + self._fi = subprocess.Popen(['git', 'fast-import', '--quiet'], stdin=subprocess.PIPE, cwd=repo.path) self._out = self._fi.stdin except OSError as err: diff --git a/gbp/git/modifier.py b/gbp/git/modifier.py index 847c4e6d..cb8bec19 100644 --- a/gbp/git/modifier.py +++ b/gbp/git/modifier.py @@ -21,14 +21,17 @@ like committing changes or authoring a patch """ import six -import calendar, datetime +import calendar +import datetime from gbp.git.errors import GitError + class GitModifierError(GitError): """Exception thrown by L{GitModifier}""" pass + class GitTz(datetime.tzinfo): """Simple class to store the utc offset only""" def __init__(self, offset_sec=0, *args, **kwargs): @@ -41,6 +44,7 @@ class GitTz(datetime.tzinfo): def dst(self, dt): return datetime.timedelta(0) + class GitModifier(object): """Stores authorship/committer information""" def __init__(self, name=None, email=None, date=None): @@ -64,16 +68,16 @@ class GitModifier(object): timestamp, offset = date.split() offset_h = int(offset[:-2]) offset_m = int(offset[-2:]) - tz = GitTz(offset_h*3600 + offset_m*60) + tz = GitTz(offset_h * 3600 + offset_m * 60) self._date = datetime.datetime.fromtimestamp(int(timestamp), tz) - elif type(date) in [ type(0), type(0.0) ]: + elif type(date) in [type(0), type(0.0)]: self._date = datetime.datetime.fromtimestamp(date, tz) elif isinstance(date, datetime.datetime): if date.tzinfo: self._date = date else: self._date = date.replace(tzinfo=tz) - elif date != None: + elif date is not None: raise ValueError("Date '%s' not timestamp, " "datetime object or git raw date" % date) @@ -154,7 +158,7 @@ class GitModifier(object): @staticmethod def keys(): - return [ 'name', 'email', 'date' ] + return ['name', 'email', 'date'] def items(self): items = [] diff --git a/gbp/git/vfs.py b/gbp/git/vfs.py index b34e5736..191cf621 100644 --- a/gbp/git/vfs.py +++ b/gbp/git/vfs.py @@ -17,7 +17,8 @@ """Make blobs in a git repository accessible as file like objects""" from six import StringIO -from gbp.git.repository import GitRepositoryError +from gbp.git.repository import GitRepositoryError + class GitVfs(object): |