Fix docstrings over 80 characters
This commit is contained in:
		
							parent
							
								
									467d5a2626
								
							
						
					
					
						commit
						8793d9ff41
					
				
					 4 changed files with 20 additions and 50 deletions
				
			
		|  | @ -32,8 +32,8 @@ def album_zip_directories(album, recursive=True): | |||
|      | ||||
| def album_zip_filenames(album, recursive=True): | ||||
|     ''' | ||||
|     Given an album, produce a dictionary mapping local filepaths to the filenames | ||||
|     that will appear inside the zip archive. | ||||
|     Given an album, produce a dictionary mapping local filepaths to the | ||||
|     filenames that will appear inside the zip archive. | ||||
|     This includes creating subfolders for sub albums. | ||||
| 
 | ||||
|     If a photo appears in multiple albums, only the first is used. | ||||
|  | @ -141,7 +141,7 @@ def comma_split(s): | |||
| 
 | ||||
| def dict_to_params(d): | ||||
|     ''' | ||||
|     Given a dictionary representing URL parameters, return a URL parameter string. | ||||
|     Given a dictionary of URL parameters, return a URL parameter string. | ||||
| 
 | ||||
|     {'a':1, 'b':2} => ?a=1&b=2 | ||||
|     ''' | ||||
|  | @ -168,7 +168,8 @@ def fit_into_bounds(image_width, image_height, frame_width, frame_height): | |||
| 
 | ||||
| def get_mimetype(filepath): | ||||
|     ''' | ||||
|     Extension to mimetypes.guess_type which uses my constants.ADDITIONAL_MIMETYPES. | ||||
|     Extension to mimetypes.guess_type which uses my | ||||
|     constants.ADDITIONAL_MIMETYPES. | ||||
|     ''' | ||||
|     extension = os.path.splitext(filepath)[1].replace('.', '') | ||||
|     if extension in constants.ADDITIONAL_MIMETYPES: | ||||
|  |  | |||
|  | @ -526,7 +526,7 @@ class Photo(ObjectBase): | |||
|     def generate_thumbnail(self, *, commit=True, **special): | ||||
|         ''' | ||||
|         special: | ||||
|             For videos, you can provide a `timestamp` to take the thumbnail from. | ||||
|             For videos, you can provide a `timestamp` to take the thumbnail at. | ||||
|         ''' | ||||
|         if not self.photodb.config['enable_photo_generate_thumbnail']: | ||||
|             raise exceptions.FeatureDisabled('photo.generate_thumbnail') | ||||
|  | @ -875,9 +875,9 @@ class Tag(ObjectBase, GroupableMixin): | |||
| 
 | ||||
|     def convert_to_synonym(self, mastertag, *, commit=True): | ||||
|         ''' | ||||
|         Convert an independent tag into a synonym for a different independent tag. | ||||
|         All photos which possess the current tag will have it replaced | ||||
|         with the new master tag. | ||||
|         Convert this tag into a synonym for a different tag. | ||||
|         All photos which possess the current tag will have it replaced with the | ||||
|         new master tag. | ||||
|         All synonyms of the old tag will point to the new tag. | ||||
| 
 | ||||
|         Good for when two tags need to be merged under a single name. | ||||
|  |  | |||
|  | @ -257,7 +257,8 @@ class PDBAlbumMixin: | |||
| 
 | ||||
|     def get_album_by_path(self, filepath): | ||||
|         ''' | ||||
|         Return the album with the `associated_directory` of this value, NOT case-sensitive. | ||||
|         Return the album with the `associated_directory` of this value, | ||||
|         NOT case-sensitive. | ||||
|         ''' | ||||
|         filepath = os.path.abspath(filepath) | ||||
|         cur = self.sql.cursor() | ||||
|  | @ -434,11 +435,11 @@ class PDBPhotoMixin: | |||
|             tags=None, | ||||
|         ): | ||||
|         ''' | ||||
|         Given a filepath, determine its attributes and create a new Photo object in the | ||||
|         database. Tags may be applied now or later. | ||||
|         Given a filepath, determine its attributes and create a new Photo object | ||||
|         in the database. Tags may be applied now or later. | ||||
| 
 | ||||
|         If `allow_duplicates` is False, we will first check the database for any files | ||||
|         with the same path and raise exceptions.PhotoExists if found. | ||||
|         If `allow_duplicates` is False, we will first check the database for any | ||||
|         files with the same path and raise exceptions.PhotoExists if found. | ||||
| 
 | ||||
|         Returns the Photo object. | ||||
|         ''' | ||||
|  | @ -1108,41 +1109,6 @@ class PDBUserMixin: | |||
| 
 | ||||
| 
 | ||||
| class PhotoDB(PDBAlbumMixin, PDBBookmarkMixin, PDBPhotoMixin, PDBTagMixin, PDBUserMixin): | ||||
|     ''' | ||||
|     This class represents an SQLite3 database containing the following tables: | ||||
| 
 | ||||
|     albums: | ||||
|         Rows represent the inclusion of a photo in an album | ||||
| 
 | ||||
|     photos: | ||||
|         Rows represent image files on the local disk. | ||||
|         Entries contain a unique ID, the image's filepath, and metadata | ||||
|         like dimensions and filesize. | ||||
| 
 | ||||
|     tags: | ||||
|         Rows represent labels, which can be applied to an arbitrary number of | ||||
|         photos. Photos may be selected by which tags they contain. | ||||
|         Entries contain a unique ID and a name. | ||||
| 
 | ||||
|     photo_tag_rel: | ||||
|         Rows represent a Photo's ownership of a particular Tag. | ||||
| 
 | ||||
|     tag_synonyms: | ||||
|         Rows represent relationships between two tag names, so that they both | ||||
|         resolve to the same Tag object when selected. Entries contain the | ||||
|         subordinate name and master name. | ||||
|         The master name MUST also exist in the `tags` table. | ||||
|         If a new synonym is created referring to another synoym, the master name | ||||
|         will be resolved and used instead, so a synonym never points to another synonym. | ||||
|         Tag objects will ALWAYS represent the master tag. | ||||
| 
 | ||||
|         Note that the entries in this table do not contain ID numbers. | ||||
|         The rationale here is that "coco" is a synonym for "chocolate" regardless | ||||
|         of the "chocolate" tag's ID, and that if a tag is renamed, its synonyms | ||||
|         do not necessarily follow. | ||||
|         The `rename` method of Tag objects includes a parameter | ||||
|         `apply_to_synonyms` if you do want them to follow. | ||||
|     ''' | ||||
|     def __init__( | ||||
|             self, | ||||
|             data_directory=None, | ||||
|  | @ -1229,7 +1195,8 @@ class PhotoDB(PDBAlbumMixin, PDBBookmarkMixin, PDBPhotoMixin, PDBTagMixin, PDBUs | |||
|         ''' | ||||
|         Create an album, and add the directory's contents to it recursively. | ||||
| 
 | ||||
|         If a Photo object already exists for a file, it will be added to the correct album. | ||||
|         If a Photo object already exists for a file, it will be added to the | ||||
|         correct album. | ||||
|         ''' | ||||
|         if not os.path.isdir(directory): | ||||
|             raise ValueError('Not a directory: %s' % directory) | ||||
|  |  | |||
|  | @ -50,7 +50,9 @@ def minmax(key, value, minimums, maximums, warning_bag=None): | |||
|     ''' | ||||
|     Dissects a hyphenated range string and inserts the correct k:v pair into | ||||
|     both minimums and maximums. | ||||
|     ('area', '100-200', {}, {}) --> {'area': 100}, {'area': 200} (MODIFIED IN PLACE) | ||||
|     ('area', '100-200', {}, {}) | ||||
|     --> | ||||
|     {'area': 100}, {'area': 200} (MODIFIED IN PLACE) | ||||
|     ''' | ||||
|     if value is None: | ||||
|         return | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue