Where is 'State' defined in social_graph_snippets.py?
Created by: cclauss
State is currently an undefined name in the context of social_graph_snippets.py so the code would raise a NameError at runtime.
Is State merely an Enum with two items (visited and unvisited) or is it more complex than that? If it is just the simple Enum then perhaps it would be cleaner to rename the field to be source.state_visited and use the values True and False.
flake8 testing of https://github.com/donnemartin/system-design-primer on Python 3.6.3
$ flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics
./solutions/system_design/social_graph/social_graph_snippets.py:10:30: F821 undefined name 'State'
source.visit_state = State.visited
^
./solutions/system_design/social_graph/social_graph_snippets.py:17:49: F821 undefined name 'State'
if adjacent_node.visit_state == State.unvisited:
^
./solutions/system_design/social_graph/social_graph_snippets.py:19:49: F821 undefined name 'State'
adjacent_node.visit_state = State.visited
^
3 F821 undefined name 'State'
Discovered via #93