From d26be28c12af976af34e1a91a0195c1e5666228f Mon Sep 17 00:00:00 2001 From: Kosarew Konstantin Date: Fri, 23 May 2025 22:30:05 +0300 Subject: [PATCH 01/15] =?UTF-8?q?=D0=A2=D0=B5=D1=81=D1=82=D0=B8=D1=80?= =?UTF-8?q?=D1=83=D1=8E=20=D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BD=D0=BD?= =?UTF-8?q?=D1=8B=D0=B5=20=D1=84=D1=83=D0=BD=D0=BA=D1=86=D0=B8=D0=B8=20?= =?UTF-8?q?=D0=B2=20=D0=BD=D0=BE=D0=B2=D0=BE=D0=BC=20=D0=BC=D0=BE=D0=B4?= =?UTF-8?q?=D1=83=D0=BB=D0=B5=20processing.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/__pycache__/__init__.cpython-313.pyc | Bin 169 -> 0 bytes src/__pycache__/masks.cpython-313.pyc | Bin 2259 -> 0 bytes src/processing.py | 30 +++++++++++++++++++++++ test/main.py | 8 ++++++ 4 files changed, 38 insertions(+) delete mode 100644 src/__pycache__/__init__.cpython-313.pyc delete mode 100644 src/__pycache__/masks.cpython-313.pyc create mode 100644 src/processing.py diff --git a/src/__pycache__/__init__.cpython-313.pyc b/src/__pycache__/__init__.cpython-313.pyc deleted file mode 100644 index 9e09270370c3f5a5d0ff3b53f4380b5f29a3c180..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 169 zcmey&%ge<81V(;p86f&Gh=2h`DC08=kTI1Zok5e)ZzV$!6Oi{ABz4Qf*(xTqIJKxa z#ydZ+xFj*JBr`82pfWilu_!m7C_gJTxuiHIIlr{1I29;dl98VW6^$t_N{)$-&&!NHS{-?b*KH$IT)OWztd5+x>h&RsW(Axh+Hdd~UI-|xHk zcg|gDZ1fUXu}^!aMj8nD6*ucktO+XzLAXRz5+f=XBhQE`zm-gjl&jMSj)qso4IjzT z2$L?wZTpPu>?xhb6B*ULUyb;AKg zd<`Hb8f4iXe*R!AYUCUjCo*O%kHo1>f@Evc~q0uzg2=*uutNV<%r{ zCp9*HioKFx!6fr+EjI_4CvdBIU71o>95ThbCm&wae)8HpafShn962`cR2IrE=6J*jmL7o$yAQPP8 zqga+ANGaZedVo~$g;o$fcldDloQTM!SUI~Jh=W^fraUx4fqiSe|F5_W1n!~z;iD86 z^+PS%h@=UKEm6&w)NOG(oigl(;WrcdTqcz^6lo3r+iF8GJrPG>Yl#d1K0XIyawcWy zHkYE!nB{TJH1*k2GkP-qfQG?mA>*Rh$M%*7AwF*CZ_sUEM&z5zKoIq<(jZsv43s*1 ztLSWhi=)Nu`LPw+aj59qnLkvD9I+xtN|6yOGV`{BL0pQ!og{OZXT!#DBLka zaEbXrX-FbB+$}>yys^0#p+}$i2Id2K>quq zqjL8?7ZE;06fyf51U|wC0Ver-)<-Z!>*x3*&i?y`JMDx6Qs`PTrf?2Cfpx*w#D1w^ zrey;&wP!_TFk(NO*uu_)>+=j8f=IMy|YdY+w4C$ls9VcHE5cn list: + """ + Функция возвращает новый список словарей, содержащий только те словари, у которых + ключ state соответствует указанному значению. + + :param data_list: + :param state: + :return: + """ + + lens = len(data_list) + temp_list = list() + for i in range(lens): + temp_list.append(data_list[i]) if data_list[i].get('state',0) == state else temp_list + + return temp_list + + +def sort_by_date(date_list: list, ascending = False) -> list: + """ + Функция возвращает новый список, отсортированный по дате (date) + + :param date_list: + :param ascending: + :return: + """ + + sorted_list = sorted(date_list, key=lambda x: x.get("date", 0), reverse=ascending) + + return sorted_list diff --git a/test/main.py b/test/main.py index f551ce8..bea489b 100644 --- a/test/main.py +++ b/test/main.py @@ -1,4 +1,5 @@ from src.widget import get_date, mask_account_card +from src.processing import filter_by_state, sort_by_date if __name__ == "__main__": #Проверочные вызовы @@ -21,3 +22,10 @@ # тогда всё у нас будет хорошо # ну либо опять не понял задание print(get_date("2024-03-11T02:26:18.671407")) + + print() + + print("state ", filter_by_state([{'id': 41428829, 'state': 'EXECUTED', 'date': '2019-07-03T18:35:29.512364'}, {'id': 939719570, 'state': 'EXECUTED', 'date': '2018-06-30T02:08:58.425572'}, {'id': 594226727, 'state': 'CANCELED', 'date': '2018-09-12T21:27:25.241689'}, {'id': 615064591, 'state': 'CANCELED', 'date': '2018-10-14T08:21:33.419441'}])) + print("state ", filter_by_state([{'id': 41428829, 'state': 'EXECUTED', 'date': '2019-07-03T18:35:29.512364'}, {'id': 939719570, 'state': 'EXECUTED', 'date': '2018-06-30T02:08:58.425572'}, {'id': 594226727, 'state': 'CANCELED', 'date': '2018-09-12T21:27:25.241689'}, {'id': 615064591, 'state': 'CANCELED', 'date': '2018-10-14T08:21:33.419441'}], 'CANCELED')) + print("sort ", sort_by_date([{'id': 41428829, 'state': 'EXECUTED', 'date': '2019-07-03T18:35:29.512364'}, {'id': 939719570, 'state': 'EXECUTED', 'date': '2018-06-30T02:08:58.425572'}, {'id': 594226727, 'state': 'CANCELED', 'date': '2018-09-12T21:27:25.241689'}, {'id': 615064591, 'state': 'CANCELED', 'date': '2018-10-14T08:21:33.419441'}], True)) + print("sort ", sort_by_date([{'id': 41428829, 'state': 'EXECUTED', 'date': '2019-07-03T18:35:29.512364'}, {'id': 939719570, 'state': 'EXECUTED', 'date': '2018-06-30T02:08:58.425572'}, {'id': 594226727, 'state': 'CANCELED', 'date': '2018-09-12T21:27:25.241689'}, {'id': 615064591, 'state': 'CANCELED', 'date': '2018-10-14T08:21:33.419441'}])) From 7c6757267e351653603d7c2209f3a0bbdd056ff7 Mon Sep 17 00:00:00 2001 From: Kosarew Konstantin Date: Fri, 23 May 2025 22:38:01 +0300 Subject: [PATCH 02/15] =?UTF-8?q?=D1=82=D0=BE=D1=82=20=D0=B6=D0=B5=20?= =?UTF-8?q?=D0=BA=D0=BE=D0=B4,=20=D0=BD=D0=BE=20=D0=BF=D0=BE=D1=81=D0=BB?= =?UTF-8?q?=D0=B5=20=D0=BF=D1=80=D0=B8=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D1=8F=20linter=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/processing.py | 6 +++--- test/main.py | 54 +++++++++++++++++++++++++++++++++++++++++------ 2 files changed, 51 insertions(+), 9 deletions(-) diff --git a/src/processing.py b/src/processing.py index 1e8d45a..d5ca210 100644 --- a/src/processing.py +++ b/src/processing.py @@ -1,4 +1,4 @@ -def filter_by_state(data_list: list, state: str = 'EXECUTED') -> list: +def filter_by_state(data_list: list, state: str = "EXECUTED") -> list: """ Функция возвращает новый список словарей, содержащий только те словари, у которых ключ state соответствует указанному значению. @@ -11,12 +11,12 @@ def filter_by_state(data_list: list, state: str = 'EXECUTED') -> list: lens = len(data_list) temp_list = list() for i in range(lens): - temp_list.append(data_list[i]) if data_list[i].get('state',0) == state else temp_list + temp_list.append(data_list[i]) if data_list[i].get("state", 0) == state else temp_list return temp_list -def sort_by_date(date_list: list, ascending = False) -> list: +def sort_by_date(date_list: list, ascending: bool = False) -> list: """ Функция возвращает новый список, отсортированный по дате (date) diff --git a/test/main.py b/test/main.py index bea489b..3d129b0 100644 --- a/test/main.py +++ b/test/main.py @@ -1,8 +1,8 @@ -from src.widget import get_date, mask_account_card from src.processing import filter_by_state, sort_by_date +from src.widget import get_date, mask_account_card if __name__ == "__main__": - #Проверочные вызовы + # Проверочные вызовы print(mask_account_card("Счет 73654108430535874307")) print(mask_account_card("Visa Platinum 7000712289606361")) print(mask_account_card("Maestro 7000792108106361")) @@ -25,7 +25,49 @@ print() - print("state ", filter_by_state([{'id': 41428829, 'state': 'EXECUTED', 'date': '2019-07-03T18:35:29.512364'}, {'id': 939719570, 'state': 'EXECUTED', 'date': '2018-06-30T02:08:58.425572'}, {'id': 594226727, 'state': 'CANCELED', 'date': '2018-09-12T21:27:25.241689'}, {'id': 615064591, 'state': 'CANCELED', 'date': '2018-10-14T08:21:33.419441'}])) - print("state ", filter_by_state([{'id': 41428829, 'state': 'EXECUTED', 'date': '2019-07-03T18:35:29.512364'}, {'id': 939719570, 'state': 'EXECUTED', 'date': '2018-06-30T02:08:58.425572'}, {'id': 594226727, 'state': 'CANCELED', 'date': '2018-09-12T21:27:25.241689'}, {'id': 615064591, 'state': 'CANCELED', 'date': '2018-10-14T08:21:33.419441'}], 'CANCELED')) - print("sort ", sort_by_date([{'id': 41428829, 'state': 'EXECUTED', 'date': '2019-07-03T18:35:29.512364'}, {'id': 939719570, 'state': 'EXECUTED', 'date': '2018-06-30T02:08:58.425572'}, {'id': 594226727, 'state': 'CANCELED', 'date': '2018-09-12T21:27:25.241689'}, {'id': 615064591, 'state': 'CANCELED', 'date': '2018-10-14T08:21:33.419441'}], True)) - print("sort ", sort_by_date([{'id': 41428829, 'state': 'EXECUTED', 'date': '2019-07-03T18:35:29.512364'}, {'id': 939719570, 'state': 'EXECUTED', 'date': '2018-06-30T02:08:58.425572'}, {'id': 594226727, 'state': 'CANCELED', 'date': '2018-09-12T21:27:25.241689'}, {'id': 615064591, 'state': 'CANCELED', 'date': '2018-10-14T08:21:33.419441'}])) + print( + "state ", + filter_by_state( + [ + {"id": 41428829, "state": "EXECUTED", "date": "2019-07-03T18:35:29.512364"}, + {"id": 939719570, "state": "EXECUTED", "date": "2018-06-30T02:08:58.425572"}, + {"id": 594226727, "state": "CANCELED", "date": "2018-09-12T21:27:25.241689"}, + {"id": 615064591, "state": "CANCELED", "date": "2018-10-14T08:21:33.419441"}, + ] + ), + ) + print( + "state ", + filter_by_state( + [ + {"id": 41428829, "state": "EXECUTED", "date": "2019-07-03T18:35:29.512364"}, + {"id": 939719570, "state": "EXECUTED", "date": "2018-06-30T02:08:58.425572"}, + {"id": 594226727, "state": "CANCELED", "date": "2018-09-12T21:27:25.241689"}, + {"id": 615064591, "state": "CANCELED", "date": "2018-10-14T08:21:33.419441"}, + ], + "CANCELED", + ), + ) + print( + "sort ", + sort_by_date( + [ + {"id": 41428829, "state": "EXECUTED", "date": "2019-07-03T18:35:29.512364"}, + {"id": 939719570, "state": "EXECUTED", "date": "2018-06-30T02:08:58.425572"}, + {"id": 594226727, "state": "CANCELED", "date": "2018-09-12T21:27:25.241689"}, + {"id": 615064591, "state": "CANCELED", "date": "2018-10-14T08:21:33.419441"}, + ], + True, + ), + ) + print( + "sort ", + sort_by_date( + [ + {"id": 41428829, "state": "EXECUTED", "date": "2019-07-03T18:35:29.512364"}, + {"id": 939719570, "state": "EXECUTED", "date": "2018-06-30T02:08:58.425572"}, + {"id": 594226727, "state": "CANCELED", "date": "2018-09-12T21:27:25.241689"}, + {"id": 615064591, "state": "CANCELED", "date": "2018-10-14T08:21:33.419441"}, + ] + ), + ) From 04fca66061f8cfe29f498fffde64642a9111bfab Mon Sep 17 00:00:00 2001 From: kostya261 <62214954+kostya261@users.noreply.github.com> Date: Fri, 23 May 2025 23:39:15 +0300 Subject: [PATCH 03/15] Create README.md --- README.md | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..62d5396 --- /dev/null +++ b/README.md @@ -0,0 +1,64 @@ +# Проект домашнего задания на SkyEng +## Описание: +Проект домашнего задания по созданию виджета для работы с банковскими картами. + +## Установка: + +1. Клонируйте репозиторий: + ''' + + ''' +2. а в данной ветке README.md я пока что не знаю что ещё можно написать... + +## Использование: + +Откройте проект например в PyCharm, найдите PythonPackage\test, откройте файл main.py и запустите его. +По желанию можно его всячески модифицировать в рамках тестирования написанных функций. + +В PythonPackage\src описаны три модуля: +**masks.py, widget.py, processing.py**, которые и реализуют весь скромный функционал домашнего задания. + +### masks.py +В модуле masks.py описаны функции *get_mask_card_number* и *get_mask_account* +обе функции выполняют маскировку реквизитов: + +*get_mask_card_number* - маскирует номера карт +Принимает на входе строку с номером карты. +На выходе строка с маскированым номером + +*get_mask_account* - маскирует номер счёта +Принимает на входе строку с номером счёта. +На выходе строка с маскированым номером + +### widget.py +В данном модуле описаны функции: + +*mask_account_ card* - которая принимает на вход строку с наименованием карты и её номером после чего определяет что это за карта +и вызывает необходимую функцию из модуля masks.py и возвращает строку с маскированным номером карты + +*get_date* - конвертирует строку формата **"2024-03-11T02:26:18.671407"** в строку где указана дата в формате **ДД.ММ.ГГГ** + +### proctssing.py +proctssing.py так же содержит две функции как и предыдущие модули: + +*filter_by_state* - Функция возвращает новый список словарей, содержащий только те словари, у которых +ключ state соответствует указанному значению. + +Принимает на входе два параметра: +*список с данными карт +*строка с параметром state по которому происходит отбор карт в новый список + +На выходе функции новый список с отобранными по заданному параметру картами + + +*sort_by_date* - Функция возвращает новый список, отсортированный по дате (date) + +Принимает на входе два параметра: +*список с данными карт +*Булевое значение которое указывает тип сортировки (возрастающи/ убывающий) + +На выходе функции новый список с отсортированными по дате значениями. + +## Лицензия: + +В данном конкретном случае вероятно её ещё нет 8-/ From 8b1e220906104cb82db786ae4416de5859370ac0 Mon Sep 17 00:00:00 2001 From: Kosarew Konstantin Date: Sat, 24 May 2025 23:04:53 +0300 Subject: [PATCH 04/15] =?UTF-8?q?=D0=9F=D0=BE=D0=B4=D0=BF=D1=80=D0=B0?= =?UTF-8?q?=D0=B2=D0=B8=D0=BB=20=D0=BD=D0=B0=D0=B8=D0=BC=D0=B5=D0=BD=D0=BE?= =?UTF-8?q?=D0=B2=D0=B0=D0=BD=D0=B8=D0=B5=20=D0=BF=D0=B5=D1=80=D0=B5=D0=BC?= =?UTF-8?q?=D0=B5=D0=BD=D0=BD=D1=8B=D1=85=20=D0=B2=20=D0=BC=D0=BE=D0=B4?= =?UTF-8?q?=D1=83=D0=BB=D0=B5=20processing.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/processing.py | 8 ++++---- test/main.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/processing.py b/src/processing.py index d5ca210..47eec90 100644 --- a/src/processing.py +++ b/src/processing.py @@ -8,15 +8,15 @@ def filter_by_state(data_list: list, state: str = "EXECUTED") -> list: :return: """ - lens = len(data_list) + length_list = len(data_list) temp_list = list() - for i in range(lens): - temp_list.append(data_list[i]) if data_list[i].get("state", 0) == state else temp_list + for current_index in range(length_list): + temp_list.append(data_list[current_index]) if data_list[current_index].get("state", 0) == state else temp_list return temp_list -def sort_by_date(date_list: list, ascending: bool = False) -> list: +def sort_by_date(date_list: list, ascending: bool = True) -> list: """ Функция возвращает новый список, отсортированный по дате (date) diff --git a/test/main.py b/test/main.py index 3d129b0..34fe4f2 100644 --- a/test/main.py +++ b/test/main.py @@ -18,7 +18,7 @@ print() - # Если строка будет в таком виде, как сказано в задании... "2024-03-11T02:26:18.671407" + # Если строка будет в таком виде, как сказано в задании... # тогда всё у нас будет хорошо # ну либо опять не понял задание print(get_date("2024-03-11T02:26:18.671407")) From 8bdee823975e1e3a332237198b218828a285ccc6 Mon Sep 17 00:00:00 2001 From: kostya261 <62214954+kostya261@users.noreply.github.com> Date: Sat, 24 May 2025 23:41:36 +0300 Subject: [PATCH 05/15] Update README.md --- README.md | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 61 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 62d5396..fe758e4 100644 --- a/README.md +++ b/README.md @@ -5,10 +5,23 @@ ## Установка: 1. Клонируйте репозиторий: - ''' - - ''' -2. а в данной ветке README.md я пока что не знаю что ещё можно написать... + [ссылка](https://github.com/kostya261/PythonProject/tree/feature/homework_10_1) +2. Зависимости указанные в файле: *pyproject.toml* +``` +[tool.poetry.dependencies] +python = "^3.13" +poetry-core = "^2.1.3" +shell = "^1.0.1" + +[tool.poetry.group.dev.dependencies] +requests = "^2.32.3" + +[tool.poetry.group.lint.dependencies] +flake8 = "^7.2.0" +mypy = "^1.15.0" +black = "^25.1.0" +isort = "^6.0.1" +``` ## Использование: @@ -30,6 +43,26 @@ Принимает на входе строку с номером счёта. На выходе строка с маскированым номером +Примеры использования: +``` +temp_result = get_mask_card_number("4365592421228764") +print(temp_result) +``` +Результат: +``` +4365 59** **** 8764 +``` + +``` +temp_result = get_mask_account("12345678910111213145") +print(temp_result) +``` + +Результат: +``` +**3145 +``` + ### widget.py В данном модуле описаны функции: @@ -38,6 +71,30 @@ *get_date* - конвертирует строку формата **"2024-03-11T02:26:18.671407"** в строку где указана дата в формате **ДД.ММ.ГГГ** +Пример использования: +``` +print(mask_account_card("Счет 73654108430535874307")) +print(mask_account_card("Visa Platinum 7000712289606361")) +print(mask_account_card("Maestro 7000792108106361")) +``` + +Результат: +``` +Счет **4307 +Visa Platinum 7000 71** **** 6361 +Maestro 7000 79** **** 6361 +``` + +``` +print(get_date("2024-03-11T02:26:18.671407")) +``` + +Результат: +``` +11.03.2024 +``` + + ### proctssing.py proctssing.py так же содержит две функции как и предыдущие модули: From 19b768545cad337c384d6dcbb6830c8ef63f5b25 Mon Sep 17 00:00:00 2001 From: kostya261 <62214954+kostya261@users.noreply.github.com> Date: Sat, 24 May 2025 23:44:24 +0300 Subject: [PATCH 06/15] Update README.md --- README.md | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/README.md b/README.md index fe758e4..d56f14a 100644 --- a/README.md +++ b/README.md @@ -116,6 +116,40 @@ proctssing.py так же содержит две функции как и пр На выходе функции новый список с отсортированными по дате значениями. +Пример использования: +``` +print( + "state ", + filter_by_state( + [ + {"id": 41428829, "state": "EXECUTED", "date": "2019-07-03T18:35:29.512364"}, + {"id": 939719570, "state": "EXECUTED", "date": "2018-06-30T02:08:58.425572"}, + {"id": 594226727, "state": "CANCELED", "date": "2018-09-12T21:27:25.241689"}, + {"id": 615064591, "state": "CANCELED", "date": "2018-10-14T08:21:33.419441"}, + ] + ), + ) + +print( + "sort ", + sort_by_date( + [ + {"id": 41428829, "state": "EXECUTED", "date": "2019-07-03T18:35:29.512364"}, + {"id": 939719570, "state": "EXECUTED", "date": "2018-06-30T02:08:58.425572"}, + {"id": 594226727, "state": "CANCELED", "date": "2018-09-12T21:27:25.241689"}, + {"id": 615064591, "state": "CANCELED", "date": "2018-10-14T08:21:33.419441"}, + ], + True, + ), + ) +``` + +Результат: +``` +state [{'id': 41428829, 'state': 'EXECUTED', 'date': '2019-07-03T18:35:29.512364'}, {'id': 939719570, 'state': 'EXECUTED', 'date': '2018-06-30T02:08:58.425572'}] +sort [{'id': 41428829, 'state': 'EXECUTED', 'date': '2019-07-03T18:35:29.512364'}, {'id': 615064591, 'state': 'CANCELED', 'date': '2018-10-14T08:21:33.419441'}, +{'id': 594226727, 'state': 'CANCELED', 'date': '2018-09-12T21:27:25.241689'}, {'id': 939719570, 'state': 'EXECUTED', 'date': '2018-06-30T02:08:58.425572'}] +``` ## Лицензия: В данном конкретном случае вероятно её ещё нет 8-/ From f29473c70ea524ec23217bc00021e96119ba4e65 Mon Sep 17 00:00:00 2001 From: Kosarew Konstantin Date: Sun, 25 May 2025 00:30:10 +0300 Subject: [PATCH 07/15] =?UTF-8?q?=D0=92=D0=BE=D0=B7=D0=BC=D0=BE=D0=B6?= =?UTF-8?q?=D0=BD=D0=BE=20=D0=BF=D1=80=D0=BE=D0=B1=D0=BB=D0=B5=D0=BC=D0=B0?= =?UTF-8?q?=20=D0=B1=D1=8B=D0=BB=D0=B0=20=D0=B2=20main/py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/main.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/main.py b/test/main.py index 34fe4f2..02f4a42 100644 --- a/test/main.py +++ b/test/main.py @@ -36,6 +36,7 @@ ] ), ) + print( "state ", filter_by_state( @@ -48,6 +49,7 @@ "CANCELED", ), ) + print( "sort ", sort_by_date( @@ -60,6 +62,7 @@ True, ), ) + print( "sort ", sort_by_date( From 19cf8e24c6d80253acd815bea9d5c32caadb7a44 Mon Sep 17 00:00:00 2001 From: Kosarew Konstantin Date: Mon, 26 May 2025 23:53:23 +0300 Subject: [PATCH 08/15] =?UTF-8?q?=D0=BD=D0=B0=D1=87=D0=B8=D0=BD=D0=B0?= =?UTF-8?q?=D1=8E=20=D0=B3=D0=BE=D1=82=D0=BE=D0=B2=D0=B8=D1=82=D1=8C=D1=81?= =?UTF-8?q?=D1=8F=20=D0=BA=20=D0=BE=D1=87=D0=B5=D1=80=D0=B5=D0=B4=D0=BD?= =?UTF-8?q?=D0=BE=D0=BC=D1=83=20=D0=B4=D0=BE=D0=BC=D0=B0=D1=88=D0=BD=D0=B5?= =?UTF-8?q?=D0=BC=D1=83=20=D0=B7=D0=B0=D0=B4=D0=B0=D0=BD=D0=B8=D1=8E=2010.?= =?UTF-8?q?2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- poetry.lock | 156 ++++++++++++++++++++++++++++++++++++++- pyproject.toml | 2 + tests/__init__.py | 0 tests/conftest.py | 3 + tests/test_main.py | 0 tests/test_masks.py | 0 tests/test_processing.py | 0 tests/test_widget.py | 0 8 files changed, 157 insertions(+), 4 deletions(-) create mode 100644 tests/__init__.py create mode 100644 tests/conftest.py create mode 100644 tests/test_main.py create mode 100644 tests/test_masks.py create mode 100644 tests/test_processing.py create mode 100644 tests/test_widget.py diff --git a/poetry.lock b/poetry.lock index 721fa1b..736686a 100644 --- a/poetry.lock +++ b/poetry.lock @@ -180,12 +180,92 @@ version = "0.4.6" description = "Cross-platform colored terminal text." optional = false python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" -groups = ["lint"] -markers = "platform_system == \"Windows\"" +groups = ["dev", "lint"] files = [ {file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"}, {file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"}, ] +markers = {dev = "sys_platform == \"win32\"", lint = "platform_system == \"Windows\""} + +[[package]] +name = "coverage" +version = "7.8.2" +description = "Code coverage measurement for Python" +optional = false +python-versions = ">=3.9" +groups = ["dev"] +files = [ + {file = "coverage-7.8.2-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:bd8ec21e1443fd7a447881332f7ce9d35b8fbd2849e761bb290b584535636b0a"}, + {file = "coverage-7.8.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:4c26c2396674816deaeae7ded0e2b42c26537280f8fe313335858ffff35019be"}, + {file = "coverage-7.8.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1aec326ed237e5880bfe69ad41616d333712c7937bcefc1343145e972938f9b3"}, + {file = "coverage-7.8.2-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:5e818796f71702d7a13e50c70de2a1924f729228580bcba1607cccf32eea46e6"}, + {file = "coverage-7.8.2-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:546e537d9e24efc765c9c891328f30f826e3e4808e31f5d0f87c4ba12bbd1622"}, + {file = "coverage-7.8.2-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:ab9b09a2349f58e73f8ebc06fac546dd623e23b063e5398343c5270072e3201c"}, + {file = "coverage-7.8.2-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:fd51355ab8a372d89fb0e6a31719e825cf8df8b6724bee942fb5b92c3f016ba3"}, + {file = "coverage-7.8.2-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:0774df1e093acb6c9e4d58bce7f86656aeed6c132a16e2337692c12786b32404"}, + {file = "coverage-7.8.2-cp310-cp310-win32.whl", hash = "sha256:00f2e2f2e37f47e5f54423aeefd6c32a7dbcedc033fcd3928a4f4948e8b96af7"}, + {file = "coverage-7.8.2-cp310-cp310-win_amd64.whl", hash = "sha256:145b07bea229821d51811bf15eeab346c236d523838eda395ea969d120d13347"}, + {file = "coverage-7.8.2-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:b99058eef42e6a8dcd135afb068b3d53aff3921ce699e127602efff9956457a9"}, + {file = "coverage-7.8.2-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:5feb7f2c3e6ea94d3b877def0270dff0947b8d8c04cfa34a17be0a4dc1836879"}, + {file = "coverage-7.8.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:670a13249b957bb9050fab12d86acef7bf8f6a879b9d1a883799276e0d4c674a"}, + {file = "coverage-7.8.2-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:0bdc8bf760459a4a4187b452213e04d039990211f98644c7292adf1e471162b5"}, + {file = "coverage-7.8.2-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:07a989c867986c2a75f158f03fdb413128aad29aca9d4dbce5fc755672d96f11"}, + {file = "coverage-7.8.2-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:2db10dedeb619a771ef0e2949ccba7b75e33905de959c2643a4607bef2f3fb3a"}, + {file = "coverage-7.8.2-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:e6ea7dba4e92926b7b5f0990634b78ea02f208d04af520c73a7c876d5a8d36cb"}, + {file = "coverage-7.8.2-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:ef2f22795a7aca99fc3c84393a55a53dd18ab8c93fb431004e4d8f0774150f54"}, + {file = "coverage-7.8.2-cp311-cp311-win32.whl", hash = "sha256:641988828bc18a6368fe72355df5f1703e44411adbe49bba5644b941ce6f2e3a"}, + {file = "coverage-7.8.2-cp311-cp311-win_amd64.whl", hash = "sha256:8ab4a51cb39dc1933ba627e0875046d150e88478dbe22ce145a68393e9652975"}, + {file = "coverage-7.8.2-cp311-cp311-win_arm64.whl", hash = "sha256:8966a821e2083c74d88cca5b7dcccc0a3a888a596a04c0b9668a891de3a0cc53"}, + {file = "coverage-7.8.2-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:e2f6fe3654468d061942591aef56686131335b7a8325684eda85dacdf311356c"}, + {file = "coverage-7.8.2-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:76090fab50610798cc05241bf83b603477c40ee87acd358b66196ab0ca44ffa1"}, + {file = "coverage-7.8.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2bd0a0a5054be160777a7920b731a0570284db5142abaaf81bcbb282b8d99279"}, + {file = "coverage-7.8.2-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:da23ce9a3d356d0affe9c7036030b5c8f14556bd970c9b224f9c8205505e3b99"}, + {file = "coverage-7.8.2-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c9392773cffeb8d7e042a7b15b82a414011e9d2b5fdbbd3f7e6a6b17d5e21b20"}, + {file = "coverage-7.8.2-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:876cbfd0b09ce09d81585d266c07a32657beb3eaec896f39484b631555be0fe2"}, + {file = "coverage-7.8.2-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:3da9b771c98977a13fbc3830f6caa85cae6c9c83911d24cb2d218e9394259c57"}, + {file = "coverage-7.8.2-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:9a990f6510b3292686713bfef26d0049cd63b9c7bb17e0864f133cbfd2e6167f"}, + {file = "coverage-7.8.2-cp312-cp312-win32.whl", hash = "sha256:bf8111cddd0f2b54d34e96613e7fbdd59a673f0cf5574b61134ae75b6f5a33b8"}, + {file = "coverage-7.8.2-cp312-cp312-win_amd64.whl", hash = "sha256:86a323a275e9e44cdf228af9b71c5030861d4d2610886ab920d9945672a81223"}, + {file = "coverage-7.8.2-cp312-cp312-win_arm64.whl", hash = "sha256:820157de3a589e992689ffcda8639fbabb313b323d26388d02e154164c57b07f"}, + {file = "coverage-7.8.2-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:ea561010914ec1c26ab4188aef8b1567272ef6de096312716f90e5baa79ef8ca"}, + {file = "coverage-7.8.2-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:cb86337a4fcdd0e598ff2caeb513ac604d2f3da6d53df2c8e368e07ee38e277d"}, + {file = "coverage-7.8.2-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:26a4636ddb666971345541b59899e969f3b301143dd86b0ddbb570bd591f1e85"}, + {file = "coverage-7.8.2-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:5040536cf9b13fb033f76bcb5e1e5cb3b57c4807fef37db9e0ed129c6a094257"}, + {file = "coverage-7.8.2-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:dc67994df9bcd7e0150a47ef41278b9e0a0ea187caba72414b71dc590b99a108"}, + {file = "coverage-7.8.2-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:6e6c86888fd076d9e0fe848af0a2142bf606044dc5ceee0aa9eddb56e26895a0"}, + {file = "coverage-7.8.2-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:684ca9f58119b8e26bef860db33524ae0365601492e86ba0b71d513f525e7050"}, + {file = "coverage-7.8.2-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:8165584ddedb49204c4e18da083913bdf6a982bfb558632a79bdaadcdafd0d48"}, + {file = "coverage-7.8.2-cp313-cp313-win32.whl", hash = "sha256:34759ee2c65362163699cc917bdb2a54114dd06d19bab860725f94ef45a3d9b7"}, + {file = "coverage-7.8.2-cp313-cp313-win_amd64.whl", hash = "sha256:2f9bc608fbafaee40eb60a9a53dbfb90f53cc66d3d32c2849dc27cf5638a21e3"}, + {file = "coverage-7.8.2-cp313-cp313-win_arm64.whl", hash = "sha256:9fe449ee461a3b0c7105690419d0b0aba1232f4ff6d120a9e241e58a556733f7"}, + {file = "coverage-7.8.2-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:8369a7c8ef66bded2b6484053749ff220dbf83cba84f3398c84c51a6f748a008"}, + {file = "coverage-7.8.2-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:159b81df53a5fcbc7d45dae3adad554fdbde9829a994e15227b3f9d816d00b36"}, + {file = "coverage-7.8.2-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e6fcbbd35a96192d042c691c9e0c49ef54bd7ed865846a3c9d624c30bb67ce46"}, + {file = "coverage-7.8.2-cp313-cp313t-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:05364b9cc82f138cc86128dc4e2e1251c2981a2218bfcd556fe6b0fbaa3501be"}, + {file = "coverage-7.8.2-cp313-cp313t-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:46d532db4e5ff3979ce47d18e2fe8ecad283eeb7367726da0e5ef88e4fe64740"}, + {file = "coverage-7.8.2-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:4000a31c34932e7e4fa0381a3d6deb43dc0c8f458e3e7ea6502e6238e10be625"}, + {file = "coverage-7.8.2-cp313-cp313t-musllinux_1_2_i686.whl", hash = "sha256:43ff5033d657cd51f83015c3b7a443287250dc14e69910577c3e03bd2e06f27b"}, + {file = "coverage-7.8.2-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:94316e13f0981cbbba132c1f9f365cac1d26716aaac130866ca812006f662199"}, + {file = "coverage-7.8.2-cp313-cp313t-win32.whl", hash = "sha256:3f5673888d3676d0a745c3d0e16da338c5eea300cb1f4ada9c872981265e76d8"}, + {file = "coverage-7.8.2-cp313-cp313t-win_amd64.whl", hash = "sha256:2c08b05ee8d7861e45dc5a2cc4195c8c66dca5ac613144eb6ebeaff2d502e73d"}, + {file = "coverage-7.8.2-cp313-cp313t-win_arm64.whl", hash = "sha256:1e1448bb72b387755e1ff3ef1268a06617afd94188164960dba8d0245a46004b"}, + {file = "coverage-7.8.2-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:496948261eaac5ac9cf43f5d0a9f6eb7a6d4cb3bedb2c5d294138142f5c18f2a"}, + {file = "coverage-7.8.2-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:eacd2de0d30871eff893bab0b67840a96445edcb3c8fd915e6b11ac4b2f3fa6d"}, + {file = "coverage-7.8.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b039ffddc99ad65d5078ef300e0c7eed08c270dc26570440e3ef18beb816c1ca"}, + {file = "coverage-7.8.2-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:0e49824808d4375ede9dd84e9961a59c47f9113039f1a525e6be170aa4f5c34d"}, + {file = "coverage-7.8.2-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b069938961dfad881dc2f8d02b47645cd2f455d3809ba92a8a687bf513839787"}, + {file = "coverage-7.8.2-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:de77c3ba8bb686d1c411e78ee1b97e6e0b963fb98b1637658dd9ad2c875cf9d7"}, + {file = "coverage-7.8.2-cp39-cp39-musllinux_1_2_i686.whl", hash = "sha256:1676628065a498943bd3f64f099bb573e08cf1bc6088bbe33cf4424e0876f4b3"}, + {file = "coverage-7.8.2-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:8e1a26e7e50076e35f7afafde570ca2b4d7900a491174ca357d29dece5aacee7"}, + {file = "coverage-7.8.2-cp39-cp39-win32.whl", hash = "sha256:6782a12bf76fa61ad9350d5a6ef5f3f020b57f5e6305cbc663803f2ebd0f270a"}, + {file = "coverage-7.8.2-cp39-cp39-win_amd64.whl", hash = "sha256:1efa4166ba75ccefd647f2d78b64f53f14fb82622bc94c5a5cb0a622f50f1c9e"}, + {file = "coverage-7.8.2-pp39.pp310.pp311-none-any.whl", hash = "sha256:ec455eedf3ba0bbdf8f5a570012617eb305c63cb9f03428d39bf544cb2b94837"}, + {file = "coverage-7.8.2-py3-none-any.whl", hash = "sha256:726f32ee3713f7359696331a18daf0c3b3a70bb0ae71141b9d3c52be7c595e32"}, + {file = "coverage-7.8.2.tar.gz", hash = "sha256:a886d531373a1f6ff9fad2a2ba4a045b68467b779ae729ee0b3b10ac20033b27"}, +] + +[package.extras] +toml = ["tomli ; python_full_version <= \"3.11.0a6\""] [[package]] name = "flake8" @@ -219,6 +299,18 @@ files = [ [package.extras] all = ["flake8 (>=7.1.1)", "mypy (>=1.11.2)", "pytest (>=8.3.2)", "ruff (>=0.6.2)"] +[[package]] +name = "iniconfig" +version = "2.1.0" +description = "brain-dead simple config-ini parsing" +optional = false +python-versions = ">=3.8" +groups = ["dev"] +files = [ + {file = "iniconfig-2.1.0-py3-none-any.whl", hash = "sha256:9deba5723312380e77435581c6bf4935c94cbfab9b1ed33ef8d238ea168eb760"}, + {file = "iniconfig-2.1.0.tar.gz", hash = "sha256:3abbd2e30b36733fee78f9c7f7308f2d0050e88f0087fd25c2645f63c773e1c7"}, +] + [[package]] name = "isort" version = "6.0.1" @@ -318,7 +410,7 @@ version = "25.0" description = "Core utilities for Python packages" optional = false python-versions = ">=3.8" -groups = ["lint"] +groups = ["dev", "lint"] files = [ {file = "packaging-25.0-py3-none-any.whl", hash = "sha256:29572ef2b1f17581046b3a2227d5c611fb25ec70ca1ba8554b24b0e69331a484"}, {file = "packaging-25.0.tar.gz", hash = "sha256:d443872c98d677bf60f6a1f2f8c1cb748e8fe762d2bf9d3148b5599295b0fc4f"}, @@ -353,6 +445,22 @@ docs = ["furo (>=2024.8.6)", "proselint (>=0.14)", "sphinx (>=8.1.3)", "sphinx-a test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=8.3.4)", "pytest-cov (>=6)", "pytest-mock (>=3.14)"] type = ["mypy (>=1.14.1)"] +[[package]] +name = "pluggy" +version = "1.6.0" +description = "plugin and hook calling mechanisms for python" +optional = false +python-versions = ">=3.9" +groups = ["dev"] +files = [ + {file = "pluggy-1.6.0-py3-none-any.whl", hash = "sha256:e920276dd6813095e9377c0bc5566d94c932c33b27a3e3945d8389c374dd4746"}, + {file = "pluggy-1.6.0.tar.gz", hash = "sha256:7dcc130b76258d33b90f61b658791dede3486c3e6bfb003ee5c9bfb396dd22f3"}, +] + +[package.extras] +dev = ["pre-commit", "tox"] +testing = ["coverage", "pytest", "pytest-benchmark"] + [[package]] name = "poetry-core" version = "2.1.3" @@ -389,6 +497,46 @@ files = [ {file = "pyflakes-3.3.2.tar.gz", hash = "sha256:6dfd61d87b97fba5dcfaaf781171ac16be16453be6d816147989e7f6e6a9576b"}, ] +[[package]] +name = "pytest" +version = "8.3.5" +description = "pytest: simple powerful testing with Python" +optional = false +python-versions = ">=3.8" +groups = ["dev"] +files = [ + {file = "pytest-8.3.5-py3-none-any.whl", hash = "sha256:c69214aa47deac29fad6c2a4f590b9c4a9fdb16a403176fe154b79c0b4d4d820"}, + {file = "pytest-8.3.5.tar.gz", hash = "sha256:f4efe70cc14e511565ac476b57c279e12a855b11f48f212af1080ef2263d3845"}, +] + +[package.dependencies] +colorama = {version = "*", markers = "sys_platform == \"win32\""} +iniconfig = "*" +packaging = "*" +pluggy = ">=1.5,<2" + +[package.extras] +dev = ["argcomplete", "attrs (>=19.2)", "hypothesis (>=3.56)", "mock", "pygments (>=2.7.2)", "requests", "setuptools", "xmlschema"] + +[[package]] +name = "pytest-cov" +version = "6.1.1" +description = "Pytest plugin for measuring coverage." +optional = false +python-versions = ">=3.9" +groups = ["dev"] +files = [ + {file = "pytest_cov-6.1.1-py3-none-any.whl", hash = "sha256:bddf29ed2d0ab6f4df17b4c55b0a657287db8684af9c42ea546b21b1041b3dde"}, + {file = "pytest_cov-6.1.1.tar.gz", hash = "sha256:46935f7aaefba760e716c2ebfbe1c216240b9592966e7da99ea8292d4d3e2a0a"}, +] + +[package.dependencies] +coverage = {version = ">=7.5", extras = ["toml"]} +pytest = ">=4.6" + +[package.extras] +testing = ["fields", "hunter", "process-tests", "pytest-xdist", "virtualenv"] + [[package]] name = "requests" version = "2.32.3" @@ -456,4 +604,4 @@ zstd = ["zstandard (>=0.18.0)"] [metadata] lock-version = "2.1" python-versions = "^3.13" -content-hash = "590bbe3a739b0b5b00cca5b34e36c141a477aefbd2b405901829dda11775ba6a" +content-hash = "8232cc0101fe3c9cfd88754fe7267b5aeab0a100201a6dd987165045c63332fb" diff --git a/pyproject.toml b/pyproject.toml index e8926f2..90b80dc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,6 +13,8 @@ shell = "^1.0.1" [tool.poetry.group.dev.dependencies] requests = "^2.32.3" +pytest = "^8.3.5" +pytest-cov = "^6.1.1" [tool.poetry.group.lint.dependencies] diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/conftest.py b/tests/conftest.py new file mode 100644 index 0000000..1210010 --- /dev/null +++ b/tests/conftest.py @@ -0,0 +1,3 @@ +import pytest + + diff --git a/tests/test_main.py b/tests/test_main.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_masks.py b/tests/test_masks.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_processing.py b/tests/test_processing.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_widget.py b/tests/test_widget.py new file mode 100644 index 0000000..e69de29 From c194d8bc1c8345d92e455be7a64b7ad0dded3abf Mon Sep 17 00:00:00 2001 From: Kosarew Konstantin Date: Sun, 1 Jun 2025 22:54:41 +0300 Subject: [PATCH 09/15] =?UTF-8?q?=D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0?= =?UTF-8?q?=D0=BB=20=D1=82=D0=B5=D1=81=D1=82=D0=BE=D0=B2=D1=8B=D0=B5=20?= =?UTF-8?q?=D1=84=D1=83=D0=BD=D0=BA=D1=86=D0=B8=D0=B8=20=D0=B4=D0=BB=D1=8F?= =?UTF-8?q?=20=D1=80=D0=B0=D0=BD=D0=B5=D0=B5=20=D1=80=D0=B5=D0=B0=D0=BB?= =?UTF-8?q?=D0=B8=D0=B7=D0=BE=D0=B2=D0=B0=D0=BD=D0=BD=D0=BE=D0=B3=D0=BE=20?= =?UTF-8?q?=D0=BA=D0=BE=D0=B4=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/masks.py | 12 ++++-- src/processing.py | 18 ++++++++- src/widget.py | 17 ++++++-- test/main.py | 8 +++- tests/conftest.py | 62 +++++++++++++++++++++++++++++ tests/test_main.py | 0 tests/test_masks.py | 21 ++++++++++ tests/test_processing.py | 85 ++++++++++++++++++++++++++++++++++++++++ tests/test_widget.py | 56 ++++++++++++++++++++++++++ 9 files changed, 268 insertions(+), 11 deletions(-) delete mode 100644 tests/test_main.py diff --git a/src/masks.py b/src/masks.py index 50cc2eb..3edf73f 100644 --- a/src/masks.py +++ b/src/masks.py @@ -1,3 +1,6 @@ +INVALID_CARD_NUMBER = "Неверный номер карты!" + + def get_mask_card_number(number_card: str) -> str: """ Данная функция маскирует номер банковской карты. @@ -15,7 +18,7 @@ def get_mask_card_number(number_card: str) -> str: hidden_card_number: str = f"{number_card[0:4]} {number_card[4:6]}** **** {number_card[-4:]}" return hidden_card_number else: - return "Неверный номер карты!" + return INVALID_CARD_NUMBER def get_mask_account(account_number: str) -> str: @@ -29,8 +32,9 @@ def get_mask_account(account_number: str) -> str: :param account_number: :return: """ - if account_number.isdigit() and len(account_number) == 20: - account_number = account_number.strip() + account_number = account_number.strip() + + if len(account_number) == 20 and account_number.isdigit(): return f"**{account_number[-4:]}" else: - return "Неверный номер карты!" + return INVALID_CARD_NUMBER diff --git a/src/processing.py b/src/processing.py index 47eec90..30cdafc 100644 --- a/src/processing.py +++ b/src/processing.py @@ -6,10 +6,24 @@ def filter_by_state(data_list: list, state: str = "EXECUTED") -> list: :param data_list: :param state: :return: + PS - Я понимаю, что список можно итерировать не по индексу как у меня в примере, + а непосредственна по значениям списка. + Просто я так пытаюсь разобраться, как это хозяйство всё работает + Конструкции Python мне ломают мои привычки типа: + + for (int i = 0; i < 100; i++) + {ваш код} + + for i = 1 to 100 + ваш код + next + + но я обещаю в будущем исправиться """ length_list = len(data_list) temp_list = list() + for current_index in range(length_list): temp_list.append(data_list[current_index]) if data_list[current_index].get("state", 0) == state else temp_list @@ -24,7 +38,9 @@ def sort_by_date(date_list: list, ascending: bool = True) -> list: :param ascending: :return: """ - + if not date_list: + print("Empty") + return [] sorted_list = sorted(date_list, key=lambda x: x.get("date", 0), reverse=ascending) return sorted_list diff --git a/src/widget.py b/src/widget.py index 7be5b38..4a46067 100644 --- a/src/widget.py +++ b/src/widget.py @@ -1,3 +1,5 @@ +from datetime import datetime + from src.masks import get_mask_account, get_mask_card_number @@ -22,7 +24,7 @@ def mask_account_card(card_info_sting: str = "") -> str: if ("счет " in temp_card_info_sting) or ("счёт " in temp_card_info_sting): temp_result = get_mask_account(temp_card_info_sting[5:]) mask_card_info = "Счет " + temp_result if temp_result != card_error_message else card_error_message - else: + elif not temp_card_info_sting[-17:].isdigit(): temp_result = get_mask_card_number(temp_card_info_sting[-16:]) mask_card_info = ( card_info_sting[0:-16] + temp_result if temp_result != card_error_message else card_error_message @@ -33,7 +35,7 @@ def mask_account_card(card_info_sting: str = "") -> str: def get_date(iso_date: str) -> str: """ - принимает на вход строку с датой в формате + принимает на вход строку с датой в ISO 8601 формате "2024-03-11T02:26:18.671407" @@ -43,5 +45,12 @@ def get_date(iso_date: str) -> str: :param iso_date: :return: """ - - return iso_date[8:8 + 2] + "." + iso_date[5:5 + 2] + "." + iso_date[:4] + temp = "Неверный формат даты!" + if iso_date != "": + try: + temp_date = datetime.fromisoformat(iso_date) + temp_d = temp_date.strftime("%d.%m.%Y") + temp = str(temp_d) # афигеть рокировка... + except ValueError: + return temp + return temp diff --git a/test/main.py b/test/main.py index 02f4a42..b0e7323 100644 --- a/test/main.py +++ b/test/main.py @@ -19,7 +19,7 @@ print() # Если строка будет в таком виде, как сказано в задании... - # тогда всё у нас будет хорошо + # Тогда всё у нас будет хорошо # ну либо опять не понял задание print(get_date("2024-03-11T02:26:18.671407")) @@ -56,10 +56,11 @@ [ {"id": 41428829, "state": "EXECUTED", "date": "2019-07-03T18:35:29.512364"}, {"id": 939719570, "state": "EXECUTED", "date": "2018-06-30T02:08:58.425572"}, + {"id": 939719572, "state": "EXECUTED", "date": "2018-06-30T02:08:58.425572"}, {"id": 594226727, "state": "CANCELED", "date": "2018-09-12T21:27:25.241689"}, {"id": 615064591, "state": "CANCELED", "date": "2018-10-14T08:21:33.419441"}, ], - True, + False, ), ) @@ -69,8 +70,11 @@ [ {"id": 41428829, "state": "EXECUTED", "date": "2019-07-03T18:35:29.512364"}, {"id": 939719570, "state": "EXECUTED", "date": "2018-06-30T02:08:58.425572"}, + {"id": 939719572, "state": "EXECUTED", "date": "2018-06-30T02:08:58.425572"}, {"id": 594226727, "state": "CANCELED", "date": "2018-09-12T21:27:25.241689"}, {"id": 615064591, "state": "CANCELED", "date": "2018-10-14T08:21:33.419441"}, ] ), ) + + diff --git a/tests/conftest.py b/tests/conftest.py index 1210010..9a3235c 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,3 +1,65 @@ import pytest +card_invalid_string = "Неверный номер карты!" +card_numbers_for_test = [ + {"card": "6347551021023605", "result": "6347 55** **** 3605"}, + {"card": "6347551021023605 ", "result": "6347 55** **** 3605"}, + {"card": " 6347551021023605", "result": "6347 55** **** 3605"}, + {"card": "x347551021023605", "result": card_invalid_string}, + {"card": "34755102c1023605", "result": card_invalid_string}, + {"card": "634755102102365", "result": card_invalid_string}, + {"card": "63475510210236052", "result": card_invalid_string}, + {"card": "634755 102102 3605", "result": card_invalid_string}, +] + +account_numbers_for_test = [ + {"card": "63475526471021023605", "result": "**3605"}, + {"card": "63475510210236026475 ", "result": "**6475"}, + {"card": " 63475510210226473605", "result": "**3605"}, + {"card": "x347551021023605", "result": card_invalid_string}, + {"card": "34755102c1023605", "result": card_invalid_string}, + {"card": "634755102102365", "result": card_invalid_string}, + {"card": "63475510210236052", "result": card_invalid_string}, + {"card": "634755 102102 3605", "result": card_invalid_string}, +] + + +account_card_for_test = [ + {"card": "Счет 73654108430535874307", "result": "Счет **4307"}, + {"card": "Счет 7365408430535874307", "result": card_invalid_string}, + {"card": "Visa Platinum 7000712289606361", "result": "Visa Platinum 7000 71** **** 6361"}, + {"card": "Maestro 7000792108106361", "result": "Maestro 7000 79** **** 6361"}, + {"card": "MasterCard 7158300734726758", "result": "MasterCard 7158 30** **** 6758"}, + {"card": "Maestro 1596837868705199", "result": "Maestro 1596 83** **** 5199"}, + {"card": "Счет 64686473678894779589", "result": "Счет **9589"}, + {"card": "Счет 646864736788947795589", "result": card_invalid_string}, + {"card": "MasterCard 715300734726758", "result": card_invalid_string}, + {"card": "Счет 35383033474447895560", "result": "Счет **5560"}, + {"card": "Счет 3538303347с447895560", "result": card_invalid_string}, + {"card": "Visa Classic 6831982476737658", "result": "Visa Classic 6831 98** **** 7658"}, + {"card": "Visa Classic 683198247637658", "result": card_invalid_string}, + {"card": "Visa Classic 683198247637652448", "result": card_invalid_string}, + {"card": "Visa Platinum 8990922113665229", "result": "Visa Platinum 8990 92** **** 5229"}, + {"card": "Visa Platinum ", "result": card_invalid_string}, + {"card": "", "result": card_invalid_string}, + {"card": "Visa Gold 5999414228426353", "result": "Visa Gold 5999 41** **** 6353"}, + {"card": "счет 73654108430135874305", "result": "Счет **4305"}, + {"card": "сет 73654108430135874305", "result": card_invalid_string}, + {"card": "сЧет 73654108430135874305", "result": "Счет **4305"}, +] + + +@pytest.fixture(params=card_numbers_for_test) +def card_numbers(request): + return request.param + + +@pytest.fixture(params=account_numbers_for_test) +def account_numbers(request): + return request.param + + +@pytest.fixture(params=account_card_for_test) +def account_cards(request): + return request.param diff --git a/tests/test_main.py b/tests/test_main.py deleted file mode 100644 index e69de29..0000000 diff --git a/tests/test_masks.py b/tests/test_masks.py index e69de29..4e7a7ef 100644 --- a/tests/test_masks.py +++ b/tests/test_masks.py @@ -0,0 +1,21 @@ +from src.masks import get_mask_account, get_mask_card_number + + +def test_get_mask_card_number(card_numbers: dict) -> None: + """ + Тестируется функция get_mask_card_number. + Данные для тестов берутся из Fixture + :param card_numbers: + :return: + """ + assert get_mask_card_number(card_numbers["card"]) == card_numbers["result"] + + +def test_get_mask_account(account_numbers: dict) -> None: + """ + Тестируется функция get_mask_account. + Данные для тестов берутся из Fixture + :param card_numbers: + :return: + """ + assert get_mask_account(account_numbers["card"]) == account_numbers["result"] diff --git a/tests/test_processing.py b/tests/test_processing.py index e69de29..32f3190 100644 --- a/tests/test_processing.py +++ b/tests/test_processing.py @@ -0,0 +1,85 @@ +import pytest + +from src.processing import filter_by_state, sort_by_date + +list_date = [ + {"id": 41428829, "state": "EXECUTED", "date": "2019-07-03T18:35:29.512364"}, + {"id": 939719570, "state": "EXECUTED", "date": "2018-06-30T02:08:58.425572"}, + {"id": 939719572, "state": "EXECUTED", "date": "2018-06-30T02:08:58.425572"}, + {"id": 594226727, "state": "CANCELED", "date": "2018-09-12T21:27:25.241689"}, + {"id": 615064591, "state": "CANCELED", "date": "2018-10-14T08:21:33.419441"}, +] + +list_date_empty: list = [] + +list_date_executed = [ + {"id": 41428829, "state": "EXECUTED", "date": "2019-07-03T18:35:29.512364"}, + {"id": 939719570, "state": "EXECUTED", "date": "2018-06-30T02:08:58.425572"}, + {"id": 939719572, "state": "EXECUTED", "date": "2018-06-30T02:08:58.425572"}, +] + +list_date_canceled = [ + {"id": 594226727, "state": "CANCELED", "date": "2018-09-12T21:27:25.241689"}, + {"id": 615064591, "state": "CANCELED", "date": "2018-10-14T08:21:33.419441"}, +] + +list_date_sort_up: list = [ + {"date": "2019-07-03T18:35:29.512364", "id": 41428829, "state": "EXECUTED"}, + {"date": "2018-10-14T08:21:33.419441", "id": 615064591, "state": "CANCELED"}, + {"date": "2018-09-12T21:27:25.241689", "id": 594226727, "state": "CANCELED"}, + {"date": "2018-06-30T02:08:58.425572", "id": 939719570, "state": "EXECUTED"}, + {"date": "2018-06-30T02:08:58.425572", "id": 939719572, "state": "EXECUTED"}, +] + +list_date_sort_down: list = [ + {"date": "2018-06-30T02:08:58.425572", "id": 939719570, "state": "EXECUTED"}, + {"date": "2018-06-30T02:08:58.425572", "id": 939719572, "state": "EXECUTED"}, + {"date": "2018-09-12T21:27:25.241689", "id": 594226727, "state": "CANCELED"}, + {"date": "2018-10-14T08:21:33.419441", "id": 615064591, "state": "CANCELED"}, + {"date": "2019-07-03T18:35:29.512364", "id": 41428829, "state": "EXECUTED"}, +] + + +@pytest.mark.parametrize( + "date_list, state, expected", + [ + (list_date, "EXECUTED", list_date_executed), + (list_date, "CANCELED", list_date_canceled), + (list_date, "CALED", list_date_empty), + ([], "CANCELED", list_date_empty), + ], +) +def test_filter_by_state(date_list: list, state: str, expected: list) -> None: + """ + Тестируем функцию filter_by_state + + :param date_list: + :param state: + :param expected: + :return: + """ + assert filter_by_state(date_list, state) == expected + + +@pytest.mark.parametrize( + "date_list, ascending, expected", + [ + (list_date, True, list_date_sort_up), + (list_date, False, list_date_sort_down), + ([], False, []), + ([], True, []), + ([], None, []), + ], +) +def test_sort_by_date(date_list: list, ascending: bool, expected: list) -> None: + """ + Проверяем функцию sort_by_date, которая сортирует списки по датам + как вверх по списку так и вниз + так же проверяется как ведет себя функция если список пустой + + :param date_list: + :param ascending: + :param expected: + :return: + """ + assert sort_by_date(date_list, ascending) == expected diff --git a/tests/test_widget.py b/tests/test_widget.py index e69de29..dabaaf8 100644 --- a/tests/test_widget.py +++ b/tests/test_widget.py @@ -0,0 +1,56 @@ +from datetime import datetime + +import pytest + +from src.widget import get_date, mask_account_card + + +def test_mask_account_card(account_cards: dict[str, str]) -> None: + """ + Проверяем функцию mask_account_card которая маскирует в зависимости + от того что подано на вход, либо счёт, либо карту. + Данные берутся из fixture в виде словаря, в котором указаны + как данные на входе, так и предполагаемые данные на выходе + :param account_cards: + :return Ничего: + """ + assert mask_account_card(account_cards["card"]) == account_cards["result"] + + +@pytest.mark.parametrize( + "card, expected", + [ + ("Счет 73654108430535874307", "Счет **4307"), + ("Счет 7365408430535874307", "Неверный номер карты!"), + ("Visa Platinum 7000712289606361", "Visa Platinum 7000 71** **** 6361"), + ("Maestro 1596837868705199", "Maestro 1596 83** **** 5199"), + ("MasterCard 715300734726758", "Неверный номер карты!"), + ("", "Неверный номер карты!"), + ], +) +def test_mask_account_card_parametrize(card: str, expected: str) -> None: + """ + Данная функция проверяет функцию mask_account_card + :param card: + :param expected: + :return: + """ + assert mask_account_card(card) == expected + + +def test_get_date() -> None: + """ + Тестируем функцию get_date + Проверяется, как функция в целом фоспринимает стандарт принимаемой даты + Затем этот же самый формат подаётся, но уже в виде готовой текстовой строки + Также проверяем если строка будет пустой + И если дата будет подана в неправильном формате + :return - Ничего: + """ + now_time = datetime.now() + assert get_date(str(now_time.isoformat())) + assert get_date("2024-03-11T02:26:18.671407") == "11.03.2024" + time_data = "" + assert get_date(str(time_data)) == "Неверный формат даты!" + time_data = "10.13.2005" + assert get_date(str(time_data)) == "Неверный формат даты!" From 3d41be3b7149c5bc4f3a995cd1829881729fd7dc Mon Sep 17 00:00:00 2001 From: Kosarew Konstantin Date: Sun, 1 Jun 2025 23:23:23 +0300 Subject: [PATCH 10/15] =?UTF-8?q?=D0=BE=D0=B1=D0=BD=D0=BE=D0=B2=D0=B8?= =?UTF-8?q?=D0=BB=20=D0=B8=D0=BD=D1=84=D0=BE=D1=80=D0=BC=D0=B0=D1=86=D0=B8?= =?UTF-8?q?=D1=8E=20=D0=B2=20READ.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .coverage | Bin 0 -> 53248 bytes .gitignore | 26 +++++++++++++------------- README.md | 17 +++++++++++++++++ 3 files changed, 30 insertions(+), 13 deletions(-) create mode 100644 .coverage diff --git a/.coverage b/.coverage new file mode 100644 index 0000000000000000000000000000000000000000..a9065f9cd8b314ac34fb8ec29cb0074d13a5995c GIT binary patch literal 53248 zcmeI)+i%-c90zdUmMm#Ak4;lnm8xeC&{boYTfzY-hI9 z%L5wOkS2ln4-kI@{2A~7e*xkJ?O_NZ0TLP#{C>VP$<|Dj^00P%t;X@?oa1vo=N31u zKfJo^#!{>Wp=Zb9HRY(Hs>(Y;D2h^|SA|~rQlt$d-=TN4Z+qBgNvUmoQ87PO#tUC6 z=Jm>DbAJ4*%FAOvj(erg$G$GwC5KL6fdB*`0D=FvK=n$0Fwj;xI zT{-{3(&EaJSXq2`c}b+l#Obo2Wqw{PiZIv|Z5fI+wjX_0aa6ri|u< zy;DLbpnPt{X=%g2I~xb0<@!l6{m6~oz!!2$I-OWHb}ir>qvZ?X^_Payy1@myk;crf z)u+>oyi3e1coun$GUo?5YcC>Snj$B8_B&pk$ZvMMHdhYCNG}`*!(tAL8wXio_gpu- z)Mc-{1J#+6bB(64I=*|mBX=r)PV{2VCB^WAIl+aX7Vy$oq59@=RiRcXx1!rE`n+Y? zoj6GLEvkHLfmY+6y>Pf#ot{?j-%c6|^H_B^j&?Rm1C3_q@Q|j%=ZCi&?j?hbgnLn| zC4#l2%W!OwRt~l1{yuXy$FM{0Xd=i0Qcj;~YvasP9z?wr)Cb#I(qbY>9fZb$JlI;t zcetxWTm~oDkfFUUYuVX!Sa{YAiJHzrsZd>-9@cbrnt-*ivsvy=6pGc!N%d|iX+~LX zWpBlSCY0CYF2iVk%9D1~3G;#EX@g`Qqc=+CeIz?W#hEV_s*97uij#%27P5`Q-J(&f zo;aa)(;mU&62A@&6oQZRy1-)-!QQjqw&SLFGVgqtGCp&tP<`vfu#9sStOZ^d?p@Q8 zEZ?6<^gSB%`K1qJnUD0cd`WK4Z`dswP1?2_QkSJMIGq6m2W;3B*sceiIBCDUn>0_J zdwTgz6X@;d_7rM12~OSnN)SaZO{+X@Md$LPVy0vbWJxB zNgke@mEP{95p8oC>l-skp7P0shxrxibb0@x4bQXvMmAsZG@PbNV?TFJzD_!bP((39 zoid^>`dFHIqS;vdEZ^X(<|BoEus{F;5P$##AOHaf zKmY;|fB*y_@caqrs-_nC{$DeHR?OdMg#`i-fB*y_009U<00Izz00bZafrBY9uIW=| z{wE%Tr#>7>PR=nJNN&_Wutp) zw6q59|MiPTw>nyS`Tf7PY;>neBNemn{vXf(+vklM*@FNCAOHafKmY;|fB*y_009V$ zCZMajQsM9aRr4Q(ey~6Q0uX=z1Rwwb2tWV=5P$##An+Ut=z67;{QtlCgJS+|J~V%# z4J;6V00bZa0SG_<0uX=z1Rwwb2<&@-ieadw7mbU`gFDBRf7LOac2DY>qFmFik7>N4 z9s9JVHq}F_Q7Ro#lmGuWe^Jaw<{##-w1EWz5P$##AOHafKmY;|fB*y_0D%K4P@o%s z)i9DbT~FRL&7fZZB;WrlM-OPRkZlM+00Izz00bZa0SG_<0uX=z1okAr-~Z$Oe@|2h z1OW&@00Izz00bZa0SG_<0uVT`0_p$%Kjgpv|I7T{e0X3Bf{a4|0uX=z1Rwwb2tWV= Y5P$##Adm>?20id!*LkJ!il6`gA4s7oM*si- literal 0 HcmV?d00001 diff --git a/.gitignore b/.gitignore index 9a9dad1..96c5733 100644 --- a/.gitignore +++ b/.gitignore @@ -37,19 +37,19 @@ pip-log.txt pip-delete-this-directory.txt # Unit test / coverage reports -htmlcov/ -.tox/ -.nox/ -.coverage -.coverage.* -.cache -nosetests.xml -coverage.xml -*.cover -*.py,cover -.hypothesis/ -.pytest_cache/ -cover/ +#htmlcov/ +#.tox/ +#.nox/ +#.coverage +#.coverage.* +#.cache +#nosetests.xml +#coverage.xml +#*.cover +#*.py,cover +#.hypothesis/ +#.pytest_cache/ +#cover/ # Translations *.mo diff --git a/README.md b/README.md index d56f14a..434544c 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,8 @@ shell = "^1.0.1" [tool.poetry.group.dev.dependencies] requests = "^2.32.3" +pytest = "^8.3.5" +pytest-cov = "^6.1.1" [tool.poetry.group.lint.dependencies] flake8 = "^7.2.0" @@ -150,6 +152,21 @@ state [{'id': 41428829, 'state': 'EXECUTED', 'date': '2019-07-03T18:35:29.51236 sort [{'id': 41428829, 'state': 'EXECUTED', 'date': '2019-07-03T18:35:29.512364'}, {'id': 615064591, 'state': 'CANCELED', 'date': '2018-10-14T08:21:33.419441'}, {'id': 594226727, 'state': 'CANCELED', 'date': '2018-09-12T21:27:25.241689'}, {'id': 939719570, 'state': 'EXECUTED', 'date': '2018-06-30T02:08:58.425572'}] ``` + +## Тесты +Добавлены тестовые файлы test_widget.py, test_masks.pym test_processing.py +которые проверяют ранее написанные функции. +В них реализованы функции: +1. test_mask_account_card, +2. test_mask_account_card_parametrize, +3. test_get_date, +4. test_filter_by_state, +5. test_sort_by_date, +6. test_get_mask_card_number, +7. test_get_mask_account + +Тест запускается из командной строки, командой **pytest** + ## Лицензия: В данном конкретном случае вероятно её ещё нет 8-/ From 14a9e401e46f074ec229abb58fa287aa59b838dd Mon Sep 17 00:00:00 2001 From: Kosarew Konstantin Date: Sun, 1 Jun 2025 23:33:34 +0300 Subject: [PATCH 11/15] =?UTF-8?q?=D1=81=D1=83=D0=BC=D0=B5=D0=BB=20=D1=82?= =?UTF-8?q?=D0=B0=D0=BA=D0=B8=20=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D1=82?= =?UTF-8?q?=D1=8C=20htmlcov?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htmlcov/class_index.html | 139 ++++ htmlcov/coverage_html_cb_497bf287.js | 733 ++++++++++++++++++ htmlcov/favicon_32_cb_58284776.png | Bin 0 -> 1732 bytes htmlcov/function_index.html | 187 +++++ htmlcov/index.html | 132 ++++ htmlcov/keybd_closed_cb_ce680311.png | Bin 0 -> 9004 bytes htmlcov/status.json | 1 + htmlcov/style_cb_718ce007.css | 337 ++++++++ htmlcov/z_145eef247bfb46b6___init___py.html | 97 +++ htmlcov/z_145eef247bfb46b6_masks_py.html | 137 ++++ htmlcov/z_145eef247bfb46b6_processing_py.html | 143 ++++ htmlcov/z_145eef247bfb46b6_widget_py.html | 153 ++++ 12 files changed, 2059 insertions(+) create mode 100644 htmlcov/class_index.html create mode 100644 htmlcov/coverage_html_cb_497bf287.js create mode 100644 htmlcov/favicon_32_cb_58284776.png create mode 100644 htmlcov/function_index.html create mode 100644 htmlcov/index.html create mode 100644 htmlcov/keybd_closed_cb_ce680311.png create mode 100644 htmlcov/status.json create mode 100644 htmlcov/style_cb_718ce007.css create mode 100644 htmlcov/z_145eef247bfb46b6___init___py.html create mode 100644 htmlcov/z_145eef247bfb46b6_masks_py.html create mode 100644 htmlcov/z_145eef247bfb46b6_processing_py.html create mode 100644 htmlcov/z_145eef247bfb46b6_widget_py.html diff --git a/htmlcov/class_index.html b/htmlcov/class_index.html new file mode 100644 index 0000000..8c65bd6 --- /dev/null +++ b/htmlcov/class_index.html @@ -0,0 +1,139 @@ + + + + + Coverage report + + + + + +
+
+

Coverage report: + 100% +

+ +
+ +
+ + +
+
+

+ Files + Functions + Classes +

+

+ coverage.py v7.8.2, + created at 2025-06-01 23:14 +0300 +

+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Fileclassstatementsmissingexcludedcoverage
src\__init__.py(no class)000100%
src\masks.py(no class)1200100%
src\processing.py(no class)1200100%
src\widget.py(no class)2400100%
Total 4800100%
+

+ No items found using the specified filter. +

+
+ + + diff --git a/htmlcov/coverage_html_cb_497bf287.js b/htmlcov/coverage_html_cb_497bf287.js new file mode 100644 index 0000000..1face13 --- /dev/null +++ b/htmlcov/coverage_html_cb_497bf287.js @@ -0,0 +1,733 @@ +// Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +// For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt + +// Coverage.py HTML report browser code. +/*jslint browser: true, sloppy: true, vars: true, plusplus: true, maxerr: 50, indent: 4 */ +/*global coverage: true, document, window, $ */ + +coverage = {}; + +// General helpers +function debounce(callback, wait) { + let timeoutId = null; + return function(...args) { + clearTimeout(timeoutId); + timeoutId = setTimeout(() => { + callback.apply(this, args); + }, wait); + }; +}; + +function checkVisible(element) { + const rect = element.getBoundingClientRect(); + const viewBottom = Math.max(document.documentElement.clientHeight, window.innerHeight); + const viewTop = 30; + return !(rect.bottom < viewTop || rect.top >= viewBottom); +} + +function on_click(sel, fn) { + const elt = document.querySelector(sel); + if (elt) { + elt.addEventListener("click", fn); + } +} + +// Helpers for table sorting +function getCellValue(row, column = 0) { + const cell = row.cells[column] // nosemgrep: eslint.detect-object-injection + if (cell.childElementCount == 1) { + var child = cell.firstElementChild; + if (child.tagName === "A") { + child = child.firstElementChild; + } + if (child instanceof HTMLDataElement && child.value) { + return child.value; + } + } + return cell.innerText || cell.textContent; +} + +function rowComparator(rowA, rowB, column = 0) { + let valueA = getCellValue(rowA, column); + let valueB = getCellValue(rowB, column); + if (!isNaN(valueA) && !isNaN(valueB)) { + return valueA - valueB; + } + return valueA.localeCompare(valueB, undefined, {numeric: true}); +} + +function sortColumn(th) { + // Get the current sorting direction of the selected header, + // clear state on other headers and then set the new sorting direction. + const currentSortOrder = th.getAttribute("aria-sort"); + [...th.parentElement.cells].forEach(header => header.setAttribute("aria-sort", "none")); + var direction; + if (currentSortOrder === "none") { + direction = th.dataset.defaultSortOrder || "ascending"; + } + else if (currentSortOrder === "ascending") { + direction = "descending"; + } + else { + direction = "ascending"; + } + th.setAttribute("aria-sort", direction); + + const column = [...th.parentElement.cells].indexOf(th) + + // Sort all rows and afterwards append them in order to move them in the DOM. + Array.from(th.closest("table").querySelectorAll("tbody tr")) + .sort((rowA, rowB) => rowComparator(rowA, rowB, column) * (direction === "ascending" ? 1 : -1)) + .forEach(tr => tr.parentElement.appendChild(tr)); + + // Save the sort order for next time. + if (th.id !== "region") { + let th_id = "file"; // Sort by file if we don't have a column id + let current_direction = direction; + const stored_list = localStorage.getItem(coverage.INDEX_SORT_STORAGE); + if (stored_list) { + ({th_id, direction} = JSON.parse(stored_list)) + } + localStorage.setItem(coverage.INDEX_SORT_STORAGE, JSON.stringify({ + "th_id": th.id, + "direction": current_direction + })); + if (th.id !== th_id || document.getElementById("region")) { + // Sort column has changed, unset sorting by function or class. + localStorage.setItem(coverage.SORTED_BY_REGION, JSON.stringify({ + "by_region": false, + "region_direction": current_direction + })); + } + } + else { + // Sort column has changed to by function or class, remember that. + localStorage.setItem(coverage.SORTED_BY_REGION, JSON.stringify({ + "by_region": true, + "region_direction": direction + })); + } +} + +// Find all the elements with data-shortcut attribute, and use them to assign a shortcut key. +coverage.assign_shortkeys = function () { + document.querySelectorAll("[data-shortcut]").forEach(element => { + document.addEventListener("keypress", event => { + if (event.target.tagName.toLowerCase() === "input") { + return; // ignore keypress from search filter + } + if (event.key === element.dataset.shortcut) { + element.click(); + } + }); + }); +}; + +// Create the events for the filter box. +coverage.wire_up_filter = function () { + // Populate the filter and hide100 inputs if there are saved values for them. + const saved_filter_value = localStorage.getItem(coverage.FILTER_STORAGE); + if (saved_filter_value) { + document.getElementById("filter").value = saved_filter_value; + } + const saved_hide100_value = localStorage.getItem(coverage.HIDE100_STORAGE); + if (saved_hide100_value) { + document.getElementById("hide100").checked = JSON.parse(saved_hide100_value); + } + + // Cache elements. + const table = document.querySelector("table.index"); + const table_body_rows = table.querySelectorAll("tbody tr"); + const no_rows = document.getElementById("no_rows"); + + // Observe filter keyevents. + const filter_handler = (event => { + // Keep running total of each metric, first index contains number of shown rows + const totals = new Array(table.rows[0].cells.length).fill(0); + // Accumulate the percentage as fraction + totals[totals.length - 1] = { "numer": 0, "denom": 0 }; // nosemgrep: eslint.detect-object-injection + + var text = document.getElementById("filter").value; + // Store filter value + localStorage.setItem(coverage.FILTER_STORAGE, text); + const casefold = (text === text.toLowerCase()); + const hide100 = document.getElementById("hide100").checked; + // Store hide value. + localStorage.setItem(coverage.HIDE100_STORAGE, JSON.stringify(hide100)); + + // Hide / show elements. + table_body_rows.forEach(row => { + var show = false; + // Check the text filter. + for (let column = 0; column < totals.length; column++) { + cell = row.cells[column]; + if (cell.classList.contains("name")) { + var celltext = cell.textContent; + if (casefold) { + celltext = celltext.toLowerCase(); + } + if (celltext.includes(text)) { + show = true; + } + } + } + + // Check the "hide covered" filter. + if (show && hide100) { + const [numer, denom] = row.cells[row.cells.length - 1].dataset.ratio.split(" "); + show = (numer !== denom); + } + + if (!show) { + // hide + row.classList.add("hidden"); + return; + } + + // show + row.classList.remove("hidden"); + totals[0]++; + + for (let column = 0; column < totals.length; column++) { + // Accumulate dynamic totals + cell = row.cells[column] // nosemgrep: eslint.detect-object-injection + if (cell.classList.contains("name")) { + continue; + } + if (column === totals.length - 1) { + // Last column contains percentage + const [numer, denom] = cell.dataset.ratio.split(" "); + totals[column]["numer"] += parseInt(numer, 10); // nosemgrep: eslint.detect-object-injection + totals[column]["denom"] += parseInt(denom, 10); // nosemgrep: eslint.detect-object-injection + } + else { + totals[column] += parseInt(cell.textContent, 10); // nosemgrep: eslint.detect-object-injection + } + } + }); + + // Show placeholder if no rows will be displayed. + if (!totals[0]) { + // Show placeholder, hide table. + no_rows.style.display = "block"; + table.style.display = "none"; + return; + } + + // Hide placeholder, show table. + no_rows.style.display = null; + table.style.display = null; + + const footer = table.tFoot.rows[0]; + // Calculate new dynamic sum values based on visible rows. + for (let column = 0; column < totals.length; column++) { + // Get footer cell element. + const cell = footer.cells[column]; // nosemgrep: eslint.detect-object-injection + if (cell.classList.contains("name")) { + continue; + } + + // Set value into dynamic footer cell element. + if (column === totals.length - 1) { + // Percentage column uses the numerator and denominator, + // and adapts to the number of decimal places. + const match = /\.([0-9]+)/.exec(cell.textContent); + const places = match ? match[1].length : 0; + const { numer, denom } = totals[column]; // nosemgrep: eslint.detect-object-injection + cell.dataset.ratio = `${numer} ${denom}`; + // Check denom to prevent NaN if filtered files contain no statements + cell.textContent = denom + ? `${(numer * 100 / denom).toFixed(places)}%` + : `${(100).toFixed(places)}%`; + } + else { + cell.textContent = totals[column]; // nosemgrep: eslint.detect-object-injection + } + } + }); + + document.getElementById("filter").addEventListener("input", debounce(filter_handler)); + document.getElementById("hide100").addEventListener("input", debounce(filter_handler)); + + // Trigger change event on setup, to force filter on page refresh + // (filter value may still be present). + document.getElementById("filter").dispatchEvent(new Event("input")); + document.getElementById("hide100").dispatchEvent(new Event("input")); +}; +coverage.FILTER_STORAGE = "COVERAGE_FILTER_VALUE"; +coverage.HIDE100_STORAGE = "COVERAGE_HIDE100_VALUE"; + +// Set up the click-to-sort columns. +coverage.wire_up_sorting = function () { + document.querySelectorAll("[data-sortable] th[aria-sort]").forEach( + th => th.addEventListener("click", e => sortColumn(e.target)) + ); + + // Look for a localStorage item containing previous sort settings: + let th_id = "file", direction = "ascending"; + const stored_list = localStorage.getItem(coverage.INDEX_SORT_STORAGE); + if (stored_list) { + ({th_id, direction} = JSON.parse(stored_list)); + } + let by_region = false, region_direction = "ascending"; + const sorted_by_region = localStorage.getItem(coverage.SORTED_BY_REGION); + if (sorted_by_region) { + ({ + by_region, + region_direction + } = JSON.parse(sorted_by_region)); + } + + const region_id = "region"; + if (by_region && document.getElementById(region_id)) { + direction = region_direction; + } + // If we are in a page that has a column with id of "region", sort on + // it if the last sort was by function or class. + let th; + if (document.getElementById(region_id)) { + th = document.getElementById(by_region ? region_id : th_id); + } + else { + th = document.getElementById(th_id); + } + th.setAttribute("aria-sort", direction === "ascending" ? "descending" : "ascending"); + th.click() +}; + +coverage.INDEX_SORT_STORAGE = "COVERAGE_INDEX_SORT_2"; +coverage.SORTED_BY_REGION = "COVERAGE_SORT_REGION"; + +// Loaded on index.html +coverage.index_ready = function () { + coverage.assign_shortkeys(); + coverage.wire_up_filter(); + coverage.wire_up_sorting(); + + on_click(".button_prev_file", coverage.to_prev_file); + on_click(".button_next_file", coverage.to_next_file); + + on_click(".button_show_hide_help", coverage.show_hide_help); +}; + +// -- pyfile stuff -- + +coverage.LINE_FILTERS_STORAGE = "COVERAGE_LINE_FILTERS"; + +coverage.pyfile_ready = function () { + // If we're directed to a particular line number, highlight the line. + var frag = location.hash; + if (frag.length > 2 && frag[1] === "t") { + document.querySelector(frag).closest(".n").classList.add("highlight"); + coverage.set_sel(parseInt(frag.substr(2), 10)); + } + else { + coverage.set_sel(0); + } + + on_click(".button_toggle_run", coverage.toggle_lines); + on_click(".button_toggle_mis", coverage.toggle_lines); + on_click(".button_toggle_exc", coverage.toggle_lines); + on_click(".button_toggle_par", coverage.toggle_lines); + + on_click(".button_next_chunk", coverage.to_next_chunk_nicely); + on_click(".button_prev_chunk", coverage.to_prev_chunk_nicely); + on_click(".button_top_of_page", coverage.to_top); + on_click(".button_first_chunk", coverage.to_first_chunk); + + on_click(".button_prev_file", coverage.to_prev_file); + on_click(".button_next_file", coverage.to_next_file); + on_click(".button_to_index", coverage.to_index); + + on_click(".button_show_hide_help", coverage.show_hide_help); + + coverage.filters = undefined; + try { + coverage.filters = localStorage.getItem(coverage.LINE_FILTERS_STORAGE); + } catch(err) {} + + if (coverage.filters) { + coverage.filters = JSON.parse(coverage.filters); + } + else { + coverage.filters = {run: false, exc: true, mis: true, par: true}; + } + + for (cls in coverage.filters) { + coverage.set_line_visibilty(cls, coverage.filters[cls]); // nosemgrep: eslint.detect-object-injection + } + + coverage.assign_shortkeys(); + coverage.init_scroll_markers(); + coverage.wire_up_sticky_header(); + + document.querySelectorAll("[id^=ctxs]").forEach( + cbox => cbox.addEventListener("click", coverage.expand_contexts) + ); + + // Rebuild scroll markers when the window height changes. + window.addEventListener("resize", coverage.build_scroll_markers); +}; + +coverage.toggle_lines = function (event) { + const btn = event.target.closest("button"); + const category = btn.value + const show = !btn.classList.contains("show_" + category); + coverage.set_line_visibilty(category, show); + coverage.build_scroll_markers(); + coverage.filters[category] = show; + try { + localStorage.setItem(coverage.LINE_FILTERS_STORAGE, JSON.stringify(coverage.filters)); + } catch(err) {} +}; + +coverage.set_line_visibilty = function (category, should_show) { + const cls = "show_" + category; + const btn = document.querySelector(".button_toggle_" + category); + if (btn) { + if (should_show) { + document.querySelectorAll("#source ." + category).forEach(e => e.classList.add(cls)); + btn.classList.add(cls); + } + else { + document.querySelectorAll("#source ." + category).forEach(e => e.classList.remove(cls)); + btn.classList.remove(cls); + } + } +}; + +// Return the nth line div. +coverage.line_elt = function (n) { + return document.getElementById("t" + n)?.closest("p"); +}; + +// Set the selection. b and e are line numbers. +coverage.set_sel = function (b, e) { + // The first line selected. + coverage.sel_begin = b; + // The next line not selected. + coverage.sel_end = (e === undefined) ? b+1 : e; +}; + +coverage.to_top = function () { + coverage.set_sel(0, 1); + coverage.scroll_window(0); +}; + +coverage.to_first_chunk = function () { + coverage.set_sel(0, 1); + coverage.to_next_chunk(); +}; + +coverage.to_prev_file = function () { + window.location = document.getElementById("prevFileLink").href; +} + +coverage.to_next_file = function () { + window.location = document.getElementById("nextFileLink").href; +} + +coverage.to_index = function () { + location.href = document.getElementById("indexLink").href; +} + +coverage.show_hide_help = function () { + const helpCheck = document.getElementById("help_panel_state") + helpCheck.checked = !helpCheck.checked; +} + +// Return a string indicating what kind of chunk this line belongs to, +// or null if not a chunk. +coverage.chunk_indicator = function (line_elt) { + const classes = line_elt?.className; + if (!classes) { + return null; + } + const match = classes.match(/\bshow_\w+\b/); + if (!match) { + return null; + } + return match[0]; +}; + +coverage.to_next_chunk = function () { + const c = coverage; + + // Find the start of the next colored chunk. + var probe = c.sel_end; + var chunk_indicator, probe_line; + while (true) { + probe_line = c.line_elt(probe); + if (!probe_line) { + return; + } + chunk_indicator = c.chunk_indicator(probe_line); + if (chunk_indicator) { + break; + } + probe++; + } + + // There's a next chunk, `probe` points to it. + var begin = probe; + + // Find the end of this chunk. + var next_indicator = chunk_indicator; + while (next_indicator === chunk_indicator) { + probe++; + probe_line = c.line_elt(probe); + next_indicator = c.chunk_indicator(probe_line); + } + c.set_sel(begin, probe); + c.show_selection(); +}; + +coverage.to_prev_chunk = function () { + const c = coverage; + + // Find the end of the prev colored chunk. + var probe = c.sel_begin-1; + var probe_line = c.line_elt(probe); + if (!probe_line) { + return; + } + var chunk_indicator = c.chunk_indicator(probe_line); + while (probe > 1 && !chunk_indicator) { + probe--; + probe_line = c.line_elt(probe); + if (!probe_line) { + return; + } + chunk_indicator = c.chunk_indicator(probe_line); + } + + // There's a prev chunk, `probe` points to its last line. + var end = probe+1; + + // Find the beginning of this chunk. + var prev_indicator = chunk_indicator; + while (prev_indicator === chunk_indicator) { + probe--; + if (probe <= 0) { + return; + } + probe_line = c.line_elt(probe); + prev_indicator = c.chunk_indicator(probe_line); + } + c.set_sel(probe+1, end); + c.show_selection(); +}; + +// Returns 0, 1, or 2: how many of the two ends of the selection are on +// the screen right now? +coverage.selection_ends_on_screen = function () { + if (coverage.sel_begin === 0) { + return 0; + } + + const begin = coverage.line_elt(coverage.sel_begin); + const end = coverage.line_elt(coverage.sel_end-1); + + return ( + (checkVisible(begin) ? 1 : 0) + + (checkVisible(end) ? 1 : 0) + ); +}; + +coverage.to_next_chunk_nicely = function () { + if (coverage.selection_ends_on_screen() === 0) { + // The selection is entirely off the screen: + // Set the top line on the screen as selection. + + // This will select the top-left of the viewport + // As this is most likely the span with the line number we take the parent + const line = document.elementFromPoint(0, 0).parentElement; + if (line.parentElement !== document.getElementById("source")) { + // The element is not a source line but the header or similar + coverage.select_line_or_chunk(1); + } + else { + // We extract the line number from the id + coverage.select_line_or_chunk(parseInt(line.id.substring(1), 10)); + } + } + coverage.to_next_chunk(); +}; + +coverage.to_prev_chunk_nicely = function () { + if (coverage.selection_ends_on_screen() === 0) { + // The selection is entirely off the screen: + // Set the lowest line on the screen as selection. + + // This will select the bottom-left of the viewport + // As this is most likely the span with the line number we take the parent + const line = document.elementFromPoint(document.documentElement.clientHeight-1, 0).parentElement; + if (line.parentElement !== document.getElementById("source")) { + // The element is not a source line but the header or similar + coverage.select_line_or_chunk(coverage.lines_len); + } + else { + // We extract the line number from the id + coverage.select_line_or_chunk(parseInt(line.id.substring(1), 10)); + } + } + coverage.to_prev_chunk(); +}; + +// Select line number lineno, or if it is in a colored chunk, select the +// entire chunk +coverage.select_line_or_chunk = function (lineno) { + var c = coverage; + var probe_line = c.line_elt(lineno); + if (!probe_line) { + return; + } + var the_indicator = c.chunk_indicator(probe_line); + if (the_indicator) { + // The line is in a highlighted chunk. + // Search backward for the first line. + var probe = lineno; + var indicator = the_indicator; + while (probe > 0 && indicator === the_indicator) { + probe--; + probe_line = c.line_elt(probe); + if (!probe_line) { + break; + } + indicator = c.chunk_indicator(probe_line); + } + var begin = probe + 1; + + // Search forward for the last line. + probe = lineno; + indicator = the_indicator; + while (indicator === the_indicator) { + probe++; + probe_line = c.line_elt(probe); + indicator = c.chunk_indicator(probe_line); + } + + coverage.set_sel(begin, probe); + } + else { + coverage.set_sel(lineno); + } +}; + +coverage.show_selection = function () { + // Highlight the lines in the chunk + document.querySelectorAll("#source .highlight").forEach(e => e.classList.remove("highlight")); + for (let probe = coverage.sel_begin; probe < coverage.sel_end; probe++) { + coverage.line_elt(probe).querySelector(".n").classList.add("highlight"); + } + + coverage.scroll_to_selection(); +}; + +coverage.scroll_to_selection = function () { + // Scroll the page if the chunk isn't fully visible. + if (coverage.selection_ends_on_screen() < 2) { + const element = coverage.line_elt(coverage.sel_begin); + coverage.scroll_window(element.offsetTop - 60); + } +}; + +coverage.scroll_window = function (to_pos) { + window.scroll({top: to_pos, behavior: "smooth"}); +}; + +coverage.init_scroll_markers = function () { + // Init some variables + coverage.lines_len = document.querySelectorAll("#source > p").length; + + // Build html + coverage.build_scroll_markers(); +}; + +coverage.build_scroll_markers = function () { + const temp_scroll_marker = document.getElementById("scroll_marker") + if (temp_scroll_marker) temp_scroll_marker.remove(); + // Don't build markers if the window has no scroll bar. + if (document.body.scrollHeight <= window.innerHeight) { + return; + } + + const marker_scale = window.innerHeight / document.body.scrollHeight; + const line_height = Math.min(Math.max(3, window.innerHeight / coverage.lines_len), 10); + + let previous_line = -99, last_mark, last_top; + + const scroll_marker = document.createElement("div"); + scroll_marker.id = "scroll_marker"; + document.getElementById("source").querySelectorAll( + "p.show_run, p.show_mis, p.show_exc, p.show_exc, p.show_par" + ).forEach(element => { + const line_top = Math.floor(element.offsetTop * marker_scale); + const line_number = parseInt(element.querySelector(".n a").id.substr(1)); + + if (line_number === previous_line + 1) { + // If this solid missed block just make previous mark higher. + last_mark.style.height = `${line_top + line_height - last_top}px`; + } + else { + // Add colored line in scroll_marker block. + last_mark = document.createElement("div"); + last_mark.id = `m${line_number}`; + last_mark.classList.add("marker"); + last_mark.style.height = `${line_height}px`; + last_mark.style.top = `${line_top}px`; + scroll_marker.append(last_mark); + last_top = line_top; + } + + previous_line = line_number; + }); + + // Append last to prevent layout calculation + document.body.append(scroll_marker); +}; + +coverage.wire_up_sticky_header = function () { + const header = document.querySelector("header"); + const header_bottom = ( + header.querySelector(".content h2").getBoundingClientRect().top - + header.getBoundingClientRect().top + ); + + function updateHeader() { + if (window.scrollY > header_bottom) { + header.classList.add("sticky"); + } + else { + header.classList.remove("sticky"); + } + } + + window.addEventListener("scroll", updateHeader); + updateHeader(); +}; + +coverage.expand_contexts = function (e) { + var ctxs = e.target.parentNode.querySelector(".ctxs"); + + if (!ctxs.classList.contains("expanded")) { + var ctxs_text = ctxs.textContent; + var width = Number(ctxs_text[0]); + ctxs.textContent = ""; + for (var i = 1; i < ctxs_text.length; i += width) { + key = ctxs_text.substring(i, i + width).trim(); + ctxs.appendChild(document.createTextNode(contexts[key])); + ctxs.appendChild(document.createElement("br")); + } + ctxs.classList.add("expanded"); + } +}; + +document.addEventListener("DOMContentLoaded", () => { + if (document.body.classList.contains("indexfile")) { + coverage.index_ready(); + } + else { + coverage.pyfile_ready(); + } +}); diff --git a/htmlcov/favicon_32_cb_58284776.png b/htmlcov/favicon_32_cb_58284776.png new file mode 100644 index 0000000000000000000000000000000000000000..8649f0475d8d20793b2ec431fe25a186a414cf10 GIT binary patch literal 1732 zcmV;#20QtQP)K2KOkBOVxIZChq#W-v7@TU%U6P(wycKT1hUJUToW3ke1U1ONa4 z000000000000000bb)GRa9mqwR9|UWHy;^RUrt?IT__Y0JUcxmBP0(51q1>E00030 z|NrOz)aw7%8sJzM<5^g%z7^qE`}_Ot|JUUG(NUkWzR|7K?Zo%@_v-8G-1N%N=D$;; zw;keH4dGY$`1t4M=HK_s*zm^0#KgqfwWhe3qO_HtvXYvtjgX>;-~C$L`&k>^R)9)7 zdPh2TL^pCnHC#0+_4D)M`p?qp!pq{jO_{8;$fbaflbx`Tn52n|n}8VFRTA1&ugOP< zPd{uvFjz7t*Vot1&d$l-xWCk}s;sQL&#O(Bskh6gqNJv>#iB=ypG1e3K!K4yc7!~M zfj4S*g^zZ7eP$+_Sl07Z646l;%urinP#D8a6TwRtnLIRcI!r4f@bK~9-`~;E(N?Lv zSEst7s;rcxsi~}{Nsytfz@MtUoR*iFc8!#vvx}Umhm4blk(_~MdVD-@dW&>!Nn~ro z_E~-ESVQAj6Wmn;(olz(O&_{U2*pZBc1aYjMh>Dq3z|6`jW`RDHV=t3I6yRKJ~LOX zz_z!!vbVXPqob#=pj3^VMT?x6t(irRmSKsMo1~LLkB&=#j!=M%NP35mfqim$drWb9 zYIb>no_LUwc!r^NkDzs4YHu@=ZHRzrafWDZd1EhEVq=tGX?tK$pIa)DTh#bkvh!J- z?^%@YS!U*0E8$q$_*aOTQ&)Ra64g>ep;BdcQgvlg8qQHrP*E$;P{-m=A*@axn@$bO zO-Y4JzS&EAi%YG}N?cn?YFS7ivPY=EMV6~YH;+Xxu|tefLS|Aza)Cg6us#)=JW!uH zQa?H>d^j+YHCtyjL^LulF*05|F$RG!AX_OHVI&MtA~_@=5_lU|0000rbW%=J06GH4 z^5LD8b8apw8vNh1ua1mF{{Hy)_U`NA;Nacc+sCpuHXa-V{r&yz?c(9#+}oX+NmiRW z+W-IqK1oDDR5;6GfCDCOP5}iL5fK(cB~ET81`MFgF2kGa9AjhSIk~-E-4&*tPPKdiilQJ11k_J082ZS z>@TvivP!5ZFG?t@{t+GpR3XR&@*hA_VE1|Lo8@L@)l*h(Z@=?c-NS$Fk&&61IzUU9 z*nPqBM=OBZ-6ka1SJgGAS-Us5EN)r#dUX%>wQZLa2ytPCtMKp)Ob z*xcu38Z&d5<-NBS)@jRD+*!W*cf-m_wmxDEqBf?czI%3U0J$Xik;lA`jg}VH?(S(V zE!M3;X2B8w0TnnW&6(8;_Uc)WD;Ms6PKP+s(sFgO!}B!^ES~GDt4qLPxwYB)^7)XA zZwo9zDy-B0B+jT6V=!=bo(zs_8{eBA78gT9GH$(DVhz;4VAYwz+bOIdZ-PNb|I&rl z^XG=vFLF)1{&nT2*0vMz#}7^9hXzzf&ZdKlEj{LihP;|;Ywqn35ajP?H?7t|i-Un% z&&kxee@9B{nwgv1+S-~0)E1{ob1^Wn`F2isurqThKK=3%&;`@{0{!D- z&CSj80t;uPu&FaJFtSXKH#ajgGj}=sEad7US6jP0|Db@0j)?(5@sf<7`~a9>s;wCa zm^)spe{uxGFmrJYI9cOh7s$>8Npkt-5EWB1UKc`{W{y5Ce$1+nM9Cr;);=Ju#N^62OSlJMn7omiUgP&ErsYzT~iGxcW aE(`!K@+CXylaC4j0000 + + + + Coverage report + + + + + +
+
+

Coverage report: + 100% +

+ +
+ +
+ + +
+
+

+ Files + Functions + Classes +

+

+ coverage.py v7.8.2, + created at 2025-06-01 23:14 +0300 +

+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Filefunctionstatementsmissingexcludedcoverage
src\__init__.py(no function)000100%
src\masks.pyget_mask_card_number500100%
src\masks.pyget_mask_account400100%
src\masks.py(no function)300100%
src\processing.pyfilter_by_state500100%
src\processing.pysort_by_date500100%
src\processing.py(no function)200100%
src\widget.pymask_account_card1100100%
src\widget.pyget_date900100%
src\widget.py(no function)400100%
Total 4800100%
+

+ No items found using the specified filter. +

+
+ + + diff --git a/htmlcov/index.html b/htmlcov/index.html new file mode 100644 index 0000000..7181970 --- /dev/null +++ b/htmlcov/index.html @@ -0,0 +1,132 @@ + + + + + Coverage report + + + + + +
+
+

Coverage report: + 100% +

+ +
+ +
+ + +
+
+

+ Files + Functions + Classes +

+

+ coverage.py v7.8.2, + created at 2025-06-01 23:14 +0300 +

+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Filestatementsmissingexcludedcoverage
src\__init__.py000100%
src\masks.py1200100%
src\processing.py1200100%
src\widget.py2400100%
Total4800100%
+

+ No items found using the specified filter. +

+
+ + + diff --git a/htmlcov/keybd_closed_cb_ce680311.png b/htmlcov/keybd_closed_cb_ce680311.png new file mode 100644 index 0000000000000000000000000000000000000000..ba119c47df81ed2bbd27a06988abf700139c4f99 GIT binary patch literal 9004 zcmeHLc{tSF+aIY=A^R4_poB4tZAN2XC;O7M(inrW3}(h&Q4}dl*&-65$i9^&vW6_# zcM4g`Qix=GhkBl;=lwnJ@Ap2}^}hc-b6vBXb3XUyzR%~}_c`-Dw+!?&>5p(90RRB> zXe~7($~PP3eT?=X<@3~Q1w84vX~IoSx~1#~02+TopXK(db;4v6!{+W`RHLkkHO zo;+s?)puc`+$yOwHv>I$5^8v^F3<|$44HA8AFnFB0cAP|C`p}aSMJK*-CUB{eQ!;K z-9Ju3OQ+xVPr3P#o4>_lNBT;M+1vgV&B~6!naOGHb-LFA9TkfHv1IFA1Y!Iz!Zl3) z%c#-^zNWPq7U_}6I7aHSmFWi125RZrNBKyvnV^?64)zviS;E!UD%LaGRl6@zn!3E{ zJ`B$5``cH_3a)t1#6I7d==JeB_IcSU%=I#DrRCBGm8GvCmA=+XHEvC2SIfsNa0(h9 z7P^C4U`W@@`9p>2f^zyb5B=lpc*RZMn-%%IqrxSWQF8{ec3i?-AB(_IVe z)XgT>Y^u41MwOMFvU=I4?!^#jaS-%bjnx@ zmL44yVEslR_ynm18F!u}Ru#moEn3EE?1=9@$B1Z5aLi5b8{&?V(IAYBzIar!SiY3< z`l0V)djHtrImy}(!7x-Pmq+njM)JFQ9mx*(C+9a3M)(_SW|lrN=gfxFhStu^zvynS zm@gl;>d8i8wpUkX42vS3BEzE3-yctH%t0#N%s+6-&_<*Fe7+h=`=FM?DOg1)eGL~~ zQvIFm$D*lqEh07XrXY=jb%hdyP4)`wyMCb$=-z9(lOme9=tirVkb)_GOl2MJn;=Ky z^0pV1owR7KP-BSxhI@@@+gG0roD-kXE1;!#R7KY1QiUbyDdTElm|ul7{mMdF1%UDJ z_vp=Vo!TCF?D*?u% zk~}4!xK2MSQd-QKC0${G=ZRv2x8%8ZqdfR!?Dv=5Mj^8WU)?iH;C?o6rSQy*^YwQb zf@5V)q=xah#a3UEIBC~N7on(p4jQd4K$|i7k`d8mw|M{Mxapl46Z^X^9U}JgqH#;T z`CTzafpMD+J-LjzF+3Xau>xM_sXisRj6m-287~i9g|%gHc}v77>n_+p7ZgmJszx!b zSmL4wV;&*5Z|zaCk`rOYFdOjZLLQr!WSV6AlaqYh_OE)>rYdtx`gk$yAMO=-E1b~J zIZY6gM*}1UWsJ)TW(pf1=h?lJy_0TFOr|nALGW>$IE1E7z+$`^2WJY+>$$nJo8Rs` z)xS>AH{N~X3+b=2+8Q_|n(1JoGv55r>TuwBV~MXE&9?3Zw>cIxnOPNs#gh~C4Zo=k z&!s;5)^6UG>!`?hh0Q|r|Qbm>}pgtOt23Vh!NSibozH$`#LSiYL)HR4bkfEJMa zBHwC3TaHx|BzD|MXAr>mm&FbZXeEX-=W}Ji&!pji4sO$#0Wk^Q7j%{8#bJPn$C=E% zPlB}0)@Ti^r_HMJrTMN?9~4LQbIiUiOKBVNm_QjABKY4;zC88yVjvB>ZETNzr%^(~ zI3U&Ont?P`r&4 z#Bp)jcVV_N_{c1_qW}_`dQm)D`NG?h{+S!YOaUgWna4i8SuoLcXAZ|#Jh&GNn7B}3 z?vZ8I{LpmCYT=@6)dLPd@|(;d<08ufov%+V?$mgUYQHYTrc%eA=CDUzK}v|G&9}yJ z)|g*=+RH1IQ>rvkY9UIam=fkxWDyGIKQ2RU{GqOQjD8nG#sl+$V=?wpzJdT=wlNWr z1%lw&+;kVs(z?e=YRWRA&jc75rQ~({*TS<( z8X!j>B}?Bxrrp%wEE7yBefQ?*nM20~+ZoQK(NO_wA`RNhsqVkXHy|sod@mqen=B#@ zmLi=x2*o9rWqTMWoB&qdZph$~qkJJTVNc*8^hU?gH_fY{GYPEBE8Q{j0Y$tvjMv%3 z)j#EyBf^7n)2d8IXDYX2O0S%ZTnGhg4Ss#sEIATKpE_E4TU=GimrD5F6K(%*+T-!o z?Se7^Vm`$ZKDwq+=~jf?w0qC$Kr&R-;IF#{iLF*8zKu8(=#chRO;>x zdM;h{i{RLpJgS!B-ueTFs8&4U4+D8|7nP~UZ@P`J;*0sj^#f_WqT#xpA?@qHonGB& zQ<^;OLtOG1w#)N~&@b0caUL7syAsAxV#R`n>-+eVL9aZwnlklzE>-6!1#!tVA`uNo z>Gv^P)sohc~g_1YMC;^f(N<{2y5C^;QCEXo;LQ^#$0 zr>jCrdoeXuff!dJ^`#=Wy2Gumo^Qt7BZrI~G+Pyl_kL>is3P0^JlE;Sjm-YfF~I>t z_KeNpK|5U&F4;v?WS&#l(jxUWDarfcIcl=-6!8>^S`57!M6;hZea5IFA@)2+*Rt85 zi-MBs_b^DU8LygXXQGkG+86N7<%M|baM(orG*ASffC`p!?@m{qd}IcYmZyi^d}#Q& zNjk-0@CajpUI-gPm20ERVDO!L8@p`tMJ69FD(ASIkdoLdiRV6h9TPKRz>2WK4upHd z6OZK33EP?`GoJkXh)S035}uLUO$;TlXwNdMg-WOhLB)7a`-%*a9lFmjf6n+4ZmIHN z-V@$ z8PXsoR4*`5RwXz=A8|5;aXKtSHFccj%dG7cO~UBJnt)61K>-uPX)`vu{7fcX6_>zZ zw_2V&Li+7mxbf!f7{Rk&VVyY!UtZywac%g!cH+xh#j$a`uf?XWl<``t`36W;p7=_* zO6uf~2{sAdkZn=Ts@p0>8N8rzw2ZLS@$ibV-c-QmG@%|3gUUrRxu=e*ekhTa+f?8q z3$JVGPr9w$VQG~QCq~Y=2ThLIH!T@(>{NihJ6nj*HA_C#Popv)CBa)+UI-bx8u8zfCT^*1|k z&N9oFYsZEijPn31Yx_yO5pFs>0tOAV=oRx~Wpy5ie&S_449m4R^{LWQMA~}vocV1O zIf#1ZV85E>tvZE4mz~zn{hs!pkIQM;EvZMimqiPAJu-9P@mId&nb$lsrICS=)zU3~ zn>a#9>}5*3N)9;PTMZ)$`5k} z?iG}Rwj$>Y*|(D3S3e&fxhaPHma8@vwu(cwdlaCjX+NIK6=$H4U`rfzcWQVOhp{fnzuZhgCCGpw|p zTi`>cv~xVzdx|^`C0vXdlMwPae3S?>3|7v$e*Bs6-5gS>>FMHk_r2M(ADOV{KV7+6 zA@5Q(mdx%7J}MY}K461iuQ}5GwDGI=Yc&g0MZHu)7gC3{5@QZj6SJl*o0MS2Cl_ia zyK?9QmC9tJ6yn{EA-erJ4wk$+!E#X(s~9h^HOmQ_|6V_s1)k;%9Q6Niw}SyT?jxl4 z;HYz2$Nj$8Q_*Xo`TWEUx^Q9b+ik@$o39`mlY&P}G8wnjdE+Dlj?uL;$aB$n;x zWoh-M_u>9}_Ok@d_uidMqz10zJc}RQijPW3Fs&~1am=j*+A$QWTvxf9)6n;n8zTQW z!Q_J1%apTsJzLF`#^P_#mRv2Ya_keUE7iMSP!ha-WQoo0vZZG?gyR;+4q8F6tL#u< zRj8Hu5f-p1$J;)4?WpGL{4@HmJ6&tF9A5Tc8Trp>;Y>{^s?Q1&bam}?OjsnKd?|Z82aix26wUOLxbEW~E)|CgJ#)MLf_me# zv4?F$o@A~Um)6>HlM0=3Bd-vc91EM}D+t6-@!}O%i*&Wl%@#C8X+?5+nv`oPu!!=5 znbL+Fk_#J_%8vOq^FIv~5N(nk03kyo1p@l|1c+rO^zCG3bk2?|%AF;*|4si1XM<`a z1NY0-8$wv?&129!(g_A1lXR!+pD*1*cF?T~e1d6*G1Fz)jcSaZoKpxtA%FNnKP2jo zLXn@OR#1z@6zuH%mMB98}-t zHJqClsZ!G5xMSgIs_=<8sBePXxfoXsuvy`|buON9BX%s-o>OVLA)k3W=wKnw1?so$ zEjm0aS=zu@Xu#;{A)QTjJ$a9_={++ACkRY*sk3jLk&Fu}RxR<-DXR<`5`$VNG*wJE zidM6VzaQ!M0gbQM98@x@;#0qUS8O)p6mrYwTk*;8J~!ovbY6jon^Ki}uggd3#J5G8 z>awvtF85Y<9yE{Iag}J7O7)1O=ylk^255@XmV5J06-{xaaSNASZoTKKp~$tSxdUI~ zU1RZ&UuW37Ro&_ryj^cSt$Jd&pt|+h!A&dwcr&`S=R5E`=6Tm`+(qGm@$YZ8(8@a$ zXfo@Rwtvm7N3RMmVCb7radAs-@QtCXx^CQ-<)V>QPLZy@jH{#dc4#(y zV)6Hp{ZMz!|NG8!>i01gZMy)G<8Hf2X7e&LH_gOaajW<<^Xi55@OnlY*|S|*TS8;u_nHbv7lgmmZ+Q<5 zi!*lLCJmdpyzl(L${$C?(pVo|oR%r~x_B_ocPePa_);27^=n4L=`toZ;xdBut9rSv z?wDQ7j2I3WQBdhz%X7`2YaG_y|wA!7|s?k;A&WNMLMTZEzCaE^d??E&u?f=ejQBR~|< z)=thyP2(p8r6mt?Ad}tXAP_GvF9|P630I;$1cpQ+Ay7C34hK^ZV3H4kjPV8&NP>G5 zKRDEIBrFl{M#j4mfP0)68&?mqJP1S?2mU0djAGTjDV;wZ?6vplNn~3Hn$nP>%!dMi zz@bnC7zzi&k&s{QDWkf&zgrVXKUJjY3Gv3bL0}S4h>OdgEJ$Q^&p-VAr3J}^a*+rz z!jW7(h*+GuCyqcC{MD(Ovj^!{pB^OKUe|uy&bD?CN>KZrf3?v>>l*xSvnQiH-o^ViN$%FRdm9url;%(*jf5H$*S)8;i0xWHdl>$p);nH9v0)YfW?Vz$! zNCeUbi9`NEg(i^57y=fzM@1o*z*Bf6?QCV>2p9}(BLlYsOCfMjFv1pw1mlo)Py{8v zppw{MDfEeWN+n>Ne~oI7%9cU}mz0r3!es2gNF0t5jkGipjIo2lz;-e)7}Ul_#!eDv zw;#>kI>;#-pyfeu3Fsd^2F@6=oh#8r9;A!G0`-mm7%{=S;Ec(bJ=I_`FodKGQVNEY zmXwr4{9*jpDl%4{ggQZ5Ac z%wYTdl*!1c5^)%^E78Q&)ma|27c6j(a=)g4sGrp$r{jv>>M2 z6y)E5|Aooe!PSfKzvKA>`a6pfK3=E8vL14ksP&f=>gOP?}rG6ye@9ZR3 zJF*vsh*P$w390i!FV~~_Hv6t2Zl<4VUi|rNja#boFt{%q~xGb z(2petq9A*_>~B*>?d?Olx^lmYg4)}sH2>G42RE; literal 0 HcmV?d00001 diff --git a/htmlcov/status.json b/htmlcov/status.json new file mode 100644 index 0000000..0659dbe --- /dev/null +++ b/htmlcov/status.json @@ -0,0 +1 @@ +{"note":"This file is an internal implementation detail to speed up HTML report generation. Its format can change at any time. You might be looking for the JSON report: https://coverage.rtfd.io/cmd.html#cmd-json","format":5,"version":"7.8.2","globals":"06fbd4730370e0840a9d3c86ead59982","files":{"z_145eef247bfb46b6___init___py":{"hash":"e6baa73cda2916dad605215f937a92e1","index":{"url":"z_145eef247bfb46b6___init___py.html","file":"src\\__init__.py","description":"","nums":{"precision":0,"n_files":1,"n_statements":0,"n_excluded":0,"n_missing":0,"n_branches":0,"n_partial_branches":0,"n_missing_branches":0}}},"z_145eef247bfb46b6_masks_py":{"hash":"393484953d68155b1fba2440a3819174","index":{"url":"z_145eef247bfb46b6_masks_py.html","file":"src\\masks.py","description":"","nums":{"precision":0,"n_files":1,"n_statements":12,"n_excluded":0,"n_missing":0,"n_branches":0,"n_partial_branches":0,"n_missing_branches":0}}},"z_145eef247bfb46b6_processing_py":{"hash":"e5134d9dd4ee75ddec29f12d4d95d38d","index":{"url":"z_145eef247bfb46b6_processing_py.html","file":"src\\processing.py","description":"","nums":{"precision":0,"n_files":1,"n_statements":12,"n_excluded":0,"n_missing":0,"n_branches":0,"n_partial_branches":0,"n_missing_branches":0}}},"z_145eef247bfb46b6_widget_py":{"hash":"ffadddb80eedae4098179830c534240b","index":{"url":"z_145eef247bfb46b6_widget_py.html","file":"src\\widget.py","description":"","nums":{"precision":0,"n_files":1,"n_statements":24,"n_excluded":0,"n_missing":0,"n_branches":0,"n_partial_branches":0,"n_missing_branches":0}}}}} \ No newline at end of file diff --git a/htmlcov/style_cb_718ce007.css b/htmlcov/style_cb_718ce007.css new file mode 100644 index 0000000..3cdaf05 --- /dev/null +++ b/htmlcov/style_cb_718ce007.css @@ -0,0 +1,337 @@ +@charset "UTF-8"; +/* Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 */ +/* For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt */ +/* Don't edit this .css file. Edit the .scss file instead! */ +html, body, h1, h2, h3, p, table, td, th { margin: 0; padding: 0; border: 0; font-weight: inherit; font-style: inherit; font-size: 100%; font-family: inherit; vertical-align: baseline; } + +body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; font-size: 1em; background: #fff; color: #000; } + +@media (prefers-color-scheme: dark) { body { background: #1e1e1e; } } + +@media (prefers-color-scheme: dark) { body { color: #eee; } } + +html > body { font-size: 16px; } + +a:active, a:focus { outline: 2px dashed #007acc; } + +p { font-size: .875em; line-height: 1.4em; } + +table { border-collapse: collapse; } + +td { vertical-align: top; } + +table tr.hidden { display: none !important; } + +p#no_rows { display: none; font-size: 1.15em; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; } + +a.nav { text-decoration: none; color: inherit; } + +a.nav:hover { text-decoration: underline; color: inherit; } + +.hidden { display: none; } + +header { background: #f8f8f8; width: 100%; z-index: 2; border-bottom: 1px solid #ccc; } + +@media (prefers-color-scheme: dark) { header { background: black; } } + +@media (prefers-color-scheme: dark) { header { border-color: #333; } } + +header .content { padding: 1rem 3.5rem; } + +header h2 { margin-top: .5em; font-size: 1em; } + +header h2 a.button { font-family: inherit; font-size: inherit; border: 1px solid; border-radius: .2em; background: #eee; color: inherit; text-decoration: none; padding: .1em .5em; margin: 1px calc(.1em + 1px); cursor: pointer; border-color: #ccc; } + +@media (prefers-color-scheme: dark) { header h2 a.button { background: #333; } } + +@media (prefers-color-scheme: dark) { header h2 a.button { border-color: #444; } } + +header h2 a.button.current { border: 2px solid; background: #fff; border-color: #999; cursor: default; } + +@media (prefers-color-scheme: dark) { header h2 a.button.current { background: #1e1e1e; } } + +@media (prefers-color-scheme: dark) { header h2 a.button.current { border-color: #777; } } + +header p.text { margin: .5em 0 -.5em; color: #666; font-style: italic; } + +@media (prefers-color-scheme: dark) { header p.text { color: #aaa; } } + +header.sticky { position: fixed; left: 0; right: 0; height: 2.5em; } + +header.sticky .text { display: none; } + +header.sticky h1, header.sticky h2 { font-size: 1em; margin-top: 0; display: inline-block; } + +header.sticky .content { padding: 0.5rem 3.5rem; } + +header.sticky .content p { font-size: 1em; } + +header.sticky ~ #source { padding-top: 6.5em; } + +main { position: relative; z-index: 1; } + +footer { margin: 1rem 3.5rem; } + +footer .content { padding: 0; color: #666; font-style: italic; } + +@media (prefers-color-scheme: dark) { footer .content { color: #aaa; } } + +#index { margin: 1rem 0 0 3.5rem; } + +h1 { font-size: 1.25em; display: inline-block; } + +#filter_container { float: right; margin: 0 2em 0 0; line-height: 1.66em; } + +#filter_container #filter { width: 10em; padding: 0.2em 0.5em; border: 2px solid #ccc; background: #fff; color: #000; } + +@media (prefers-color-scheme: dark) { #filter_container #filter { border-color: #444; } } + +@media (prefers-color-scheme: dark) { #filter_container #filter { background: #1e1e1e; } } + +@media (prefers-color-scheme: dark) { #filter_container #filter { color: #eee; } } + +#filter_container #filter:focus { border-color: #007acc; } + +#filter_container :disabled ~ label { color: #ccc; } + +@media (prefers-color-scheme: dark) { #filter_container :disabled ~ label { color: #444; } } + +#filter_container label { font-size: .875em; color: #666; } + +@media (prefers-color-scheme: dark) { #filter_container label { color: #aaa; } } + +header button { font-family: inherit; font-size: inherit; border: 1px solid; border-radius: .2em; background: #eee; color: inherit; text-decoration: none; padding: .1em .5em; margin: 1px calc(.1em + 1px); cursor: pointer; border-color: #ccc; } + +@media (prefers-color-scheme: dark) { header button { background: #333; } } + +@media (prefers-color-scheme: dark) { header button { border-color: #444; } } + +header button:active, header button:focus { outline: 2px dashed #007acc; } + +header button.run { background: #eeffee; } + +@media (prefers-color-scheme: dark) { header button.run { background: #373d29; } } + +header button.run.show_run { background: #dfd; border: 2px solid #00dd00; margin: 0 .1em; } + +@media (prefers-color-scheme: dark) { header button.run.show_run { background: #373d29; } } + +header button.mis { background: #ffeeee; } + +@media (prefers-color-scheme: dark) { header button.mis { background: #4b1818; } } + +header button.mis.show_mis { background: #fdd; border: 2px solid #ff0000; margin: 0 .1em; } + +@media (prefers-color-scheme: dark) { header button.mis.show_mis { background: #4b1818; } } + +header button.exc { background: #f7f7f7; } + +@media (prefers-color-scheme: dark) { header button.exc { background: #333; } } + +header button.exc.show_exc { background: #eee; border: 2px solid #808080; margin: 0 .1em; } + +@media (prefers-color-scheme: dark) { header button.exc.show_exc { background: #333; } } + +header button.par { background: #ffffd5; } + +@media (prefers-color-scheme: dark) { header button.par { background: #650; } } + +header button.par.show_par { background: #ffa; border: 2px solid #bbbb00; margin: 0 .1em; } + +@media (prefers-color-scheme: dark) { header button.par.show_par { background: #650; } } + +#help_panel, #source p .annotate.long { display: none; position: absolute; z-index: 999; background: #ffffcc; border: 1px solid #888; border-radius: .2em; color: #333; padding: .25em .5em; } + +#source p .annotate.long { white-space: normal; float: right; top: 1.75em; right: 1em; height: auto; } + +#help_panel_wrapper { float: right; position: relative; } + +#keyboard_icon { margin: 5px; } + +#help_panel_state { display: none; } + +#help_panel { top: 25px; right: 0; padding: .75em; border: 1px solid #883; color: #333; } + +#help_panel .keyhelp p { margin-top: .75em; } + +#help_panel .legend { font-style: italic; margin-bottom: 1em; } + +.indexfile #help_panel { width: 25em; } + +.pyfile #help_panel { width: 18em; } + +#help_panel_state:checked ~ #help_panel { display: block; } + +kbd { border: 1px solid black; border-color: #888 #333 #333 #888; padding: .1em .35em; font-family: SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-weight: bold; background: #eee; border-radius: 3px; } + +#source { padding: 1em 0 1em 3.5rem; font-family: SFMono-Regular, Menlo, Monaco, Consolas, monospace; } + +#source p { position: relative; white-space: pre; } + +#source p * { box-sizing: border-box; } + +#source p .n { float: left; text-align: right; width: 3.5rem; box-sizing: border-box; margin-left: -3.5rem; padding-right: 1em; color: #999; user-select: none; } + +@media (prefers-color-scheme: dark) { #source p .n { color: #777; } } + +#source p .n.highlight { background: #ffdd00; } + +#source p .n a { scroll-margin-top: 6em; text-decoration: none; color: #999; } + +@media (prefers-color-scheme: dark) { #source p .n a { color: #777; } } + +#source p .n a:hover { text-decoration: underline; color: #999; } + +@media (prefers-color-scheme: dark) { #source p .n a:hover { color: #777; } } + +#source p .t { display: inline-block; width: 100%; box-sizing: border-box; margin-left: -.5em; padding-left: 0.3em; border-left: 0.2em solid #fff; } + +@media (prefers-color-scheme: dark) { #source p .t { border-color: #1e1e1e; } } + +#source p .t:hover { background: #f2f2f2; } + +@media (prefers-color-scheme: dark) { #source p .t:hover { background: #282828; } } + +#source p .t:hover ~ .r .annotate.long { display: block; } + +#source p .t .com { color: #008000; font-style: italic; line-height: 1px; } + +@media (prefers-color-scheme: dark) { #source p .t .com { color: #6a9955; } } + +#source p .t .key { font-weight: bold; line-height: 1px; } + +#source p .t .str { color: #0451a5; } + +@media (prefers-color-scheme: dark) { #source p .t .str { color: #9cdcfe; } } + +#source p.mis .t { border-left: 0.2em solid #ff0000; } + +#source p.mis.show_mis .t { background: #fdd; } + +@media (prefers-color-scheme: dark) { #source p.mis.show_mis .t { background: #4b1818; } } + +#source p.mis.show_mis .t:hover { background: #f2d2d2; } + +@media (prefers-color-scheme: dark) { #source p.mis.show_mis .t:hover { background: #532323; } } + +#source p.run .t { border-left: 0.2em solid #00dd00; } + +#source p.run.show_run .t { background: #dfd; } + +@media (prefers-color-scheme: dark) { #source p.run.show_run .t { background: #373d29; } } + +#source p.run.show_run .t:hover { background: #d2f2d2; } + +@media (prefers-color-scheme: dark) { #source p.run.show_run .t:hover { background: #404633; } } + +#source p.exc .t { border-left: 0.2em solid #808080; } + +#source p.exc.show_exc .t { background: #eee; } + +@media (prefers-color-scheme: dark) { #source p.exc.show_exc .t { background: #333; } } + +#source p.exc.show_exc .t:hover { background: #e2e2e2; } + +@media (prefers-color-scheme: dark) { #source p.exc.show_exc .t:hover { background: #3c3c3c; } } + +#source p.par .t { border-left: 0.2em solid #bbbb00; } + +#source p.par.show_par .t { background: #ffa; } + +@media (prefers-color-scheme: dark) { #source p.par.show_par .t { background: #650; } } + +#source p.par.show_par .t:hover { background: #f2f2a2; } + +@media (prefers-color-scheme: dark) { #source p.par.show_par .t:hover { background: #6d5d0c; } } + +#source p .r { position: absolute; top: 0; right: 2.5em; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; } + +#source p .annotate { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; color: #666; padding-right: .5em; } + +@media (prefers-color-scheme: dark) { #source p .annotate { color: #ddd; } } + +#source p .annotate.short:hover ~ .long { display: block; } + +#source p .annotate.long { width: 30em; right: 2.5em; } + +#source p input { display: none; } + +#source p input ~ .r label.ctx { cursor: pointer; border-radius: .25em; } + +#source p input ~ .r label.ctx::before { content: "▶ "; } + +#source p input ~ .r label.ctx:hover { background: #e8f4ff; color: #666; } + +@media (prefers-color-scheme: dark) { #source p input ~ .r label.ctx:hover { background: #0f3a42; } } + +@media (prefers-color-scheme: dark) { #source p input ~ .r label.ctx:hover { color: #aaa; } } + +#source p input:checked ~ .r label.ctx { background: #d0e8ff; color: #666; border-radius: .75em .75em 0 0; padding: 0 .5em; margin: -.25em 0; } + +@media (prefers-color-scheme: dark) { #source p input:checked ~ .r label.ctx { background: #056; } } + +@media (prefers-color-scheme: dark) { #source p input:checked ~ .r label.ctx { color: #aaa; } } + +#source p input:checked ~ .r label.ctx::before { content: "▼ "; } + +#source p input:checked ~ .ctxs { padding: .25em .5em; overflow-y: scroll; max-height: 10.5em; } + +#source p label.ctx { color: #999; display: inline-block; padding: 0 .5em; font-size: .8333em; } + +@media (prefers-color-scheme: dark) { #source p label.ctx { color: #777; } } + +#source p .ctxs { display: block; max-height: 0; overflow-y: hidden; transition: all .2s; padding: 0 .5em; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; white-space: nowrap; background: #d0e8ff; border-radius: .25em; margin-right: 1.75em; text-align: right; } + +@media (prefers-color-scheme: dark) { #source p .ctxs { background: #056; } } + +#index { font-family: SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 0.875em; } + +#index table.index { margin-left: -.5em; } + +#index td, #index th { text-align: right; padding: .25em .5em; border-bottom: 1px solid #eee; } + +@media (prefers-color-scheme: dark) { #index td, #index th { border-color: #333; } } + +#index td.name, #index th.name { text-align: left; width: auto; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; min-width: 15em; } + +#index th { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; font-style: italic; color: #333; cursor: pointer; } + +@media (prefers-color-scheme: dark) { #index th { color: #ddd; } } + +#index th:hover { background: #eee; } + +@media (prefers-color-scheme: dark) { #index th:hover { background: #333; } } + +#index th .arrows { color: #666; font-size: 85%; font-family: sans-serif; font-style: normal; pointer-events: none; } + +#index th[aria-sort="ascending"], #index th[aria-sort="descending"] { white-space: nowrap; background: #eee; padding-left: .5em; } + +@media (prefers-color-scheme: dark) { #index th[aria-sort="ascending"], #index th[aria-sort="descending"] { background: #333; } } + +#index th[aria-sort="ascending"] .arrows::after { content: " ▲"; } + +#index th[aria-sort="descending"] .arrows::after { content: " ▼"; } + +#index td.name { font-size: 1.15em; } + +#index td.name a { text-decoration: none; color: inherit; } + +#index td.name .no-noun { font-style: italic; } + +#index tr.total td, #index tr.total_dynamic td { font-weight: bold; border-top: 1px solid #ccc; border-bottom: none; } + +#index tr.region:hover { background: #eee; } + +@media (prefers-color-scheme: dark) { #index tr.region:hover { background: #333; } } + +#index tr.region:hover td.name { text-decoration: underline; color: inherit; } + +#scroll_marker { position: fixed; z-index: 3; right: 0; top: 0; width: 16px; height: 100%; background: #fff; border-left: 1px solid #eee; will-change: transform; } + +@media (prefers-color-scheme: dark) { #scroll_marker { background: #1e1e1e; } } + +@media (prefers-color-scheme: dark) { #scroll_marker { border-color: #333; } } + +#scroll_marker .marker { background: #ccc; position: absolute; min-height: 3px; width: 100%; } + +@media (prefers-color-scheme: dark) { #scroll_marker .marker { background: #444; } } diff --git a/htmlcov/z_145eef247bfb46b6___init___py.html b/htmlcov/z_145eef247bfb46b6___init___py.html new file mode 100644 index 0000000..aee4e4e --- /dev/null +++ b/htmlcov/z_145eef247bfb46b6___init___py.html @@ -0,0 +1,97 @@ + + + + + Coverage for src\__init__.py: 100% + + + + + +
+
+

+ Coverage for src\__init__.py: + 100% +

+ +

+ 0 statements   + + + +

+

+ « prev     + ^ index     + » next +       + coverage.py v7.8.2, + created at 2025-06-01 23:14 +0300 +

+ +
+
+
+
+ + + diff --git a/htmlcov/z_145eef247bfb46b6_masks_py.html b/htmlcov/z_145eef247bfb46b6_masks_py.html new file mode 100644 index 0000000..2a845e6 --- /dev/null +++ b/htmlcov/z_145eef247bfb46b6_masks_py.html @@ -0,0 +1,137 @@ + + + + + Coverage for src\masks.py: 100% + + + + + +
+
+

+ Coverage for src\masks.py: + 100% +

+ +

+ 12 statements   + + + +

+

+ « prev     + ^ index     + » next +       + coverage.py v7.8.2, + created at 2025-06-01 23:14 +0300 +

+ +
+
+
+

1INVALID_CARD_NUMBER = "Неверный номер карты!" 

+

2 

+

3 

+

4def get_mask_card_number(number_card: str) -> str: 

+

5 """ 

+

6 Данная функция маскирует номер банковской карты. 

+

7 

+

8 На вход принимается строка. 

+

9 

+

10 На выходе форматированная строка. 

+

11 

+

12 :param number_card: 

+

13 :return: 

+

14 """ 

+

15 number_card = number_card.strip() 

+

16 

+

17 if len(number_card) == 16 and number_card.isdigit(): 

+

18 hidden_card_number: str = f"{number_card[0:4]} {number_card[4:6]}** **** {number_card[-4:]}" 

+

19 return hidden_card_number 

+

20 else: 

+

21 return INVALID_CARD_NUMBER 

+

22 

+

23 

+

24def get_mask_account(account_number: str) -> str: 

+

25 """ 

+

26 Данная функция маскирует номер счёта. 

+

27 

+

28 На вход принимается строка. 

+

29 

+

30 На выходе строка. 

+

31 

+

32 :param account_number: 

+

33 :return: 

+

34 """ 

+

35 account_number = account_number.strip() 

+

36 

+

37 if len(account_number) == 20 and account_number.isdigit(): 

+

38 return f"**{account_number[-4:]}" 

+

39 else: 

+

40 return INVALID_CARD_NUMBER 

+
+ + + diff --git a/htmlcov/z_145eef247bfb46b6_processing_py.html b/htmlcov/z_145eef247bfb46b6_processing_py.html new file mode 100644 index 0000000..48af0ad --- /dev/null +++ b/htmlcov/z_145eef247bfb46b6_processing_py.html @@ -0,0 +1,143 @@ + + + + + Coverage for src\processing.py: 100% + + + + + +
+
+

+ Coverage for src\processing.py: + 100% +

+ +

+ 12 statements   + + + +

+

+ « prev     + ^ index     + » next +       + coverage.py v7.8.2, + created at 2025-06-01 23:14 +0300 +

+ +
+
+
+

1def filter_by_state(data_list: list, state: str = "EXECUTED") -> list: 

+

2 """ 

+

3 Функция возвращает новый список словарей, содержащий только те словари, у которых 

+

4 ключ state соответствует указанному значению. 

+

5 

+

6 :param data_list: 

+

7 :param state: 

+

8 :return: 

+

9 PS - Я понимаю, что список можно итерировать не по индексу как у меня в примере, 

+

10 а непосредственна по значениям списка. 

+

11 Просто я так пытаюсь разобраться, как это хозяйство всё работает 

+

12 Конструкции Python мне ломают мои привычки типа: 

+

13 

+

14 for (int i = 0; i < 100; i++) 

+

15 {ваш код} 

+

16 

+

17 for i = 1 to 100 

+

18 ваш код 

+

19 next 

+

20 

+

21 но я обещаю в будущем исправиться 

+

22 """ 

+

23 

+

24 length_list = len(data_list) 

+

25 temp_list = list() 

+

26 

+

27 for current_index in range(length_list): 

+

28 temp_list.append(data_list[current_index]) if data_list[current_index].get("state", 0) == state else temp_list 

+

29 

+

30 return temp_list 

+

31 

+

32 

+

33def sort_by_date(date_list: list, ascending: bool = True) -> list: 

+

34 """ 

+

35 Функция возвращает новый список, отсортированный по дате (date) 

+

36 

+

37 :param date_list: 

+

38 :param ascending: 

+

39 :return: 

+

40 """ 

+

41 if not date_list: 

+

42 print("Empty") 

+

43 return [] 

+

44 sorted_list = sorted(date_list, key=lambda x: x.get("date", 0), reverse=ascending) 

+

45 

+

46 return sorted_list 

+
+ + + diff --git a/htmlcov/z_145eef247bfb46b6_widget_py.html b/htmlcov/z_145eef247bfb46b6_widget_py.html new file mode 100644 index 0000000..70a2d92 --- /dev/null +++ b/htmlcov/z_145eef247bfb46b6_widget_py.html @@ -0,0 +1,153 @@ + + + + + Coverage for src\widget.py: 100% + + + + + +
+
+

+ Coverage for src\widget.py: + 100% +

+ +

+ 24 statements   + + + +

+

+ « prev     + ^ index     + » next +       + coverage.py v7.8.2, + created at 2025-06-01 23:14 +0300 +

+ +
+
+
+

1from datetime import datetime 

+

2 

+

3from src.masks import get_mask_account, get_mask_card_number 

+

4 

+

5 

+

6def mask_account_card(card_info_sting: str = "") -> str: 

+

7 """ 

+

8 Принимает на вход строку с наименованием карты и её номером 

+

9 

+

10 После чего номер маскирует 

+

11 

+

12 На выходе получаем наименование карты и маскированый номер 

+

13 

+

14 :param card_info_sting: 

+

15 :return: 

+

16 

+

17 """ 

+

18 

+

19 temp_card_info_sting: str = card_info_sting.lower().strip() 

+

20 

+

21 card_error_message: str = "Неверный номер карты!" 

+

22 mask_card_info: str = card_error_message 

+

23 if card_info_sting != "": 

+

24 if ("счет " in temp_card_info_sting) or ("счёт " in temp_card_info_sting): 

+

25 temp_result = get_mask_account(temp_card_info_sting[5:]) 

+

26 mask_card_info = "Счет " + temp_result if temp_result != card_error_message else card_error_message 

+

27 elif not temp_card_info_sting[-17:].isdigit(): 

+

28 temp_result = get_mask_card_number(temp_card_info_sting[-16:]) 

+

29 mask_card_info = ( 

+

30 card_info_sting[0:-16] + temp_result if temp_result != card_error_message else card_error_message 

+

31 ) 

+

32 

+

33 return mask_card_info 

+

34 

+

35 

+

36def get_date(iso_date: str) -> str: 

+

37 """ 

+

38 принимает на вход строку с датой в ISO 8601 формате 

+

39 

+

40 "2024-03-11T02:26:18.671407" 

+

41 

+

42 и возвращает строку с датой в формате 

+

43 

+

44 "ДД.ММ.ГГГГ" ("11.03.2024") 

+

45 :param iso_date: 

+

46 :return: 

+

47 """ 

+

48 temp = "Неверный формат даты!" 

+

49 if iso_date != "": 

+

50 try: 

+

51 temp_date = datetime.fromisoformat(iso_date) 

+

52 temp_d = temp_date.strftime("%d.%m.%Y") 

+

53 temp = str(temp_d) # афигеть рокировка... 

+

54 except ValueError: 

+

55 return temp 

+

56 return temp 

+
+ + + From 0c40047dcf0fdc98ebaf0a56a6b991d25d69a93d Mon Sep 17 00:00:00 2001 From: kostya261 <62214954+kostya261@users.noreply.github.com> Date: Sun, 1 Jun 2025 23:40:13 +0300 Subject: [PATCH 12/15] Update README.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Поправил ссылку --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 434544c..0ea5c28 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ ## Установка: 1. Клонируйте репозиторий: - [ссылка](https://github.com/kostya261/PythonProject/tree/feature/homework_10_1) + [ссылка](https://github.com/kostya261/PythonProject/tree/feature/homework_10_2) 2. Зависимости указанные в файле: *pyproject.toml* ``` [tool.poetry.dependencies] From cf85b379d5db65b41d1c2cd8071afb653472a3c2 Mon Sep 17 00:00:00 2001 From: kostya261 <62214954+kostya261@users.noreply.github.com> Date: Sun, 1 Jun 2025 23:50:45 +0300 Subject: [PATCH 13/15] Update README.md --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0ea5c28..dd9bb19 100644 --- a/README.md +++ b/README.md @@ -5,8 +5,9 @@ ## Установка: 1. Клонируйте репозиторий: - [ссылка](https://github.com/kostya261/PythonProject/tree/feature/homework_10_2) -2. Зависимости указанные в файле: *pyproject.toml* + [ссылка](https://github.com/kostya261/PythonProject/pull/3) + +3. Зависимости указанные в файле: *pyproject.toml* ``` [tool.poetry.dependencies] python = "^3.13" From c572b1450a883292bbfc82af24145b98c029ab22 Mon Sep 17 00:00:00 2001 From: Kosarew Konstantin Date: Thu, 5 Jun 2025 23:55:10 +0300 Subject: [PATCH 14/15] =?UTF-8?q?=D0=BF=D1=80=D0=B0=D0=BA=D1=82=D0=B8?= =?UTF-8?q?=D1=87=D0=B5=D1=81=D0=BA=D0=B8=20=D0=BF=D0=BE=D0=BB=D0=BD=D0=BE?= =?UTF-8?q?=D1=81=D1=82=D1=8C=D1=8E=20=D0=BF=D0=B5=D1=80=D0=B5=D0=BF=D0=B8?= =?UTF-8?q?=D1=81=D0=B0=D0=BB=20=D0=B2=D1=81=D0=B5=20=D1=84=D1=83=D0=BD?= =?UTF-8?q?=D0=BA=D1=86=D0=B8=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/masks.py | 22 +++---- src/processing.py | 25 +------ src/widget.py | 55 +++++++++------- tests/conftest.py | 70 ++++---------------- tests/test_masks.py | 89 ++++++++++++++++++++----- tests/test_processing.py | 64 ++++++++---------- tests/test_widget.py | 137 ++++++++++++++++++++++++--------------- 7 files changed, 241 insertions(+), 221 deletions(-) diff --git a/src/masks.py b/src/masks.py index 3edf73f..9d4b186 100644 --- a/src/masks.py +++ b/src/masks.py @@ -12,13 +12,13 @@ def get_mask_card_number(number_card: str) -> str: :param number_card: :return: """ - number_card = number_card.strip() - if len(number_card) == 16 and number_card.isdigit(): - hidden_card_number: str = f"{number_card[0:4]} {number_card[4:6]}** **** {number_card[-4:]}" - return hidden_card_number - else: - return INVALID_CARD_NUMBER + digits = "".join(char for char in number_card if char.isdigit()) + + if len(digits) != 16: + raise ValueError(INVALID_CARD_NUMBER) + + return f"{digits[0:4]} {digits[4:6]}** **** {digits[-4:]}" def get_mask_account(account_number: str) -> str: @@ -32,9 +32,7 @@ def get_mask_account(account_number: str) -> str: :param account_number: :return: """ - account_number = account_number.strip() - - if len(account_number) == 20 and account_number.isdigit(): - return f"**{account_number[-4:]}" - else: - return INVALID_CARD_NUMBER + digits = "".join(char for char in account_number if char.isdigit()) + if len(digits) != 20: + raise ValueError(INVALID_CARD_NUMBER) + return f"**{digits[-4:]}" diff --git a/src/processing.py b/src/processing.py index 30cdafc..beaa4e4 100644 --- a/src/processing.py +++ b/src/processing.py @@ -6,28 +6,9 @@ def filter_by_state(data_list: list, state: str = "EXECUTED") -> list: :param data_list: :param state: :return: - PS - Я понимаю, что список можно итерировать не по индексу как у меня в примере, - а непосредственна по значениям списка. - Просто я так пытаюсь разобраться, как это хозяйство всё работает - Конструкции Python мне ломают мои привычки типа: - - for (int i = 0; i < 100; i++) - {ваш код} - - for i = 1 to 100 - ваш код - next - - но я обещаю в будущем исправиться """ - length_list = len(data_list) - temp_list = list() - - for current_index in range(length_list): - temp_list.append(data_list[current_index]) if data_list[current_index].get("state", 0) == state else temp_list - - return temp_list + return [item for item in data_list if item.get("state") == state] def sort_by_date(date_list: list, ascending: bool = True) -> list: @@ -39,8 +20,6 @@ def sort_by_date(date_list: list, ascending: bool = True) -> list: :return: """ if not date_list: - print("Empty") return [] - sorted_list = sorted(date_list, key=lambda x: x.get("date", 0), reverse=ascending) - return sorted_list + return sorted(date_list, key=lambda x: x.get("date", 0), reverse=ascending) diff --git a/src/widget.py b/src/widget.py index 4a46067..7da70a6 100644 --- a/src/widget.py +++ b/src/widget.py @@ -9,33 +9,46 @@ def mask_account_card(card_info_sting: str = "") -> str: После чего номер маскирует - На выходе получаем наименование карты и маскированый номер + На выходе получаем наименование карты и маскированный номер :param card_info_sting: :return: """ + card_error_message: str = "Неверный номер карты!" + if not card_info_sting.strip(): + return card_error_message - temp_card_info_sting: str = card_info_sting.lower().strip() + # приводим строку к требуемому виду + normalized_card_sting: str = card_info_sting.lower().strip() + # Извлечение цифр из строки + all_digits: str = "".join(char for char in normalized_card_sting if char.isdigit()) + # Извлекаю имя карты + card_name: str = "".join(char for char in card_info_sting if not char.isdigit() and char not in ("-", "/")).strip() - card_error_message: str = "Неверный номер карты!" + # На всякий случай в переменной сообщение об ошибке. + # Если маскировка карты пройдёт успешно, то в этой переменной будет результат mask_card_info: str = card_error_message - if card_info_sting != "": - if ("счет " in temp_card_info_sting) or ("счёт " in temp_card_info_sting): - temp_result = get_mask_account(temp_card_info_sting[5:]) - mask_card_info = "Счет " + temp_result if temp_result != card_error_message else card_error_message - elif not temp_card_info_sting[-17:].isdigit(): - temp_result = get_mask_card_number(temp_card_info_sting[-16:]) - mask_card_info = ( - card_info_sting[0:-16] + temp_result if temp_result != card_error_message else card_error_message - ) + # Проверяю счёт унас на входе или иная невидаль + if ("счет " in normalized_card_sting) or ("счёт " in normalized_card_sting): + # если счёт, то смотрим, 20ть ли цифирь, если да, то маскируем + if len(all_digits) == 20: + mask_card_info = card_name + " " + get_mask_account(all_digits) + else: + # если не счёт, то возможно карта, тогда смотрим 16ть ли цифирь + # и если 16ть, маскируем, если нет, то просто выходим + if len(all_digits) == 16: + mask_card_info = card_name + " " + get_mask_card_number(all_digits) + + # если хотя бы одна функция в условии выше отработала, тогда возвращаем результат + # если же нет, то записанное ранее сообщение об ошибке return mask_card_info def get_date(iso_date: str) -> str: """ - принимает на вход строку с датой в ISO 8601 формате + принимает на вход строку с датой в ISO 8601 формате "2024-03-11T02:26:18.671407" @@ -45,12 +58,10 @@ def get_date(iso_date: str) -> str: :param iso_date: :return: """ - temp = "Неверный формат даты!" - if iso_date != "": - try: - temp_date = datetime.fromisoformat(iso_date) - temp_d = temp_date.strftime("%d.%m.%Y") - temp = str(temp_d) # афигеть рокировка... - except ValueError: - return temp - return temp + error_message: str = "Неверный формат даты!" + if not iso_date: + return error_message + try: + return datetime.fromisoformat(iso_date).strftime("%d.%m.%Y") + except (ValueError, TypeError): + return error_message diff --git a/tests/conftest.py b/tests/conftest.py index 9a3235c..0dae911 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,65 +1,19 @@ -import pytest - -card_invalid_string = "Неверный номер карты!" - -card_numbers_for_test = [ - {"card": "6347551021023605", "result": "6347 55** **** 3605"}, - {"card": "6347551021023605 ", "result": "6347 55** **** 3605"}, - {"card": " 6347551021023605", "result": "6347 55** **** 3605"}, - {"card": "x347551021023605", "result": card_invalid_string}, - {"card": "34755102c1023605", "result": card_invalid_string}, - {"card": "634755102102365", "result": card_invalid_string}, - {"card": "63475510210236052", "result": card_invalid_string}, - {"card": "634755 102102 3605", "result": card_invalid_string}, -] +from datetime import datetime -account_numbers_for_test = [ - {"card": "63475526471021023605", "result": "**3605"}, - {"card": "63475510210236026475 ", "result": "**6475"}, - {"card": " 63475510210226473605", "result": "**3605"}, - {"card": "x347551021023605", "result": card_invalid_string}, - {"card": "34755102c1023605", "result": card_invalid_string}, - {"card": "634755102102365", "result": card_invalid_string}, - {"card": "63475510210236052", "result": card_invalid_string}, - {"card": "634755 102102 3605", "result": card_invalid_string}, -] - - -account_card_for_test = [ - {"card": "Счет 73654108430535874307", "result": "Счет **4307"}, - {"card": "Счет 7365408430535874307", "result": card_invalid_string}, - {"card": "Visa Platinum 7000712289606361", "result": "Visa Platinum 7000 71** **** 6361"}, - {"card": "Maestro 7000792108106361", "result": "Maestro 7000 79** **** 6361"}, - {"card": "MasterCard 7158300734726758", "result": "MasterCard 7158 30** **** 6758"}, - {"card": "Maestro 1596837868705199", "result": "Maestro 1596 83** **** 5199"}, - {"card": "Счет 64686473678894779589", "result": "Счет **9589"}, - {"card": "Счет 646864736788947795589", "result": card_invalid_string}, - {"card": "MasterCard 715300734726758", "result": card_invalid_string}, - {"card": "Счет 35383033474447895560", "result": "Счет **5560"}, - {"card": "Счет 3538303347с447895560", "result": card_invalid_string}, - {"card": "Visa Classic 6831982476737658", "result": "Visa Classic 6831 98** **** 7658"}, - {"card": "Visa Classic 683198247637658", "result": card_invalid_string}, - {"card": "Visa Classic 683198247637652448", "result": card_invalid_string}, - {"card": "Visa Platinum 8990922113665229", "result": "Visa Platinum 8990 92** **** 5229"}, - {"card": "Visa Platinum ", "result": card_invalid_string}, - {"card": "", "result": card_invalid_string}, - {"card": "Visa Gold 5999414228426353", "result": "Visa Gold 5999 41** **** 6353"}, - {"card": "счет 73654108430135874305", "result": "Счет **4305"}, - {"card": "сет 73654108430135874305", "result": card_invalid_string}, - {"card": "сЧет 73654108430135874305", "result": "Счет **4305"}, -] +import pytest -@pytest.fixture(params=card_numbers_for_test) -def card_numbers(request): - return request.param +@pytest.fixture +def error_message() -> str: + return "Неверный номер карты!" -@pytest.fixture(params=account_numbers_for_test) -def account_numbers(request): - return request.param +@pytest.fixture +def error_data_message() -> str: + return "Неверный формат даты!" -@pytest.fixture(params=account_card_for_test) -def account_cards(request): - return request.param +@pytest.fixture +def current_data() -> str: + now_time = datetime.now() + return str(now_time.isoformat()) diff --git a/tests/test_masks.py b/tests/test_masks.py index 4e7a7ef..c5b8dbf 100644 --- a/tests/test_masks.py +++ b/tests/test_masks.py @@ -1,21 +1,74 @@ +import pytest + from src.masks import get_mask_account, get_mask_card_number +valid_cards = [ + ("1234567890123456", "1234 56** **** 3456"), + ("0000111122223333", "0000 11** **** 3333"), + (" 1234 5678 9012 3456 ", "1234 56** **** 3456"), + ("1234-5678-9012-3456", "1234 56** **** 3456"), + ("Visa 1234 5678 9012 3456", "1234 56** **** 3456"), + ("MC-1234-5678-9012-3456", "1234 56** **** 3456"), + ("Карта: 1234 5678 9012 3456", "1234 56** **** 3456"), + ("Visa Platinum 7000 7122 8960 6361", "7000 71** **** 6361"), + ("Maestro 7000792108106361", "7000 79** **** 6361"), + ("MasterCard 7158 3007 3472 6758", "7158 30** **** 6758"), + ("Счет 1234567890123456", "1234 56** **** 3456"), + ("Платежная карта № 1234-5678-9012-3456", "1234 56** **** 3456"), +] + + +invalid_cards = [ + "1234", + "12345678901234567890", + "Card 1234 5678 9012", + "Visa 1234abcd5678efgh", + "", + " ", + "Счет без номера", + "123456789012345a", + "1234 5678 9012 345", +] + + +valid_accounts = [ + ("Счет 73654108430535874307", "**4307"), + ("Счет 73654108430535874307 ", "**4307"), + ("Счет 7365-4108-4305-3587-4307 ", "**4307"), + ("Счет 7365 4108 4305 3587 4307", "**4307"), +] + + +invalid_accounts = [ + "Счет 736541084305358874307", + "Счет 7365410843053588747", + "", + " ", + "Счет без номера", + "1234 2345 2345", + "12d3 654t 3245 5678 fght", +] + + +@pytest.mark.parametrize("card_input, expected", valid_cards) +def test_valid_card_masking(card_input: str, expected: str) -> None: + assert get_mask_card_number(card_input) == expected + + +@pytest.mark.parametrize("card_input", invalid_cards) +def test_invalid_card_errors(card_input: str, error_message: str) -> None: + with pytest.raises(ValueError) as exc_info: + get_mask_card_number(card_input) + assert str(exc_info.value) == error_message + + +@pytest.mark.parametrize("card_input, expected", valid_accounts) +def test_valid_account_masking(card_input: str, expected: str) -> None: + assert get_mask_account(card_input) == expected + -def test_get_mask_card_number(card_numbers: dict) -> None: - """ - Тестируется функция get_mask_card_number. - Данные для тестов берутся из Fixture - :param card_numbers: - :return: - """ - assert get_mask_card_number(card_numbers["card"]) == card_numbers["result"] - - -def test_get_mask_account(account_numbers: dict) -> None: - """ - Тестируется функция get_mask_account. - Данные для тестов берутся из Fixture - :param card_numbers: - :return: - """ - assert get_mask_account(account_numbers["card"]) == account_numbers["result"] +@pytest.mark.parametrize("card_input", invalid_accounts) +def test_invalid_account_errors(card_input: str, error_message: str) -> None: + with pytest.raises(ValueError) as exc_info: + get_mask_account(card_input) + assert str(exc_info.value) == error_message diff --git a/tests/test_processing.py b/tests/test_processing.py index 32f3190..3ef5cda 100644 --- a/tests/test_processing.py +++ b/tests/test_processing.py @@ -10,43 +10,49 @@ {"id": 615064591, "state": "CANCELED", "date": "2018-10-14T08:21:33.419441"}, ] -list_date_empty: list = [] - -list_date_executed = [ +list_executed = [ {"id": 41428829, "state": "EXECUTED", "date": "2019-07-03T18:35:29.512364"}, {"id": 939719570, "state": "EXECUTED", "date": "2018-06-30T02:08:58.425572"}, {"id": 939719572, "state": "EXECUTED", "date": "2018-06-30T02:08:58.425572"}, ] -list_date_canceled = [ +list_canceled = [ {"id": 594226727, "state": "CANCELED", "date": "2018-09-12T21:27:25.241689"}, {"id": 615064591, "state": "CANCELED", "date": "2018-10-14T08:21:33.419441"}, ] -list_date_sort_up: list = [ - {"date": "2019-07-03T18:35:29.512364", "id": 41428829, "state": "EXECUTED"}, - {"date": "2018-10-14T08:21:33.419441", "id": 615064591, "state": "CANCELED"}, - {"date": "2018-09-12T21:27:25.241689", "id": 594226727, "state": "CANCELED"}, - {"date": "2018-06-30T02:08:58.425572", "id": 939719570, "state": "EXECUTED"}, - {"date": "2018-06-30T02:08:58.425572", "id": 939719572, "state": "EXECUTED"}, +list_empty: list = [] + + +list_sorted_false = [ + {"id": 939719570, "state": "EXECUTED", "date": "2018-06-30T02:08:58.425572"}, + {"id": 939719572, "state": "EXECUTED", "date": "2018-06-30T02:08:58.425572"}, + {"id": 594226727, "state": "CANCELED", "date": "2018-09-12T21:27:25.241689"}, + {"id": 615064591, "state": "CANCELED", "date": "2018-10-14T08:21:33.419441"}, + {"id": 41428829, "state": "EXECUTED", "date": "2019-07-03T18:35:29.512364"}, ] -list_date_sort_down: list = [ - {"date": "2018-06-30T02:08:58.425572", "id": 939719570, "state": "EXECUTED"}, - {"date": "2018-06-30T02:08:58.425572", "id": 939719572, "state": "EXECUTED"}, - {"date": "2018-09-12T21:27:25.241689", "id": 594226727, "state": "CANCELED"}, - {"date": "2018-10-14T08:21:33.419441", "id": 615064591, "state": "CANCELED"}, - {"date": "2019-07-03T18:35:29.512364", "id": 41428829, "state": "EXECUTED"}, + +list_sorted_true = [ + {"id": 41428829, "state": "EXECUTED", "date": "2019-07-03T18:35:29.512364"}, + {"id": 615064591, "state": "CANCELED", "date": "2018-10-14T08:21:33.419441"}, + {"id": 594226727, "state": "CANCELED", "date": "2018-09-12T21:27:25.241689"}, + {"id": 939719570, "state": "EXECUTED", "date": "2018-06-30T02:08:58.425572"}, + {"id": 939719572, "state": "EXECUTED", "date": "2018-06-30T02:08:58.425572"}, ] @pytest.mark.parametrize( "date_list, state, expected", [ - (list_date, "EXECUTED", list_date_executed), - (list_date, "CANCELED", list_date_canceled), - (list_date, "CALED", list_date_empty), - ([], "CANCELED", list_date_empty), + (list_date, "EXECUTED", list_executed), + (list_date, "CANCELED", list_canceled), + (list_date, "", list_empty), + (list_date, "UNKNOW", list_empty), + (list_date, None, list_empty), + (list_empty, None, list_empty), + (list_empty, "EXECUTED", list_empty), + (list_empty, "CANCELED", list_empty), ], ) def test_filter_by_state(date_list: list, state: str, expected: list) -> None: @@ -63,23 +69,7 @@ def test_filter_by_state(date_list: list, state: str, expected: list) -> None: @pytest.mark.parametrize( "date_list, ascending, expected", - [ - (list_date, True, list_date_sort_up), - (list_date, False, list_date_sort_down), - ([], False, []), - ([], True, []), - ([], None, []), - ], + [(list_date, False, list_sorted_false), (list_date, True, list_sorted_true), (list_date, None, list_sorted_false)], ) def test_sort_by_date(date_list: list, ascending: bool, expected: list) -> None: - """ - Проверяем функцию sort_by_date, которая сортирует списки по датам - как вверх по списку так и вниз - так же проверяется как ведет себя функция если список пустой - - :param date_list: - :param ascending: - :param expected: - :return: - """ assert sort_by_date(date_list, ascending) == expected diff --git a/tests/test_widget.py b/tests/test_widget.py index dabaaf8..f1361c3 100644 --- a/tests/test_widget.py +++ b/tests/test_widget.py @@ -1,56 +1,91 @@ -from datetime import datetime - import pytest from src.widget import get_date, mask_account_card +# Параметры правильных данных карт +valid_cards = [ + ("Visa 1234 5678 9012 3456", "Visa 1234 56** **** 3456"), + ("MC-1234-5678-9012-3456", "MC 1234 56** **** 3456"), + ("Карта: 1234 5678 9012 3456", "Карта: 1234 56** **** 3456"), + ("Visa Platinum 7000 7122 8960 6361", "Visa Platinum 7000 71** **** 6361"), + ("Maestro 7000792108106361", "Maestro 7000 79** **** 6361"), + ("MasterCard 7158 3007 3472 6758", "MasterCard 7158 30** **** 6758"), + ("Платежная карта № 1234-5678-9012-3456", "Платежная карта № 1234 56** **** 3456"), + ("Счет 73654108430535874307", "Счет **4307"), + ("Счет 73654108430535874307 ", "Счет **4307"), + ("Счет 7365-4108-4305-3587-4307 ", "Счет **4307"), + ("Счет 7365 4108 4305 3587 4307", "Счет **4307"), +] + + +# Параметры неправильных данных карт +invalid_cards = [ + "1234", + "12345678901234567890", + "Card 1234 5678 9012", + "Visa 1234abcd5678efgh", + "", + " ", + "Счет без номера", + "123456789012345a", + "1234 5678 9012 345", + "Счет736541084305358874307", + "Счет 7365410843053588747", + "", + " ", + "Счет без номера", + "1234 2345 2345", + "12d3 654t 3245 5678 fght", +] + + +# Параметры правильных данных +valid_dates = [ + ("2024-03-11T02:26:18.671407", "11.03.2024"), + ("2023-12-31T23:59:59.999999", "31.12.2023"), + ("2000-01-01T00:00:00.000000", "01.01.2000"), + ("1999-02-28T15:30:45.123456", "28.02.1999"), + ("2024-02-29T12:00:00.000000", "29.02.2024"), +] + + +# Параметры неправильных данных +invalid_dates = [ + "2024-03-32T00:00:00.000000", + "2023-13-01T00:00:00.000000", + "2024-03-11 ", + "11.03.2024T02:26:18.671407", + "2024-03-11T25:00:00.000000", + "Hello World!", + "2024/03/11T02:26:18.671407", +] + + +@pytest.mark.parametrize("card_input, expected", valid_cards) +def test_valid_card_masking(card_input: str, expected: str) -> None: + assert mask_account_card(card_input) == expected + + +@pytest.mark.parametrize("card_input", invalid_cards) +def test_invalid_card_errors(card_input: str, error_message: str) -> None: + assert mask_account_card(card_input) == error_message + + +# Тест для правильных данных +@pytest.mark.parametrize("iso_date, expected", valid_dates) +def test_valid_dates(iso_date: str, expected: str) -> None: + result = get_date(iso_date) + assert result == expected + + +# Тест для неправильных данных +@pytest.mark.parametrize("iso_date", invalid_dates) +def test_invalid_dates(iso_date: str, error_data_message: str) -> None: + assert get_date(iso_date) == error_data_message + + +# Тест для пустой строки +@pytest.mark.parametrize("iso_date", [""]) +def test_none_input(iso_date: str, error_data_message: str) -> None: -def test_mask_account_card(account_cards: dict[str, str]) -> None: - """ - Проверяем функцию mask_account_card которая маскирует в зависимости - от того что подано на вход, либо счёт, либо карту. - Данные берутся из fixture в виде словаря, в котором указаны - как данные на входе, так и предполагаемые данные на выходе - :param account_cards: - :return Ничего: - """ - assert mask_account_card(account_cards["card"]) == account_cards["result"] - - -@pytest.mark.parametrize( - "card, expected", - [ - ("Счет 73654108430535874307", "Счет **4307"), - ("Счет 7365408430535874307", "Неверный номер карты!"), - ("Visa Platinum 7000712289606361", "Visa Platinum 7000 71** **** 6361"), - ("Maestro 1596837868705199", "Maestro 1596 83** **** 5199"), - ("MasterCard 715300734726758", "Неверный номер карты!"), - ("", "Неверный номер карты!"), - ], -) -def test_mask_account_card_parametrize(card: str, expected: str) -> None: - """ - Данная функция проверяет функцию mask_account_card - :param card: - :param expected: - :return: - """ - assert mask_account_card(card) == expected - - -def test_get_date() -> None: - """ - Тестируем функцию get_date - Проверяется, как функция в целом фоспринимает стандарт принимаемой даты - Затем этот же самый формат подаётся, но уже в виде готовой текстовой строки - Также проверяем если строка будет пустой - И если дата будет подана в неправильном формате - :return - Ничего: - """ - now_time = datetime.now() - assert get_date(str(now_time.isoformat())) - assert get_date("2024-03-11T02:26:18.671407") == "11.03.2024" - time_data = "" - assert get_date(str(time_data)) == "Неверный формат даты!" - time_data = "10.13.2005" - assert get_date(str(time_data)) == "Неверный формат даты!" + assert get_date(iso_date) == error_data_message From 2b957f075db4ed010b6f4c16abd1a1efb76dcb3c Mon Sep 17 00:00:00 2001 From: Kosarew Konstantin Date: Fri, 6 Jun 2025 00:10:51 +0300 Subject: [PATCH 15/15] =?UTF-8?q?=D0=BF=D1=80=D0=B0=D0=BA=D1=82=D0=B8?= =?UTF-8?q?=D1=87=D0=B5=D1=81=D0=BA=D0=B8=20=D0=BF=D0=BE=D0=BB=D0=BD=D0=BE?= =?UTF-8?q?=D1=81=D1=82=D1=8C=D1=8E=20=D0=BF=D0=B5=D1=80=D0=B5=D0=BF=D0=B8?= =?UTF-8?q?=D1=81=D0=B0=D0=BB=20=D0=B2=D1=81=D0=B5=20=D1=84=D1=83=D0=BD?= =?UTF-8?q?=D0=BA=D1=86=D0=B8=D0=B8=20+=20code=20coverage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .coverage | Bin 53248 -> 53248 bytes htmlcov/class_index.html | 22 ++--- htmlcov/function_index.html | 42 ++++---- htmlcov/index.html | 22 ++--- htmlcov/status.json | 2 +- htmlcov/z_145eef247bfb46b6_masks_py.html | 32 +++--- htmlcov/z_145eef247bfb46b6_processing_py.html | 67 +++++-------- htmlcov/z_145eef247bfb46b6_widget_py.html | 91 ++++++++++-------- 8 files changed, 133 insertions(+), 145 deletions(-) diff --git a/.coverage b/.coverage index a9065f9cd8b314ac34fb8ec29cb0074d13a5995c..a16cae0103b9c72267eef17a814e74bbc6f90252 100644 GIT binary patch delta 70 zcmZozz}&Eac>`Mm*Chu2pZst6AMsz>EGTe@U!9MIg^^Q^#fxE1mx&wG1Ab0sAYX); Y$-{w(iwVdSV-jM}Wvtlzv!C4o0Ll3gK>z>% delta 72 zcmZozz}&Eac>`Mm*98XtpZst5@AF^SEGTe*Uz3-Gg^^Q+#f#xZy%58HMs8*xSAv;| ZfgzeHj++U@VG?T4W6WUO{Ij3k0RZb%5y}7n diff --git a/htmlcov/class_index.html b/htmlcov/class_index.html index 8c65bd6..49b84d7 100644 --- a/htmlcov/class_index.html +++ b/htmlcov/class_index.html @@ -11,7 +11,7 @@

Coverage report: - 100% + 98%

@@ -83,18 +83,18 @@

src\masks.py (no class) - 12 + 11 0 0 - 100% + 100% src\processing.py (no class) - 12 + 6 + 1 0 - 0 - 100% + 83% src\widget.py @@ -109,10 +109,10 @@

Total   - 48 - 0 + 41 + 1 0 - 100% + 98% @@ -124,7 +124,7 @@

coverage.py v7.8.2, - created at 2025-06-01 23:14 +0300 + created at 2025-06-06 00:06 +0300