From b3bd4382cc6c32c45bf874320a99c241b314c26e Mon Sep 17 00:00:00 2001 From: Ross McFarland Date: Mon, 14 Oct 2019 07:32:09 -0700 Subject: [PATCH] Apply suggestions from code review Co-Authored-By: Theo Julienne --- octodns/manager.py | 4 ++++ octodns/provider/rackspace.py | 2 +- octodns/record/__init__.py | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/octodns/manager.py b/octodns/manager.py index 14a8f07..bc78f5b 100644 --- a/octodns/manager.py +++ b/octodns/manager.py @@ -283,6 +283,8 @@ class Manager(object): self.log.info('sync: sources=%s -> targets=%s', sources, targets) try: + # rather than using a list comprehension, we break this loop out + # so that the `except` block below can reference the `source` collected = [] for source in sources: collected.append(self.providers[source]) @@ -408,6 +410,8 @@ class Manager(object): .format(zone_name)) try: + # rather than using a list comprehension, we break this loop out + # so that the `except` block below can reference the `source` collected = [] for source in sources: collected.append(self.providers[source]) diff --git a/octodns/provider/rackspace.py b/octodns/provider/rackspace.py index 28b7f05..7fed05b 100644 --- a/octodns/provider/rackspace.py +++ b/octodns/provider/rackspace.py @@ -14,7 +14,7 @@ from .base import BaseProvider def _value_keyer(v): - return '{}-{}-{}'.format(v.get('type', ''), v['name'], v.get('data', '')) + return (v.get('type', ''), v['name'], v.get('data', '')) def add_trailing_dot(s): diff --git a/octodns/record/__init__.py b/octodns/record/__init__.py index 47d2e9b..c0f6482 100644 --- a/octodns/record/__init__.py +++ b/octodns/record/__init__.py @@ -926,7 +926,7 @@ class MxValue(object): } def __hash__(self): - return hash('{} {}'.format(self.preference, self.exchange)) + return hash((self.preference, self.exchange)) def __eq__(self, other): return ((self.preference, self.exchange) ==