Simplify TopologyDescription.reset_server.

Same effect, much more directly expressed.
This commit is contained in:
A. Jesse Jiryu Davis 2015-03-03 16:42:27 -05:00
parent 0b3d6eb111
commit fcc06e52d5

View File

@ -83,17 +83,7 @@ class TopologyDescription(object):
def reset_server(self, address):
"""A copy of this description, with one server marked Unknown."""
sds = self.server_descriptions()
# The default ServerDescription's type is Unknown.
sds[address] = ServerDescription(address)
if self._topology_type == TOPOLOGY_TYPE.ReplicaSetWithPrimary:
topology_type = _check_has_primary(sds)
else:
topology_type = self._topology_type
return TopologyDescription(topology_type, sds, self._replica_set_name)
return updated_topology_description(self, ServerDescription(address))
def reset(self):
"""A copy of this description, with all servers marked Unknown."""