prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  export toposort for conda-build
  
  export toposort for conda-build
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `conda/exports.py`
  Content:
  ```
  1 # -*- coding: utf-8 -*-
  2 from __future__ import absolute_import, division, print_function, unicode_literals
  3 
  4 from functools import partial
  5 from logging import getLogger
  6 from warnings import warn
  7 
  8 log = getLogger(__name__)
  9 
  10 from . import CondaError  # NOQA
  11 CondaError = CondaError
  12 
  13 from . import compat, plan  # NOQA
  14 compat, plan = compat, plan
  15 
  16 from .api import get_index  # NOQA
  17 get_index = get_index
  18 
  19 from .cli.common import specs_from_args, spec_from_line, specs_from_url  # NOQA
  20 from .cli.conda_argparse import add_parser_prefix, add_parser_channels  # NOQA
  21 add_parser_channels, add_parser_prefix = add_parser_channels, add_parser_prefix
  22 specs_from_args, spec_from_line = specs_from_args, spec_from_line
  23 specs_from_url = specs_from_url
  24 
  25 from .cli.conda_argparse import ArgumentParser  # NOQA
  26 ArgumentParser = ArgumentParser
  27 
  28 from .common.compat import PY3, StringIO,  input, iteritems, string_types, text_type  # NOQA
  29 PY3, StringIO,  input, iteritems, string_types, text_type = PY3, StringIO,  input, iteritems, string_types, text_type  # NOQA
  30 from .gateways.connection import CondaSession  # NOQA
  31 CondaSession = CondaSession
  32 
  33 from .gateways.disk.link import lchmod  # NOQA
  34 lchmod = lchmod
  35 
  36 from .fetch import TmpDownload  # NOQA
  37 TmpDownload = TmpDownload
  38 handle_proxy_407 = lambda x, y: warn("handle_proxy_407 is deprecated. "
  39                                      "Now handled by CondaSession.")
  40 from .core.index import dist_str_in_index, fetch_index  # NOQA
  41 dist_str_in_index, fetch_index = dist_str_in_index, fetch_index
  42 from .core.package_cache import download, rm_fetched  # NOQA
  43 download, rm_fetched = download, rm_fetched
  44 
  45 from .install import package_cache, prefix_placeholder, rm_rf, symlink_conda  # NOQA
  46 package_cache, prefix_placeholder, rm_rf, symlink_conda = package_cache, prefix_placeholder, rm_rf, symlink_conda  # NOQA
  47 
  48 from .gateways.disk.delete import delete_trash, move_to_trash  # NOQA
  49 delete_trash, move_to_trash = delete_trash, move_to_trash
  50 
  51 from .core.linked_data import is_linked, linked, linked_data  # NOQA
  52 is_linked, linked, linked_data = is_linked, linked, linked_data
  53 
  54 from .misc import untracked, walk_prefix  # NOQA
  55 untracked, walk_prefix = untracked, walk_prefix
  56 
  57 from .resolve import MatchSpec, NoPackagesFound, Resolve, Unsatisfiable, normalized_version  # NOQA
  58 MatchSpec, NoPackagesFound, Resolve = MatchSpec, NoPackagesFound, Resolve
  59 Unsatisfiable, normalized_version = Unsatisfiable, normalized_version
  60 
  61 from .signature import KEYS, KEYS_DIR, hash_file, verify  # NOQA
  62 KEYS, KEYS_DIR = KEYS, KEYS_DIR
  63 hash_file, verify = hash_file, verify
  64 
  65 from .utils import hashsum_file, human_bytes, memoized, unix_path_to_win, win_path_to_unix, url_path  # NOQA
  66 hashsum_file, human_bytes = hashsum_file, human_bytes
  67 memoized, unix_path_to_win = memoized, unix_path_to_win
  68 win_path_to_unix, url_path = win_path_to_unix, url_path
  69 
  70 from .gateways.disk.read import compute_md5sum  # NOQA
  71 md5_file = compute_md5sum
  72 
  73 from .config import sys_rc_path  # NOQA
  74 sys_rc_path = sys_rc_path
  75 
  76 from .models.version import VersionOrder  # NOQA
  77 VersionOrder = VersionOrder
  78 
  79 import conda.base.context  # NOQA
  80 from .base.context import get_prefix as context_get_prefix, non_x86_linux_machines  # NOQA
  81 non_x86_linux_machines = non_x86_linux_machines
  82 
  83 from ._vendor.auxlib.entity import EntityEncoder        # NOQA
  84 EntityEncoder = EntityEncoder
  85 from .base.constants import DEFAULT_CHANNELS, DEFAULT_CHANNELS_WIN, DEFAULT_CHANNELS_UNIX  # NOQA
  86 DEFAULT_CHANNELS, DEFAULT_CHANNELS_WIN, DEFAULT_CHANNELS_UNIX = DEFAULT_CHANNELS, DEFAULT_CHANNELS_WIN, DEFAULT_CHANNELS_UNIX  # NOQA
  87 get_prefix = partial(context_get_prefix, conda.base.context.context)
  88 get_default_urls = lambda: DEFAULT_CHANNELS
  89 
  90 arch_name = conda.base.context.context.arch_name
  91 binstar_upload = conda.base.context.context.anaconda_upload
  92 bits = conda.base.context.context.bits
  93 default_prefix = conda.base.context.context.default_prefix
  94 default_python = conda.base.context.context.default_python
  95 envs_dirs = conda.base.context.context.envs_dirs
  96 pkgs_dirs = conda.base.context.context.pkgs_dirs
  97 platform = conda.base.context.context.platform
  98 root_dir = conda.base.context.context.root_prefix
  99 root_writable = conda.base.context.context.root_writable
  100 subdir = conda.base.context.context.subdir
  101 from .models.channel import get_conda_build_local_url  # NOQA
  102 get_rc_urls = lambda: list(conda.base.context.context.channels)
  103 get_local_urls = lambda: list(get_conda_build_local_url()) or []
  104 load_condarc = lambda fn: conda.base.context.reset_context([fn])
  105 from .exceptions import PaddingError  # NOQA
  106 PaddingError = PaddingError
  107 from .gateways.disk.link import CrossPlatformStLink  # NOQA
  108 CrossPlatformStLink = CrossPlatformStLink
  109 
  110 from .models.enums import FileMode  # NOQA
  111 FileMode = FileMode
  112 from .models.enums import PathType  # NOQA
  113 PathType = PathType
  114 
  115 
  116 if PY3:
  117     import configparser  # NOQA  # pragma: py2 no cover
  118 else:
  119     import ConfigParser as configparser  # NOQA  # pragma: py3 no cover
  120 configparser = configparser
  121 
  122 
  123 from .compat import TemporaryDirectory  # NOQA
  124 TemporaryDirectory = TemporaryDirectory
  125 
  126 from .gateways.subprocess import ACTIVE_SUBPROCESSES, subprocess_call  # NOQA
  127 ACTIVE_SUBPROCESSES, subprocess_call = ACTIVE_SUBPROCESSES, subprocess_call
  128 
  129 from .core.repodata import cache_fn_url  # NOQA
  130 cache_fn_url = cache_fn_url
  131 
  132 
  133 class Completer(object):
  134     def get_items(self):
  135         return self._get_items()
  136 
  137     def __contains__(self, item):
  138         return True
  139 
  140     def __iter__(self):
  141         return iter(self.get_items())
  142 
  143 class InstalledPackages(object): pass  # NOQA
  144
  ```
  --- 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()
  
  ```
  
golden_diff: diff --git a/conda/exports.py b/conda/exports.py
  --- a/conda/exports.py
  +++ b/conda/exports.py
  @@ -30,6 +30,9 @@
   from .gateways.connection import CondaSession  # NOQA
   CondaSession = CondaSession
   
  +from .common.toposort import _toposort
  +_toposort = _toposort
  +
   from .gateways.disk.link import lchmod  # NOQA
   lchmod = lchmod
  
verification_info: {"golden_diff": "diff --git a/conda/exports.py b/conda/exports.py\n--- a/conda/exports.py\n+++ b/conda/exports.py\n@@ -30,6 +30,9 @@\n from .gateways.connection import CondaSession  # NOQA\n CondaSession = CondaSession\n \n+from .common.toposort import _toposort\n+_toposort = _toposort\n+\n from .gateways.disk.link import lchmod  # NOQA\n lchmod = lchmod\n", "issue": "export toposort for conda-build\n\nexport toposort for conda-build\n\n", "before_files": [{"content": "# -*- coding: utf-8 -*-\nfrom __future__ import absolute_import, division, print_function, unicode_literals\n\nfrom functools import partial\nfrom logging import getLogger\nfrom warnings import warn\n\nlog = getLogger(__name__)\n\nfrom . import CondaError  # NOQA\nCondaError = CondaError\n\nfrom . import compat, plan  # NOQA\ncompat, plan = compat, plan\n\nfrom .api import get_index  # NOQA\nget_index = get_index\n\nfrom .cli.common import specs_from_args, spec_from_line, specs_from_url  # NOQA\nfrom .cli.conda_argparse import add_parser_prefix, add_parser_channels  # NOQA\nadd_parser_channels, add_parser_prefix = add_parser_channels, add_parser_prefix\nspecs_from_args, spec_from_line = specs_from_args, spec_from_line\nspecs_from_url = specs_from_url\n\nfrom .cli.conda_argparse import ArgumentParser  # NOQA\nArgumentParser = ArgumentParser\n\nfrom .common.compat import PY3, StringIO,  input, iteritems, string_types, text_type  # NOQA\nPY3, StringIO,  input, iteritems, string_types, text_type = PY3, StringIO,  input, iteritems, string_types, text_type  # NOQA\nfrom .gateways.connection import CondaSession  # NOQA\nCondaSession = CondaSession\n\nfrom .gateways.disk.link import lchmod  # NOQA\nlchmod = lchmod\n\nfrom .fetch import TmpDownload  # NOQA\nTmpDownload = TmpDownload\nhandle_proxy_407 = lambda x, y: warn(\"handle_proxy_407 is deprecated. \"\n                                     \"Now handled by CondaSession.\")\nfrom .core.index import dist_str_in_index, fetch_index  # NOQA\ndist_str_in_index, fetch_index = dist_str_in_index, fetch_index\nfrom .core.package_cache import download, rm_fetched  # NOQA\ndownload, rm_fetched = download, rm_fetched\n\nfrom .install import package_cache, prefix_placeholder, rm_rf, symlink_conda  # NOQA\npackage_cache, prefix_placeholder, rm_rf, symlink_conda = package_cache, prefix_placeholder, rm_rf, symlink_conda  # NOQA\n\nfrom .gateways.disk.delete import delete_trash, move_to_trash  # NOQA\ndelete_trash, move_to_trash = delete_trash, move_to_trash\n\nfrom .core.linked_data import is_linked, linked, linked_data  # NOQA\nis_linked, linked, linked_data = is_linked, linked, linked_data\n\nfrom .misc import untracked, walk_prefix  # NOQA\nuntracked, walk_prefix = untracked, walk_prefix\n\nfrom .resolve import MatchSpec, NoPackagesFound, Resolve, Unsatisfiable, normalized_version  # NOQA\nMatchSpec, NoPackagesFound, Resolve = MatchSpec, NoPackagesFound, Resolve\nUnsatisfiable, normalized_version = Unsatisfiable, normalized_version\n\nfrom .signature import KEYS, KEYS_DIR, hash_file, verify  # NOQA\nKEYS, KEYS_DIR = KEYS, KEYS_DIR\nhash_file, verify = hash_file, verify\n\nfrom .utils import hashsum_file, human_bytes, memoized, unix_path_to_win, win_path_to_unix, url_path  # NOQA\nhashsum_file, human_bytes = hashsum_file, human_bytes\nmemoized, unix_path_to_win = memoized, unix_path_to_win\nwin_path_to_unix, url_path = win_path_to_unix, url_path\n\nfrom .gateways.disk.read import compute_md5sum  # NOQA\nmd5_file = compute_md5sum\n\nfrom .config import sys_rc_path  # NOQA\nsys_rc_path = sys_rc_path\n\nfrom .models.version import VersionOrder  # NOQA\nVersionOrder = VersionOrder\n\nimport conda.base.context  # NOQA\nfrom .base.context import get_prefix as context_get_prefix, non_x86_linux_machines  # NOQA\nnon_x86_linux_machines = non_x86_linux_machines\n\nfrom ._vendor.auxlib.entity import EntityEncoder        # NOQA\nEntityEncoder = EntityEncoder\nfrom .base.constants import DEFAULT_CHANNELS, DEFAULT_CHANNELS_WIN, DEFAULT_CHANNELS_UNIX  # NOQA\nDEFAULT_CHANNELS, DEFAULT_CHANNELS_WIN, DEFAULT_CHANNELS_UNIX = DEFAULT_CHANNELS, DEFAULT_CHANNELS_WIN, DEFAULT_CHANNELS_UNIX  # NOQA\nget_prefix = partial(context_get_prefix, conda.base.context.context)\nget_default_urls = lambda: DEFAULT_CHANNELS\n\narch_name = conda.base.context.context.arch_name\nbinstar_upload = conda.base.context.context.anaconda_upload\nbits = conda.base.context.context.bits\ndefault_prefix = conda.base.context.context.default_prefix\ndefault_python = conda.base.context.context.default_python\nenvs_dirs = conda.base.context.context.envs_dirs\npkgs_dirs = conda.base.context.context.pkgs_dirs\nplatform = conda.base.context.context.platform\nroot_dir = conda.base.context.context.root_prefix\nroot_writable = conda.base.context.context.root_writable\nsubdir = conda.base.context.context.subdir\nfrom .models.channel import get_conda_build_local_url  # NOQA\nget_rc_urls = lambda: list(conda.base.context.context.channels)\nget_local_urls = lambda: list(get_conda_build_local_url()) or []\nload_condarc = lambda fn: conda.base.context.reset_context([fn])\nfrom .exceptions import PaddingError  # NOQA\nPaddingError = PaddingError\nfrom .gateways.disk.link import CrossPlatformStLink  # NOQA\nCrossPlatformStLink = CrossPlatformStLink\n\nfrom .models.enums import FileMode  # NOQA\nFileMode = FileMode\nfrom .models.enums import PathType  # NOQA\nPathType = PathType\n\n\nif PY3:\n    import configparser  # NOQA  # pragma: py2 no cover\nelse:\n    import ConfigParser as configparser  # NOQA  # pragma: py3 no cover\nconfigparser = configparser\n\n\nfrom .compat import TemporaryDirectory  # NOQA\nTemporaryDirectory = TemporaryDirectory\n\nfrom .gateways.subprocess import ACTIVE_SUBPROCESSES, subprocess_call  # NOQA\nACTIVE_SUBPROCESSES, subprocess_call = ACTIVE_SUBPROCESSES, subprocess_call\n\nfrom .core.repodata import cache_fn_url  # NOQA\ncache_fn_url = cache_fn_url\n\n\nclass Completer(object):\n    def get_items(self):\n        return self._get_items()\n\n    def __contains__(self, item):\n        return True\n\n    def __iter__(self):\n        return iter(self.get_items())\n\nclass InstalledPackages(object): pass  # NOQA\n", "path": "conda/exports.py"}], "after_files": [{"content": "# -*- coding: utf-8 -*-\nfrom __future__ import absolute_import, division, print_function, unicode_literals\n\nfrom functools import partial\nfrom logging import getLogger\nfrom warnings import warn\n\nlog = getLogger(__name__)\n\nfrom . import CondaError  # NOQA\nCondaError = CondaError\n\nfrom . import compat, plan  # NOQA\ncompat, plan = compat, plan\n\nfrom .api import get_index  # NOQA\nget_index = get_index\n\nfrom .cli.common import specs_from_args, spec_from_line, specs_from_url  # NOQA\nfrom .cli.conda_argparse import add_parser_prefix, add_parser_channels  # NOQA\nadd_parser_channels, add_parser_prefix = add_parser_channels, add_parser_prefix\nspecs_from_args, spec_from_line = specs_from_args, spec_from_line\nspecs_from_url = specs_from_url\n\nfrom .cli.conda_argparse import ArgumentParser  # NOQA\nArgumentParser = ArgumentParser\n\nfrom .common.compat import PY3, StringIO,  input, iteritems, string_types, text_type  # NOQA\nPY3, StringIO,  input, iteritems, string_types, text_type = PY3, StringIO,  input, iteritems, string_types, text_type  # NOQA\nfrom .gateways.connection import CondaSession  # NOQA\nCondaSession = CondaSession\n\nfrom .common.toposort import _toposort\n_toposort = _toposort\n\nfrom .gateways.disk.link import lchmod  # NOQA\nlchmod = lchmod\n\nfrom .fetch import TmpDownload  # NOQA\nTmpDownload = TmpDownload\nhandle_proxy_407 = lambda x, y: warn(\"handle_proxy_407 is deprecated. \"\n                                     \"Now handled by CondaSession.\")\nfrom .core.index import dist_str_in_index, fetch_index  # NOQA\ndist_str_in_index, fetch_index = dist_str_in_index, fetch_index\nfrom .core.package_cache import download, rm_fetched  # NOQA\ndownload, rm_fetched = download, rm_fetched\n\nfrom .install import package_cache, prefix_placeholder, rm_rf, symlink_conda  # NOQA\npackage_cache, prefix_placeholder, rm_rf, symlink_conda = package_cache, prefix_placeholder, rm_rf, symlink_conda  # NOQA\n\nfrom .gateways.disk.delete import delete_trash, move_to_trash  # NOQA\ndelete_trash, move_to_trash = delete_trash, move_to_trash\n\nfrom .core.linked_data import is_linked, linked, linked_data  # NOQA\nis_linked, linked, linked_data = is_linked, linked, linked_data\n\nfrom .misc import untracked, walk_prefix  # NOQA\nuntracked, walk_prefix = untracked, walk_prefix\n\nfrom .resolve import MatchSpec, NoPackagesFound, Resolve, Unsatisfiable, normalized_version  # NOQA\nMatchSpec, NoPackagesFound, Resolve = MatchSpec, NoPackagesFound, Resolve\nUnsatisfiable, normalized_version = Unsatisfiable, normalized_version\n\nfrom .signature import KEYS, KEYS_DIR, hash_file, verify  # NOQA\nKEYS, KEYS_DIR = KEYS, KEYS_DIR\nhash_file, verify = hash_file, verify\n\nfrom .utils import hashsum_file, human_bytes, memoized, unix_path_to_win, win_path_to_unix, url_path  # NOQA\nhashsum_file, human_bytes = hashsum_file, human_bytes\nmemoized, unix_path_to_win = memoized, unix_path_to_win\nwin_path_to_unix, url_path = win_path_to_unix, url_path\n\nfrom .gateways.disk.read import compute_md5sum  # NOQA\nmd5_file = compute_md5sum\n\nfrom .config import sys_rc_path  # NOQA\nsys_rc_path = sys_rc_path\n\nfrom .models.version import VersionOrder  # NOQA\nVersionOrder = VersionOrder\n\nimport conda.base.context  # NOQA\nfrom .base.context import get_prefix as context_get_prefix, non_x86_linux_machines  # NOQA\nnon_x86_linux_machines = non_x86_linux_machines\n\nfrom ._vendor.auxlib.entity import EntityEncoder        # NOQA\nEntityEncoder = EntityEncoder\nfrom .base.constants import DEFAULT_CHANNELS, DEFAULT_CHANNELS_WIN, DEFAULT_CHANNELS_UNIX  # NOQA\nDEFAULT_CHANNELS, DEFAULT_CHANNELS_WIN, DEFAULT_CHANNELS_UNIX = DEFAULT_CHANNELS, DEFAULT_CHANNELS_WIN, DEFAULT_CHANNELS_UNIX  # NOQA\nget_prefix = partial(context_get_prefix, conda.base.context.context)\nget_default_urls = lambda: DEFAULT_CHANNELS\n\narch_name = conda.base.context.context.arch_name\nbinstar_upload = conda.base.context.context.anaconda_upload\nbits = conda.base.context.context.bits\ndefault_prefix = conda.base.context.context.default_prefix\ndefault_python = conda.base.context.context.default_python\nenvs_dirs = conda.base.context.context.envs_dirs\npkgs_dirs = conda.base.context.context.pkgs_dirs\nplatform = conda.base.context.context.platform\nroot_dir = conda.base.context.context.root_prefix\nroot_writable = conda.base.context.context.root_writable\nsubdir = conda.base.context.context.subdir\nfrom .models.channel import get_conda_build_local_url  # NOQA\nget_rc_urls = lambda: list(conda.base.context.context.channels)\nget_local_urls = lambda: list(get_conda_build_local_url()) or []\nload_condarc = lambda fn: conda.base.context.reset_context([fn])\nfrom .exceptions import PaddingError  # NOQA\nPaddingError = PaddingError\nfrom .gateways.disk.link import CrossPlatformStLink  # NOQA\nCrossPlatformStLink = CrossPlatformStLink\n\nfrom .models.enums import FileMode  # NOQA\nFileMode = FileMode\nfrom .models.enums import PathType  # NOQA\nPathType = PathType\n\n\nif PY3:\n    import configparser  # NOQA  # pragma: py2 no cover\nelse:\n    import ConfigParser as configparser  # NOQA  # pragma: py3 no cover\nconfigparser = configparser\n\n\nfrom .compat import TemporaryDirectory  # NOQA\nTemporaryDirectory = TemporaryDirectory\n\nfrom .gateways.subprocess import ACTIVE_SUBPROCESSES, subprocess_call  # NOQA\nACTIVE_SUBPROCESSES, subprocess_call = ACTIVE_SUBPROCESSES, subprocess_call\n\nfrom .core.repodata import cache_fn_url  # NOQA\ncache_fn_url = cache_fn_url\n\n\nclass Completer(object):\n    def get_items(self):\n        return self._get_items()\n\n    def __contains__(self, item):\n        return True\n\n    def __iter__(self):\n        return iter(self.get_items())\n\nclass InstalledPackages(object): pass  # NOQA\n", "path": "conda/exports.py"}]}