# Buggy code
def project_from_options(project_dir, options):
    environment = Environment.from_env_file(project_dir)
    host = options.get("--host")
    if host is not None:
        host = host.lstrip("=")
    return get_project(
        project_dir,
        get_config_path_from_options(project_dir, options, environment),
        project_name=options.get("--project-name"),
        verbose=options.get("--verbose"),
        host=host,
        tls_config=tls_config_from_options(options),
        environment=environment,
        override_dir=options.get("--project-directory"),
    )


# Traceback (IOError)
Exception in thread Thread-5:
Traceback (most recent call last):
File "/compose/build/docker-compose/out00-PYZ.pyz/threading", line 810, in __bootstrap_inner
File "/compose/build/docker-compose/out00-PYZ.pyz/threading", line 763, in run
File "/compose/build/docker-compose/out00-PYZ.pyz/compose.utils", line 31, in inner_execute_function
File "/compose/build/docker-compose/out00-PYZ.pyz/compose.service", line 220, in <lambda>
File "/compose/build/docker-compose/out00-PYZ.pyz/compose.service", line 173, in create_and_start
File "/compose/build/docker-compose/out00-PYZ.pyz/compose.service", line 268, in create_container
File "/compose/build/docker-compose/out00-PYZ.pyz/compose.service", line 579, in _get_container_create_options
File "/compose/build/docker-compose/out00-PYZ.pyz/compose.service", line 464, in config_hash
File "/compose/build/docker-compose/out00-PYZ.pyz/compose.service", line 469, in config_dict
File "/compose/build/docker-compose/out00-PYZ.pyz/compose.service", line 295, in image
File "/compose/build/docker-compose/out00-PYZ.pyz/docker.utils.decorators", line 20, in wrapped
File "/compose/build/docker-compose/out00-PYZ.pyz/docker.client", line 489, in inspect_image
File "/compose/build/docker-compose/out00-PYZ.pyz/docker.clientbase", line 86, in _get
File "/compose/build/docker-compose/out00-PYZ.pyz/requests.sessions", line 477, in get
File "/compose/build/docker-compose/out00-PYZ.pyz/requests.sessions", line 465, in request
File "/compose/build/docker-compose/out00-PYZ.pyz/requests.sessions", line 573, in send
File "/compose/build/docker-compose/out00-PYZ.pyz/requests.adapters", line 370, in send
File "/compose/build/docker-compose/out00-PYZ.pyz/requests.packages.urllib3.connectionpool", line 544, in urlopen
File "/compose/build/docker-compose/out00-PYZ.pyz/requests.packages.urllib3.connectionpool", line 341, in _make_request
File "/compose/build/docker-compose/out00-PYZ.pyz/requests.packages.urllib3.connectionpool", line 761, in _validate_conn
File "/compose/build/docker-compose/out00-PYZ.pyz/requests.packages.urllib3.connection", line 238, in connect
File "/compose/build/docker-compose/out00-PYZ.pyz/requests.packages.urllib3.util.ssl_", line 277, in ssl_wrap_socket
IOError: [Errno 24] Too many open files

# Fixed code
def project_from_options(project_dir, options):
    environment = Environment.from_env_file(project_dir)
    set_parallel_limit(environment)

    host = options.get("--host")
    if host is not None:
        host = host.lstrip("=")
    return get_project(
        project_dir,
        get_config_path_from_options(project_dir, options, environment),
        project_name=options.get("--project-name"),
        verbose=options.get("--verbose"),
        host=host,
        tls_config=tls_config_from_options(options),
        environment=environment,
        override_dir=options.get("--project-directory"),
    )