Repository: joke2k/faker

Issue:
Decrease binary dummy length
`fake.binary(length=1048576)` generate too huge binary data but it is useless at docs build time.

I tested two case, 1048576 and 1024.

``` console
(faker) [item4@item4-mbp docs]$ echo "1048576"
1048576
(faker) [item4@item4-mbp docs]$ time make html
sphinx-build -b html -d _build/doctrees   . _build/html
Running Sphinx v1.4.8
loading pickled environment... done
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 61 source files that are out of date
updating environment: 0 added, 61 changed, 0 removed
reading sources... [100%] providers/faker.providers.user_agent
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents... done
writing output... [100%] providers/faker.providers.user_agent
generating indices... genindex
writing additional pages... search
copying static files... WARNING: html_static_path entry '/Users/item4/Projects/faker/docs/_static' does not exist
done
copying extra files... done
dumping search index in English (code: en) ... done
dumping object inventory... done
build succeeded, 1 warning.

Build finished. The HTML pages are in _build/html.

real    3m24.875s
user    3m3.222s
sys 0m10.986s
(faker) [item4@item4-mbp docs]$ echo "1024"
1024
(faker) [item4@item4-mbp docs]$ time make html
sphinx-build -b html -d _build/doctrees   . _build/html
Running Sphinx v1.4.8
loading pickled environment... done
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 61 source files that are out of date
updating environment: 0 added, 61 changed, 0 removed
reading sources... [100%] providers/faker.providers.user_agent
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents... done
writing output... [100%] providers/faker.providers.user_agent
generating indices... genindex
writing additional pages... search
copying static files... WARNING: html_static_path entry '/Users/item4/Projects/faker/docs/_static' does not exist
done
copying extra files... done
dumping search index in English (code: en) ... done
dumping object inventory... done
build succeeded, 1 warning.

Build finished. The HTML pages are in _build/html.

real    0m46.086s
user    0m43.772s
sys 0m1.479s
```

Does docs really need 1048576 length binary?



Discussion:
I agree, does nothing except make docs load really slowly.

Resolving patch:
diff --git a/faker/documentor.py b/faker/documentor.py
--- a/faker/documentor.py
+++ b/faker/documentor.py
@@ -39,12 +39,16 @@ def get_provider_formatters(self, provider, prefix='fake.',
         formatters = {}
 
         for name, method in inspect.getmembers(provider, inspect.ismethod):
-
             # skip 'private' method and inherited methods
             if name.startswith('_') or name in self.already_generated:
                 continue
 
             arguments = []
+            faker_args = []
+            faker_kwargs = {}
+
+            if name == 'binary':
+                faker_kwargs['length'] = 1024
 
             if with_args:
                 # retrieve all parameter
@@ -84,7 +88,7 @@ def get_provider_formatters(self, provider, prefix='fake.',
                                              ", ".join(arguments))
 
             # make a fake example
-            example = self.generator.format(name)
+            example = self.generator.format(name, *faker_args, **faker_kwargs)
 
             formatters[signature] = example
 


Test patch: