MCPcopy Index your code
hub / github.com/mongodb/mongo-python-driver / parse_read_preference

Function parse_read_preference

test/utils_shared.py:578–587  ·  view source on GitHub ↗
(pref)

Source from the content-addressed store, hash-verified

576
577
578def parse_read_preference(pref):
579 # Make first letter lowercase to match read_pref's modes.
580 mode_string = pref.get("mode", "primary")
581 mode_string = mode_string[:1].lower() + mode_string[1:]
582 mode = read_preferences.read_pref_mode_from_name(mode_string)
583 max_staleness = pref.get("maxStalenessSeconds", -1)
584 tag_sets = pref.get("tagSets") or pref.get("tag_sets")
585 return read_preferences.make_read_preference(
586 mode, tag_sets=tag_sets, max_staleness=max_staleness
587 )
588
589
590def server_name_to_type(name):

Callers 4

run_scenarioFunction · 0.90
run_scenarioFunction · 0.90
parse_collection_optionsFunction · 0.85
parse_spec_optionsFunction · 0.85

Calls 1

getMethod · 0.45

Tested by 2

run_scenarioFunction · 0.72
run_scenarioFunction · 0.72