From 609eb5d952a0d96791e82a32ff26edef492ec8df Mon Sep 17 00:00:00 2001 From: Leon Sandøy Date: Fri, 27 Apr 2018 09:41:21 +0200 Subject: Declaring the encoding to be utf-8 is not necessary in Python3 projects, as this is the default encoding. Encoding declarations are only useful in py3 if you want to declare it to be something _other_ than utf-8. This was, however, a very useful convention in py2. (#56) --- pysite/__init__.py | 1 - pysite/base_route.py | 1 - pysite/constants.py | 2 -- pysite/decorators.py | 1 - pysite/logs.py | 1 - pysite/mixins.py | 1 - pysite/route_manager.py | 1 - pysite/rst/__init__.py | 1 - pysite/rst/directives/__init__.py | 1 - pysite/rst/roles.py | 1 - pysite/views/api/__init__.py | 1 - pysite/views/api/bot/hiphopify.py | 1 - pysite/views/api/bot/tags.py | 2 -- pysite/views/api/bot/user.py | 1 - pysite/views/api/error_view.py | 1 - pysite/views/api/healthcheck.py | 1 - pysite/views/api/index.py | 1 - pysite/views/error_handlers/http_4xx.py | 1 - pysite/views/error_handlers/http_5xx.py | 1 - pysite/views/main/__init__.py | 1 - pysite/views/main/abort.py | 1 - pysite/views/main/about/__init__.py | 1 - pysite/views/main/about/index.py | 1 - pysite/views/main/about/partners.py | 1 - pysite/views/main/about/rules.py | 1 - pysite/views/main/error.py | 1 - pysite/views/main/index.py | 1 - pysite/views/main/info/__init__.py | 1 - pysite/views/main/info/help.py | 1 - pysite/views/main/info/index.py | 1 - pysite/views/main/info/jams.py | 1 - pysite/views/main/info/resources.py | 1 - pysite/views/main/redirects/github.py | 1 - pysite/views/main/redirects/invite.py | 1 - pysite/views/main/redirects/stats.py | 1 - pysite/views/main/ws_test.py | 1 - pysite/views/main/ws_test_rst.py | 1 - pysite/views/staff/index.py | 1 - pysite/views/tests/index.py | 2 -- pysite/views/wiki/edit.py | 1 - pysite/views/wiki/history/compare.py | 1 - pysite/views/wiki/history/show.py | 1 - pysite/views/wiki/index.py | 1 - pysite/views/wiki/page.py | 1 - pysite/views/wiki/render.py | 1 - pysite/views/wiki/source.py | 1 - pysite/views/ws/echo.py | 1 - pysite/views/ws/rst.py | 1 - pysite/websockets.py | 1 - 49 files changed, 52 deletions(-) (limited to 'pysite') diff --git a/pysite/__init__.py b/pysite/__init__.py index 93362f6a..98e66630 100644 --- a/pysite/__init__.py +++ b/pysite/__init__.py @@ -1,4 +1,3 @@ -# coding=utf-8 import logging import sys from logging import Logger, StreamHandler diff --git a/pysite/base_route.py b/pysite/base_route.py index 1d30669d..e9df7afe 100644 --- a/pysite/base_route.py +++ b/pysite/base_route.py @@ -1,4 +1,3 @@ -# coding=utf-8 from collections import Iterable from typing import Any diff --git a/pysite/constants.py b/pysite/constants.py index 4eff3606..225550fe 100644 --- a/pysite/constants.py +++ b/pysite/constants.py @@ -1,5 +1,3 @@ -# coding=utf-8 - from enum import Enum, IntEnum from os import environ diff --git a/pysite/decorators.py b/pysite/decorators.py index 0b02ebde..0c31fe6e 100644 --- a/pysite/decorators.py +++ b/pysite/decorators.py @@ -1,4 +1,3 @@ -# coding=utf-8 import os from functools import wraps from json import JSONDecodeError diff --git a/pysite/logs.py b/pysite/logs.py index 301cb98b..e789b1ea 100644 --- a/pysite/logs.py +++ b/pysite/logs.py @@ -1,4 +1,3 @@ -# coding=utf-8 from logging.handlers import SocketHandler diff --git a/pysite/mixins.py b/pysite/mixins.py index 5108a9a1..a3edc4f2 100644 --- a/pysite/mixins.py +++ b/pysite/mixins.py @@ -1,4 +1,3 @@ -# coding=utf-8 from weakref import ref from flask import Blueprint diff --git a/pysite/route_manager.py b/pysite/route_manager.py index e6d2c92c..429a553e 100644 --- a/pysite/route_manager.py +++ b/pysite/route_manager.py @@ -1,4 +1,3 @@ -# coding=utf-8 import importlib import inspect import logging diff --git a/pysite/rst/__init__.py b/pysite/rst/__init__.py index 74f19285..ae79f529 100644 --- a/pysite/rst/__init__.py +++ b/pysite/rst/__init__.py @@ -1,4 +1,3 @@ -# coding=utf-8 import re from docutils.core import publish_parts diff --git a/pysite/rst/directives/__init__.py b/pysite/rst/directives/__init__.py index 9bad5790..e69de29b 100644 --- a/pysite/rst/directives/__init__.py +++ b/pysite/rst/directives/__init__.py @@ -1 +0,0 @@ -# coding=utf-8 diff --git a/pysite/rst/roles.py b/pysite/rst/roles.py index acba31e4..00d12dba 100644 --- a/pysite/rst/roles.py +++ b/pysite/rst/roles.py @@ -1,4 +1,3 @@ -# coding=utf-8 from docutils import nodes from docutils.parsers.rst.roles import set_classes from docutils.parsers.rst.states import Inliner diff --git a/pysite/views/api/__init__.py b/pysite/views/api/__init__.py index 9bad5790..e69de29b 100644 --- a/pysite/views/api/__init__.py +++ b/pysite/views/api/__init__.py @@ -1 +0,0 @@ -# coding=utf-8 diff --git a/pysite/views/api/bot/hiphopify.py b/pysite/views/api/bot/hiphopify.py index 7ebf47e1..bb85d5b5 100644 --- a/pysite/views/api/bot/hiphopify.py +++ b/pysite/views/api/bot/hiphopify.py @@ -1,4 +1,3 @@ -# coding=utf-8 import datetime import logging diff --git a/pysite/views/api/bot/tags.py b/pysite/views/api/bot/tags.py index ee1a1bee..c901347e 100644 --- a/pysite/views/api/bot/tags.py +++ b/pysite/views/api/bot/tags.py @@ -1,5 +1,3 @@ -# coding=utf-8 - from flask import jsonify from schema import Optional, Schema diff --git a/pysite/views/api/bot/user.py b/pysite/views/api/bot/user.py index 3d8d7271..1394e699 100644 --- a/pysite/views/api/bot/user.py +++ b/pysite/views/api/bot/user.py @@ -1,4 +1,3 @@ -# coding=utf-8 import logging from flask import jsonify, request diff --git a/pysite/views/api/error_view.py b/pysite/views/api/error_view.py index 30e133f9..89b4d6ad 100644 --- a/pysite/views/api/error_view.py +++ b/pysite/views/api/error_view.py @@ -1,4 +1,3 @@ -# coding=utf-8 from flask import jsonify from werkzeug.exceptions import HTTPException diff --git a/pysite/views/api/healthcheck.py b/pysite/views/api/healthcheck.py index d57f61fa..c873d674 100644 --- a/pysite/views/api/healthcheck.py +++ b/pysite/views/api/healthcheck.py @@ -1,4 +1,3 @@ -# coding=utf-8 from flask import jsonify from pysite.base_route import APIView diff --git a/pysite/views/api/index.py b/pysite/views/api/index.py index e2bd8fe0..5111162c 100644 --- a/pysite/views/api/index.py +++ b/pysite/views/api/index.py @@ -1,4 +1,3 @@ -# coding=utf-8 from pysite.base_route import APIView from pysite.constants import ErrorCodes diff --git a/pysite/views/error_handlers/http_4xx.py b/pysite/views/error_handlers/http_4xx.py index 2d6c54c6..69c0bdda 100644 --- a/pysite/views/error_handlers/http_4xx.py +++ b/pysite/views/error_handlers/http_4xx.py @@ -1,4 +1,3 @@ -# coding=utf-8 from flask import request from werkzeug.exceptions import HTTPException diff --git a/pysite/views/error_handlers/http_5xx.py b/pysite/views/error_handlers/http_5xx.py index 46c65e38..5a4fbdc2 100644 --- a/pysite/views/error_handlers/http_5xx.py +++ b/pysite/views/error_handlers/http_5xx.py @@ -1,4 +1,3 @@ -# coding=utf-8 from flask import request from werkzeug.exceptions import HTTPException, InternalServerError diff --git a/pysite/views/main/__init__.py b/pysite/views/main/__init__.py index 9bad5790..e69de29b 100644 --- a/pysite/views/main/__init__.py +++ b/pysite/views/main/__init__.py @@ -1 +0,0 @@ -# coding=utf-8 diff --git a/pysite/views/main/abort.py b/pysite/views/main/abort.py index d9e3282f..ecfe8f91 100644 --- a/pysite/views/main/abort.py +++ b/pysite/views/main/abort.py @@ -1,4 +1,3 @@ -# coding=utf-8 from werkzeug.exceptions import InternalServerError from pysite.base_route import RouteView diff --git a/pysite/views/main/about/__init__.py b/pysite/views/main/about/__init__.py index 9bad5790..e69de29b 100644 --- a/pysite/views/main/about/__init__.py +++ b/pysite/views/main/about/__init__.py @@ -1 +0,0 @@ -# coding=utf-8 diff --git a/pysite/views/main/about/index.py b/pysite/views/main/about/index.py index a3fecc31..9f211702 100644 --- a/pysite/views/main/about/index.py +++ b/pysite/views/main/about/index.py @@ -1,4 +1,3 @@ -# coding=utf-8 from pysite.base_route import RouteView diff --git a/pysite/views/main/about/partners.py b/pysite/views/main/about/partners.py index b5e7f587..4fe321a5 100644 --- a/pysite/views/main/about/partners.py +++ b/pysite/views/main/about/partners.py @@ -1,4 +1,3 @@ -# coding=utf-8 import json from logging import getLogger diff --git a/pysite/views/main/about/rules.py b/pysite/views/main/about/rules.py index 805936a8..22e79afa 100644 --- a/pysite/views/main/about/rules.py +++ b/pysite/views/main/about/rules.py @@ -1,4 +1,3 @@ -# coding=utf-8 from pysite.base_route import RouteView diff --git a/pysite/views/main/error.py b/pysite/views/main/error.py index 2e432102..07286eb4 100644 --- a/pysite/views/main/error.py +++ b/pysite/views/main/error.py @@ -1,4 +1,3 @@ -# coding=utf-8 from flask import abort from pysite.base_route import RouteView diff --git a/pysite/views/main/index.py b/pysite/views/main/index.py index 210eb057..ef5ed700 100644 --- a/pysite/views/main/index.py +++ b/pysite/views/main/index.py @@ -1,4 +1,3 @@ -# coding=utf-8 from pysite.base_route import RouteView diff --git a/pysite/views/main/info/__init__.py b/pysite/views/main/info/__init__.py index 9bad5790..e69de29b 100644 --- a/pysite/views/main/info/__init__.py +++ b/pysite/views/main/info/__init__.py @@ -1 +0,0 @@ -# coding=utf-8 diff --git a/pysite/views/main/info/help.py b/pysite/views/main/info/help.py index 868b969f..a47362fc 100644 --- a/pysite/views/main/info/help.py +++ b/pysite/views/main/info/help.py @@ -1,4 +1,3 @@ -# coding=utf-8 from pysite.base_route import RouteView diff --git a/pysite/views/main/info/index.py b/pysite/views/main/info/index.py index 3f36e50f..f9fab682 100644 --- a/pysite/views/main/info/index.py +++ b/pysite/views/main/info/index.py @@ -1,4 +1,3 @@ -# coding=utf-8 from pysite.base_route import RouteView diff --git a/pysite/views/main/info/jams.py b/pysite/views/main/info/jams.py index 19e4cb9c..9158091f 100644 --- a/pysite/views/main/info/jams.py +++ b/pysite/views/main/info/jams.py @@ -1,4 +1,3 @@ -# coding=utf-8 from pysite.base_route import RouteView diff --git a/pysite/views/main/info/resources.py b/pysite/views/main/info/resources.py index 2642e1ec..541b9ba1 100644 --- a/pysite/views/main/info/resources.py +++ b/pysite/views/main/info/resources.py @@ -1,4 +1,3 @@ -# coding=utf-8 import json from logging import getLogger diff --git a/pysite/views/main/redirects/github.py b/pysite/views/main/redirects/github.py index d2ceaf49..f861a91c 100644 --- a/pysite/views/main/redirects/github.py +++ b/pysite/views/main/redirects/github.py @@ -1,4 +1,3 @@ -# coding=utf-8 from flask import redirect from pysite.base_route import RouteView diff --git a/pysite/views/main/redirects/invite.py b/pysite/views/main/redirects/invite.py index 5f31d7db..1895d36a 100644 --- a/pysite/views/main/redirects/invite.py +++ b/pysite/views/main/redirects/invite.py @@ -1,4 +1,3 @@ -# coding=utf-8 from flask import redirect from pysite.base_route import RouteView diff --git a/pysite/views/main/redirects/stats.py b/pysite/views/main/redirects/stats.py index 7766f9ed..935f8539 100644 --- a/pysite/views/main/redirects/stats.py +++ b/pysite/views/main/redirects/stats.py @@ -1,4 +1,3 @@ -# coding=utf-8 from flask import redirect from pysite.base_route import RouteView diff --git a/pysite/views/main/ws_test.py b/pysite/views/main/ws_test.py index c53515c5..a0b6215f 100644 --- a/pysite/views/main/ws_test.py +++ b/pysite/views/main/ws_test.py @@ -1,4 +1,3 @@ -# coding=utf-8 import os from pysite.base_route import RouteView diff --git a/pysite/views/main/ws_test_rst.py b/pysite/views/main/ws_test_rst.py index 9c2ee805..e80acc55 100644 --- a/pysite/views/main/ws_test_rst.py +++ b/pysite/views/main/ws_test_rst.py @@ -1,4 +1,3 @@ -# coding=utf-8 import os from pysite.base_route import RouteView diff --git a/pysite/views/staff/index.py b/pysite/views/staff/index.py index 7569ba32..11447f87 100644 --- a/pysite/views/staff/index.py +++ b/pysite/views/staff/index.py @@ -1,4 +1,3 @@ -# coding=utf-8 from pprint import pformat from flask import current_app diff --git a/pysite/views/tests/index.py b/pysite/views/tests/index.py index 3071bf0e..b96590c0 100644 --- a/pysite/views/tests/index.py +++ b/pysite/views/tests/index.py @@ -1,5 +1,3 @@ -# coding=utf-8 - from flask import jsonify from schema import Schema diff --git a/pysite/views/wiki/edit.py b/pysite/views/wiki/edit.py index 9cff9da0..2cd4181c 100644 --- a/pysite/views/wiki/edit.py +++ b/pysite/views/wiki/edit.py @@ -1,4 +1,3 @@ -# coding=utf-8 import datetime import difflib diff --git a/pysite/views/wiki/history/compare.py b/pysite/views/wiki/history/compare.py index d42a6b36..6296f734 100644 --- a/pysite/views/wiki/history/compare.py +++ b/pysite/views/wiki/history/compare.py @@ -1,4 +1,3 @@ -# coding=utf-8 import difflib from pygments import highlight diff --git a/pysite/views/wiki/history/show.py b/pysite/views/wiki/history/show.py index e18b017e..50fc5d73 100644 --- a/pysite/views/wiki/history/show.py +++ b/pysite/views/wiki/history/show.py @@ -1,4 +1,3 @@ -# coding=utf-8 import datetime from werkzeug.exceptions import NotFound diff --git a/pysite/views/wiki/index.py b/pysite/views/wiki/index.py index 778a808c..8290eac9 100644 --- a/pysite/views/wiki/index.py +++ b/pysite/views/wiki/index.py @@ -1,4 +1,3 @@ -# coding=utf-8 from flask import url_for from werkzeug.utils import redirect diff --git a/pysite/views/wiki/page.py b/pysite/views/wiki/page.py index 500d5c04..26edfcc4 100644 --- a/pysite/views/wiki/page.py +++ b/pysite/views/wiki/page.py @@ -1,4 +1,3 @@ -# coding=utf-8 from flask import redirect, url_for from werkzeug.exceptions import NotFound diff --git a/pysite/views/wiki/render.py b/pysite/views/wiki/render.py index 9d3e8cc3..b08f54dd 100644 --- a/pysite/views/wiki/render.py +++ b/pysite/views/wiki/render.py @@ -1,4 +1,3 @@ -# coding=utf-8 import re from docutils.utils import SystemMessage diff --git a/pysite/views/wiki/source.py b/pysite/views/wiki/source.py index 80f362df..83674447 100644 --- a/pysite/views/wiki/source.py +++ b/pysite/views/wiki/source.py @@ -1,4 +1,3 @@ -# coding=utf-8 from flask import redirect, url_for from pygments import highlight from pygments.formatters.html import HtmlFormatter diff --git a/pysite/views/ws/echo.py b/pysite/views/ws/echo.py index 7e6b036f..b6f11168 100644 --- a/pysite/views/ws/echo.py +++ b/pysite/views/ws/echo.py @@ -1,4 +1,3 @@ -# coding=utf-8 import logging from geventwebsocket.websocket import WebSocket diff --git a/pysite/views/ws/rst.py b/pysite/views/ws/rst.py index 24bdb3ca..f2b2db24 100644 --- a/pysite/views/ws/rst.py +++ b/pysite/views/ws/rst.py @@ -1,4 +1,3 @@ -# coding=utf-8 import logging from geventwebsocket.websocket import WebSocket diff --git a/pysite/websockets.py b/pysite/websockets.py index 1e7960f7..19f9bf83 100644 --- a/pysite/websockets.py +++ b/pysite/websockets.py @@ -1,4 +1,3 @@ -# coding=utf-8 from flask import Blueprint from geventwebsocket.websocket import WebSocket -- cgit v1.2.3 From 23b17a6a1e01d199ca3bbb69e628a2b0f3b262bb Mon Sep 17 00:00:00 2001 From: Joseph Date: Sun, 29 Apr 2018 20:27:49 +0100 Subject: Fix for wiki.history.show with slashes in URL --- pysite/views/wiki/history/show.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'pysite') diff --git a/pysite/views/wiki/history/show.py b/pysite/views/wiki/history/show.py index 50fc5d73..00a1dc27 100644 --- a/pysite/views/wiki/history/show.py +++ b/pysite/views/wiki/history/show.py @@ -8,7 +8,7 @@ from pysite.mixins import DBMixin class RevisionsListView(RouteView, DBMixin): - path = "/history/show/" + path = "/history/show/" name = "history.show" table_name = "wiki_revisions" -- cgit v1.2.3 From 87d3c8b8c87144fb527c0811e36165c329388cea Mon Sep 17 00:00:00 2001 From: Gareth Coles Date: Mon, 30 Apr 2018 11:01:22 +0100 Subject: [Wiki] Header icons need a space afterwards --- pysite/rst/__init__.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'pysite') diff --git a/pysite/rst/__init__.py b/pysite/rst/__init__.py index ae79f529..97a77f40 100644 --- a/pysite/rst/__init__.py +++ b/pysite/rst/__init__.py @@ -67,12 +67,23 @@ def render(rst: str): if depth == 1: # Top-level header, so just store it in the current header current_header["id"] = match.group(1) - current_header["title"] = match.group(2) + + title = match.group(2) + + if title.startswith(" ", "  ") + + current_header["title"] = title else: # Second-level (or deeper) header, should be stored in a list of sub-headers under the current sub_headers = current_header.get("sub_headers", []) + title = match.group(2) + + if title.startswith(" ", "  ") + sub_headers.append({ "id": match.group(1), - "title": match.group(2) + "title": title }) current_header["sub_headers"] = sub_headers -- cgit v1.2.3 From ba68c031aa3a8dc1c0eae9952ab23a6bc1d8eb4a Mon Sep 17 00:00:00 2001 From: Gareth Coles Date: Mon, 30 Apr 2018 11:18:22 +0100 Subject: [Wiki] Icons should all be the same width --- pysite/rst/roles.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'pysite') diff --git a/pysite/rst/roles.py b/pysite/rst/roles.py index 00d12dba..abade243 100644 --- a/pysite/rst/roles.py +++ b/pysite/rst/roles.py @@ -40,7 +40,7 @@ def icon_role(_role: str, rawtext: str, text: str, lineno: int, inliner: Inliner return [prb], [msg] - html = f"""""" + html = f"""""" node = nodes.raw(html, html, format="html", **options) return [node], [] -- cgit v1.2.3