Skip to content

Commit d72d8aa

Browse files
committed
Blackened code
1 parent e4bce9b commit d72d8aa

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+710
-280
lines changed

.pre-commit-config.yaml

+78
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# See https://pre-commit.com for more information
2+
# See https://pre-commit.com/hooks.html for more hooks
3+
repos:
4+
- repo: https://github.com/lucasmbrown/mirrors-autoflake
5+
rev: v1.3
6+
hooks:
7+
- id: autoflake
8+
args:
9+
[
10+
'--in-place',
11+
'--remove-all-unused-imports',
12+
'--ignore-init-module-imports',
13+
'--remove-unused-variables',
14+
'--remove-duplicate-keys',
15+
]
16+
- repo: https://github.com/pre-commit/mirrors-isort
17+
rev: v4.3.21
18+
hooks:
19+
- id: isort
20+
additional_dependencies:
21+
- toml
22+
- repo: https://github.com/ambv/black
23+
rev: 19.10b0
24+
hooks:
25+
- id: black
26+
- repo: https://github.com/pre-commit/pre-commit-hooks
27+
rev: v3.1.0
28+
hooks:
29+
- id: check-added-large-files
30+
- id: check-ast
31+
- id: check-byte-order-marker
32+
- id: check-case-conflict
33+
- id: check-docstring-first
34+
- id: check-executables-have-shebangs
35+
- id: check-json
36+
- id: check-merge-conflict
37+
- id: check-symlinks
38+
- id: check-toml
39+
- id: check-xml
40+
- id: check-yaml
41+
- id: debug-statements
42+
- id: detect-aws-credentials
43+
args: ['--allow-missing-credentials']
44+
- id: detect-private-key
45+
- id: end-of-file-fixer
46+
- id: fix-encoding-pragma
47+
args: ['--remove']
48+
- id: forbid-new-submodules
49+
- id: mixed-line-ending
50+
- id: no-commit-to-branch
51+
- id: requirements-txt-fixer
52+
- id: trailing-whitespace
53+
- repo: https://gitlab.com/pycqa/flake8
54+
rev: 3.8.2
55+
hooks:
56+
- id: flake8
57+
additional_dependencies:
58+
- toml
59+
- flake8-assertive
60+
- flake8-blind-except
61+
- flake8-builtins
62+
- flake8-comprehensions
63+
- flake8-isort
64+
- flake8-logging-format
65+
- flake8-mutable
66+
- flake8-print
67+
- pep8-naming
68+
- repo: https://github.com/PyCQA/bandit
69+
rev: 1.6.2
70+
hooks:
71+
- id: bandit
72+
language_version: python3
73+
exclude: (^tests|funnel/loginproviders/flask_oauth.py)
74+
- repo: https://github.com/prettier/prettier
75+
rev: 2.0.5
76+
hooks:
77+
- id: prettier
78+
args: ['--single-quote', '--trailing-comma', 'es5']

.pyup.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
schedule: "every month"
1+
schedule: 'every month'

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
language: python
22
python:
3-
- "3.7"
3+
- '3.7'
44
install:
55
- pip install git+https://github.com/hasgeek/flask-babelhg/
66
- pip install -r requirements.txt

README.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
HasGeek Custom Mailer
2-
=====================
1+
# HasGeek Custom Mailer
32

43
![Build status](https://secure.travis-ci.org/hasgeek/hasmail.png)
54
[![Coverage Status](https://coveralls.io/repos/hasgeek/hasmail/badge.png?branch=master)](https://coveralls.io/r/hasgeek/hasmail?branch=master)

hasmail/__init__.py

+17-9
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
1-
# -*- coding: utf-8 -*-
2-
31
# The imports in this file are order-sensitive
42

53

64
from flask import Flask
75
from flask_mail import Mail
8-
from flask_rq2 import RQ
96
from flask_migrate import Migrate
7+
from flask_rq2 import RQ
8+
9+
from baseframe import Version, _, __, assets, baseframe # NOQA
1010
from flask_lastuser import Lastuser
1111
from flask_lastuser.sqlalchemy import UserManager
12-
from baseframe import baseframe, assets, Version
13-
from baseframe import _, __ # NOQA
1412
import coaster.app
13+
1514
from ._version import __version__
1615

1716
version = Version(__version__)
@@ -25,8 +24,8 @@
2524

2625
# Second, import the models and views
2726

28-
from . import models, views # NOQA
29-
from .models import db
27+
from . import models, views # NOQA: F401 # isort:skip
28+
from .models import db # isort:skip
3029

3130
# Third, setup baseframe and assets
3231

@@ -40,8 +39,17 @@
4039
db.app = app
4140
migrate = Migrate(app, db)
4241
rq.init_app(app) # Pick up RQ configuration from the app
43-
baseframe.init_app(app, requires=['hasmail'],
44-
ext_requires=['bootstrap3-editable', 'codemirror-markdown', 'codemirror-css', 'fontawesome', 'baseframe-bs3'])
42+
baseframe.init_app(
43+
app,
44+
requires=['hasmail'],
45+
ext_requires=[
46+
'bootstrap3-editable',
47+
'codemirror-markdown',
48+
'codemirror-css',
49+
'fontawesome',
50+
'baseframe-bs3',
51+
],
52+
)
4553
mail.init_app(app)
4654
lastuser.init_app(app)
4755
lastuser.init_usermanager(UserManager(db, models.User))

hasmail/_version.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
__all__ = ['__version__', '__version_info__']
22

33
__version__ = '0.1.0-dev'
4-
__version_info__ = tuple([int(num) if num.isdigit() else num for num in __version__.replace('-', '.', 1).split('.')])
4+
__version_info__ = tuple(
5+
int(num) if num.isdigit() else num
6+
for num in __version__.replace('-', '.', 1).split('.')
7+
)

hasmail/forms/__init__.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -*-
21
# flake8: noqa
32

43
from .email import *

hasmail/forms/email.py

+34-17
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,61 @@
1-
# -*- coding: utf-8 -*-
2-
31
import wtforms
2+
43
from baseframe.forms import Form, StylesheetField
4+
55
from .. import __
66

77
__all__ = ['CampaignSettingsForm', 'CampaignSendForm', 'TemplateForm']
88

99

1010
class CampaignSettingsForm(Form):
11-
title = wtforms.TextField(__("What’s this email about?"),
12-
validators=[wtforms.validators.Required(__("This is required"))])
11+
title = wtforms.TextField(
12+
__("What’s this email about?"),
13+
validators=[wtforms.validators.Required(__("This is required"))],
14+
)
1315

14-
importfile = wtforms.FileField(__("Who do you want to send this to?"),
15-
description=__("A CSV file containing names and email addresses would be most excellent"))
16+
importfile = wtforms.FileField(
17+
__("Who do you want to send this to?"),
18+
description=__(
19+
"A CSV file containing names and email addresses would be most excellent"
20+
),
21+
)
1622

17-
stylesheet = StylesheetField(__("CSS Stylesheet"),
23+
stylesheet = StylesheetField(
24+
__("CSS Stylesheet"),
1825
description=__("These styles will be applied to your email before it is sent"),
19-
validators=[wtforms.validators.Optional()])
26+
validators=[wtforms.validators.Optional()],
27+
)
2028

2129
# TODO: Validate addresses
22-
cc = wtforms.TextAreaField(__("CC"),
23-
description=__("CCed recipients, one per line"))
30+
cc = wtforms.TextAreaField(
31+
__("CC"), description=__("CCed recipients, one per line")
32+
)
2433

2534
# TODO: Validate addresses
26-
bcc = wtforms.TextAreaField(__("BCC"),
27-
description=__("BCCed recipients, one per line"))
35+
bcc = wtforms.TextAreaField(
36+
__("BCC"), description=__("BCCed recipients, one per line")
37+
)
2838

29-
trackopens = wtforms.BooleanField(__("Track opens"), default=False,
30-
description=__("This will include a tiny, invisible image in your email. "
39+
trackopens = wtforms.BooleanField(
40+
__("Track opens"),
41+
default=False,
42+
description=__(
43+
"This will include a tiny, invisible image in your email. "
3144
"Your recipient's email client may ask them if they want to view images. "
32-
"Best used if your email also includes images"))
45+
"Best used if your email also includes images"
46+
),
47+
)
3348

3449
# trackclicks = wtforms.BooleanField(__(u"Track clicks"), default=False,
3550
# description=__(u"All links in your email will be wrapped and clicks will be tracked "
3651
# u"so you know which recipient opened which links"))
3752

3853

3954
class CampaignSendForm(Form):
40-
email = wtforms.RadioField(__("Send from"),
41-
description=__("What email address would you like to send this from?"))
55+
email = wtforms.RadioField(
56+
__("Send from"),
57+
description=__("What email address would you like to send this from?"),
58+
)
4259

4360

4461
class TemplateForm(Form):

hasmail/models/__init__.py

+9-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
1-
# -*- coding: utf-8 -*-
21
# flake8: noqa
32

4-
from coaster.sqlalchemy import TimestampMixin, BaseMixin, BaseNameMixin, BaseScopedIdMixin, MarkdownColumn, JsonDict
53
from coaster.db import db
4+
from coaster.sqlalchemy import (
5+
BaseMixin,
6+
BaseNameMixin,
7+
BaseScopedIdMixin,
8+
JsonDict,
9+
MarkdownColumn,
10+
TimestampMixin,
11+
)
612

7-
from .user import *
813
from .email import *
14+
from .user import *

0 commit comments

Comments
 (0)