Skip to content

Commit

Permalink
ruff linting
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasst committed Jun 27, 2024
1 parent a8435a1 commit 6c093de
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- uses: actions/setup-python@v2
name: Install Python
with:
python-version: 3.8
python-version: 3.9

- run: |
pip install packaging
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
lint:
strategy:
matrix:
python-version: [ '3.8', '3.9', '3.10', '3.11' ]
python-version: ['3.9', '3.10', '3.11']
name: Lint ${{ matrix.python-version }}
runs-on: 'ubuntu-20.04'
container: python:${{ matrix.python-version }}
Expand All @@ -30,7 +30,7 @@ jobs:
test:
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11']
python-version: ['3.9', '3.10', '3.11']
# Do not cancel any jobs when a single job fails
fail-fast: false
name: Python ${{ matrix.python-version }}
Expand Down
9 changes: 6 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ line-length = 79
ignore = [
"ISC001",
"PLR2004",
"S101",
"S201",
"TRY003",
# Some patterns contain special characters.
"PLR0911",
"RUF001",
]
select = [
Expand Down Expand Up @@ -50,4 +50,7 @@ forced-separate = ["tests"]
max-complexity = 15

[tool.ruff.lint.pylint]
max-branches = 11
max-branches = 16

[tool.ruff.lint.per-file-ignores]
"tests/test_quotequail.py" = ["E501", "PT009"]
2 changes: 1 addition & 1 deletion quotequail/_html.py
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ def _trim_spaces(text):
line += token

else:
raise RuntimeError("invalid token: {}".format(token))
raise RuntimeError(f"invalid token: {token}")

line = _trim_spaces(line)
if line:
Expand Down
7 changes: 4 additions & 3 deletions quotequail/_internal.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,9 @@ def parse_reply(line):
return None


def find_unwrap_start(lines, max_wrap_lines, min_header_lines, min_quoted_lines):
def find_unwrap_start(
lines, max_wrap_lines, min_header_lines, min_quoted_lines
):
"""
Find the starting point of a wrapped email. Returns a tuple containing
(start_line_number, end_line_number, type), where type can be one of the
Expand Down Expand Up @@ -356,5 +358,4 @@ def unwrap(lines, max_wrap_lines, min_header_lines, min_quoted_lines):
True,
)

# TODO: refactor
assert False
return None
3 changes: 2 additions & 1 deletion quotequail/_patterns.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import functools
import operator
import re
from typing import List

REPLY_PATTERNS = [
"^On (.*) wrote:$", # apple mail/gmail reply
Expand Down Expand Up @@ -107,6 +106,8 @@
operator.iadd, COMPILED_PATTERN_MAP.values(), []
)

MULTIPLE_WHITESPACE_RE = re.compile(r"\s+")

# Amount to lines to join to check for potential wrapped patterns in plain text
# messages.
MAX_WRAP_LINES = 2
Expand Down
9 changes: 6 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,13 @@
url="http://github.com/closeio/quotequail",
license="MIT",
author="Thomas Steinacher",
author_email="engineering@close.io",
author_email="engineering@close.com",
maintainer="Thomas Steinacher",
maintainer_email="engineering@close.io",
description="A library that identifies quoted text in plain text and HTML email messages.",
maintainer_email="engineering@close.com",
description=(
"A library that identifies quoted text in plain text and HTML email "
"messages."
),
long_description=__doc__,
packages=[
"quotequail",
Expand Down
2 changes: 0 additions & 2 deletions tests/test_quotequail.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

import os
import unittest

Expand Down

0 comments on commit 6c093de

Please sign in to comment.