Add pylint to devnotes
This commit is contained in:
parent
6508bb082e
commit
d72464d56a
11
DEVNOTES.md
11
DEVNOTES.md
@ -1,3 +1,4 @@
|
|||||||
|
Notes for developers
|
||||||
|
|
||||||
## Running just one test
|
## Running just one test
|
||||||
|
|
||||||
@ -8,10 +9,13 @@ python -m unittest tests.test_pop.TestPop3.test_CAPA
|
|||||||
## Patch for enable logging in test
|
## Patch for enable logging in test
|
||||||
|
|
||||||
Patch generated using below
|
Patch generated using below
|
||||||
|
|
||||||
```
|
```
|
||||||
git diff --patch -U1 tests >> ./DEVNOTES.md
|
git diff --patch -U1 tests >> ./DEVNOTES.md
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Apply with below
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git apply - <<PATCH
|
git apply - <<PATCH
|
||||||
diff --git a/tests/test_pop.py b/tests/test_pop.py
|
diff --git a/tests/test_pop.py b/tests/test_pop.py
|
||||||
@ -25,3 +29,10 @@ index 55c1a91..a825665 100644
|
|||||||
td = tempfile.TemporaryDirectory(prefix="m41.pop.")
|
td = tempfile.TemporaryDirectory(prefix="m41.pop.")
|
||||||
PATCH
|
PATCH
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## pylint
|
||||||
|
|
||||||
|
```
|
||||||
|
pylint mail4one/*py > /tmp/errs
|
||||||
|
vim +"cfile /tmp/errs"
|
||||||
|
```
|
||||||
|
@ -298,7 +298,7 @@ async def transaction_stage() -> None:
|
|||||||
deleted_items_path, existing_deleted_items.union(new_deleted_items)
|
deleted_items_path, existing_deleted_items.union(new_deleted_items)
|
||||||
)
|
)
|
||||||
|
|
||||||
logger.info(f"Saved deleted items")
|
logger.info("Saved deleted items")
|
||||||
|
|
||||||
|
|
||||||
async def start_session() -> None:
|
async def start_session() -> None:
|
||||||
@ -341,7 +341,7 @@ def make_pop_server_callback(mails_path: Path, users: list[User], timeout_second
|
|||||||
c_shared_state.set(s_state)
|
c_shared_state.set(s_state)
|
||||||
ip, _ = writer.get_extra_info("peername")
|
ip, _ = writer.get_extra_info("peername")
|
||||||
c_state.set(State(reader=reader, writer=writer, ip=ip, req_id=s_state.next_id()))
|
c_state.set(State(reader=reader, writer=writer, ip=ip, req_id=s_state.next_id()))
|
||||||
logger.info(f"Got pop server callback")
|
logger.info("Got pop server callback")
|
||||||
try:
|
try:
|
||||||
try:
|
try:
|
||||||
return await asyncio.wait_for(start_session(), timeout_seconds)
|
return await asyncio.wait_for(start_session(), timeout_seconds)
|
||||||
@ -363,7 +363,7 @@ async def create_pop_server(
|
|||||||
timeout_seconds: int = 60,
|
timeout_seconds: int = 60,
|
||||||
) -> asyncio.Server:
|
) -> asyncio.Server:
|
||||||
logging.info(
|
logging.info(
|
||||||
f"Starting POP3 server {host=}, {port=}, {mails_path=!s}, {len(users)=}, {ssl_context != None=}, {timeout_seconds=}"
|
f"Starting POP3 server {host=}, {port=}, {mails_path=!s}, {len(users)=}, {bool(ssl_context)=}, {timeout_seconds=}"
|
||||||
)
|
)
|
||||||
return await asyncio.start_server(
|
return await asyncio.start_server(
|
||||||
make_pop_server_callback(mails_path, users, timeout_seconds),
|
make_pop_server_callback(mails_path, users, timeout_seconds),
|
||||||
|
@ -34,7 +34,7 @@ class MyHandler(AsyncMessage):
|
|||||||
self.peer = session.peer
|
self.peer = session.peer
|
||||||
return await super().handle_DATA(server, session, envelope)
|
return await super().handle_DATA(server, session, envelope)
|
||||||
|
|
||||||
async def handle_message(self, m: Message): # type: ignore[override]
|
async def handle_message(self, message: Message): # type: ignore[override]
|
||||||
all_mboxes: set[str] = set()
|
all_mboxes: set[str] = set()
|
||||||
for addr in self.rcpt_tos:
|
for addr in self.rcpt_tos:
|
||||||
for mbox in self.mbox_finder(addr.lower()):
|
for mbox in self.mbox_finder(addr.lower()):
|
||||||
@ -51,7 +51,7 @@ class MyHandler(AsyncMessage):
|
|||||||
temp_email_path = Path(tmpdir) / filename
|
temp_email_path = Path(tmpdir) / filename
|
||||||
with open(temp_email_path, "wb") as fp:
|
with open(temp_email_path, "wb") as fp:
|
||||||
gen = BytesGenerator(fp, policy=email.policy.SMTP)
|
gen = BytesGenerator(fp, policy=email.policy.SMTP)
|
||||||
gen.flatten(m)
|
gen.flatten(message)
|
||||||
for mbox in all_mboxes:
|
for mbox in all_mboxes:
|
||||||
shutil.copy(temp_email_path, self.mails_path / mbox / "new")
|
shutil.copy(temp_email_path, self.mails_path / mbox / "new")
|
||||||
logger.info(
|
logger.info(
|
||||||
@ -104,7 +104,7 @@ async def create_smtp_server_starttls(
|
|||||||
smtputf8: bool,
|
smtputf8: bool,
|
||||||
) -> asyncio.Server:
|
) -> asyncio.Server:
|
||||||
logging.info(
|
logging.info(
|
||||||
f"Starting SMTP STARTTLS server {host=}, {port=}, {mails_path=!s}, {ssl_context != None=}"
|
f"Starting SMTP STARTTLS server {host=}, {port=}, {mails_path=!s}, {bool(ssl_context)=}"
|
||||||
)
|
)
|
||||||
loop = asyncio.get_event_loop()
|
loop = asyncio.get_event_loop()
|
||||||
return await loop.create_server(
|
return await loop.create_server(
|
||||||
@ -131,7 +131,7 @@ async def create_smtp_server(
|
|||||||
smtputf8: bool,
|
smtputf8: bool,
|
||||||
) -> asyncio.Server:
|
) -> asyncio.Server:
|
||||||
logging.info(
|
logging.info(
|
||||||
f"Starting SMTP server {host=}, {port=}, {mails_path=!s}, {ssl_context != None=}"
|
f"Starting SMTP server {host=}, {port=}, {mails_path=!s}, {bool(ssl_context)=}"
|
||||||
)
|
)
|
||||||
loop = asyncio.get_event_loop()
|
loop = asyncio.get_event_loop()
|
||||||
return await loop.create_server(
|
return await loop.create_server(
|
||||||
|
Loading…
Reference in New Issue
Block a user