Rearrange imports so voussoirkit is right after lib imports.
Added a styleguide.md file to refer back to. Since voussoirkit is a library it feels better to have it below the rest of the library and above the local project imports.
This commit is contained in:
		
							parent
							
								
									6d3ab0f1ee
								
							
						
					
					
						commit
						dbdd509cd2
					
				
					 14 changed files with 67 additions and 44 deletions
				
			
		|  | @ -1,7 +1,6 @@ | ||||||
| ''' | ''' | ||||||
| This file provides data and objects that do not change throughout the runtime. | This file provides data and objects that do not change throughout the runtime. | ||||||
| ''' | ''' | ||||||
| 
 |  | ||||||
| import converter | import converter | ||||||
| import logging | import logging | ||||||
| import shutil | import shutil | ||||||
|  |  | ||||||
|  | @ -2,7 +2,6 @@ | ||||||
| This file provides functions which are used in various places throughout the | This file provides functions which are used in various places throughout the | ||||||
| codebase but don't deserve to be methods of any class. | codebase but don't deserve to be methods of any class. | ||||||
| ''' | ''' | ||||||
| 
 |  | ||||||
| import datetime | import datetime | ||||||
| import hashlib | import hashlib | ||||||
| import math | import math | ||||||
|  | @ -12,12 +11,12 @@ import PIL.Image | ||||||
| import unicodedata | import unicodedata | ||||||
| import zipstream | import zipstream | ||||||
| 
 | 
 | ||||||
| from . import constants |  | ||||||
| from . import exceptions |  | ||||||
| 
 |  | ||||||
| from voussoirkit import bytestring | from voussoirkit import bytestring | ||||||
| from voussoirkit import pathclass | from voussoirkit import pathclass | ||||||
| 
 | 
 | ||||||
|  | from . import constants | ||||||
|  | from . import exceptions | ||||||
|  | 
 | ||||||
| def album_as_directory_map(album, recursive=True): | def album_as_directory_map(album, recursive=True): | ||||||
|     ''' |     ''' | ||||||
|     Given an album, produce a dictionary mapping Album objects to directory |     Given an album, produce a dictionary mapping Album objects to directory | ||||||
|  | @ -499,11 +498,12 @@ def truthystring(s): | ||||||
| def zip_album(album, recursive=True): | def zip_album(album, recursive=True): | ||||||
|     ''' |     ''' | ||||||
|     Given an album, return a zipstream zipfile that contains the album's |     Given an album, return a zipstream zipfile that contains the album's | ||||||
|     photos (recursive = include childen's photos) organized into folders |     photos (recursive = include children's photos) organized into folders | ||||||
|     for each album. Each album folder also gets a text file containing |     for each album. Each album folder also gets a text file containing | ||||||
|     the album's name and description if applicable. |     the album's name and description if applicable. | ||||||
| 
 | 
 | ||||||
|     If an album is a child of multiple albums, only one instance is used. |     If an album is a child of multiple albums, only one instance is used. | ||||||
|  |     If a photo appears in multiple albums, only one instance is used. | ||||||
|     ''' |     ''' | ||||||
|     zipfile = zipstream.ZipFile() |     zipfile = zipstream.ZipFile() | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -2,21 +2,20 @@ | ||||||
| This file provides the data objects that should not be instantiated directly, | This file provides the data objects that should not be instantiated directly, | ||||||
| but are returned by the PDB accesses. | but are returned by the PDB accesses. | ||||||
| ''' | ''' | ||||||
| 
 |  | ||||||
| import os | import os | ||||||
| import PIL.Image | import PIL.Image | ||||||
| import string | import string | ||||||
| import traceback | import traceback | ||||||
| 
 | 
 | ||||||
|  | from voussoirkit import bytestring | ||||||
|  | from voussoirkit import pathclass | ||||||
|  | from voussoirkit import spinal | ||||||
|  | 
 | ||||||
| from . import constants | from . import constants | ||||||
| from . import decorators | from . import decorators | ||||||
| from . import exceptions | from . import exceptions | ||||||
| from . import helpers | from . import helpers | ||||||
| 
 | 
 | ||||||
| from voussoirkit import bytestring |  | ||||||
| from voussoirkit import pathclass |  | ||||||
| from voussoirkit import spinal |  | ||||||
| 
 |  | ||||||
| 
 | 
 | ||||||
| class ObjectBase: | class ObjectBase: | ||||||
|     def __init__(self, photodb): |     def __init__(self, photodb): | ||||||
|  |  | ||||||
|  | @ -9,6 +9,13 @@ import string | ||||||
| import tempfile | import tempfile | ||||||
| import time | import time | ||||||
| 
 | 
 | ||||||
|  | from voussoirkit import cacheclass | ||||||
|  | from voussoirkit import expressionmatch | ||||||
|  | from voussoirkit import pathclass | ||||||
|  | from voussoirkit import ratelimiter | ||||||
|  | from voussoirkit import spinal | ||||||
|  | from voussoirkit import sqlhelpers | ||||||
|  | 
 | ||||||
| from . import constants | from . import constants | ||||||
| from . import decorators | from . import decorators | ||||||
| from . import exceptions | from . import exceptions | ||||||
|  | @ -17,13 +24,6 @@ from . import objects | ||||||
| from . import searchhelpers | from . import searchhelpers | ||||||
| from . import tag_export | from . import tag_export | ||||||
| 
 | 
 | ||||||
| from voussoirkit import cacheclass |  | ||||||
| from voussoirkit import expressionmatch |  | ||||||
| from voussoirkit import pathclass |  | ||||||
| from voussoirkit import ratelimiter |  | ||||||
| from voussoirkit import spinal |  | ||||||
| from voussoirkit import sqlhelpers |  | ||||||
| 
 |  | ||||||
| 
 | 
 | ||||||
| logging.basicConfig() | logging.basicConfig() | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -3,7 +3,6 @@ This file provides helper functions used to normalize the arguments that | ||||||
| go into search queries. Mainly converting the strings given by the user | go into search queries. Mainly converting the strings given by the user | ||||||
| into proper data types. | into proper data types. | ||||||
| ''' | ''' | ||||||
| 
 |  | ||||||
| from . import constants | from . import constants | ||||||
| from . import exceptions | from . import exceptions | ||||||
| from . import helpers | from . import helpers | ||||||
|  |  | ||||||
|  | @ -3,11 +3,11 @@ import functools | ||||||
| import hashlib | import hashlib | ||||||
| import time | import time | ||||||
| 
 | 
 | ||||||
| import etiquette |  | ||||||
| 
 |  | ||||||
| from voussoirkit import cacheclass | from voussoirkit import cacheclass | ||||||
| from voussoirkit import pathclass | from voussoirkit import pathclass | ||||||
| 
 | 
 | ||||||
|  | import etiquette | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
| def cached_endpoint(max_age): | def cached_endpoint(max_age): | ||||||
|     ''' |     ''' | ||||||
|  |  | ||||||
|  | @ -3,11 +3,11 @@ import os | ||||||
| import mimetypes | import mimetypes | ||||||
| import traceback | import traceback | ||||||
| 
 | 
 | ||||||
| import etiquette |  | ||||||
| 
 |  | ||||||
| from voussoirkit import bytestring | from voussoirkit import bytestring | ||||||
| from voussoirkit import pathclass | from voussoirkit import pathclass | ||||||
| 
 | 
 | ||||||
|  | import etiquette | ||||||
|  | 
 | ||||||
| from . import caching | from . import caching | ||||||
| from . import jinja_filters | from . import jinja_filters | ||||||
| from . import jsonify | from . import jsonify | ||||||
|  |  | ||||||
|  | @ -3,10 +3,10 @@ import json | ||||||
| import traceback | import traceback | ||||||
| import urllib.parse | import urllib.parse | ||||||
| 
 | 
 | ||||||
| import etiquette |  | ||||||
| 
 |  | ||||||
| from voussoirkit import cacheclass | from voussoirkit import cacheclass | ||||||
| 
 | 
 | ||||||
|  | import etiquette | ||||||
|  | 
 | ||||||
| from .. import common | from .. import common | ||||||
| from .. import decorators | from .. import decorators | ||||||
| from .. import helpers | from .. import helpers | ||||||
|  |  | ||||||
|  | @ -1,10 +1,10 @@ | ||||||
| import datetime | import datetime | ||||||
| import jinja2.filters | import jinja2.filters | ||||||
| 
 | 
 | ||||||
| import etiquette |  | ||||||
| 
 |  | ||||||
| import voussoirkit.bytestring | import voussoirkit.bytestring | ||||||
| 
 | 
 | ||||||
|  | import etiquette | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
| def bytestring(x): | def bytestring(x): | ||||||
|     try: |     try: | ||||||
|  |  | ||||||
|  | @ -4,10 +4,10 @@ import math | ||||||
| import os | import os | ||||||
| import werkzeug.wrappers | import werkzeug.wrappers | ||||||
| 
 | 
 | ||||||
| import etiquette |  | ||||||
| 
 |  | ||||||
| from voussoirkit import cacheclass | from voussoirkit import cacheclass | ||||||
| 
 | 
 | ||||||
|  | import etiquette | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
| SESSION_MAX_AGE = 86400 | SESSION_MAX_AGE = 86400 | ||||||
| REQUEST_TYPES = (flask.Request, werkzeug.wrappers.Request, werkzeug.local.LocalProxy) | REQUEST_TYPES = (flask.Request, werkzeug.wrappers.Request, werkzeug.local.LocalProxy) | ||||||
|  |  | ||||||
|  | @ -5,9 +5,9 @@ If you are using Gunicorn, for example: | ||||||
| gunicorn etiquette_flask_entrypoint:site --bind "0.0.0.0:PORT" --access-logfile "-" | gunicorn etiquette_flask_entrypoint:site --bind "0.0.0.0:PORT" --access-logfile "-" | ||||||
| ''' | ''' | ||||||
| import sys | import sys | ||||||
|  | import werkzeug.contrib.fixers | ||||||
| 
 | 
 | ||||||
| import etiquette_flask | import etiquette_flask | ||||||
| import werkzeug.contrib.fixers |  | ||||||
| 
 | 
 | ||||||
| etiquette_flask.site.wsgi_app = werkzeug.contrib.fixers.ProxyFix(etiquette_flask.site.wsgi_app) | etiquette_flask.site.wsgi_app = werkzeug.contrib.fixers.ProxyFix(etiquette_flask.site.wsgi_app) | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -12,8 +12,8 @@ log_format = '{levelname}:etiquette.{module}.{funcName}: {message}' | ||||||
| handler.setFormatter(logging.Formatter(log_format, style='{')) | handler.setFormatter(logging.Formatter(log_format, style='{')) | ||||||
| logging.getLogger().addHandler(handler) | logging.getLogger().addHandler(handler) | ||||||
| 
 | 
 | ||||||
| import gevent.pywsgi |  | ||||||
| import argparse | import argparse | ||||||
|  | import gevent.pywsgi | ||||||
| import sys | import sys | ||||||
| 
 | 
 | ||||||
| import etiquette_flask_entrypoint | import etiquette_flask_entrypoint | ||||||
|  |  | ||||||
|  | @ -1,16 +1,3 @@ | ||||||
| /* |  | ||||||
| Organization: |  | ||||||
| { |  | ||||||
|     own grid area name |  | ||||||
|     display, flexing, gridding |  | ||||||
|     positioning and alignment |  | ||||||
|     bounding box (width, margin, overflow, ...) |  | ||||||
|     borders and shadows |  | ||||||
|     backgrounds |  | ||||||
|     foregrounds |  | ||||||
|     misc |  | ||||||
| } |  | ||||||
| */ |  | ||||||
| :root | :root | ||||||
| { | { | ||||||
|     --color_site_theme: #00d8f4; |     --color_site_theme: #00d8f4; | ||||||
|  |  | ||||||
							
								
								
									
										39
									
								
								styleguide.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										39
									
								
								styleguide.md
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,39 @@ | ||||||
|  | Etiquette styleguide | ||||||
|  | ==================== | ||||||
|  | 
 | ||||||
|  | ## Python | ||||||
|  | 
 | ||||||
|  | ### imports | ||||||
|  | 
 | ||||||
|  | ```Python | ||||||
|  | ''' | ||||||
|  | docstring | ||||||
|  | ''' | ||||||
|  | library imports | ||||||
|  | 
 | ||||||
|  | voussoirkit imports | ||||||
|  | 
 | ||||||
|  | etiquette imports | ||||||
|  | 
 | ||||||
|  | local folder imports | ||||||
|  | 
 | ||||||
|  | dot imports | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | # code | ||||||
|  | ``` | ||||||
|  | 
 | ||||||
|  | ## CSS | ||||||
|  | 
 | ||||||
|  | ```css | ||||||
|  | { | ||||||
|  |     own grid area name | ||||||
|  |     display, flexing, gridding | ||||||
|  |     positioning and alignment | ||||||
|  |     bounding box (width, margin, overflow, ...) | ||||||
|  |     borders and shadows | ||||||
|  |     backgrounds | ||||||
|  |     foregrounds | ||||||
|  |     misc | ||||||
|  | } | ||||||
|  | ``` | ||||||
		Loading…
	
		Reference in a new issue