Skip to content

Commit

Permalink
Fix docsting formatting indentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Tathorack committed Feb 11, 2018
1 parent a6a0bf6 commit 053d029
Show file tree
Hide file tree
Showing 2 changed files with 91 additions and 79 deletions.
131 changes: 70 additions & 61 deletions imagecolor/average.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,25 +42,27 @@ def core_average(image, downsample=True, max_size=100, alpha_threshold=245):
Parameters
----------
image : str
A filename, pathlib.Path object or a file object.
downsample : bool, optional
if downsampling is enabled to speed up iteration.
max_size : int, optional
max length of longest side if downsample == True.
alpha_threshold : int, optional
level at which transparent pixels are excluded.
image : str
A filename, pathlib.Path object or a file object.
downsample : bool, optional
if downsampling is enabled to speed up iteration.
max_size : int, optional
max length of longest side if downsample == True.
alpha_threshold : int, optional
level at which transparent pixels are excluded.
Returns
-------
dict
A dictionary with the following keys: red, green, blue.
dict
A dictionary with the following keys: red, green, blue.
Raises
------
IOError
If the file cannot be found, or the image cannot be
opened and identified.
ImageAveragingError
If the image could not be averaged.
IOError
If the file cannot be found, or the image cannot be
opened and identified.
ImageAveragingError
If the image could not be averaged.
"""
LOGGER.debug("core_average called")
Expand Down Expand Up @@ -115,29 +117,31 @@ def file_average(image, name=None, downsample=True,
Parameters
----------
image : str
A filename, pathlib.Path object or a file object.
name : str, optional
auto generated from path unless set.
downsample : bool, optional
if downsampling is enabled to speed up iteration.
max_size : int, optional
max length of longest side if downsample == True.
alpha_threshold : int, optional
level at which transparent pixels are excluded.
image : str
A filename, pathlib.Path object or a file object.
name : str, optional
auto generated from path unless set.
downsample : bool, optional
if downsampling is enabled to speed up iteration.
max_size : int, optional
max length of longest side if downsample == True.
alpha_threshold : int, optional
level at which transparent pixels are excluded.
Returns
-------
dict
A dictionary with the following keys: name, red, green, blue.
dict
A dictionary with the following keys: name, red, green, blue.
Raises
------
AttributeError
If name is not passed in and cannot be set from filepath.
IOError
If the file cannot be found, or the image cannot be
opened and identified.
ImageAveragingError
If the image could not be averaged.
AttributeError
If name is not passed in and cannot be set from filepath.
IOError
If the file cannot be found, or the image cannot be
opened and identified.
ImageAveragingError
If the image could not be averaged.
"""
if name is None:
Expand All @@ -160,20 +164,22 @@ def directory_average(path, image_formats=('jpeg', 'png')):
Parameters
----------
path : str
Path to directory.
image_formats : touple of str, optional
touple of image formats used by imghdr to determine what types
of images to average. Defaults: ('jpeg', 'png')
path : str
Path to directory.
image_formats : touple of str, optional
touple of image formats used by imghdr to determine what types
of images to average. Defaults: ('jpeg', 'png')
Returns
-------
list
For each image averaged, returns a list of dictionaries
each with the following keys: name, red, green, blue.
list
For each image averaged, returns a list of dictionaries
each with the following keys: name, red, green, blue.
Raises
------
ImageAveragingError
If no images were averaged successfully.
ImageAveragingError
If no images were averaged successfully.
"""
images = _images_from_dir(path, image_formats=image_formats)
Expand Down Expand Up @@ -211,19 +217,21 @@ def single_directory_average(path, image_formats=('jpeg', 'png')):
Parameters
----------
path : str
Path to directory.
image_formats : touple of str, optional
touple of image formats used by imghdr to determine what types
of images to average. Defaults: ('jpeg', 'png')
path : str
Path to directory.
image_formats : touple of str, optional
touple of image formats used by imghdr to determine what types
of images to average. Defaults: ('jpeg', 'png')
Returns
-------
dict
A dictionary with the following keys: name, red, green, blue.
dict
A dictionary with the following keys: name, red, green, blue.
Raises
------
DirectoryAveragingError
If the directory could not be averaged.
DirectoryAveragingError
If the directory could not be averaged.
"""
name = os.path.abspath(path).split(os.sep)[-1]
Expand Down Expand Up @@ -257,16 +265,17 @@ def nested_directory_average(path, image_formats=('jpeg', 'png')):
Parameters
----------
path : str
path to directory
image_formats : touple of str, optional
touple of image formats used by imghdr to determine what types
of images to average. Defaults: ('jpeg', 'png')
path : str
path to directory
image_formats : touple of str, optional
touple of image formats used by imghdr to determine what types
of images to average. Defaults: ('jpeg', 'png')
Returns
-------
list
For each directory averaged, returns a list of dictionaries
each with the following keys: name, red, green, blue.
list
For each directory averaged, returns a list of dictionaries
each with the following keys: name, red, green, blue.
"""
filtered_paths = _directories_with_images(
Expand Down
39 changes: 21 additions & 18 deletions imagecolor/loadsave.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,13 @@ def results_line(results):
Parameters
----------
results : list
a list of imagecolor results
results : list
a list of imagecolor results
Returns
-------
PIL.Image.object
linear image containing the results
PIL.Image.object
linear image containing the results
"""
if not results:
Expand All @@ -71,14 +72,15 @@ def results_rectangle(results, aspectratio=(3, 2)):
Parameters
----------
results : list
a list of imagecolor results.
aspectratio : tuple of int
the aspect ratio of the image being created. Format (3, 2)
results : list
a list of imagecolor results.
aspectratio : tuple of int
the aspect ratio of the image being created. Format (3, 2)
Returns
-------
PIL.Image.object
rectangular image containing the results.
PIL.Image.object
rectangular image containing the results.
"""
if not results:
Expand Down Expand Up @@ -110,10 +112,10 @@ def results_save_csv(results, path):
Parameters
----------
results : list
a list of imagecolor results.
path : str
the path to the file to be created.
results : list
a list of imagecolor results.
path : str
the path to the file to be created.
"""
if not results:
Expand All @@ -138,12 +140,13 @@ def results_load_csv(path):
Parameters
----------
path : str
the path to the file to be loaded.
path : str
the path to the file to be loaded.
Returns
-------
list
a list of imagecolor results.
list
a list of imagecolor results.
"""
results = []
Expand Down

0 comments on commit 053d029

Please sign in to comment.