Reblack
Committed 16abeb
--- a/tests/test_indieweb.py
+++ b/tests/test_indieweb.py
# import pytest
import requests
import web
+
# from PIL import ImageGrab
from selenium import webdriver
from selenium.webdriver.common.by import By
--- a/web/__init__.py
+++ b/web/__init__.py
from .framework import * # noqa
from .markdown import render as mkdn
from .response import Status # noqa
-from .response import (OK, Accepted, BadRequest, Conflict, Created, Forbidden,
- Found, Gone, MethodNotAllowed, MovedPermanently,
- MultiStatus, NoContent, NotFound, PermanentRedirect,
- SeeOther, Unauthorized)
+from .response import (
+ OK,
+ Accepted,
+ BadRequest,
+ Conflict,
+ Created,
+ Forbidden,
+ Found,
+ Gone,
+ MethodNotAllowed,
+ MovedPermanently,
+ MultiStatus,
+ NoContent,
+ NotFound,
+ PermanentRedirect,
+ SeeOther,
+ Unauthorized,
+)
from .templating import template, templates
__all__ = [
--- a/web/framework/__init__.py
+++ b/web/framework/__init__.py
import pendulum
import pkg_resources
import sqlyte
+
# import errno
import toml
import unidecode
from .. import templating
from ..response import Status # noqa
-from ..response import (OK, Accepted, BadRequest, Conflict, Created, Forbidden,
- Found, Gone, MethodNotAllowed, MovedPermanently,
- MultiStatus, NoContent, NotFound, PermanentRedirect,
- SeeOther, Subscription, Unauthorized)
+from ..response import (
+ OK,
+ Accepted,
+ BadRequest,
+ Conflict,
+ Created,
+ Forbidden,
+ Found,
+ Gone,
+ MethodNotAllowed,
+ MovedPermanently,
+ MultiStatus,
+ NoContent,
+ NotFound,
+ PermanentRedirect,
+ SeeOther,
+ Subscription,
+ Unauthorized,
+)
from ..util import dump, load
from .letsencrypt import generate_cert
from .passphrases import generate_passphrase, verify_passphrase
# TODO metaclass for `__repr__` -- see `app.controllers`
class Route(controller, Resource):
-
__doc__ = controller.__doc__
__web__ = path_template, templates, self
handler = controller
--- a/web/framework/util.py
+++ b/web/framework/util.py
class Context(local.local):
-
# TODO still needed?
def __iter__(self):
class User(Context):
-
# TODO cookie/session
def _contextualize(self, environ):
class Transaction:
-
host = Host()
user = User()
request = Request()
--- a/web/markdown/__init__.py
+++ b/web/markdown/__init__.py
class StrongEm(Inline):
-
# pattern = r"""\*{3}([\w\s\-.,'"]+)\*{3}"""
pattern = r"""\*{3}(.+?)\*{3}"""
class Strong(Inline):
-
# pattern = r"""\*{2}([\w\s\-.,'"]+)\*{2}"""
pattern = r"""\*{2}(.+?)\*{2}"""
class Em(Inline):
-
# pattern = r"""\*([\w\s\-.,'"]+)\*"""
pattern = r"""\*(.+?)\*"""
class Small(Inline):
-
# pattern = r"""~([\w\s\-/<>%!.,'"]+)~"""
pattern = r"""(?s)~(.+?)~"""
class Code(Inline):
-
pattern = r"""(?s)`(.+?)`"""
def parse(self, match):
class Ampersand(Inline):
-
pattern = r" %!amp!% "
def parse(self, match):
class Copyright(Inline):
-
pattern = r" \(c\) "
def parse(self, match):
class Ellipsis(Inline):
-
pattern = r"\.\.\."
def parse(self, match):
class QuotationDash(Inline):
-
pattern = r"^---"
def parse(self, match):
class DblEmDash(Inline):
-
pattern = r"----"
def parse(self, match):
class EmDash(Inline):
-
pattern = r"---"
def parse(self, match):
class InnerEmDash(Inline):
-
pattern = r" --- "
def parse(self, match):
class EnDash(Inline):
-
pattern = r"--"
def parse(self, match):
class InnerEnDash(Inline):
-
pattern = r" -- "
def parse(self, match):
class LigatureAE(Inline):
-
pattern = r"(?i)(ae)"
def parse(self, match):
class Heart(Inline):
-
pattern = r" <3 "
def parse(self, match):
--- a/web/slrzd.py
+++ b/web/slrzd.py
import pygments.style
from lxml.html import builder
from pygments.token import Literal # Token
-from pygments.token import (Comment, Error, Generic, Keyword, Name, Number,
- Operator, Other, Punctuation, String, Text,
- Whitespace)
+from pygments.token import (
+ Comment,
+ Error,
+ Generic,
+ Keyword,
+ Name,
+ Number,
+ Operator,
+ Other,
+ Punctuation,
+ String,
+ Text,
+ Whitespace,
+)
__all__ = ["highlight", "Solar", "Lunar"]
--- a/web/templating/parse.py
+++ b/web/templating/parse.py
class If(Block):
-
pass
class Else(Block):
-
pass
class Elif(Block):
-
pass
--- a/web/templating/templating.py
+++ b/web/templating/templating.py
import pkg_resources
from RestrictedPython import compile_restricted, safe_globals
-from RestrictedPython.Eval import (default_guarded_getitem,
- default_guarded_getiter)
+from RestrictedPython.Eval import default_guarded_getitem, default_guarded_getiter
from RestrictedPython.Guards import safe_builtins
from .. import markdown