We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Move to using master in azavea/models
We've been using  a branch of azavea/models, which can cause confusion.

Before release, merge  the `upgrade-sept-2018` branch into the main branch and update our install_deps script accordingly.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `rastervision/runner/command_dag.py`
Content:
```
1 import networkx as nx
2 
3 import rastervision as rv
4 from rastervision.utils.files import file_exists
5 
6 import click
7 
8 
9 class CommandDAG:
10     """ A directed acyclic graph of command definitions.
11     """
12 
13     def __init__(self,
14                  command_definitions,
15                  rerun_commands=False,
16                  skip_file_check=False):
17         """Generates a CommandDAG from a list of CommandDefinitions
18 
19         This logic checks if there are any non-exsiting URIs that are
20         not produced as outputs by some command in the set. If so,
21         it raises a ConfigError stating the missing files.
22         """
23         # Create a set of edges, from input_uri to command_config and
24         # from command_config to output_uri. Nodes for commands are their
25         # index into command_definitions.
26 
27         uri_dag = nx.DiGraph()
28 
29         for idx, command_def in enumerate(command_definitions):
30             uri_dag.add_node(idx)
31             for input_uri in command_def.io_def.input_uris:
32                 uri_dag.add_edge(input_uri, idx)
33 
34             for output_uri in command_def.io_def.output_uris:
35                 uri_dag.add_edge(idx, output_uri)
36 
37         # Find all source input_uris, and ensure they exist.
38         if not skip_file_check:
39             unsolved_sources = [
40                 uri for uri in uri_dag.nodes
41                 if (type(uri) == str and len(uri_dag.in_edges(uri)) == 0)
42             ]
43 
44             missing_files = []
45 
46             with click.progressbar(
47                     unsolved_sources,
48                     label='Ensuring input files exists ') as uris:
49                 for uri in uris:
50                     if not file_exists(uri):
51                         missing_files.append(uri)
52 
53             if any(missing_files):
54                 raise rv.ConfigError(
55                     'Files do not exist and are not supplied by commands:\n'
56                     '\t{}\n'.format(',\b\t'.join(missing_files)))
57 
58         # If we are not rerunning, remove commands that have existing outputs.
59         self.skipped_commands = []
60         if not rerun_commands:
61             commands_to_outputs = [(idx, edge[1]) for idx in uri_dag.nodes
62                                    if type(idx) == int
63                                    for edge in uri_dag.out_edges(idx)]
64             with click.progressbar(
65                     commands_to_outputs,
66                     label='Checking for existing output') as lst:
67                 for idx, output_uri in lst:
68                     if file_exists(output_uri):
69                         uri_dag.remove_edge(idx, output_uri)
70 
71             for idx in set(map(lambda x: x[0], commands_to_outputs)):
72                 if len(uri_dag.out_edges(idx)) == 0:
73                     self.skipped_commands.append(command_definitions[idx])
74                     uri_dag.remove_node(idx)
75 
76         # Collapse the graph to create edges from command to command.
77         command_id_dag = nx.DiGraph()
78 
79         for idx in [idx for idx in uri_dag.nodes if (type(idx) == int)]:
80             command_id_dag.add_node(idx)
81             for upstream_idx in [
82                     edge2[0] for edge1 in uri_dag.in_edges(idx)
83                     for edge2 in uri_dag.in_edges(edge1[0])
84             ]:
85                 command_id_dag.add_edge(upstream_idx, idx)
86 
87         # Feed this digraph of commands to the child runner.
88         self.command_definitions = command_definitions
89         self.command_id_dag = command_id_dag
90 
91     def get_sorted_commands(self):
92         """Return a topologically sorted list of commands configurations.
93 
94         Returns a list of command configurations that are sorted such that every
95         command that depends on some other parent command appears later
96         than that parent command.
97         """
98         return [
99             self.command_definitions[idx].command_config
100             for idx in self.get_sorted_command_ids()
101         ]
102 
103     def get_sorted_command_ids(self):
104         """Return a topologically sorted list of commands ids.
105 
106         Returns a list of command IDs that can be used to retrieve
107         specific commands out of this DAG. These are sorted such that every
108         command that depends on some other parent command appears later
109         than that parent command.
110         """
111         return [idx for idx in nx.topological_sort(self.command_id_dag)]
112 
113     def get_command(self, command_id):
114         """Retrieves a command configuration for the given ID"""
115         return self.get_command_definition(command_id).command_config
116 
117     def get_command_definition(self, command_id):
118         """Retrieves a command definition for the given ID"""
119         return self.command_definitions[command_id]
120 
121     def get_upstream_command_ids(self, command_id):
122         """Returns the command ids for upstream commands for the command
123         with the given id.
124         """
125         return list(
126             map(lambda x: x[0], self.command_id_dag.in_edges(command_id)))
127 
128     def get_command_definitions(self):
129         """Returns the command definitions that will be run in this DAG."""
130         return [
131             self.command_definitions[idx] for idx in self.command_id_dag.nodes
132         ]
133
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/rastervision/runner/command_dag.py b/rastervision/runner/command_dag.py
--- a/rastervision/runner/command_dag.py
+++ b/rastervision/runner/command_dag.py
@@ -45,7 +45,7 @@
 
             with click.progressbar(
                     unsolved_sources,
-                    label='Ensuring input files exists ') as uris:
+                    label='Ensuring input files exist  ') as uris:
                 for uri in uris:
                     if not file_exists(uri):
                         missing_files.append(uri)

{"golden_diff": "diff --git a/rastervision/runner/command_dag.py b/rastervision/runner/command_dag.py\n--- a/rastervision/runner/command_dag.py\n+++ b/rastervision/runner/command_dag.py\n@@ -45,7 +45,7 @@\n \n             with click.progressbar(\n                     unsolved_sources,\n-                    label='Ensuring input files exists ') as uris:\n+                    label='Ensuring input files exist  ') as uris:\n                 for uri in uris:\n                     if not file_exists(uri):\n                         missing_files.append(uri)\n", "issue": "Move to using master in azavea/models\nWe've been using  a branch of azavea/models, which can cause confusion.\r\n\r\nBefore release, merge  the `upgrade-sept-2018` branch into the main branch and update our install_deps script accordingly.\n", "before_files": [{"content": "import networkx as nx\n\nimport rastervision as rv\nfrom rastervision.utils.files import file_exists\n\nimport click\n\n\nclass CommandDAG:\n    \"\"\" A directed acyclic graph of command definitions.\n    \"\"\"\n\n    def __init__(self,\n                 command_definitions,\n                 rerun_commands=False,\n                 skip_file_check=False):\n        \"\"\"Generates a CommandDAG from a list of CommandDefinitions\n\n        This logic checks if there are any non-exsiting URIs that are\n        not produced as outputs by some command in the set. If so,\n        it raises a ConfigError stating the missing files.\n        \"\"\"\n        # Create a set of edges, from input_uri to command_config and\n        # from command_config to output_uri. Nodes for commands are their\n        # index into command_definitions.\n\n        uri_dag = nx.DiGraph()\n\n        for idx, command_def in enumerate(command_definitions):\n            uri_dag.add_node(idx)\n            for input_uri in command_def.io_def.input_uris:\n                uri_dag.add_edge(input_uri, idx)\n\n            for output_uri in command_def.io_def.output_uris:\n                uri_dag.add_edge(idx, output_uri)\n\n        # Find all source input_uris, and ensure they exist.\n        if not skip_file_check:\n            unsolved_sources = [\n                uri for uri in uri_dag.nodes\n                if (type(uri) == str and len(uri_dag.in_edges(uri)) == 0)\n            ]\n\n            missing_files = []\n\n            with click.progressbar(\n                    unsolved_sources,\n                    label='Ensuring input files exists ') as uris:\n                for uri in uris:\n                    if not file_exists(uri):\n                        missing_files.append(uri)\n\n            if any(missing_files):\n                raise rv.ConfigError(\n                    'Files do not exist and are not supplied by commands:\\n'\n                    '\\t{}\\n'.format(',\\b\\t'.join(missing_files)))\n\n        # If we are not rerunning, remove commands that have existing outputs.\n        self.skipped_commands = []\n        if not rerun_commands:\n            commands_to_outputs = [(idx, edge[1]) for idx in uri_dag.nodes\n                                   if type(idx) == int\n                                   for edge in uri_dag.out_edges(idx)]\n            with click.progressbar(\n                    commands_to_outputs,\n                    label='Checking for existing output') as lst:\n                for idx, output_uri in lst:\n                    if file_exists(output_uri):\n                        uri_dag.remove_edge(idx, output_uri)\n\n            for idx in set(map(lambda x: x[0], commands_to_outputs)):\n                if len(uri_dag.out_edges(idx)) == 0:\n                    self.skipped_commands.append(command_definitions[idx])\n                    uri_dag.remove_node(idx)\n\n        # Collapse the graph to create edges from command to command.\n        command_id_dag = nx.DiGraph()\n\n        for idx in [idx for idx in uri_dag.nodes if (type(idx) == int)]:\n            command_id_dag.add_node(idx)\n            for upstream_idx in [\n                    edge2[0] for edge1 in uri_dag.in_edges(idx)\n                    for edge2 in uri_dag.in_edges(edge1[0])\n            ]:\n                command_id_dag.add_edge(upstream_idx, idx)\n\n        # Feed this digraph of commands to the child runner.\n        self.command_definitions = command_definitions\n        self.command_id_dag = command_id_dag\n\n    def get_sorted_commands(self):\n        \"\"\"Return a topologically sorted list of commands configurations.\n\n        Returns a list of command configurations that are sorted such that every\n        command that depends on some other parent command appears later\n        than that parent command.\n        \"\"\"\n        return [\n            self.command_definitions[idx].command_config\n            for idx in self.get_sorted_command_ids()\n        ]\n\n    def get_sorted_command_ids(self):\n        \"\"\"Return a topologically sorted list of commands ids.\n\n        Returns a list of command IDs that can be used to retrieve\n        specific commands out of this DAG. These are sorted such that every\n        command that depends on some other parent command appears later\n        than that parent command.\n        \"\"\"\n        return [idx for idx in nx.topological_sort(self.command_id_dag)]\n\n    def get_command(self, command_id):\n        \"\"\"Retrieves a command configuration for the given ID\"\"\"\n        return self.get_command_definition(command_id).command_config\n\n    def get_command_definition(self, command_id):\n        \"\"\"Retrieves a command definition for the given ID\"\"\"\n        return self.command_definitions[command_id]\n\n    def get_upstream_command_ids(self, command_id):\n        \"\"\"Returns the command ids for upstream commands for the command\n        with the given id.\n        \"\"\"\n        return list(\n            map(lambda x: x[0], self.command_id_dag.in_edges(command_id)))\n\n    def get_command_definitions(self):\n        \"\"\"Returns the command definitions that will be run in this DAG.\"\"\"\n        return [\n            self.command_definitions[idx] for idx in self.command_id_dag.nodes\n        ]\n", "path": "rastervision/runner/command_dag.py"}], "after_files": [{"content": "import networkx as nx\n\nimport rastervision as rv\nfrom rastervision.utils.files import file_exists\n\nimport click\n\n\nclass CommandDAG:\n    \"\"\" A directed acyclic graph of command definitions.\n    \"\"\"\n\n    def __init__(self,\n                 command_definitions,\n                 rerun_commands=False,\n                 skip_file_check=False):\n        \"\"\"Generates a CommandDAG from a list of CommandDefinitions\n\n        This logic checks if there are any non-exsiting URIs that are\n        not produced as outputs by some command in the set. If so,\n        it raises a ConfigError stating the missing files.\n        \"\"\"\n        # Create a set of edges, from input_uri to command_config and\n        # from command_config to output_uri. Nodes for commands are their\n        # index into command_definitions.\n\n        uri_dag = nx.DiGraph()\n\n        for idx, command_def in enumerate(command_definitions):\n            uri_dag.add_node(idx)\n            for input_uri in command_def.io_def.input_uris:\n                uri_dag.add_edge(input_uri, idx)\n\n            for output_uri in command_def.io_def.output_uris:\n                uri_dag.add_edge(idx, output_uri)\n\n        # Find all source input_uris, and ensure they exist.\n        if not skip_file_check:\n            unsolved_sources = [\n                uri for uri in uri_dag.nodes\n                if (type(uri) == str and len(uri_dag.in_edges(uri)) == 0)\n            ]\n\n            missing_files = []\n\n            with click.progressbar(\n                    unsolved_sources,\n                    label='Ensuring input files exist  ') as uris:\n                for uri in uris:\n                    if not file_exists(uri):\n                        missing_files.append(uri)\n\n            if any(missing_files):\n                raise rv.ConfigError(\n                    'Files do not exist and are not supplied by commands:\\n'\n                    '\\t{}\\n'.format(',\\b\\t'.join(missing_files)))\n\n        # If we are not rerunning, remove commands that have existing outputs.\n        self.skipped_commands = []\n        if not rerun_commands:\n            commands_to_outputs = [(idx, edge[1]) for idx in uri_dag.nodes\n                                   if type(idx) == int\n                                   for edge in uri_dag.out_edges(idx)]\n            with click.progressbar(\n                    commands_to_outputs,\n                    label='Checking for existing output') as lst:\n                for idx, output_uri in lst:\n                    if file_exists(output_uri):\n                        uri_dag.remove_edge(idx, output_uri)\n\n            for idx in set(map(lambda x: x[0], commands_to_outputs)):\n                if len(uri_dag.out_edges(idx)) == 0:\n                    self.skipped_commands.append(command_definitions[idx])\n                    uri_dag.remove_node(idx)\n\n        # Collapse the graph to create edges from command to command.\n        command_id_dag = nx.DiGraph()\n\n        for idx in [idx for idx in uri_dag.nodes if (type(idx) == int)]:\n            command_id_dag.add_node(idx)\n            for upstream_idx in [\n                    edge2[0] for edge1 in uri_dag.in_edges(idx)\n                    for edge2 in uri_dag.in_edges(edge1[0])\n            ]:\n                command_id_dag.add_edge(upstream_idx, idx)\n\n        # Feed this digraph of commands to the child runner.\n        self.command_definitions = command_definitions\n        self.command_id_dag = command_id_dag\n\n    def get_sorted_commands(self):\n        \"\"\"Return a topologically sorted list of commands configurations.\n\n        Returns a list of command configurations that are sorted such that every\n        command that depends on some other parent command appears later\n        than that parent command.\n        \"\"\"\n        return [\n            self.command_definitions[idx].command_config\n            for idx in self.get_sorted_command_ids()\n        ]\n\n    def get_sorted_command_ids(self):\n        \"\"\"Return a topologically sorted list of commands ids.\n\n        Returns a list of command IDs that can be used to retrieve\n        specific commands out of this DAG. These are sorted such that every\n        command that depends on some other parent command appears later\n        than that parent command.\n        \"\"\"\n        return [idx for idx in nx.topological_sort(self.command_id_dag)]\n\n    def get_command(self, command_id):\n        \"\"\"Retrieves a command configuration for the given ID\"\"\"\n        return self.get_command_definition(command_id).command_config\n\n    def get_command_definition(self, command_id):\n        \"\"\"Retrieves a command definition for the given ID\"\"\"\n        return self.command_definitions[command_id]\n\n    def get_upstream_command_ids(self, command_id):\n        \"\"\"Returns the command ids for upstream commands for the command\n        with the given id.\n        \"\"\"\n        return list(\n            map(lambda x: x[0], self.command_id_dag.in_edges(command_id)))\n\n    def get_command_definitions(self):\n        \"\"\"Returns the command definitions that will be run in this DAG.\"\"\"\n        return [\n            self.command_definitions[idx] for idx in self.command_id_dag.nodes\n        ]\n", "path": "rastervision/runner/command_dag.py"}]}