Minor fixes & pylint appeasements.
This commit is contained in:
		
							parent
							
								
									e5a316ff9c
								
							
						
					
					
						commit
						1c1e7f158f
					
				
					 11 changed files with 44 additions and 16 deletions
				
			
		|  | @ -1,3 +1,7 @@ | ||||||
|  | ''' | ||||||
|  | This file provides data and objects that do not change throughout the runtime. | ||||||
|  | ''' | ||||||
|  | 
 | ||||||
| import converter | import converter | ||||||
| import logging | import logging | ||||||
| import string | import string | ||||||
|  |  | ||||||
|  | @ -35,6 +35,7 @@ class EtiquetteException(Exception, metaclass=ErrorTypeAdder): | ||||||
|     ''' |     ''' | ||||||
|     error_message = '' |     error_message = '' | ||||||
|     def __init__(self, *args, **kwargs): |     def __init__(self, *args, **kwargs): | ||||||
|  |         super().__init__() | ||||||
|         self.given_args = args |         self.given_args = args | ||||||
|         self.given_kwargs = kwargs |         self.given_kwargs = kwargs | ||||||
|         self.error_message = self.error_message.format(*args, **kwargs) |         self.error_message = self.error_message.format(*args, **kwargs) | ||||||
|  |  | ||||||
|  | @ -1,3 +1,8 @@ | ||||||
|  | ''' | ||||||
|  | This file provides functions which are used in various places throughout the | ||||||
|  | codebase but don't deserve to be methods of any class. | ||||||
|  | ''' | ||||||
|  | 
 | ||||||
| import datetime | import datetime | ||||||
| import math | import math | ||||||
| import mimetypes | import mimetypes | ||||||
|  |  | ||||||
|  | @ -1,5 +1,7 @@ | ||||||
| import json | ''' | ||||||
| 
 | This file provides functions that convert the Etiquette objects into | ||||||
|  | dictionaries suitable for JSON serializing. | ||||||
|  | ''' | ||||||
| 
 | 
 | ||||||
| def album(a, minimal=False): | def album(a, minimal=False): | ||||||
|     j = { |     j = { | ||||||
|  |  | ||||||
|  | @ -1,3 +1,8 @@ | ||||||
|  | ''' | ||||||
|  | This file provides the data objects that should not be instantiated directly, | ||||||
|  | but are returned by the PDB accesses. | ||||||
|  | ''' | ||||||
|  | 
 | ||||||
| import os | import os | ||||||
| import PIL.Image | import PIL.Image | ||||||
| import traceback | import traceback | ||||||
|  | @ -623,7 +628,7 @@ class Photo(ObjectBase): | ||||||
|             'id': self.id, |             'id': self.id, | ||||||
|             'tagged_at': helpers.now(), |             'tagged_at': helpers.now(), | ||||||
|         } |         } | ||||||
|         self.photodb.sql_update(table='photos', data=data, where_key='id', commit=False) |         self.photodb.sql_update(table='photos', pairs=data, where_key='id', commit=False) | ||||||
| 
 | 
 | ||||||
|         if commit: |         if commit: | ||||||
|             self.photodb.log.debug('Committing - add photo tag') |             self.photodb.log.debug('Committing - add photo tag') | ||||||
|  | @ -859,7 +864,7 @@ class Photo(ObjectBase): | ||||||
|                     self.duration = probe.format.duration or probe.video.duration |                     self.duration = probe.format.duration or probe.video.duration | ||||||
|                     self.width = probe.video.video_width |                     self.width = probe.video.video_width | ||||||
|                     self.height = probe.video.video_height |                     self.height = probe.video.video_height | ||||||
|             except: |             except Exception: | ||||||
|                 traceback.print_exc() |                 traceback.print_exc() | ||||||
| 
 | 
 | ||||||
|         elif self.simple_mimetype == 'audio' and constants.ffmpeg: |         elif self.simple_mimetype == 'audio' and constants.ffmpeg: | ||||||
|  | @ -867,7 +872,7 @@ class Photo(ObjectBase): | ||||||
|                 probe = constants.ffmpeg.probe(self.real_filepath) |                 probe = constants.ffmpeg.probe(self.real_filepath) | ||||||
|                 if probe and probe.audio: |                 if probe and probe.audio: | ||||||
|                     self.duration = probe.audio.duration |                     self.duration = probe.audio.duration | ||||||
|             except: |             except Exception: | ||||||
|                 traceback.print_exc() |                 traceback.print_exc() | ||||||
| 
 | 
 | ||||||
|         if self.width and self.height: |         if self.width and self.height: | ||||||
|  |  | ||||||
|  | @ -1,3 +1,9 @@ | ||||||
|  | ''' | ||||||
|  | This function provides helper functions used to normalize the arguments that | ||||||
|  | go into search queries. Mainly converting the strings given by the user | ||||||
|  | into proper data types. | ||||||
|  | ''' | ||||||
|  | 
 | ||||||
| from . import constants | from . import constants | ||||||
| from . import exceptions | from . import exceptions | ||||||
| from . import helpers | from . import helpers | ||||||
|  |  | ||||||
|  | @ -1,3 +1,8 @@ | ||||||
|  | ''' | ||||||
|  | This file provides a variety of functions for exporting a PDB's tags into other | ||||||
|  | formats. Strings, dicts, etc. | ||||||
|  | ''' | ||||||
|  | 
 | ||||||
| def easybake(tags): | def easybake(tags): | ||||||
|     ''' |     ''' | ||||||
|     A string where every line is the qualified name of a tag or its synonyms. |     A string where every line is the qualified name of a tag or its synonyms. | ||||||
|  |  | ||||||
|  | @ -48,7 +48,7 @@ | ||||||
|                 <a href="{{bookmark.url}}" |                 <a href="{{bookmark.url}}" | ||||||
|                 class="bookmark_title" |                 class="bookmark_title" | ||||||
|                 data-editor-id="title" |                 data-editor-id="title" | ||||||
|                 data-editor-placeholer="title" |                 data-editor-placeholder="title" | ||||||
|                 data-editor-empty-text="{{bookmark.id}}"> |                 data-editor-empty-text="{{bookmark.id}}"> | ||||||
|                 {%- if bookmark.title -%} |                 {%- if bookmark.title -%} | ||||||
|                     {{bookmark.title}} |                     {{bookmark.title}} | ||||||
|  |  | ||||||
|  | @ -311,7 +311,7 @@ function refresh_metadata(photoid) | ||||||
| { | { | ||||||
|     var url= "/photo/" + photoid + "/refresh_metadata"; |     var url= "/photo/" + photoid + "/refresh_metadata"; | ||||||
|     var data = new FormData(); |     var data = new FormData(); | ||||||
|     callback = function(){location.reload();}; |     var callback = function(){location.reload();}; | ||||||
|     post(url, data, callback); |     post(url, data, callback); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -162,8 +162,8 @@ form | ||||||
|                 {% if search_kwargs[key] %} |                 {% if search_kwargs[key] %} | ||||||
|                 {% for tagname in search_kwargs[key] %} |                 {% for tagname in search_kwargs[key] %} | ||||||
|                 <li class="search_builder_{{tagtype}}_inputted"> |                 <li class="search_builder_{{tagtype}}_inputted"> | ||||||
|                     <span class="tag_object">{{tagname}}</span><!-- |                     <span class="tag_object">{{tagname}}</span>{{-''-}} | ||||||
|                     --><button class="remove_tag_button red_button" |                     <button class="remove_tag_button red_button" | ||||||
|                     onclick="remove_searchtag(this, '{{tagname}}', inputted_{{tagtype}});"></button> |                     onclick="remove_searchtag(this, '{{tagname}}', inputted_{{tagtype}});"></button> | ||||||
|                 </li> |                 </li> | ||||||
|                 {% endfor %} |                 {% endfor %} | ||||||
|  | @ -252,11 +252,11 @@ form | ||||||
|                     {% do limit_options.sort() %} |                     {% do limit_options.sort() %} | ||||||
|                 {% endif %} |                 {% endif %} | ||||||
|                 {% for limit_option in limit_options %} |                 {% for limit_option in limit_options %} | ||||||
|                 <option |                 <option{{-' '-}} | ||||||
|                 value="{{limit_option}}" |                 value="{{limit_option}}"{{-''-}} | ||||||
|                 {{"selected" if search_kwargs['limit'] == limit_option else ""}} |                 {{-" selected" if search_kwargs['limit'] == limit_option else ""-}} | ||||||
|                 > |                 > | ||||||
|                 {{limit_option}} items |                 {{- limit_option }} items{{-''-}} | ||||||
|                 </option> |                 </option> | ||||||
|                 {% endfor %} |                 {% endfor %} | ||||||
|             </select> |             </select> | ||||||
|  | @ -275,14 +275,14 @@ form | ||||||
|         <span>Tags on this page (click to join query):</span> |         <span>Tags on this page (click to join query):</span> | ||||||
|         <ul> |         <ul> | ||||||
|             {% for tag in total_tags %} |             {% for tag in total_tags %} | ||||||
|             <li>{{tag_object.tag_object( |             <li>{{-tag_object.tag_object( | ||||||
|                 tag, |                 tag, | ||||||
|                 extra_classes="tags_on_this_page", |                 extra_classes="tags_on_this_page", | ||||||
|                 link='void', |                 link='void', | ||||||
|                 qualified_name=False, |                 qualified_name=False, | ||||||
|                 with_alt_qualified_name=True, |                 with_alt_qualified_name=True, | ||||||
|                 with_alt_description=True, |                 with_alt_description=True, | ||||||
|             )}}</li> |             )-}}</li> | ||||||
|             {% endfor %} |             {% endfor %} | ||||||
|         </ul> |         </ul> | ||||||
|         {% endif %} |         {% endif %} | ||||||
|  |  | ||||||
|  | @ -55,7 +55,7 @@ | ||||||
| 
 | 
 | ||||||
| {{' '}}class="tag_object {{extra_classes}}" | {{' '}}class="tag_object {{extra_classes}}" | ||||||
| 
 | 
 | ||||||
| {% set altlines=[] %} | {%- set altlines=[] -%} | ||||||
| {% if with_alt_qualified_name %}{% do altlines.append(tag.qualified_name()) %}{% endif %} | {% if with_alt_qualified_name %}{% do altlines.append(tag.qualified_name()) %}{% endif %} | ||||||
| {% if with_alt_description and tag.description != "" %}{% do altlines.append(tag.description) %}{% endif %} | {% if with_alt_description and tag.description != "" %}{% do altlines.append(tag.description) %}{% endif %} | ||||||
| {% set altlines=altlines|join("\n") %} | {% set altlines=altlines|join("\n") %} | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue