Skip to content

Commit 60d998a

Browse files
committed
Remove unwanted config objects
Remove object level phone number declaration Release `v1.0.2`
1 parent fe8b920 commit 60d998a

11 files changed

Lines changed: 42 additions & 50 deletions

File tree

.pre-commit-config.yaml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,24 @@ repos:
3030
- id: requirements-txt-fixer
3131
- id: trailing-whitespace
3232

33-
- repo: https://github.com/PyCQA/isort
34-
rev: 5.12.0
33+
- repo: https://github.com/psf/black
34+
rev: 22.3.0
3535
hooks:
36-
- id: isort
36+
- id: black
37+
exclude: doc_generator/
3738

3839
- repo: https://github.com/PyCQA/flake8
3940
rev: 7.0.0
4041
hooks:
4142
- id: flake8
4243
args: [-j8, '--ignore=F401,W503,E203,E501,F821,E306,E722,N812']
4344

45+
- repo: https://github.com/PyCQA/isort
46+
rev: 5.12.0
47+
hooks:
48+
- id: isort
49+
args: [--profile, black]
50+
4451
- repo: https://github.com/jumanjihouse/pre-commit-hook-yamlfmt
4552
rev: 0.2.3
4653
hooks:

docs/genindex.html

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ <h1 id="index">Index</h1>
5353
| <a href="#M"><strong>M</strong></a>
5454
| <a href="#N"><strong>N</strong></a>
5555
| <a href="#O"><strong>O</strong></a>
56-
| <a href="#P"><strong>P</strong></a>
5756
| <a href="#R"><strong>R</strong></a>
5857
| <a href="#S"><strong>S</strong></a>
5958
| <a href="#T"><strong>T</strong></a>
@@ -413,24 +412,14 @@ <h2 id="O">O</h2>
413412
</ul></td>
414413
</tr></table>
415414

416-
<h2 id="P">P</h2>
417-
<table style="width: 100%" class="indextable genindextable"><tr>
418-
<td style="width: 33%; vertical-align: top;"><ul>
419-
<li><a href="index.html#gmailconnector.models.config.EgressConfig.phone">phone (gmailconnector.models.config.EgressConfig attribute)</a>
420-
</li>
421-
</ul></td>
422-
</tr></table>
423-
424415
<h2 id="R">R</h2>
425416
<table style="width: 100%" class="indextable genindextable"><tr>
426417
<td style="width: 33%; vertical-align: top;"><ul>
427418
<li><a href="index.html#gmailconnector.read_email.ReadEmail.read_mail">read_mail() (gmailconnector.read_email.ReadEmail method)</a>
428-
</li>
429-
<li><a href="index.html#gmailconnector.read_email.ReadEmail">ReadEmail (class in gmailconnector.read_email)</a>
430419
</li>
431420
</ul></td>
432421
<td style="width: 33%; vertical-align: top;"><ul>
433-
<li><a href="index.html#gmailconnector.models.config.EgressConfig.recipient">recipient (gmailconnector.models.config.EgressConfig attribute)</a>
422+
<li><a href="index.html#gmailconnector.read_email.ReadEmail">ReadEmail (class in gmailconnector.read_email)</a>
434423
</li>
435424
<li><a href="index.html#gmailconnector.models.responder.Response">Response (class in gmailconnector.models.responder)</a>
436425
</li>

docs/index.html

Lines changed: 9 additions & 19 deletions
Large diffs are not rendered by default.

docs/objects.inv

-13 Bytes
Binary file not shown.

docs/searchindex.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gmailconnector/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@
1111
from .validator.address import EmailAddress # noqa: F401
1212
from .validator.validate_email import validate_email # noqa: F401
1313

14-
version = "1.0.1"
14+
version = "1.0.2"

gmailconnector/models/config.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ class EgressConfig(BaseSettings):
4646

4747
gmail_user: EmailStr
4848
gmail_pass: str
49-
recipient: Union[EmailStr, None] = None
50-
phone: Union[str, None] = Field(None, pattern="\\d{10}$")
5149
gmail_host: str = "smtp.gmail.com"
5250
encryption: Encryption = Encryption.TLS
5351
timeout: int = 10

gmailconnector/send_email.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,12 +234,16 @@ def send_email(
234234
attachments = (
235235
[attachment]
236236
if isinstance(attachment, str)
237-
else attachment if attachment else []
237+
else attachment
238+
if attachment
239+
else []
238240
)
239241
filenames = (
240242
[filename]
241243
if isinstance(filename, str)
242-
else filename if filename else []
244+
else filename
245+
if filename
246+
else []
243247
)
244248

245249
msg = self.multipart_message(

gmailconnector/send_sms.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -123,19 +123,14 @@ def send_sms(
123123
Response:
124124
A custom response object with properties: ok, status and body to the user.
125125
"""
126-
if phone:
127-
self.env.phone = phone
128-
self.env = EgressConfig(**self.env.__dict__)
129-
elif not self.env.phone:
130-
raise ValueError(
131-
'\n\tcannot proceed without phone number'
132-
)
126+
if not all((phone, len(phone) == 10)):
127+
raise ValueError("\n\tcannot proceed without a valid phone number")
133128
if not sms_gateway:
134129
sms_gateway = SMSGateway.tmobile
135130
if not country_code:
136131
country_code = "+1"
137132
if COUNTRY_CODE.match(country_code):
138-
to = country_code + self.env.phone + "@" + sms_gateway
133+
to = country_code + phone + "@" + sms_gateway
139134
else:
140135
raise ValueError(
141136
f"\n\tcountry code should match the pattern {COUNTRY_CODE.pattern}"

gmailconnector/validator/validate_email.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,12 @@
77
from ..models.responder import Response
88
from .address import EmailAddress
99
from .domain import get_mx_records
10-
from .exceptions import (AddressFormatError, InvalidDomain, NotMailServer,
11-
UnresponsiveMailServer)
10+
from .exceptions import (
11+
AddressFormatError,
12+
InvalidDomain,
13+
NotMailServer,
14+
UnresponsiveMailServer,
15+
)
1216

1317
formatter = logging.Formatter(fmt="%(levelname)s\t %(message)s")
1418

0 commit comments

Comments
 (0)