mirror of
https://github.com/github/octodns.git
synced 2024-05-11 05:55:00 +00:00
Explicit list-ification
This commit is contained in:
@@ -60,7 +60,7 @@ class BaseProvider(BaseSource):
|
||||
|
||||
# allow the provider to filter out false positives
|
||||
before = len(changes)
|
||||
changes = filter(self._include_change, changes)
|
||||
changes = list(filter(self._include_change, changes))
|
||||
after = len(changes)
|
||||
if before != after:
|
||||
self.log.info('plan: filtered out %s changes', before - after)
|
||||
|
||||
@@ -325,7 +325,8 @@ class OvhProvider(BaseProvider):
|
||||
splitted = value.split('\\;')
|
||||
found_key = False
|
||||
for splitted_value in splitted:
|
||||
sub_split = map(lambda x: x.strip(), splitted_value.split("=", 1))
|
||||
sub_split = list(map(lambda x: x.strip(),
|
||||
splitted_value.split("=", 1)))
|
||||
if len(sub_split) < 2:
|
||||
return False
|
||||
key, value = sub_split[0], sub_split[1]
|
||||
|
||||
+1
-2
@@ -49,8 +49,7 @@ class SortingDumper(SafeDumper):
|
||||
'''
|
||||
|
||||
def _representer(self, data):
|
||||
data = data.items()
|
||||
data.sort(key=lambda d: _natsort_key(d[0]))
|
||||
data = sorted(data.items(), key=lambda d: _natsort_key(d[0]))
|
||||
return self.represent_mapping(self.DEFAULT_MAPPING_TAG, data)
|
||||
|
||||
|
||||
|
||||
@@ -57,8 +57,9 @@ class TestYamlProvider(TestCase):
|
||||
|
||||
# We add everything
|
||||
plan = target.plan(zone)
|
||||
self.assertEquals(15, len(filter(lambda c: isinstance(c, Create),
|
||||
plan.changes)))
|
||||
self.assertEquals(15, len(list(filter(lambda c:
|
||||
isinstance(c, Create),
|
||||
plan.changes))))
|
||||
self.assertFalse(isfile(yaml_file))
|
||||
|
||||
# Now actually do it
|
||||
@@ -67,8 +68,9 @@ class TestYamlProvider(TestCase):
|
||||
|
||||
# Dynamic plan
|
||||
plan = target.plan(dynamic_zone)
|
||||
self.assertEquals(5, len(filter(lambda c: isinstance(c, Create),
|
||||
plan.changes)))
|
||||
self.assertEquals(5, len(list(filter(lambda c:
|
||||
isinstance(c, Create),
|
||||
plan.changes))))
|
||||
self.assertFalse(isfile(dynamic_yaml_file))
|
||||
# Apply it
|
||||
self.assertEquals(5, target.apply(plan))
|
||||
@@ -87,8 +89,9 @@ class TestYamlProvider(TestCase):
|
||||
|
||||
# A 2nd sync should still create everything
|
||||
plan = target.plan(zone)
|
||||
self.assertEquals(15, len(filter(lambda c: isinstance(c, Create),
|
||||
plan.changes)))
|
||||
self.assertEquals(15, len(list(filter(lambda c:
|
||||
isinstance(c, Create),
|
||||
plan.changes))))
|
||||
|
||||
with open(yaml_file) as fh:
|
||||
data = safe_load(fh.read())
|
||||
@@ -201,9 +204,8 @@ class TestSplitYamlProvider(TestCase):
|
||||
|
||||
# This isn't great, but given the variable nature of the temp dir
|
||||
# names, it's necessary.
|
||||
self.assertItemsEqual(
|
||||
yaml_files,
|
||||
(basename(f) for f in _list_all_yaml_files(directory)))
|
||||
d = list(basename(f) for f in _list_all_yaml_files(directory))
|
||||
self.assertEqual(len(yaml_files), len(d))
|
||||
|
||||
def test_zone_directory(self):
|
||||
source = SplitYamlProvider(
|
||||
|
||||
Reference in New Issue
Block a user