Skip to content

Commit

Permalink
refactor_v1.2.3 small refactoring (#171)
Browse files Browse the repository at this point in the history
* refactor_v1.2.3 small refactorings

* change python version for github actions
  • Loading branch information
sabuhish authored Dec 29, 2022
1 parent e9762a0 commit 81aac21
Show file tree
Hide file tree
Showing 30 changed files with 1,746 additions and 1,739 deletions.
2 changes: 1 addition & 1 deletion .flake8
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[flake8]
max_line_length = 115
exclude = .venv,.mypy_cache,.pytest_cache
ignore = PT013,PT018,W503
ignore = PT013,PT018,W503
6 changes: 2 additions & 4 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
name: Deploy Documentation to the github pages.




name: Deploy Documentation
on:
push:
branches:
- master

jobs:
deploy:
runs-on: ubuntu-latest
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/linter.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: CI

on:
push:
branches: '**'
Expand All @@ -8,8 +9,8 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]
poetry-version: [1.1.8]
python-version: [3.8, 3.9]
poetry-version: [1.3.1]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
Expand All @@ -23,5 +24,5 @@ jobs:
poetry-version: ${{ matrix.poetry-version }}
- name: Install dependencies
run: poetry install
- name: Run Linter
run: poetry run make
- name: Run linter
run: poetry run make lint
1 change: 0 additions & 1 deletion .github/workflows/poetry-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
release:
types: [created]


jobs:
release:
runs-on: ubuntu-latest
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]
poetry-version: [1.1.8]
python-version: [3.8, 3.9]
poetry-version: [1.3.1]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
Expand Down
11 changes: 5 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ lint:
@echo
isort --diff -c --skip-glob '*.venv' .
@echo
blue --check --diff --color .
black .
@echo
flake8 .
@echo
Expand All @@ -11,11 +11,10 @@ lint:

format_code:
isort .
blue .
black .
flake8 .


test_only:
pytest -v --cov-report term-missing --cov-report html --cov-branch \
test:
pytest -vvv --cov-report term-missing --cov-report html --cov-branch \
--cov fastapi_mail/

test: lint test_only
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ For more examples of using fastapi-mail please check:
## Contributors ✨

Thanks goes to these wonderful
[People](https://sabuhish.github.io/fastapi-mail/contributors.txt)
[People](https://github.com/sabuhish/fastapi-mail/blob/master/contributors.txt)


# Contributing
Expand Down
12 changes: 6 additions & 6 deletions examples/utils_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

from fastapi_mail.email_utils import DefaultChecker, WhoIsXmlApi

checker = DefaultChecker(db_provider='redis')
checker = DefaultChecker(db_provider="redis")
loop = asyncio.get_event_loop()
loop.run_until_complete(checker.init_redis())
res = loop.run_until_complete(checker.blacklist_rm_temp('promail1.net'))
res = loop.run_until_complete(checker.blacklist_rm_temp("promail1.net"))
print(res)
loop_until = loop.run_until_complete(checker.temp_email_count())

who_is = WhoIsXmlApi(token='Your access token', email='[email protected]')
who_is = WhoIsXmlApi(token="Your access token", email="[email protected]")

print(who_is.smtp_check_()) # check smtp server
print(who_is.is_disposable()) # check email is disposable or not
print(who_is.check_mx_record()) # check domain mx records
print(who_is.free_check) # check email domain is free or not
print(who_is.is_disposable()) # check email is disposable or not
print(who_is.check_mx_record()) # check domain mx records
print(who_is.free_check) # check email domain is free or not
14 changes: 7 additions & 7 deletions fastapi_mail/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@

from . import email_utils

__author__ = '[email protected]'
__author__ = "[email protected]"

__all__ = [
'FastMail',
'ConnectionConfig',
'MessageSchema',
'email_utils',
'MultipartSubtypeEnum',
'MessageType',
"FastMail",
"ConnectionConfig",
"MessageSchema",
"email_utils",
"MultipartSubtypeEnum",
"MessageType",
]
2 changes: 1 addition & 1 deletion fastapi_mail/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def template_engine(self) -> Environment:
folder = self.TEMPLATE_FOLDER
if not folder:
raise ValueError(
'Class initialization did not include a ``TEMPLATE_FOLDER`` ``PathLike`` object.'
"Class initialization did not include a ``TEMPLATE_FOLDER`` ``PathLike`` object."
)
template_env = Environment(loader=FileSystemLoader(folder))
return template_env
10 changes: 5 additions & 5 deletions fastapi_mail/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ class Connection:
def __init__(self, settings: ConnectionConfig) -> None:
if not isinstance(settings, ConnectionConfig):
raise PydanticClassRequired(
'Configuration should be provided from ConnectionConfig class'
"Configuration should be provided from ConnectionConfig class"
)
self.settings = settings

async def __aenter__(self) -> 'Connection':
async def __aenter__(self) -> "Connection":
"""
Setting up a connection
"""
Expand All @@ -27,7 +27,7 @@ async def __aexit__(self, exc_type, exc, tb) -> None:
"""
Closing the connection
"""
if not self.settings.SUPPRESS_SEND: # for test environ
if not self.settings.SUPPRESS_SEND: # for test environ
await self.session.quit()

async def _configure_connection(self) -> None:
Expand All @@ -41,7 +41,7 @@ async def _configure_connection(self) -> None:
validate_certs=self.settings.VALIDATE_CERTS,
)

if not self.settings.SUPPRESS_SEND: # for test environ
if not self.settings.SUPPRESS_SEND: # for test environ
await self.session.connect()

if self.settings.USE_CREDENTIALS:
Expand All @@ -51,5 +51,5 @@ async def _configure_connection(self) -> None:

except Exception as error:
raise ConnectionErrors(
f'Exception raised {error}, check your credentials or email service configuration'
f"Exception raised {error}, check your credentials or email service configuration"
)
2 changes: 1 addition & 1 deletion fastapi_mail/email_utils/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from fastapi_mail.email_utils.email_check import DefaultChecker, WhoIsXmlApi

__all__ = ['DefaultChecker', 'WhoIsXmlApi']
__all__ = ["DefaultChecker", "WhoIsXmlApi"]
Loading

0 comments on commit 81aac21

Please sign in to comment.