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.
|
||||
'''
|
||||
|
||||
import converter
|
||||
import logging
|
||||
import shutil
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
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 hashlib
|
||||
import math
|
||||
|
@ -12,12 +11,12 @@ import PIL.Image
|
|||
import unicodedata
|
||||
import zipstream
|
||||
|
||||
from . import constants
|
||||
from . import exceptions
|
||||
|
||||
from voussoirkit import bytestring
|
||||
from voussoirkit import pathclass
|
||||
|
||||
from . import constants
|
||||
from . import exceptions
|
||||
|
||||
def album_as_directory_map(album, recursive=True):
|
||||
'''
|
||||
Given an album, produce a dictionary mapping Album objects to directory
|
||||
|
@ -499,11 +498,12 @@ def truthystring(s):
|
|||
def zip_album(album, recursive=True):
|
||||
'''
|
||||
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
|
||||
the album's name and description if applicable.
|
||||
|
||||
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()
|
||||
|
||||
|
|
|
@ -2,21 +2,20 @@
|
|||
This file provides the data objects that should not be instantiated directly,
|
||||
but are returned by the PDB accesses.
|
||||
'''
|
||||
|
||||
import os
|
||||
import PIL.Image
|
||||
import string
|
||||
import traceback
|
||||
|
||||
from voussoirkit import bytestring
|
||||
from voussoirkit import pathclass
|
||||
from voussoirkit import spinal
|
||||
|
||||
from . import constants
|
||||
from . import decorators
|
||||
from . import exceptions
|
||||
from . import helpers
|
||||
|
||||
from voussoirkit import bytestring
|
||||
from voussoirkit import pathclass
|
||||
from voussoirkit import spinal
|
||||
|
||||
|
||||
class ObjectBase:
|
||||
def __init__(self, photodb):
|
||||
|
|
|
@ -9,6 +9,13 @@ import string
|
|||
import tempfile
|
||||
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 decorators
|
||||
from . import exceptions
|
||||
|
@ -17,13 +24,6 @@ from . import objects
|
|||
from . import searchhelpers
|
||||
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()
|
||||
|
||||
|
|
|
@ -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
|
||||
into proper data types.
|
||||
'''
|
||||
|
||||
from . import constants
|
||||
from . import exceptions
|
||||
from . import helpers
|
||||
|
|
|
@ -3,11 +3,11 @@ import functools
|
|||
import hashlib
|
||||
import time
|
||||
|
||||
import etiquette
|
||||
|
||||
from voussoirkit import cacheclass
|
||||
from voussoirkit import pathclass
|
||||
|
||||
import etiquette
|
||||
|
||||
|
||||
def cached_endpoint(max_age):
|
||||
'''
|
||||
|
|
|
@ -3,11 +3,11 @@ import os
|
|||
import mimetypes
|
||||
import traceback
|
||||
|
||||
import etiquette
|
||||
|
||||
from voussoirkit import bytestring
|
||||
from voussoirkit import pathclass
|
||||
|
||||
import etiquette
|
||||
|
||||
from . import caching
|
||||
from . import jinja_filters
|
||||
from . import jsonify
|
||||
|
|
|
@ -3,10 +3,10 @@ import json
|
|||
import traceback
|
||||
import urllib.parse
|
||||
|
||||
import etiquette
|
||||
|
||||
from voussoirkit import cacheclass
|
||||
|
||||
import etiquette
|
||||
|
||||
from .. import common
|
||||
from .. import decorators
|
||||
from .. import helpers
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import datetime
|
||||
import jinja2.filters
|
||||
|
||||
import etiquette
|
||||
|
||||
import voussoirkit.bytestring
|
||||
|
||||
import etiquette
|
||||
|
||||
|
||||
def bytestring(x):
|
||||
try:
|
||||
|
|
|
@ -4,10 +4,10 @@ import math
|
|||
import os
|
||||
import werkzeug.wrappers
|
||||
|
||||
import etiquette
|
||||
|
||||
from voussoirkit import cacheclass
|
||||
|
||||
import etiquette
|
||||
|
||||
|
||||
SESSION_MAX_AGE = 86400
|
||||
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 "-"
|
||||
'''
|
||||
import sys
|
||||
import werkzeug.contrib.fixers
|
||||
|
||||
import etiquette_flask
|
||||
import werkzeug.contrib.fixers
|
||||
|
||||
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='{'))
|
||||
logging.getLogger().addHandler(handler)
|
||||
|
||||
import gevent.pywsgi
|
||||
import argparse
|
||||
import gevent.pywsgi
|
||||
import sys
|
||||
|
||||
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
|
||||
{
|
||||
--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