Commit 9106fb29 authored by Loïc Dachary's avatar Loïc Dachary
Browse files

main: do not provide argv to constructors



It is not needed and the use case for which it was planned can be
better implemented otherwise.
Signed-off-by: Loïc Dachary's avatarLoic Dachary <loic@dachary.org>
parent 770e1638
......@@ -237,4 +237,4 @@ class CephWorkbench(object):
level = logging.INFO
logging.getLogger('ceph_workbench').setLevel(level)
return self.args.func(self.args, argv).run()
return self.args.func(self.args).run()
......@@ -27,9 +27,9 @@ import tempfile
class WBBackport(object):
def __init__(self, args, argv):
def __init__(self, args):
self.args = args
self.xref = wbxref.WBXref(args, argv)
self.xref = wbxref.WBXref(args)
if self.args.backport_wiki:
self.wiki_directory = self.args.backport_wiki
else:
......@@ -61,7 +61,7 @@ class WBBackport(object):
@staticmethod
def factory(argv):
return WBBackport(WBBackport.get_parser().parse_args(argv), argv)
return WBBackport(WBBackport.get_parser().parse_args(argv))
def display_merge_ids(self, merge_ids, prefix, f):
for merge_id in merge_ids:
......
......@@ -44,7 +44,7 @@ class WBBackportCreateIssue(wbredmine.WBRedmine):
@staticmethod
def factory(argv):
return WBBackportCreateIssue(
WBBackportCreateIssue.get_parser().parse_args(argv), argv)
WBBackportCreateIssue.get_parser().parse_args(argv))
def run(self):
self.open().index()
......
......@@ -31,11 +31,11 @@ log = logging.getLogger(__name__)
class WBBackportSetRelease(object):
def __init__(self, args, argv):
def __init__(self, args):
self.args = args
self.git = wbgit.WBRepo(args)
self.github = wbgithub.WBGitHub(args)
self.redmine = wbredmine.WBRedmine(args, argv)
self.redmine = wbredmine.WBRedmine(args)
def open(self):
self.git.open().index()
......@@ -77,7 +77,7 @@ class WBBackportSetRelease(object):
@staticmethod
def factory(argv):
return WBBackportSetRelease(
WBBackportSetRelease.get_parser().parse_args(argv), argv)
WBBackportSetRelease.get_parser().parse_args(argv))
def run(self):
self.set_defaults()
......
......@@ -35,9 +35,8 @@ class WBRedmine(object):
pending_backport = 'Pending Backport'
def __init__(self, args, argv):
def __init__(self, args):
self.args = args
self.argv = argv
self.issues = {}
self.status2status_id = {}
self.version2version_id = {}
......@@ -141,7 +140,7 @@ class WBRedmine(object):
@staticmethod
def factory(argv):
return WBRedmine(WBRedmine.get_parser().parse_args(argv), argv)
return WBRedmine(WBRedmine.get_parser().parse_args(argv))
def url(self, issue):
return self.args.redmine_url + "/issues/" + str(issue['id'])
......
......@@ -31,11 +31,11 @@ log = logging.getLogger(__name__)
class WBXref(object):
def __init__(self, args, argv):
def __init__(self, args):
self.args = args
self.git = wbgit.WBRepo(args)
self.github = wbgithub.WBGitHub(args)
self.redmine = wbredmine.WBRedmine(args, argv)
self.redmine = wbredmine.WBRedmine(args)
self.gitlab = wbgitlab.WBGitLab(args)
self.issue_id2merge_requests = {}
self.commit2issues = {}
......@@ -73,7 +73,7 @@ class WBXref(object):
@staticmethod
def factory(argv):
return WBXref(WBXref.get_parser().parse_args(argv), argv)
return WBXref(WBXref.get_parser().parse_args(argv))
@staticmethod
def merge_message2issue(message):
......
......@@ -57,7 +57,7 @@ class TestWBXref(testtools.TestCase):
]
def test_init(self):
wbxref.WBXref(argparse.Namespace(), [])
wbxref.WBXref(argparse.Namespace())
def test_merge_message2issue(self):
expected = '1234'
......@@ -83,7 +83,7 @@ class TestWBXref(testtools.TestCase):
wbxref.WBXref.message2issue(message))
def test_update_issue(self):
x = wbxref.WBXref(argparse.Namespace(), [])
x = wbxref.WBXref(argparse.Namespace())
merge_id = 3
merge_request = {
'id': merge_id,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment