prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  MacOS 10.13 OSError: [Errno 24] Too many open files
  ```shell
      return [i for i in os.listdir(path) if os.path.isdir(os.path.join(path, i)) and not i.startswith('_')]
  OSError: [Errno 24] Too many open files: '/Users/abcdefg/.pyenv/versions/3.6.3/envs/weixin3/lib/python3.6/site-packages/faker/providers/address'
  ```
  
  
  
  </issue>
  <code>
  [start of faker/utils/loading.py]
  1 import os
  2 from importlib import import_module
  3 import pkgutil
  4 
  5 
  6 def list_module(module):
  7     path = os.path.dirname(module.__file__)
  8     modules = [name for finder, name, is_pkg in pkgutil.iter_modules([path]) if is_pkg]
  9     if len(modules) > 0:
  10         return modules
  11     return [i for i in os.listdir(path) if os.path.isdir(os.path.join(path, i)) and not i.startswith('_')]
  12 
  13 
  14 def find_available_locales(providers):
  15     available_locales = set()
  16 
  17     for provider_path in providers:
  18 
  19         provider_module = import_module(provider_path)
  20         if getattr(provider_module, 'localized', False):
  21             langs = list_module(provider_module)
  22             available_locales.update(langs)
  23     return available_locales
  24 
  25 
  26 def find_available_providers(modules):
  27     available_providers = set()
  28     for providers_mod in modules:
  29         providers = ['.'.join([providers_mod.__package__, mod]) for mod in list_module(providers_mod)]
  30         available_providers.update(providers)
  31     return sorted(available_providers)
  32
  [end of faker/utils/loading.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/faker/utils/loading.py b/faker/utils/loading.py
  --- a/faker/utils/loading.py
  +++ b/faker/utils/loading.py
  @@ -6,9 +6,7 @@
   def list_module(module):
       path = os.path.dirname(module.__file__)
       modules = [name for finder, name, is_pkg in pkgutil.iter_modules([path]) if is_pkg]
  -    if len(modules) > 0:
  -        return modules
  -    return [i for i in os.listdir(path) if os.path.isdir(os.path.join(path, i)) and not i.startswith('_')]
  +    return modules
   
   
   def find_available_locales(providers):
  
verification_info: {"golden_diff": "diff --git a/faker/utils/loading.py b/faker/utils/loading.py\n--- a/faker/utils/loading.py\n+++ b/faker/utils/loading.py\n@@ -6,9 +6,7 @@\n def list_module(module):\n     path = os.path.dirname(module.__file__)\n     modules = [name for finder, name, is_pkg in pkgutil.iter_modules([path]) if is_pkg]\n-    if len(modules) > 0:\n-        return modules\n-    return [i for i in os.listdir(path) if os.path.isdir(os.path.join(path, i)) and not i.startswith('_')]\n+    return modules\n \n \n def find_available_locales(providers):\n", "issue": "MacOS 10.13 OSError: [Errno 24] Too many open files\n```shell\r\n    return [i for i in os.listdir(path) if os.path.isdir(os.path.join(path, i)) and not i.startswith('_')]\r\nOSError: [Errno 24] Too many open files: '/Users/abcdefg/.pyenv/versions/3.6.3/envs/weixin3/lib/python3.6/site-packages/faker/providers/address'\r\n```\r\n\r\n\n", "before_files": [{"content": "import os\nfrom importlib import import_module\nimport pkgutil\n\n\ndef list_module(module):\n    path = os.path.dirname(module.__file__)\n    modules = [name for finder, name, is_pkg in pkgutil.iter_modules([path]) if is_pkg]\n    if len(modules) > 0:\n        return modules\n    return [i for i in os.listdir(path) if os.path.isdir(os.path.join(path, i)) and not i.startswith('_')]\n\n\ndef find_available_locales(providers):\n    available_locales = set()\n\n    for provider_path in providers:\n\n        provider_module = import_module(provider_path)\n        if getattr(provider_module, 'localized', False):\n            langs = list_module(provider_module)\n            available_locales.update(langs)\n    return available_locales\n\n\ndef find_available_providers(modules):\n    available_providers = set()\n    for providers_mod in modules:\n        providers = ['.'.join([providers_mod.__package__, mod]) for mod in list_module(providers_mod)]\n        available_providers.update(providers)\n    return sorted(available_providers)\n", "path": "faker/utils/loading.py"}]}