summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiana Picus <diana.picus@linaro.org>2016-09-15 12:57:16 +0300
committerDiana Picus <diana.picus@linaro.org>2016-09-15 13:24:43 +0300
commitf65d8db32e92b9e9de2922e7c0e4548d3d15d25a (patch)
treeeb9936b25c8bf9e41d1f20c5b96be301e7164574
parent9b6ce2d1dbb05ed01db4d7f5d40586a560ae289f (diff)
Run autopep8 on the first level of --aggressive
-rw-r--r--linaropy/git/clone.py6
-rw-r--r--linaropy/git/gitrepo.py4
-rw-r--r--linaropy/git/workdir.py3
-rw-r--r--linaropy/handle_exit.py2
-rw-r--r--linaropy/rn/linaroseries.py37
-rw-r--r--linaropy/rn/rnseries.py3
-rw-r--r--linaropy/series.py36
7 files changed, 49 insertions, 42 deletions
diff --git a/linaropy/git/clone.py b/linaropy/git/clone.py
index 5511f0e..535bfbe 100644
--- a/linaropy/git/clone.py
+++ b/linaropy/git/clone.py
@@ -28,7 +28,8 @@ class Clone(GitRepo):
# gcc, which take 20 minutes to clone.
# Clone a new repo from the remote
- if clonedir is None or (isinstance(clonedir, basestring) and clonedir == ""):
+ if clonedir is None or (isinstance(
+ clonedir, basestring) and clonedir == ""):
if remote == "" or remote is None:
raise TypeError(
'Clone input parameter \'remote\' can not be empty')
@@ -97,7 +98,8 @@ class Clone(GitRepo):
return self.repodir
def __repr__(self):
- return "<Clone Class: remote = " + self.remote + ", clonedir =" + self.repodir + ">"
+ return "<Clone Class: remote = " + self.remote + \
+ ", clonedir =" + self.repodir + ">"
class TestClone(unittest.TestCase):
diff --git a/linaropy/git/gitrepo.py b/linaropy/git/gitrepo.py
index dc94ea1..667c8a9 100644
--- a/linaropy/git/gitrepo.py
+++ b/linaropy/git/gitrepo.py
@@ -84,7 +84,7 @@ class GitRepo(object):
try:
# TODO This is a nop as it is.
- git("rev-parse", "--verify", branch)
+ git("rev-parse", "--verify", branch)
# if the branch exists the previous statement won't cause an
# exception so we know we can just check it out.
git("checkout", branch)
@@ -105,7 +105,7 @@ class GitRepo(object):
# so don't stash apply.
if stashid != "":
git("stash", "apply", stashid)
- except ErrorReturnCode, exc:
+ except ErrorReturnCode as exc:
raise EnvironmentError(
"Unable to return to the previous branch: %s" % exc.stderr)
diff --git a/linaropy/git/workdir.py b/linaropy/git/workdir.py
index db125e4..b9257ab 100644
--- a/linaropy/git/workdir.py
+++ b/linaropy/git/workdir.py
@@ -25,7 +25,8 @@ class Workdir(GitRepo):
# in 'track'.
# @ branchname - the name of the local branch
- def __init__(self, proj, clone=None, workdir="", track=None, branchname=""):
+ def __init__(self, proj, clone=None, workdir="",
+ track=None, branchname=""):
super(Workdir, self).__init__(proj)
# TODO: The Clone can be in a different project dir than proj. if
diff --git a/linaropy/handle_exit.py b/linaropy/handle_exit.py
index 7eb4ae1..995d884 100644
--- a/linaropy/handle_exit.py
+++ b/linaropy/handle_exit.py
@@ -51,7 +51,7 @@ def handle_exit(callback=None, append=False):
yield
except KeyboardInterrupt:
pass
- except SystemExit, err:
+ except SystemExit as err:
# code != 0 refers to an application error (e.g. explicit
# sys.exit('some error') call).
# We don't want that to pass silently.
diff --git a/linaropy/rn/linaroseries.py b/linaropy/rn/linaroseries.py
index e798f5c..ef010ad 100644
--- a/linaropy/rn/linaroseries.py
+++ b/linaropy/rn/linaroseries.py
@@ -36,7 +36,8 @@ from ..series import series_from_tag
class LinaroSeries(Series):
- def __init__(self, seriestype, vendor=None, package=None, date=datetime.today(), spin=None, rc=None, strict=True):
+ def __init__(self, seriestype, vendor=None, package=None,
+ date=datetime.today(), spin=None, rc=None, strict=True):
# This is a dispatch table so that we can use a 'toNext' function based
# on an input type and it will call the correct toNextFoo function.
@@ -189,7 +190,7 @@ class TestLinaroSeries(unittest.TestCase):
def test_candidate_to_candidate(self):
candidate = LinaroSeries(
- "candidate", package="GCC-5.3.1", date=datetime(2016, 05, 15), spin="1", rc="1")
+ "candidate", package="GCC-5.3.1", date=datetime(2016, 0o5, 15), spin="1", rc="1")
candidate2 = candidate.toNextCandidate()
self.assertEqual(candidate2.branchname(),
"releases/linaro-5.3-2016.05-1-rc2")
@@ -202,7 +203,7 @@ class TestLinaroSeries(unittest.TestCase):
def test_release_to_candidate(self):
# Test where spin is None and needs to be incremented.
release = LinaroSeries(
- "release", package="GCC-5.3.1", date=datetime(2016, 05, 15))
+ "release", package="GCC-5.3.1", date=datetime(2016, 0o5, 15))
candidate = release.toNextCandidate()
self.assertEqual(candidate.branchname(),
"releases/linaro-5.3-2016.05-1-rc1")
@@ -212,7 +213,7 @@ class TestLinaroSeries(unittest.TestCase):
# Now test where spin is already non-zero.
release2 = LinaroSeries(
- "release", package="GCC-5.3.1", date=datetime(2016, 05, 15), spin="1")
+ "release", package="GCC-5.3.1", date=datetime(2016, 0o5, 15), spin="1")
candidate2 = release2.toNextCandidate()
self.assertEqual(candidate2.branchname(),
"releases/linaro-5.3-2016.05-2-rc1")
@@ -223,7 +224,7 @@ class TestLinaroSeries(unittest.TestCase):
def test_snapshot_to_candidate(self):
snapshot = LinaroSeries(
- "snapshot", package="GCC-5.3.1", date=datetime(2016, 05, 15), spin="6")
+ "snapshot", package="GCC-5.3.1", date=datetime(2016, 0o5, 15), spin="6")
candidate = snapshot.toNextCandidate()
self.assertEqual(candidate.branchname(),
"releases/linaro-5.3-2016.06-rc1")
@@ -265,7 +266,7 @@ class TestLinaroSeries(unittest.TestCase):
def test_unknown_to_candidate(self):
unknown = LinaroSeries(
- "candidate", package="GCC-5.3.1", date=datetime(2016, 05, 15), spin="1", rc="1")
+ "candidate", package="GCC-5.3.1", date=datetime(2016, 0o5, 15), spin="1", rc="1")
# Purposely override with an incorrect seriestype.
unknown.seriestype = 99
with self.assertRaises(IndexError):
@@ -273,7 +274,7 @@ class TestLinaroSeries(unittest.TestCase):
def test_candidate_to_release(self):
candidate = LinaroSeries(
- "candidate", package="GCC-5.3.1", date=datetime(2016, 05, 15), spin="1", rc="1")
+ "candidate", package="GCC-5.3.1", date=datetime(2016, 0o5, 15), spin="1", rc="1")
release = candidate.toNextRelease()
self.assertEqual(release.branchname(), "releases/linaro-5.3-2016.05-1")
self.assertEqual(release.seriestype, Series.series.index("release"))
@@ -302,19 +303,19 @@ class TestLinaroSeries(unittest.TestCase):
def test_snapshot_to_release(self):
snapshot = LinaroSeries(
- "snapshot", package="GCC-5.3.1", date=datetime(2016, 05, 15), spin="6")
+ "snapshot", package="GCC-5.3.1", date=datetime(2016, 0o5, 15), spin="6")
with self.assertRaises(TypeError):
release = snapshot.toNextRelease()
def test_release_to_release(self):
release = LinaroSeries(
- "release", package="GCC-5.3.1", date=datetime(2016, 05, 15), spin="6")
+ "release", package="GCC-5.3.1", date=datetime(2016, 0o5, 15), spin="6")
with self.assertRaises(TypeError):
release2 = release.toNextRelease()
def test_unknown_to_release(self):
unknown = LinaroSeries(
- "release", package="GCC-5.3.1", date=datetime(2016, 05, 15), spin="1")
+ "release", package="GCC-5.3.1", date=datetime(2016, 0o5, 15), spin="1")
# Purposely override with an incorrect seriestype.
unknown.seriestype = 99
with self.assertRaises(IndexError):
@@ -322,7 +323,7 @@ class TestLinaroSeries(unittest.TestCase):
def test_candidate_to_snapshot(self):
candidate = LinaroSeries(
- "candidate", package="GCC-5.3.1", date=datetime(2016, 05, 15), spin="1", rc="1")
+ "candidate", package="GCC-5.3.1", date=datetime(2016, 0o5, 15), spin="1", rc="1")
with self.assertRaises(TypeError):
snapshot = candidate.toNextSnapshot()
# This would/should be the case if this wasn't and invalid option.
@@ -330,13 +331,13 @@ class TestLinaroSeries(unittest.TestCase):
def test_release_to_snapshot(self):
release = LinaroSeries(
- "release", package="GCC-5.3.1", date=datetime(2016, 05, 15), spin="1")
+ "release", package="GCC-5.3.1", date=datetime(2016, 0o5, 15), spin="1")
with self.assertRaises(TypeError):
snapshot = release.toNextSnapshot()
def test_snapshot_to_snapshot(self):
snapshot = LinaroSeries(
- "snapshot", package="GCC-5.3.1", date=datetime(2016, 05, 15), spin="6")
+ "snapshot", package="GCC-5.3.1", date=datetime(2016, 0o5, 15), spin="6")
snapshot2 = snapshot.toNextSnapshot()
self.assertEqual(snapshot2.branchname(),
@@ -374,7 +375,7 @@ class TestLinaroSeries(unittest.TestCase):
def test_unknown_to_snapshot(self):
unknown = LinaroSeries(
- "snapshot", package="GCC-5.3.1", date=datetime(2016, 05, 15), spin="1")
+ "snapshot", package="GCC-5.3.1", date=datetime(2016, 0o5, 15), spin="1")
# Purposely override with an incorrect seriestype.
unknown.seriestype = 99
with self.assertRaises(IndexError):
@@ -382,7 +383,7 @@ class TestLinaroSeries(unittest.TestCase):
def test_snapshot_toNext(self):
snapshot = LinaroSeries(
- "snapshot", package="GCC-5.3.1", date=datetime(2016, 05, 15), spin="1")
+ "snapshot", package="GCC-5.3.1", date=datetime(2016, 0o5, 15), spin="1")
self.assertEqual(snapshot.branchname(),
"snapshots/linaro-5.3-2016.05-1")
@@ -409,7 +410,7 @@ class TestLinaroSeries(unittest.TestCase):
def test_toNext_incorrect_keys(self):
snapshot = LinaroSeries(
- "snapshot", package="GCC-5.3.1", date=datetime(2016, 05, 15), spin="1")
+ "snapshot", package="GCC-5.3.1", date=datetime(2016, 0o5, 15), spin="1")
self.assertEqual(snapshot.branchname(),
"snapshots/linaro-5.3-2016.05-1")
with self.assertRaises(KeyError):
@@ -424,7 +425,7 @@ class TestLinaroSeries(unittest.TestCase):
# new instances and not references to the input Series.
def test_toNextFOO_return_new_objects(self):
candidate = LinaroSeries(
- "candidate", package="GCC-5.3.1", date=datetime(2016, 05, 15), spin="1", rc="1")
+ "candidate", package="GCC-5.3.1", date=datetime(2016, 0o5, 15), spin="1", rc="1")
candidate2 = candidate.toNext("candidate")
release = candidate.toNext("release")
@@ -432,7 +433,7 @@ class TestLinaroSeries(unittest.TestCase):
self.assertIsNot(candidate, release)
snapshot = LinaroSeries(
- "snapshot", package="GCC-5.3.1", date=datetime(2016, 05, 15), spin="1")
+ "snapshot", package="GCC-5.3.1", date=datetime(2016, 0o5, 15), spin="1")
snapshot2 = snapshot.toNext("snapshot")
self.assertIsNot(snapshot, snapshot2)
diff --git a/linaropy/rn/rnseries.py b/linaropy/rn/rnseries.py
index 3b6769a..6b69279 100644
--- a/linaropy/rn/rnseries.py
+++ b/linaropy/rn/rnseries.py
@@ -31,7 +31,8 @@ class RNSeries(object):
# @track_series - an instance of a LinaroSeries to track.
# @next_series - an instance of a LinaroSeries that is the next series.
- def __init__(self, proj, rnrepo=None, track_series=None, next_series=None, headless=False):
+ def __init__(self, proj, rnrepo=None, track_series=None,
+ next_series=None, headless=False):
self.proj = proj
# Create the release-notes repository clone. The Clone constructor
# will throw an exception if proj is not a Proj. That is an
diff --git a/linaropy/series.py b/linaropy/series.py
index ca0a11b..c524352 100644
--- a/linaropy/series.py
+++ b/linaropy/series.py
@@ -35,7 +35,8 @@ class Series(object):
# @ rc - Optional Rc, str, or int
# This will make sure snapshot doesn't have an rc and release doesn't have
# an rc for instance.
- def __init__(self, seriestype, vendor=None, package=None, date=datetime.today(), spin=None, rc=None, strict=True):
+ def __init__(self, seriestype, vendor=None, package=None,
+ date=datetime.today(), spin=None, rc=None, strict=True):
"""
Create a Series to store the details on a package release, snapshot,
or release-candidate.
@@ -132,7 +133,8 @@ class Series(object):
if self.rc.val != 0:
raise ValueError('A release series cannot have an rc.')
- if self.seriestype == Series.series.index("candidate") and self.rc.val is 0:
+ if self.seriestype == Series.series.index(
+ "candidate") and self.rc.val is 0:
raise TypeError('A candidate series must have an rc specified.')
# We need an OrderedDict because we want to parse/capture -%X and .%X
@@ -454,13 +456,13 @@ def series_from_branchname(branch=None):
# if there is no spin but there is an 'rcX' in the spin key:value pair
# it means that there's really no spin but should be in the rc key:value
# pair.
- if dictionary.has_key("spin") and "rc" in dictionary["spin"]:
+ if "spin" in dictionary and "rc" in dictionary["spin"]:
dictionary["rc"] = dictionary["spin"]
dictionary.pop("spin", None)
# We need to have None fields in the missing keys for when we call the
# Series constructor.
- if not dictionary.has_key("rc"):
+ if "rc" not in dictionary:
dictionary["rc"] = None
else:
# strip the "rc" and just leave the int.
@@ -472,7 +474,7 @@ def series_from_branchname(branch=None):
# We need to have None fields in the missing keys for when we call the
# Series constructor.
- if not dictionary.has_key("spin"):
+ if "spin" not in dictionary:
dictionary["spin"] = None
else:
if not dictionary["spin"].isnumeric():
@@ -483,7 +485,7 @@ def series_from_branchname(branch=None):
datekeys = ['year', 'month', 'day']
datevalues = dictionary["date"].split('.')
datefields = dict(zip(datekeys, datevalues))
- if not datefields.has_key("day"):
+ if "day" not in datefields:
datefields["day"] = "15"
seriesdate = datetime(int(datefields["year"]), int(
datefields["month"]), int(datefields["day"]))
@@ -730,21 +732,21 @@ class TestSeries(unittest.TestCase):
def test_getbranchname(self):
candidate = Series("candidate", package="GCC-5.3.1",
- date=datetime(2016, 05, 15), spin="1", rc="1")
+ date=datetime(2016, 0o5, 15), spin="1", rc="1")
self.assertEqual(candidate.branchname(),
"releases/linaro-5.3-2016.05-1-rc1")
release = Series("release", package="GCC-5.3.1",
- date=datetime(2016, 05, 15), spin="1", rc=None)
+ date=datetime(2016, 0o5, 15), spin="1", rc=None)
self.assertEqual(release.branchname(), "releases/linaro-5.3-2016.05-1")
def test_date_string(self):
candidate = Series("candidate", package="GCC-5.3.1",
date="2016.05.27", spin="1", rc="1")
- self.assertEqual(datetime(2016, 05, 15), candidate.date)
+ self.assertEqual(datetime(2016, 0o5, 15), candidate.date)
candidate2 = Series("candidate", package="GCC-5.3.1",
date="2016.05", spin="1", rc="1")
- self.assertEqual(datetime(2016, 05, 15), candidate2.date)
+ self.assertEqual(datetime(2016, 0o5, 15), candidate2.date)
with self.assertRaises(TypeError):
candidate3 = Series("candidate", package="GCC-5.3.1",
@@ -753,33 +755,33 @@ class TestSeries(unittest.TestCase):
def test_series_strict_true(self):
with self.assertRaises(ValueError):
snapshot = Series("snapshot", package="GCC-5.3.1",
- date=datetime(2016, 05, 15), spin="1", rc="1", strict=True)
+ date=datetime(2016, 0o5, 15), spin="1", rc="1", strict=True)
with self.assertRaises(ValueError):
snapshot = Series("snapshot", package="GCC-5.3.1",
- date=datetime(2016, 05, 15), spin="1", rc="1")
+ date=datetime(2016, 0o5, 15), spin="1", rc="1")
with self.assertRaises(ValueError):
release = Series("release", package="GCC-5.3.1",
- date=datetime(2016, 05, 15), spin="1", rc="1", strict=True)
+ date=datetime(2016, 0o5, 15), spin="1", rc="1", strict=True)
with self.assertRaises(ValueError):
release = Series("release", package="GCC-5.3.1",
- date=datetime(2016, 05, 15), spin="1", rc="1")
+ date=datetime(2016, 0o5, 15), spin="1", rc="1")
def test_series_strict_false(self):
snapshot = Series("snapshot", package="GCC-5.3.1",
- date=datetime(2016, 05, 15), spin="6", rc="1", strict=False)
+ date=datetime(2016, 0o5, 15), spin="6", rc="1", strict=False)
self.assertEqual(snapshot.branchname(),
"snapshots/linaro-5.3-2016.05-6-rc1")
release = Series("release", package="GCC-5.3.1",
- date=datetime(2016, 05, 15), spin="1", rc="1", strict=False)
+ date=datetime(2016, 0o5, 15), spin="1", rc="1", strict=False)
self.assertEqual(release.branchname(),
"releases/linaro-5.3-2016.05-1-rc1")
release = Series("release", package="GCC-5.3.1",
- date=datetime(2016, 05, 15), rc="1", strict=False)
+ date=datetime(2016, 0o5, 15), rc="1", strict=False)
self.assertEqual(release.branchname(),
"releases/linaro-5.3-2016.05-rc1")