Merge "Simplify ContainerBroker._get_shard_range_rows()"
This commit is contained in:
@@ -1593,8 +1593,8 @@ class ContainerBroker(DatabaseBroker):
|
|||||||
raise
|
raise
|
||||||
|
|
||||||
def _get_shard_range_rows(self, connection=None, include_deleted=False,
|
def _get_shard_range_rows(self, connection=None, include_deleted=False,
|
||||||
states=None,
|
states=None, include_own=False,
|
||||||
include_own=False, exclude_others=False):
|
exclude_others=False):
|
||||||
"""
|
"""
|
||||||
Returns a list of shard range rows.
|
Returns a list of shard range rows.
|
||||||
|
|
||||||
@@ -1620,15 +1620,11 @@ class ContainerBroker(DatabaseBroker):
|
|||||||
if exclude_others and not include_own:
|
if exclude_others and not include_own:
|
||||||
return []
|
return []
|
||||||
|
|
||||||
def prep_states(states):
|
included_states = set()
|
||||||
state_set = set()
|
|
||||||
if isinstance(states, (list, tuple, set)):
|
if isinstance(states, (list, tuple, set)):
|
||||||
state_set.update(states)
|
included_states.update(states)
|
||||||
elif states is not None:
|
elif states is not None:
|
||||||
state_set.add(states)
|
included_states.add(states)
|
||||||
return state_set
|
|
||||||
|
|
||||||
included_states = prep_states(states)
|
|
||||||
|
|
||||||
def do_query(conn):
|
def do_query(conn):
|
||||||
try:
|
try:
|
||||||
|
|||||||
Reference in New Issue
Block a user