Ido Barkan has uploaded a new change for review. Change subject: net: remove unused _parseLinkLine from ipwrapper ......................................................................
net: remove unused _parseLinkLine from ipwrapper The grouper utility was also removed as _parseLinkLine was the only one using it. Change-Id: I7723be2a556f2eb1d1a5f0c3a1b4f62ee6561369 Signed-off-by: Ido Barkan <[email protected]> --- M lib/vdsm/ipwrapper.py M lib/vdsm/utils.py M tests/utilsTests.py 3 files changed, 0 insertions(+), 59 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/92/45692/1 diff --git a/lib/vdsm/ipwrapper.py b/lib/vdsm/ipwrapper.py index 3eb5977..b42cfcb 100644 --- a/lib/vdsm/ipwrapper.py +++ b/lib/vdsm/ipwrapper.py @@ -36,7 +36,6 @@ from .utils import anyFnmatch from .utils import CommandPath from .utils import execCmd -from .utils import grouper from .netlink import link _IP_BINARY = CommandPath('ip', '/sbin/ip') @@ -90,37 +89,6 @@ TEAM = 'team' VETH = 'veth' VF = 'vf' - - -def _parseLinkLine(text): - """Returns the a link attribute dictionary resulting from parsing the - output of an iproute2 detailed link entry.""" - attrs = {} - attrs['index'], attrs['name'], data = [el.strip() for el in - text.split(':', 2)] - - processedData = [el.strip() for el in - data.replace('\\', '', 1).split('\\')] - - flags, values = processedData[0].split('>', 1) - attrs['flags'] = frozenset(flags[1:].split(',')) - - baseData = (el for el in values.strip().split(' ') if el and - el != 'link/none') - for key, value in grouper(baseData, 2): - if key.startswith('link/'): - key = 'address' - attrs[key] = value - if 'address' not in attrs: - attrs['address'] = None - - if len(processedData) > 1: - tokens = [token for token in processedData[1].split(' ') if token] - linkType = tokens.pop(0) - attrs['linkType'] = linkType - attrs.update((linkType + tokens[i], tokens[i + 1]) for i in - range(0, len(tokens) - 1, 2)) - return attrs @equals diff --git a/lib/vdsm/utils.py b/lib/vdsm/utils.py index d847a23..cf8fb5e 100644 --- a/lib/vdsm/utils.py +++ b/lib/vdsm/utils.py @@ -1029,15 +1029,6 @@ bool(glob.glob('/etc/ovirt-node-*-release'))) -# Copied from -# http://docs.python.org/2.6/library/itertools.html?highlight=grouper#recipes -def grouper(iterable, n, fillvalue=None): - "Collect data into fixed-length chunks or blocks" - # grouper('ABCDEFG', 3, 'x') --> ABC DEF Gxx - args = [iter(iterable)] * n - return itertools.izip_longest(fillvalue=fillvalue, *args) - - def anyFnmatch(name, patterns): """Returns True if any element in the patterns iterable fnmatches name.""" return any(fnmatch(name, pattern) for pattern in patterns) diff --git a/tests/utilsTests.py b/tests/utilsTests.py index b5b90ad..db4b2cc 100644 --- a/tests/utilsTests.py +++ b/tests/utilsTests.py @@ -177,24 +177,6 @@ self.assertEquals(meminfo['KernelStack'], 2760) self.assertEquals(meminfo['Inactive'], 1432748) - def testGrouper(self): - iterable = '1234567890' - grouped = [('1', '2'), ('3', '4'), ('5', '6'), ('7', '8'), ('9', '0')] - self.assertEquals(list(utils.grouper(iterable, 2)), grouped) - - iterable += 'a' - grouped.append(('a', None)) - self.assertEquals(list(utils.grouper(iterable, 2)), grouped) - - iterable += 'bcde' - grouped = [('1', '2', '3'), ('4', '5', '6'), ('7', '8', '9'), - ('0', 'a', 'b'), ('c', 'd', 'e')] - self.assertEquals(list(utils.grouper(iterable, 3)), grouped) - - grouped = [('1', '2', '3', '4', '5'), ('6', '7', '8', '9', '0'), - ('a', 'b', 'c', 'd', 'e')] - self.assertEquals(list(utils.grouper(iterable, 5)), grouped) - class AsyncProcessOperationTests(TestCaseBase): def _echo(self, text): -- To view, visit https://gerrit.ovirt.org/45692 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I7723be2a556f2eb1d1a5f0c3a1b4f62ee6561369 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Ido Barkan <[email protected]> _______________________________________________ vdsm-patches mailing list [email protected] https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
