Skip to content

Commit a64f0c2

Browse files
add lint workflow
1 parent 08c4cd6 commit a64f0c2

3 files changed

Lines changed: 58 additions & 22 deletions

File tree

.github/workflows/lint.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Lint
2+
3+
on:
4+
push:
5+
branches: [ "master" ]
6+
pull_request:
7+
branches: [ "master" ]
8+
9+
jobs:
10+
lint:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
with:
15+
fetch-depth: 0
16+
17+
- name: Get changed files
18+
id: changed-files
19+
uses: tj-actions/changed-files@v43
20+
21+
- name: Set up Python
22+
uses: actions/setup-python@v5
23+
with:
24+
python-version: "3.13"
25+
26+
- name: Install Poetry
27+
run: |
28+
pip install poetry
29+
30+
- name: Install dependencies
31+
run: |
32+
poetry install --with dev
33+
34+
- name: Run Ruff on changed files
35+
run: |
36+
# Filter Python files from changed files and run Ruff
37+
echo "${{ steps.changed-files.outputs.all_changed_files }}" | tr ' ' '\n' | grep '\.py$' | xargs -r poetry run ruff check
38+
echo "${{ steps.changed-files.outputs.all_changed_files }}" | tr ' ' '\n' | grep '\.py$' | xargs -r poetry run ruff format --check

archipy/adapters/email/adapters.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626

2727

2828
class EmailConnectionManager:
29-
3029
def __init__(self, config: EmailConfig) -> None:
3130
self.config = config
3231
self.smtp_connection = None
@@ -68,7 +67,6 @@ def refresh_if_needed(self) -> None:
6867

6968

7069
class EmailConnectionPool:
71-
7270
def __init__(self, config: EmailConfig) -> None:
7371
self.config = config
7472
self.pool: Queue = Queue(maxsize=config.POOL_SIZE)

archipy/helpers/utils/string_utils_constants.py

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ def compile_patterns(patterns):
88
class StringUtilsConstants:
99
arabic_vowel_translate_table = str.maketrans(
1010
dict.fromkeys(
11-
"\u064E\u064F\u0650\u0652\u0651\u0653\u064B\u064C\u0621\u064D\u0670" # Normal vowels (Fatha, Damma, Kasra, etc)
12-
"\u06D6\u06D7\u06D8\u06D9\u06DA\u06DB", # Quranic marks
11+
"\u064e\u064f\u0650\u0652\u0651\u0653\u064b\u064c\u0621\u064d\u0670" # Normal vowels (Fatha, Damma, Kasra, etc)
12+
"\u06d6\u06d7\u06d8\u06d9\u06da\u06db", # Quranic marks
1313
"",
1414
),
1515
)
@@ -19,7 +19,7 @@ class StringUtilsConstants:
1919

2020
# replace 'ٳ|ٲ|ٱ|إ|ﺍ|أ|ٵ | ﺎ' with 'ا'
2121
alphabet_alef_translate_table = str.maketrans(
22-
dict.fromkeys("\uFE8E\u0672\u0671\u0625\ufe8d\u0623\u0675\u0673", "\u0627"),
22+
dict.fromkeys("\ufe8e\u0672\u0671\u0625\ufe8d\u0623\u0675\u0673", "\u0627"),
2323
)
2424

2525
# replace 'ٮ|ݕ|ٻ|ﺐ|ﺏ|ﺑ' with "ب"
@@ -77,7 +77,7 @@ class StringUtilsConstants:
7777
alphabet_shin_translate_table = str.maketrans(dict.fromkeys("\ufeb5\ufeb6\ufeb8\ufeb7\u069c\u06fa", "\u0634"))
7878

7979
# replace "ڝ|ﺺ|ﺼ|ﺻ |ﺹ" with "ص"
80-
alphabet_sad_translate_table = str.maketrans(dict.fromkeys("\uFEB9\ufeba\ufebc\ufebb\u069d", "\u0635"))
80+
alphabet_sad_translate_table = str.maketrans(dict.fromkeys("\ufeb9\ufeba\ufebc\ufebb\u069d", "\u0635"))
8181

8282
# replace "ڞ|ۻ|ﺽ|ﺾ|ﺿ|ﻀ" with "ض"
8383
alphabet_zad_translate_table = str.maketrans(dict.fromkeys("\ufebd\ufebe\ufebf\ufec0\u06fb\u069e", "\u0636"))
@@ -120,7 +120,7 @@ class StringUtilsConstants:
120120

121121
# replace "ڵ|ڶ|ڸ|ڷ|ݪ|ﻝ|ﻞ|ﻠ|ڵ | ﻟ" with "ل"
122122
alphabet_lam_translate_table = str.maketrans(
123-
dict.fromkeys("\uFEDF\ufedd\ufede\ufee0\u076a\u06b7\u06b8\u06b6\u06b5", "\u0644"),
123+
dict.fromkeys("\ufedf\ufedd\ufede\ufee0\u076a\u06b7\u06b8\u06b6\u06b5", "\u0644"),
124124
)
125125

126126
# replace "ݥ|ݦ|ﻡ|ﻤ|ﻢ|ﻣ" with "م"
@@ -141,15 +141,15 @@ class StringUtilsConstants:
141141
# replace "ܝ|ܤ|ܣ|ﺔ|ﻬ|ھ|ﻩ|ﻫ|ﻪ|ۀ|ە|ة|ہ|ﮭ|ﺓ" with "ه"
142142
alphabet_ha_translate_table = str.maketrans(
143143
dict.fromkeys(
144-
"\uFE93\uFBAD\ufe94\ufeec\u06be\ufee9\ufeeb\ufeea\u06c0\u06d5\u0629\u06c1\u0723\u0724\u071d",
144+
"\ufe93\ufbad\ufe94\ufeec\u06be\ufee9\ufeeb\ufeea\u06c0\u06d5\u0629\u06c1\u0723\u0724\u071d",
145145
"\u0647",
146146
),
147147
)
148148

149149
# replace "ﺋ|ؿ|ؾ|ؽ|ۑ|ٸ|ﭛ|ﻯ|ۍ|ﻰ|ﻱ|ﻲ|ﻳ|ﻴ|ﯼ|ې|ﯽ|ﯾ|ﯿ|ێ|ے|ى|ي|ﺉ|ﺌ |ﯨ" with "ی"
150150
alphabet_ye_translate_table = str.maketrans(
151151
dict.fromkeys(
152-
"\uFBE8\ufb5b\ufeef\u06cd\ufef0\ufef1\ufef2\ufef3\ufef4\ufbfc"
152+
"\ufbe8\ufb5b\ufeef\u06cd\ufef0\ufef1\ufef2\ufef3\ufef4\ufbfc"
153153
"\u06d0\ufbfd\ufbfe\ufbff\u06ce\u06d2\u0649\u064a\u0678"
154154
"\u06d1\u063d\u063e\u063f\ufe89\ufe8b\ufe8c",
155155
"\u06cc",
@@ -160,43 +160,43 @@ class StringUtilsConstants:
160160

161161
# replace '•|·|●|·|・|∙|。|ⴰ' with '.'
162162
punctuation_translate_table2 = str.maketrans(
163-
dict.fromkeys("\u2022\u00b7\u25cf\u0387\u30fb\u2219\uff61\u2d30", "\u002E"),
163+
dict.fromkeys("\u2022\u00b7\u25cf\u0387\u30fb\u2219\uff61\u2d30", "\u002e"),
164164
)
165165

166166
# replace ',|٬|٫|‚|,' with '،'
167167
punctuation_translate_table3 = str.maketrans(dict.fromkeys("\u002c\u066c\u066b\u201a\uff0c", "\u060c"))
168168

169169
# replace 'ʕ | ? | ⁉ | � ' with '؟'
170-
punctuation_translate_table4 = str.maketrans(dict.fromkeys("\u0295\u003f\u2049\uFFFD", "\u061f"))
170+
punctuation_translate_table4 = str.maketrans(dict.fromkeys("\u0295\u003f\u2049\ufffd", "\u061f"))
171171

172172
# replace '‼ | ❕ ' with '!'
173-
punctuation_translate_table5 = str.maketrans(dict.fromkeys("\u203C\u2755", "\u0021"))
173+
punctuation_translate_table5 = str.maketrans(dict.fromkeys("\u203c\u2755", "\u0021"))
174174

175175
# replace '_ ' with 'ـ'
176-
punctuation_translate_table6 = str.maketrans(dict.fromkeys("\u005F", "\u0640"))
176+
punctuation_translate_table6 = str.maketrans(dict.fromkeys("\u005f", "\u0640"))
177177

178178
# replace ' - | ━ | − | ‐ | ‑ | – | — | ─ | − | ー | ⁃ (hyphen bullet : not supported by pycharm) | ' with '-'
179179
punctuation_translate_table7 = str.maketrans(
180-
dict.fromkeys("\uFF0D\u2501\u2212\u2010\u2011\u2013\u2014\u2500\u2212\u30FC\u2043", "\u002D"),
180+
dict.fromkeys("\uff0d\u2501\u2212\u2010\u2011\u2013\u2014\u2500\u2212\u30fc\u2043", "\u002d"),
181181
)
182182

183183
# replace '‹ |《 | ﴾ ' with '«'
184-
punctuation_translate_table8 = str.maketrans(dict.fromkeys("\u2039\u300A\uFD3E", "\u00AB"))
184+
punctuation_translate_table8 = str.maketrans(dict.fromkeys("\u2039\u300a\ufd3e", "\u00ab"))
185185

186186
# replace '› | 》| ﴿ ' with '»'
187-
punctuation_translate_table9 = str.maketrans(dict.fromkeys("\u203A\u300B\uFD3F", "\u00BB"))
187+
punctuation_translate_table9 = str.maketrans(dict.fromkeys("\u203a\u300b\ufd3f", "\u00bb"))
188188

189189
# replace ';' with '؛'
190-
punctuation_translate_table10 = str.maketrans(dict.fromkeys("\u003B", "\u061B"))
190+
punctuation_translate_table10 = str.maketrans(dict.fromkeys("\u003b", "\u061b"))
191191

192192
# replace '%' with '٪'
193-
punctuation_translate_table11 = str.maketrans(dict.fromkeys("\u0025", "\u066A"))
193+
punctuation_translate_table11 = str.maketrans(dict.fromkeys("\u0025", "\u066a"))
194194

195195
# replace " ˈ | ‘ | ’ | “ | ” " with " ' "
196-
punctuation_translate_table12 = str.maketrans(dict.fromkeys("\u02C8\u2018\u2019\u201C\u201D", "\u0027"))
196+
punctuation_translate_table12 = str.maketrans(dict.fromkeys("\u02c8\u2018\u2019\u201c\u201d", "\u0027"))
197197

198198
# replace ':' with ': '
199-
punctuation_translate_table13 = str.maketrans(dict.fromkeys("\uFF1A", "\u003A"))
199+
punctuation_translate_table13 = str.maketrans(dict.fromkeys("\uff1a", "\u003a"))
200200

201201
character_refinement_patterns: list = compile_patterns(
202202
[
@@ -258,8 +258,8 @@ class StringUtilsConstants:
258258
# replace ' «|» | . | : | ، | ؛ | ؟ | [|] | (|) | {|} | - | ـ | ٪ | ! | ' | " | # | + | / |' with ' '
259259
punctuation_persian_marks_to_space_translate_table = str.maketrans(
260260
dict.fromkeys(
261-
"\u002E\u003A\u0021\u060C\u061B\u061F\u00BB\u005D"
262-
"\u0029\u007D\u00AB\u005B\u0028\u007B\u002D\u0640\u066A\u0021\u0027\u0022\u0023"
261+
"\u002e\u003a\u0021\u060c\u061b\u061f\u00bb\u005d"
262+
"\u0029\u007d\u00ab\u005b\u0028\u007b\u002d\u0640\u066a\u0021\u0027\u0022\u0023"
263263
"\u002b\u002f",
264264
"\u0020",
265265
),

0 commit comments

Comments
 (0)