import os
from importlib import import_module
import pkgutil


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('_')]


def find_available_locales(providers):
    available_locales = set()

    for provider_path in providers:

        provider_module = import_module(provider_path)
        if getattr(provider_module, 'localized', False):
            langs = list_module(provider_module)
            available_locales.update(langs)
    return available_locales


def find_available_providers(modules):
    available_providers = set()
    for providers_mod in modules:
        providers = ['.'.join([providers_mod.__package__, mod]) for mod in list_module(providers_mod)]
        available_providers.update(providers)
    return sorted(available_providers)

faker/utils/loading.py
import os
from importlib import import_module
import pkgutil


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]
    return modules


def find_available_locales(providers):
    available_locales = set()

    for provider_path in providers:

        provider_module = import_module(provider_path)
        if getattr(provider_module, 'localized', False):
            langs = list_module(provider_module)
            available_locales.update(langs)
    return available_locales


def find_available_providers(modules):
    available_providers = set()
    for providers_mod in modules:
        providers = ['.'.join([providers_mod.__package__, mod]) for mod in list_module(providers_mod)]
        available_providers.update(providers)
    return sorted(available_providers)

faker/utils/loading.py
diff --git a/README.rst b/README.rst
index 700e437d45..b782515e3f 100644
--- a/README.rst
+++ b/README.rst
@@ -171,7 +171,7 @@ When installed, you can invoke faker from the command-line:
     faker [-h] [--version] [-o output]
           [-l {bg_BG,cs_CZ,...,zh_CN,zh_TW}]
           [-r REPEAT] [-s SEP]
-          [-i {module.containing.custom_provider othermodule.containing.custom_provider}]
+          [-i {package.containing.custom_provider otherpkg.containing.custom_provider}]
           [fake] [fake argument [fake argument ...]]
 
 Where:
@@ -194,7 +194,7 @@ Where:
    generated output
 
 -  ``-i {my.custom_provider other.custom_provider}`` list of additional custom providers to use.
-   Note that is the import path of the module containing your Provider class, not the custom Provider class itself.
+   Note that is the import path of the package containing your Provider class, not the custom Provider class itself.
 
 -  ``fake``: is the name of the fake to generate an output for, such as
    ``name``, ``address``, or ``text``
diff --git a/docs/index.rst b/docs/index.rst
index e461d1d737..892e882b87 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -176,7 +176,7 @@ When installed, you can invoke faker from the command-line:
     faker [-h] [--version] [-o output]
           [-l {bg_BG,cs_CZ,...,zh_CN,zh_TW}]
           [-r REPEAT] [-s SEP]
-          [-i {module.containing.custom_provider othermodule.containing.custom_provider}]
+          [-i {package.containing.custom_provider otherpkg.containing.custom_provider}]
           [fake] [fake argument [fake argument ...]]
 
 Where:
@@ -199,7 +199,7 @@ Where:
    generated output
 
 -  ``-i {my.custom_provider other.custom_provider}`` list of additional custom providers to use.
-   Note that is the import path of the module containing your Provider class, not the custom Provider class itself.
+   Note that is the import path of the package containing your Provider class, not the custom Provider class itself.
 
 -  ``fake``: is the name of the fake to generate an output for, such as
    ``name``, ``address``, or ``text``
diff --git a/faker/utils/loading.py b/faker/utils/loading.py
index 40e4b5dae3..d9b81a7c56 100644
--- 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):

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'
```


