Rebuild FIAS import around streamed GAR zip and reset schema migrations.
Patient search is subject → locality → street → house; municipal containers are skipped, and KLADR/postal params load from the same archive without unpacking. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
8569b546dc
commit
144ebdcad6
|
|
@ -0,0 +1,52 @@
|
|||
---
|
||||
description: Поиск адреса пациента — Субъект РФ → населённый пункт → улица → дом
|
||||
alwaysApply: true
|
||||
---
|
||||
|
||||
# Адрес пациента: три шага
|
||||
|
||||
UI и API ищут жилой адрес так: **Субъект РФ → населённый пункт (необязательно) → улица → дом**. Не ломай эту цепочку и не возвращай шаг «Регион».
|
||||
|
||||
## Что считается шагом
|
||||
|
||||
| Шаг | Уровень FIAS | Где в коде |
|
||||
|---|---|---|
|
||||
| Субъект РФ | `Level.REGION` (1) | `GET /regions`, UI «Субъект РФ» |
|
||||
| Населённый пункт | `LOCALITY_LEVELS` 2, 5, 6 | `GET /localities?region_id=` |
|
||||
| Улица | `STREET_LEVELS`: `PLANNING` (7) **и** `STREET` (8) | `GET /streets` |
|
||||
| Дом | `House` | `GET /houses?parent_id=` выбранного объекта шага «улица» |
|
||||
|
||||
На шаге улицы ищутся **все** уровни 7 и 8 (СНТ, тер., мкр., кв-л, ул. и т.д.). Не фильтруй улицы по `STREET_EXTRA_TYPE_NAMES`.
|
||||
|
||||
`STREET_EXTRA_TYPE_NAMES` (`снт`, `тер. снт`) — только импорт: в ФИАС могут прийти не уровнем 7, в БД кладутся как `PLANNING`.
|
||||
|
||||
## Правила поиска
|
||||
|
||||
- Субъект обязателен. Улица доступна **без** НП (Москва/СПб: улица висит на субъекте типа `г.`).
|
||||
- `GET /localities` сортирует: сначала `г`/`г.`, потом `пгт`/`пгт.`, затем остальные (внутри группы — по имени; при нечётком поиске — ещё по релевантности).
|
||||
- Если выбран НП, `streets` берёт прямых детей **и** внуков: hop через `PLANNING` (улицы в СНТ) и через `SETTLEMENT`/`CITY` (улицы сёл в районе).
|
||||
- Иерархия не перескакивает уровни: `parent` — ближайший импортированный предок из PATH. Цепочка: улица → село → район → субъект, не «село → край».
|
||||
- В UI село в районе как улица в СНТ: `с. Лазо · р-н Лазовский` (`parent.level` 2/7). JSON результата содержит `chain`.
|
||||
- Муниципальную ветку (`м.р-н`, `с.п.`, `г.п.`, уровни 3–4) не импортировать и не показывать в `GET /localities`: улиц и домов на ней нет.
|
||||
- Если НП не выбран, улицы ищутся по `region_code` субъекта.
|
||||
- Выбрали улицу без НП — UI подставляет `street.parent` как НП, **кроме** родителя уровня 1.
|
||||
- Дом только у выбранной улицы/планировки. Импорт домов — регион 25; родитель только `STREET` (8) или `PLANNING` (7). Дом на субъекте, районе, городе или НП не импортируется и удаляется `delete_houses` (`SKIP_HOUSE_PARENT_LEVELS`).
|
||||
- Улица может висеть на субъекте-городе (`г.` Москва/СПб) — это ближайший предок в PATH.
|
||||
|
||||
## Чего не делать
|
||||
|
||||
- Не требовать НП, чтобы искать улицу.
|
||||
- Не искать улицу только по `parent_id` без hop через PLANNING/село — пропадут улицы в СНТ и в районе.
|
||||
- Не сужать `GET /streets` allowlist-ом типов: состав планировок задаёт `IMPORT_TYPES[PLANNING]`.
|
||||
- Не добавлять в allowlist субъекта уникальные TYPENAME вроде `Чувашия` только в UI: тип должен быть в `IMPORT_TYPES[REGION]`.
|
||||
- Не обещать, что **любой** адрес находится строго за 3 клика: часть улиц без `parent` (~1%), часть планировок висит на субъекте не-`г.`, часть домов висит на улице без родителя.
|
||||
|
||||
## Пример
|
||||
|
||||
```python
|
||||
# ✅ улица / планировка внутри СНТ находится по НП-дедушке
|
||||
Q(parent_id=locality_id) | Q(parent__parent_id=locality_id, parent__level=7)
|
||||
|
||||
# ❌ только прямой parent — «ул. Лесная» внутри «тер. СНТ Ромашка» не найдётся
|
||||
Q(parent_id=locality_id)
|
||||
```
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
---
|
||||
description: После импорта проверить, что любой адрес выбирается по цепочке шагов
|
||||
alwaysApply: true
|
||||
---
|
||||
|
||||
# После импорта: можно ли выбрать адрес
|
||||
|
||||
После `import_gar` / `import_addresses` / `import_houses` / `import_hierarchy` сразу проверь живую БД. Не считай импорт успешным по логу «завершён».
|
||||
|
||||
Цепочка выбора: **Субъект РФ → НП (2, 5–6) → улица/планировка (7–8) → дом**.
|
||||
|
||||
## Что посчитать
|
||||
|
||||
1. Субъекты (level 1): все `is_active`, у улиц/НП нет `region_code` без субъекта.
|
||||
2. НП (2, 5, 6): все выбираются через `GET /localities`. Уровней 3–4 (`м.р-н`, `с.п.`, `г.п.`) в БД быть не должно.
|
||||
3. Улицы (7 и 8): все с субъектом находятся через субъект → улица (`region_code`).
|
||||
4. Дома: родитель только level 7 или 8. `parent` NULL или level 1–6 — ошибка импорта.
|
||||
5. Иерархия не прыгает: село/улица не висит сразу на крае, если в PATH был район. Пример: `с. Лазо` → `р-н Лазовский` → `край Приморский`. У района есть дети.
|
||||
6. По НП улица находится: `parent_id=НП` **или** hop через PLANNING / село (как в `include_planning_children`).
|
||||
|
||||
## Контрольные примеры (регион 25)
|
||||
|
||||
- `с. Лазо` + родитель `р-н Лазовский` (`8f4ec2ee-96f0-4498-a4a2-fa53b311001b`).
|
||||
- Улица внутри СНТ находится по городу-дедушке.
|
||||
- Дом после выбора улицы/СНТ, не после города или района.
|
||||
|
||||
## Как отчитаться
|
||||
|
||||
Напиши числа: сколько выбирается на каждом шаге, сколько нет и **почему** (нет `parent`, прыжок через район, дом на НП). Примеры объектов с `fias_id`. Не обещай 100% трёх кликов: пустые НП без улиц (контейнер-район или деревня без ул.) — норма, если улица находится без НП или через другое село.
|
||||
|
|
@ -2,5 +2,8 @@ DJANGO_DEBUG=false
|
|||
DJANGO_SECRET_KEY=change-me
|
||||
DJANGO_ALLOWED_HOSTS=localhost,127.0.0.1
|
||||
URL_PREFIX=api-address
|
||||
GRPC_HOST=[::]
|
||||
GRPC_PORT=50051
|
||||
GRPC_WORKERS=10
|
||||
# Leave DATABASE_URL empty to use SQLite.
|
||||
# DATABASE_URL=postgresql://address:address@localhost:5432/address
|
||||
|
|
|
|||
|
|
@ -26,9 +26,9 @@ RUN uv sync --no-dev && python manage.py collectstatic --noinput
|
|||
RUN addgroup --system django \
|
||||
&& adduser --system --ingroup django django \
|
||||
&& chown -R django:django /app \
|
||||
&& chmod +x /etc/services.d/caddy/run /etc/services.d/gunicorn/run
|
||||
&& chmod +x /etc/services.d/caddy/run /etc/services.d/gunicorn/run /etc/services.d/grpc/run
|
||||
|
||||
EXPOSE 8000
|
||||
EXPOSE 8000 50051
|
||||
|
||||
HEALTHCHECK --interval=30s --timeout=3s --start-period=10s --retries=3 \
|
||||
CMD python -c "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8000/' + '${URL_PREFIX:-api-address}' + '/health', timeout=2)"
|
||||
|
|
|
|||
19
README.md
19
README.md
|
|
@ -12,6 +12,8 @@ uv sync
|
|||
uv run python manage.py migrate
|
||||
uv run python manage.py createsuperuser
|
||||
uv run python manage.py runserver
|
||||
# gRPC-сервер поиска (порт 50051):
|
||||
uv run python manage.py rungrpc
|
||||
```
|
||||
|
||||
Те же операции доступны через Task: `task init`,
|
||||
|
|
@ -24,7 +26,7 @@ uv run python manage.py runserver
|
|||
docker build -t address-service .
|
||||
docker run --rm -v address-data:/data -e DATABASE_URL=sqlite:////data/db.sqlite3 \
|
||||
address-service python manage.py migrate
|
||||
docker run --rm -p 8000:8000 -v address-data:/data \
|
||||
docker run --rm -p 8000:8000 -p 50051:50051 -v address-data:/data \
|
||||
-e DATABASE_URL=sqlite:////data/db.sqlite3 address-service
|
||||
```
|
||||
|
||||
|
|
@ -33,7 +35,8 @@ docker run --rm -p 8000:8000 -v address-data:/data \
|
|||
`DJANGO_ALLOWED_HOSTS` и `DJANGO_DEBUG=false`. В контейнере Caddy принимает
|
||||
запросы на порту 8000, раздаёт Django static-файлы и проксирует API и Admin во
|
||||
внутренний Gunicorn. Количество Gunicorn workers задаётся через
|
||||
`GUNICORN_WORKERS`. Жизненным циклом Caddy и Gunicorn управляет s6-overlay:
|
||||
`GUNICORN_WORKERS`. gRPC слушает порт `50051` (`GRPC_HOST`, `GRPC_PORT`,
|
||||
`GRPC_WORKERS`). Жизненным циклом Caddy, Gunicorn и gRPC управляет s6-overlay:
|
||||
процессы запускаются независимо, автоматически перезапускаются при сбое и
|
||||
корректно завершаются при остановке контейнера.
|
||||
|
||||
|
|
@ -52,6 +55,18 @@ docker run --rm -p 8000:8000 -v address-data:/data \
|
|||
- `GET /api-address/search?kind=city&query=влад`
|
||||
- `GET /api-address/health`
|
||||
|
||||
### gRPC
|
||||
|
||||
Сервис `address.v1.AddressService` повторяет HTTP-поиск. Контракт —
|
||||
`address/grpc/address.proto`. Запуск: `uv run python manage.py rungrpc`
|
||||
или `task grpc`. По умолчанию сервер слушает `[::]:50051`. После изменения
|
||||
`.proto` пересоберите стабы: `task proto`.
|
||||
|
||||
- `SearchRegions` / `SearchCities` / `SearchLocalities` / `SearchStreets`
|
||||
- `SearchHouses`
|
||||
- `Search` — универсальный поиск, требует `region_code`
|
||||
- `Health`
|
||||
|
||||
Общие параметры поиска: `query`, `region_code`, `parent_id`, `limit` (не более
|
||||
100), `offset`, `fuzzy`. По умолчанию включён поиск с опечатками; для строгого
|
||||
поиска передайте `fuzzy=false`. Для первоначальной загрузки предполагается импорт официальных
|
||||
|
|
|
|||
|
|
@ -0,0 +1,132 @@
|
|||
# Структура импорта ГАР / ФИАС
|
||||
|
||||
Источник — официальный ZIP (`gar_xml.zip`). Архив **не распаковывается**: XML читается потоком из членов ZIP (`zipfile` + `ElementTree.iterparse`).
|
||||
|
||||
Код субъекта — двухзначный каталог внутри архива (`25/`, `77/`). Его же принимает `--region-code`.
|
||||
|
||||
## Команды
|
||||
|
||||
```
|
||||
import_gar
|
||||
├─ import_addresses объекты AS_ADDR_OBJ
|
||||
├─ import_houses дома AS_HOUSES (опционально)
|
||||
└─ import_hierarchy parent из ADM, затем MUN
|
||||
```
|
||||
|
||||
Дополнительно, не входят в `import_gar`:
|
||||
|
||||
| Команда | Источник | Что заполняет |
|
||||
|---|---|---|
|
||||
| `import_kladr` | `AS_ADDR_OBJ_PARAMS` (`TYPEID=10`) | `AddressObject.kladr_id` |
|
||||
| `import_postal_codes` | `AS_HOUSES_PARAMS` (`TYPEID=5`) | `House.postal_code` |
|
||||
| `delete_houses` | БД | дома с родителем уровня 1–6 |
|
||||
|
||||
```bash
|
||||
# субъект + дома
|
||||
uv run python manage.py import_gar /path/to/gar_xml.zip --region-code 25
|
||||
|
||||
# субъект без домов
|
||||
uv run python manage.py import_gar /path/to/gar_xml.zip --region-code 77 --houses-region-code 25
|
||||
|
||||
# только адреса и иерархия
|
||||
uv run python manage.py import_addresses /path/to/gar_xml.zip --region-code 77
|
||||
uv run python manage.py import_hierarchy /path/to/gar_xml.zip --region-code 77
|
||||
```
|
||||
|
||||
`--houses-region-code` — субъекты, для которых грузить дома. Если не задан, дома импортируются для тех же `--region-code`. Если задан и субъекта в списке нет — шаг домов пропускается.
|
||||
|
||||
## Файлы в архиве
|
||||
|
||||
На каждый субъект `NN`:
|
||||
|
||||
| Файл | Команда | Запись XML |
|
||||
|---|---|---|
|
||||
| `NN/AS_ADDR_OBJ_YYYYMMDD_*.XML` | `import_addresses` | `OBJECT` |
|
||||
| `NN/AS_HOUSES_YYYYMMDD_*.XML` | `import_houses` | `HOUSE` |
|
||||
| `NN/AS_ADM_HIERARCHY_YYYYMMDD_*.XML` | `import_hierarchy` | `ITEM` |
|
||||
| `NN/AS_MUN_HIERARCHY_YYYYMMDD_*.XML` | `import_hierarchy` (добор) | `ITEM` |
|
||||
|
||||
Разбор имён — `address/fias_archive.py`. Берётся актуальная выгрузка (`ISACTUAL=1` и `ISACTIVE=1`). Неактивные объекты и дома не пишутся.
|
||||
|
||||
## Адресные объекты
|
||||
|
||||
Таблица `AddressObject`. Повторный импорт обновляет запись по `fias_id` (`OBJECTGUID`).
|
||||
|
||||
### Уровни ФИАС → модель
|
||||
|
||||
| Level | Имя | Шаг поиска |
|
||||
|---|---|---|
|
||||
| 1 | Субъект РФ | обязательный |
|
||||
| 2 | Район | населённый пункт |
|
||||
| 3 | Муниципальный район | не импортируется |
|
||||
| 4 | Поселение (`с.п.`, `г.п.`) | не импортируется |
|
||||
| 6 | Населённый пункт | населённый пункт |
|
||||
| 7 | Планировочная структура | улица / СНТ |
|
||||
| 8 | Улица | улица / СНТ |
|
||||
|
||||
Типы `снт` и `тер. снт` в XML часто приходят уровнем 8. При импорте они **перекладываются в PLANNING (7)**. В поиске улиц отдаются вместе с уровнем 8.
|
||||
|
||||
### Allowlist типов (`IMPORT_TYPES`)
|
||||
|
||||
Импортируется только `TYPENAME` из списка уровня. Нормализация: lower, `ё→е`, без точки на конце.
|
||||
|
||||
- **1** субъект: `край`, `обл.`, `респ.`, `а.обл.`, `а.окр.`, `г.`, `г.ф.з.`, `пос.`, `АО`, `Чувашия`
|
||||
- **2** район: `р-н`, `у.`, `г.`
|
||||
- **3–4** муниципальная ветка (`м.р-н`, `с.п.`, `г.п.`) — не импортируется: улиц и домов на ней нет
|
||||
- **5** город: `г.`, `пгт.`, `рп.`, `с.`, `п.`
|
||||
- **6** НП: сёла, деревни, хутора, пгт и т.п. (`с.`, `д.`, `х.`, `пгт.`, …)
|
||||
- **7** планировка: `тер.`, `снт`, `тер. снт`, `мкр.`, `кв-л`, ДНТ/ТСН и др.
|
||||
- **8** улица: `ул.`, `пер.`, `пр-кт`, `ш.`, `б-р`, `наб.`, …
|
||||
|
||||
Тип не из списка — объект пропускается. Уникальные TYPENAME субъекта (например `Чувашия`) добавляются в `IMPORT_TYPES[REGION]`, не только в UI.
|
||||
|
||||
После этого шага у объектов **нет `parent`**.
|
||||
|
||||
## Дома
|
||||
|
||||
Таблица `House`. Ключ — `OBJECTID`. `parent` на этом шаге пустой.
|
||||
|
||||
Берутся только типы:
|
||||
|
||||
`владение`, `дом`, `домовладение`, `литера`, `корпус`
|
||||
|
||||
Гаражи, строения, сооружения, котельные и ОНС не импортируются.
|
||||
|
||||
Дом живёт только на улице или планировке (уровни 7–8). Родитель 1–6 — ошибка: такой дом удаляется на иерархии или командой `delete_houses`.
|
||||
|
||||
## Иерархия
|
||||
|
||||
Два прохода по PATH (`OBJECTID` предков через точку):
|
||||
|
||||
1. **ADM** (`AS_ADM_HIERARCHY`) — основной. Пишет `parent` всем объектам субъекта.
|
||||
2. **MUN** (`AS_MUN_HIERARCHY`) — только тем, у кого после ADM `parent` ещё пуст.
|
||||
|
||||
### Адресный объект
|
||||
|
||||
`parent` = **ближайший уже импортированный** предок из PATH (от конца к началу). Пропуски allowlist не ломают цепочку: село висит на районе, даже если между ними в ФИАС был неимпортированный уровень.
|
||||
|
||||
Если в PATH нет ни одного импортированного предка — `parent` остаётся пустым (~1% улиц).
|
||||
|
||||
### Дом
|
||||
|
||||
Ближайший предок уровня **7 или 8**. Если ближайший импортированный предок — субъект, район, город или НП (1–6), дом **удаляется**. Если первого предка в PATH нет в БД — дом тоже удаляется (улица не прошла allowlist).
|
||||
|
||||
## Что получается в БД
|
||||
|
||||
```
|
||||
Субъект РФ (1)
|
||||
├─ район / город / село (2, 5, 6) ← шаг «населённый пункт»
|
||||
│ ├─ СНТ / тер. / мкр (7)
|
||||
│ │ └─ улица (8)
|
||||
│ └─ улица (8)
|
||||
└─ улица (8) ← Москва / СПб: улица на субъекте-городе
|
||||
└─ дом
|
||||
```
|
||||
|
||||
Поиск после импорта: **субъект → НП (необязательно) → улица/СНТ → дом**.
|
||||
|
||||
- Улица ищется без НП по `region_code` субъекта.
|
||||
- С выбранным НП: прямой ребёнок **или** hop через PLANNING / село (улица внутри СНТ).
|
||||
- Дома только у выбранной улицы или СНТ.
|
||||
|
||||
Проверка после импорта — `.cursor/rules/post-import-address-check.mdc`.
|
||||
59
Taskfile.yml
59
Taskfile.yml
|
|
@ -29,6 +29,27 @@ tasks:
|
|||
cmds:
|
||||
- "{{.PYTHON}} manage.py runserver"
|
||||
|
||||
grpc:
|
||||
desc: Запустить gRPC-сервер
|
||||
cmds:
|
||||
- "{{.PYTHON}} manage.py rungrpc {{.CLI_ARGS}}"
|
||||
|
||||
proto:
|
||||
desc: Сгенерировать Python-стабы из address/grpc/address.proto
|
||||
cmds:
|
||||
- >
|
||||
{{.PYTHON}} -m grpc_tools.protoc
|
||||
--proto_path=address/grpc
|
||||
--python_out=address/grpc
|
||||
--grpc_python_out=address/grpc
|
||||
--pyi_out=address/grpc
|
||||
address/grpc/address.proto
|
||||
- >
|
||||
{{.PYTHON}} -c
|
||||
"from pathlib import Path; p=Path('address/grpc/address_pb2_grpc.py');
|
||||
t=p.read_text(); t=t.replace('import address_pb2 as address__pb2',
|
||||
'from address.grpc import address_pb2 as address__pb2'); p.write_text(t)"
|
||||
|
||||
vite:
|
||||
desc: Запустить Vite
|
||||
dir: client
|
||||
|
|
@ -50,16 +71,44 @@ tasks:
|
|||
cmds:
|
||||
- "{{.PYTHON}} manage.py createsuperuser --noinput"
|
||||
|
||||
import-fias:
|
||||
desc: Импортировать XML AS_ADDR_OBJ из ФИАС (FIAS_FILE=/path/to/25/file.xml)
|
||||
import-gar:
|
||||
desc: Импортировать адреса, дома и иерархию из ZIP ГАР без распаковки (FIAS_FILE=/path/to/gar_xml.zip)
|
||||
requires:
|
||||
vars: [FIAS_FILE]
|
||||
cmds:
|
||||
- '{{.PYTHON}} manage.py import_addresses "{{.FIAS_FILE}}"'
|
||||
- '{{.PYTHON}} manage.py import_gar "{{.FIAS_FILE}}" {{.CLI_ARGS}}'
|
||||
|
||||
import-fias:
|
||||
desc: Импортировать XML или ZIP AS_ADDR_OBJ из ФИАС (FIAS_FILE=/path/to/gar_xml.zip)
|
||||
requires:
|
||||
vars: [FIAS_FILE]
|
||||
cmds:
|
||||
- '{{.PYTHON}} manage.py import_addresses "{{.FIAS_FILE}}" {{.CLI_ARGS}}'
|
||||
|
||||
import-houses:
|
||||
desc: Импортировать XML AS_HOUSES из ФИАС (FIAS_FILE=/path/to/25/file.xml)
|
||||
desc: Импортировать XML или ZIP AS_HOUSES из ФИАС (FIAS_FILE=/path/to/gar_xml.zip)
|
||||
requires:
|
||||
vars: [FIAS_FILE]
|
||||
cmds:
|
||||
- '{{.PYTHON}} manage.py import_houses "{{.FIAS_FILE}}"'
|
||||
- '{{.PYTHON}} manage.py import_houses "{{.FIAS_FILE}}" {{.CLI_ARGS}}'
|
||||
|
||||
import-hierarchy:
|
||||
desc: Заполнить parent из XML или ZIP AS_ADM_HIERARCHY (FIAS_FILE=/path/to/gar_xml.zip)
|
||||
requires:
|
||||
vars: [FIAS_FILE]
|
||||
cmds:
|
||||
- '{{.PYTHON}} manage.py import_hierarchy "{{.FIAS_FILE}}" {{.CLI_ARGS}}'
|
||||
|
||||
import-postal-codes:
|
||||
desc: Заполнить почтовый индекс из XML или ZIP AS_HOUSES_PARAMS (FIAS_FILE=/path/to/gar_xml.zip)
|
||||
requires:
|
||||
vars: [FIAS_FILE]
|
||||
cmds:
|
||||
- '{{.PYTHON}} manage.py import_postal_codes "{{.FIAS_FILE}}" {{.CLI_ARGS}}'
|
||||
|
||||
import-kladr:
|
||||
desc: Заполнить код КЛАДР из XML или ZIP AS_ADDR_OBJ_PARAMS (FIAS_FILE=/path/to/gar_xml.zip)
|
||||
requires:
|
||||
vars: [FIAS_FILE]
|
||||
cmds:
|
||||
- '{{.PYTHON}} manage.py import_kladr "{{.FIAS_FILE}}" {{.CLI_ARGS}}'
|
||||
|
|
|
|||
|
|
@ -1,19 +1,101 @@
|
|||
from django.contrib import admin
|
||||
from django.db.models import Count
|
||||
from django.urls import reverse
|
||||
from django.utils.html import format_html
|
||||
|
||||
from .models import AddressObject, House
|
||||
|
||||
|
||||
from django.core.paginator import Paginator
|
||||
from django.db import connection
|
||||
from django.utils.functional import cached_property
|
||||
|
||||
class PostgresEstimatedPaginator(Paginator):
|
||||
@cached_property
|
||||
def count(self):
|
||||
with connection.cursor() as cursor:
|
||||
# Query the internal Postgres table statistics
|
||||
cursor.execute(
|
||||
"SELECT reltuples FROM pg_class WHERE relname = %s",
|
||||
[self.object_list.model._meta.db_table]
|
||||
)
|
||||
row = cursor.fetchone()
|
||||
return int(row[0]) if row else 0
|
||||
|
||||
|
||||
class ParentIdFilter(admin.SimpleListFilter):
|
||||
title = "родитель"
|
||||
parameter_name = "parent"
|
||||
|
||||
def lookups(self, request, model_admin):
|
||||
parent_id = request.GET.get(self.parameter_name)
|
||||
if not parent_id or not parent_id.isdigit():
|
||||
return []
|
||||
parent = AddressObject.objects.filter(pk=parent_id).first()
|
||||
if parent is None:
|
||||
return []
|
||||
return [(parent.pk, str(parent))]
|
||||
|
||||
def queryset(self, request, queryset):
|
||||
if self.value():
|
||||
return queryset.filter(parent_id=self.value())
|
||||
return queryset
|
||||
|
||||
|
||||
def children_filter_url(model_name: str, parent_id: int) -> str:
|
||||
return f"{reverse(f'admin:address_{model_name}_changelist')}?parent={parent_id}"
|
||||
|
||||
|
||||
@admin.register(AddressObject)
|
||||
class AddressObjectAdmin(admin.ModelAdmin):
|
||||
list_display = ("name", "type_name", "level", "region_code", "parent", "is_active")
|
||||
list_filter = ("level", "region_code", "is_active")
|
||||
search_fields = ("name", "fias_id", "object_id")
|
||||
list_display = (
|
||||
"name",
|
||||
"type_name",
|
||||
"level",
|
||||
"region_code",
|
||||
"parent",
|
||||
"children_link",
|
||||
"kladr_id",
|
||||
"is_active",
|
||||
)
|
||||
list_filter = ("level", "region_code", "is_active", ParentIdFilter)
|
||||
search_fields = ("name", "fias_id", "object_id", "kladr_id")
|
||||
raw_id_fields = ("parent",)
|
||||
readonly_fields = ("children_link",)
|
||||
show_full_result_count = False
|
||||
|
||||
def get_queryset(self, request):
|
||||
queryset = super().get_queryset(request)
|
||||
return queryset.annotate(
|
||||
children_count=Count("children", distinct=True),
|
||||
houses_count=Count("houses", distinct=True),
|
||||
)
|
||||
|
||||
@admin.display(description="Дочерние")
|
||||
def children_link(self, obj: AddressObject):
|
||||
if obj.pk is None:
|
||||
return "—"
|
||||
children_count = getattr(obj, "children_count", None)
|
||||
houses_count = getattr(obj, "houses_count", None)
|
||||
links = []
|
||||
if children_count != 0:
|
||||
label = "объекты" if children_count is None else f"объекты ({children_count})"
|
||||
links.append(
|
||||
format_html('<a href="{}">{}</a>', children_filter_url("addressobject", obj.pk), label)
|
||||
)
|
||||
if houses_count != 0:
|
||||
label = "дома" if houses_count is None else f"дома ({houses_count})"
|
||||
links.append(
|
||||
format_html('<a href="{}">{}</a>', children_filter_url("house", obj.pk), label)
|
||||
)
|
||||
if not links:
|
||||
return "—"
|
||||
return format_html(" · ".join(["{}"] * len(links)), *links)
|
||||
|
||||
|
||||
@admin.register(House)
|
||||
class HouseAdmin(admin.ModelAdmin):
|
||||
list_display = ("display_number", "region_code", "parent", "is_actual", "is_active")
|
||||
list_filter = ("region_code", "house_type", "is_actual", "is_active")
|
||||
list_display = ("display_number", "region_code", "parent", "postal_code")
|
||||
list_filter = ("region_code", "house_type", ParentIdFilter)
|
||||
search_fields = ("house_number", "additional_number_1", "fias_id", "object_id")
|
||||
raw_id_fields = ("parent",)
|
||||
|
|
|
|||
364
address/api.py
364
address/api.py
|
|
@ -1,18 +1,24 @@
|
|||
import heapq
|
||||
from dataclasses import dataclass
|
||||
from difflib import SequenceMatcher
|
||||
from typing import Literal
|
||||
from uuid import UUID
|
||||
|
||||
from django.db.models import Q
|
||||
from ninja import NinjaAPI, Query, Schema
|
||||
from django.contrib.postgres.search import TrigramSimilarity, TrigramWordSimilarity
|
||||
from django.db import connection
|
||||
from django.db.models import Case, IntegerField, Q, Value, When
|
||||
from django.db.models.functions import Concat, Greatest, Lower, Replace
|
||||
from ninja import NinjaAPI, Query, Router, Schema
|
||||
from ninja.errors import HttpError
|
||||
|
||||
from .models import AddressObject, House
|
||||
from .dadata import suggest_houses, suggest_streets
|
||||
from .models import AddressObject, House, format_region_code
|
||||
|
||||
api = NinjaAPI(title="FIAS Address API", version="1.0.0", docs_url="docs/")
|
||||
|
||||
|
||||
class AddressOut(Schema):
|
||||
id: int
|
||||
fias_id: UUID
|
||||
object_id: int | None
|
||||
parent_id: int | None
|
||||
|
|
@ -20,7 +26,12 @@ class AddressOut(Schema):
|
|||
type_name: str
|
||||
level: int
|
||||
region_code: str
|
||||
postal_code: str
|
||||
kladr_id: str
|
||||
parent: "AddressOut | None" = None
|
||||
|
||||
@staticmethod
|
||||
def resolve_region_code(obj: AddressObject) -> str:
|
||||
return format_region_code(obj.region_code)
|
||||
|
||||
|
||||
class SearchParams(Schema):
|
||||
|
|
@ -32,11 +43,52 @@ class SearchParams(Schema):
|
|||
fuzzy: bool = True
|
||||
|
||||
|
||||
class LocalitySearchParams(SearchParams):
|
||||
region_id: int
|
||||
|
||||
|
||||
LOCALITY_LEVELS = (
|
||||
AddressObject.Level.DISTRICT,
|
||||
AddressObject.Level.CITY,
|
||||
AddressObject.Level.SETTLEMENT,
|
||||
)
|
||||
STREET_LEVELS = (
|
||||
AddressObject.Level.PLANNING,
|
||||
AddressObject.Level.STREET,
|
||||
)
|
||||
CITY_TYPE_NAMES = frozenset({"г", "г."})
|
||||
PGT_TYPE_NAMES = frozenset({"пгт", "пгт."})
|
||||
|
||||
|
||||
class SearchResponse(Schema):
|
||||
count: int
|
||||
items: list[AddressOut]
|
||||
|
||||
|
||||
PARENT_CHAIN = (
|
||||
"parent",
|
||||
"parent__parent",
|
||||
"parent__parent__parent",
|
||||
"parent__parent__parent__parent",
|
||||
)
|
||||
|
||||
|
||||
class StreetSearchResponse(Schema):
|
||||
count: int
|
||||
items: list[AddressOut]
|
||||
|
||||
|
||||
class LocalitySearchResponse(Schema):
|
||||
count: int
|
||||
items: list[AddressOut]
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class SearchResult:
|
||||
count: int
|
||||
items: list
|
||||
|
||||
|
||||
class HouseOut(Schema):
|
||||
fias_id: UUID
|
||||
object_id: int
|
||||
|
|
@ -48,18 +100,125 @@ class HouseOut(Schema):
|
|||
additional_type_1: int | None
|
||||
additional_number_2: str
|
||||
additional_type_2: int | None
|
||||
postal_code: str
|
||||
display_number: str
|
||||
|
||||
@staticmethod
|
||||
def resolve_region_code(obj: House) -> str:
|
||||
return format_region_code(obj.region_code)
|
||||
|
||||
@staticmethod
|
||||
def resolve_house_number(obj: House) -> str:
|
||||
return obj.house_number or ""
|
||||
|
||||
@staticmethod
|
||||
def resolve_additional_number_1(obj: House) -> str:
|
||||
return obj.additional_number_1 or ""
|
||||
|
||||
@staticmethod
|
||||
def resolve_additional_number_2(obj: House) -> str:
|
||||
return obj.additional_number_2 or ""
|
||||
|
||||
@staticmethod
|
||||
def resolve_postal_code(obj: House) -> str:
|
||||
return f"{obj.postal_code:06d}" if obj.postal_code else ""
|
||||
|
||||
|
||||
class HouseSearchResponse(Schema):
|
||||
count: int
|
||||
items: list[HouseOut]
|
||||
|
||||
|
||||
class DaDataStreetParams(Schema):
|
||||
query: str = ""
|
||||
region_code: str
|
||||
city: str
|
||||
limit: int = 20
|
||||
|
||||
|
||||
class DaDataHouseParams(DaDataStreetParams):
|
||||
street: str
|
||||
|
||||
|
||||
class DaDataStreetOut(Schema):
|
||||
value: str
|
||||
fias_id: str
|
||||
kladr_id: str
|
||||
street: str
|
||||
street_type: str
|
||||
street_with_type: str
|
||||
city: str
|
||||
region_code: str
|
||||
|
||||
|
||||
class DaDataHouseOut(Schema):
|
||||
value: str
|
||||
fias_id: str
|
||||
house: str
|
||||
house_type: str
|
||||
block: str
|
||||
postal_code: str
|
||||
street: str
|
||||
city: str
|
||||
region_code: str
|
||||
|
||||
|
||||
class DaDataStreetResponse(Schema):
|
||||
count: int
|
||||
items: list[DaDataStreetOut]
|
||||
|
||||
|
||||
class DaDataHouseResponse(Schema):
|
||||
count: int
|
||||
items: list[DaDataHouseOut]
|
||||
|
||||
|
||||
def normalize(value: str) -> str:
|
||||
return " ".join(value.casefold().replace("ё", "е").split())
|
||||
|
||||
|
||||
def folded(field: str):
|
||||
return Replace(Lower(field), Value("ё"), Value("е"))
|
||||
|
||||
|
||||
def folded_full_name():
|
||||
return Replace(Lower(Concat("type_name", Value(" "), "name")), Value("ё"), Value("е"))
|
||||
|
||||
|
||||
def with_folded_names(queryset):
|
||||
return queryset.alias(
|
||||
folded_name=folded("name"),
|
||||
folded_type=folded("type_name"),
|
||||
folded_full=folded_full_name(),
|
||||
)
|
||||
|
||||
|
||||
def locality_type_rank_value(type_name: str) -> int:
|
||||
key = normalize(type_name).rstrip(".")
|
||||
if key == "г":
|
||||
return 0
|
||||
if key == "пгт":
|
||||
return 1
|
||||
return 2
|
||||
|
||||
|
||||
def with_locality_type_rank(queryset):
|
||||
type_rank = Case(
|
||||
*[When(type_name__iexact=name, then=Value(0)) for name in CITY_TYPE_NAMES],
|
||||
*[When(type_name__iexact=name, then=Value(1)) for name in PGT_TYPE_NAMES],
|
||||
default=Value(2),
|
||||
output_field=IntegerField(),
|
||||
)
|
||||
return queryset.annotate(locality_rank=type_rank)
|
||||
|
||||
|
||||
def filter_by_terms(queryset, query: str):
|
||||
queryset = with_folded_names(queryset)
|
||||
for term in normalize(query).split():
|
||||
queryset = queryset.filter(Q(folded_name__contains=term) | Q(folded_type__contains=term))
|
||||
return queryset
|
||||
|
||||
|
||||
def similarity(query: str, name: str, type_name: str) -> float:
|
||||
normalized_name = normalize(name)
|
||||
normalized_full_name = normalize(f"{type_name} {name}")
|
||||
|
|
@ -71,43 +230,133 @@ def similarity(query: str, name: str, type_name: str) -> float:
|
|||
)
|
||||
|
||||
|
||||
def fuzzy_search(queryset, query: str, limit: int, offset: int) -> SearchResponse:
|
||||
def python_fuzzy_search(
|
||||
queryset, query: str, limit: int, offset: int, prefer_city_types: bool = False
|
||||
) -> SearchResult:
|
||||
normalized_query = normalize(query)
|
||||
wanted = offset + limit
|
||||
matches = 0
|
||||
candidates = []
|
||||
for item in queryset.only("id", "name", "type_name").iterator(chunk_size=2000):
|
||||
for item in (
|
||||
queryset.select_related(None).only("id", "name", "type_name").iterator(chunk_size=2000)
|
||||
):
|
||||
score = similarity(normalized_query, item.name, item.type_name)
|
||||
if score < 0.55:
|
||||
continue
|
||||
matches += 1
|
||||
candidate = (score, -item.id, item.id)
|
||||
type_rank = locality_type_rank_value(item.type_name) if prefer_city_types else 0
|
||||
candidate = (-type_rank, score, -item.id, item.id)
|
||||
if len(candidates) < wanted:
|
||||
heapq.heappush(candidates, candidate)
|
||||
elif candidate > candidates[0]:
|
||||
heapq.heapreplace(candidates, candidate)
|
||||
|
||||
ranked_ids = [item_id for _, _, item_id in sorted(candidates, reverse=True)][offset:wanted]
|
||||
by_id = AddressObject.objects.in_bulk(ranked_ids)
|
||||
return SearchResponse(count=matches, items=[by_id[item_id] for item_id in ranked_ids])
|
||||
ranked_ids = [item_id for _, _, _, item_id in sorted(candidates, reverse=True)][
|
||||
offset:wanted
|
||||
]
|
||||
lookup = AddressObject.objects.all()
|
||||
related = queryset.query.select_related
|
||||
if related:
|
||||
lookup = lookup.select_related(*related)
|
||||
by_id = lookup.in_bulk(ranked_ids)
|
||||
return SearchResult(count=matches, items=[by_id[item_id] for item_id in ranked_ids])
|
||||
|
||||
|
||||
def search(levels: tuple[int, ...], params: SearchParams) -> SearchResponse:
|
||||
def trigram_search(
|
||||
queryset, query: str, limit: int, offset: int, prefer_city_types: bool = False
|
||||
) -> SearchResult:
|
||||
normalized_query = normalize(query)
|
||||
name = folded("name")
|
||||
full_name = folded_full_name()
|
||||
contains = Q()
|
||||
for term in normalized_query.split():
|
||||
contains &= Q(folded_name__contains=term) | Q(folded_type__contains=term)
|
||||
queryset = (
|
||||
with_folded_names(queryset)
|
||||
.annotate(
|
||||
score=Greatest(
|
||||
TrigramSimilarity(name, normalized_query),
|
||||
TrigramSimilarity(full_name, normalized_query),
|
||||
TrigramWordSimilarity(normalized_query, name),
|
||||
TrigramWordSimilarity(normalized_query, full_name),
|
||||
),
|
||||
prefix_rank=Case(
|
||||
When(folded_name__startswith=normalized_query, then=Value(2)),
|
||||
When(folded_name__contains=normalized_query, then=Value(1)),
|
||||
default=Value(0),
|
||||
),
|
||||
)
|
||||
.filter(
|
||||
contains
|
||||
| Q(folded_name__trigram_similar=normalized_query)
|
||||
| Q(folded_full__trigram_similar=normalized_query)
|
||||
| Q(folded_name__trigram_word_similar=normalized_query)
|
||||
)
|
||||
.order_by("-prefix_rank", "-score", "name")
|
||||
)
|
||||
if prefer_city_types:
|
||||
queryset = with_locality_type_rank(queryset).order_by(
|
||||
"locality_rank", "-prefix_rank", "-score", "name"
|
||||
)
|
||||
count = queryset.count()
|
||||
return SearchResult(count=count, items=list(queryset[offset : offset + limit]))
|
||||
|
||||
|
||||
def fuzzy_search(
|
||||
queryset, query: str, limit: int, offset: int, prefer_city_types: bool = False
|
||||
) -> SearchResult:
|
||||
if connection.vendor == "postgresql":
|
||||
return trigram_search(
|
||||
queryset, query, limit, offset, prefer_city_types=prefer_city_types
|
||||
)
|
||||
return python_fuzzy_search(
|
||||
queryset, query, limit, offset, prefer_city_types=prefer_city_types
|
||||
)
|
||||
|
||||
|
||||
def search(
|
||||
levels: tuple[int, ...],
|
||||
params: SearchParams,
|
||||
select_related: tuple[str, ...] = (),
|
||||
include_planning_children: bool = False,
|
||||
prefer_city_types: bool = False,
|
||||
) -> SearchResult:
|
||||
limit = min(max(params.limit, 1), 100)
|
||||
offset = max(params.offset, 0)
|
||||
queryset = AddressObject.objects.filter(level__in=levels, is_active=True)
|
||||
if params.query.strip() and not params.fuzzy:
|
||||
terms = params.query.split()
|
||||
for term in terms:
|
||||
queryset = queryset.filter(Q(name__icontains=term) | Q(type_name__icontains=term))
|
||||
queryset = AddressObject.objects.filter(is_active=True, level__in=levels)
|
||||
if select_related:
|
||||
queryset = queryset.select_related(*select_related)
|
||||
if params.region_code:
|
||||
queryset = queryset.filter(region_code=params.region_code.zfill(2))
|
||||
queryset = queryset.filter(region_code=int(params.region_code))
|
||||
if params.parent_id:
|
||||
queryset = queryset.filter(parent_id=params.parent_id)
|
||||
parent_filter = Q(parent_id=params.parent_id)
|
||||
if include_planning_children:
|
||||
parent_filter |= Q(
|
||||
parent__parent_id=params.parent_id,
|
||||
parent__level=AddressObject.Level.PLANNING,
|
||||
)
|
||||
parent_filter |= Q(
|
||||
parent__parent_id=params.parent_id,
|
||||
parent__level__in=(
|
||||
AddressObject.Level.SETTLEMENT,
|
||||
AddressObject.Level.CITY,
|
||||
),
|
||||
)
|
||||
parent_filter |= Q(
|
||||
parent__parent__parent_id=params.parent_id,
|
||||
parent__level=AddressObject.Level.PLANNING,
|
||||
)
|
||||
queryset = queryset.filter(parent_filter)
|
||||
if params.query.strip() and params.fuzzy:
|
||||
return fuzzy_search(queryset, params.query, limit, offset)
|
||||
return fuzzy_search(
|
||||
queryset, params.query, limit, offset, prefer_city_types=prefer_city_types
|
||||
)
|
||||
if params.query.strip():
|
||||
queryset = filter_by_terms(queryset, params.query)
|
||||
if prefer_city_types:
|
||||
queryset = with_locality_type_rank(queryset).order_by("locality_rank", "name")
|
||||
count = queryset.count()
|
||||
return SearchResponse(count=count, items=list(queryset[offset : offset + limit]))
|
||||
return SearchResult(count=count, items=list(queryset[offset : offset + limit]))
|
||||
|
||||
|
||||
@api.get("health", tags=["service"])
|
||||
|
|
@ -125,18 +374,34 @@ def cities(request, params: Query[SearchParams]):
|
|||
return search((AddressObject.Level.CITY, AddressObject.Level.SETTLEMENT), params)
|
||||
|
||||
|
||||
@api.get("streets", response=SearchResponse, tags=["addresses"])
|
||||
@api.get("localities", response=LocalitySearchResponse, tags=["addresses"])
|
||||
def localities(request, params: Query[LocalitySearchParams]):
|
||||
params.region_code = str(params.region_id).zfill(2)
|
||||
return search(
|
||||
LOCALITY_LEVELS,
|
||||
params,
|
||||
select_related=PARENT_CHAIN,
|
||||
prefer_city_types=True,
|
||||
)
|
||||
|
||||
|
||||
@api.get("streets", response=StreetSearchResponse, tags=["addresses"])
|
||||
def streets(request, params: Query[SearchParams]):
|
||||
return search((AddressObject.Level.STREET,), params)
|
||||
result = search(
|
||||
STREET_LEVELS,
|
||||
params,
|
||||
select_related=PARENT_CHAIN,
|
||||
include_planning_children=True,
|
||||
)
|
||||
return result
|
||||
|
||||
|
||||
@api.get("houses", response=HouseSearchResponse, tags=["addresses"])
|
||||
def houses(request, params: Query[SearchParams]):
|
||||
def search_houses(params: SearchParams) -> HouseSearchResponse:
|
||||
limit = min(max(params.limit, 1), 100)
|
||||
offset = max(params.offset, 0)
|
||||
queryset = House.objects.filter(is_actual=True, is_active=True)
|
||||
queryset = House.objects.all()
|
||||
if params.region_code:
|
||||
queryset = queryset.filter(region_code=params.region_code.zfill(2))
|
||||
queryset = queryset.filter(region_code=int(params.region_code))
|
||||
if params.parent_id:
|
||||
queryset = queryset.filter(parent_id=params.parent_id)
|
||||
for term in params.query.split():
|
||||
|
|
@ -150,6 +415,11 @@ def houses(request, params: Query[SearchParams]):
|
|||
)
|
||||
|
||||
|
||||
@api.get("houses", response=HouseSearchResponse, tags=["addresses"])
|
||||
def houses(request, params: Query[SearchParams]):
|
||||
return search_houses(params)
|
||||
|
||||
|
||||
@api.get("search", response=SearchResponse, tags=["addresses"])
|
||||
def universal_search(
|
||||
request,
|
||||
|
|
@ -161,7 +431,45 @@ def universal_search(
|
|||
levels = {
|
||||
"region": (AddressObject.Level.REGION,),
|
||||
"city": (AddressObject.Level.CITY, AddressObject.Level.SETTLEMENT),
|
||||
"street": (AddressObject.Level.STREET,),
|
||||
"street": STREET_LEVELS,
|
||||
None: tuple(level.value for level in AddressObject.Level),
|
||||
}
|
||||
return search(levels[kind], params)
|
||||
return search(
|
||||
levels[kind],
|
||||
params,
|
||||
select_related=PARENT_CHAIN,
|
||||
include_planning_children=kind == "street",
|
||||
)
|
||||
|
||||
|
||||
dadata_router = Router(tags=["dadata"])
|
||||
|
||||
|
||||
def dadata_limit(limit: int) -> int:
|
||||
return min(max(limit, 1), 20)
|
||||
|
||||
|
||||
@dadata_router.get("/streets", response=DaDataStreetResponse)
|
||||
def dadata_streets(request, params: Query[DaDataStreetParams]):
|
||||
items = suggest_streets(
|
||||
region_code=params.region_code,
|
||||
city=params.city,
|
||||
query=params.query,
|
||||
limit=dadata_limit(params.limit),
|
||||
)
|
||||
return DaDataStreetResponse(count=len(items), items=items)
|
||||
|
||||
|
||||
@dadata_router.get("/houses", response=DaDataHouseResponse)
|
||||
def dadata_houses(request, params: Query[DaDataHouseParams]):
|
||||
items = suggest_houses(
|
||||
region_code=params.region_code,
|
||||
city=params.city,
|
||||
street=params.street,
|
||||
query=params.query,
|
||||
limit=dadata_limit(params.limit),
|
||||
)
|
||||
return DaDataHouseResponse(count=len(items), items=items)
|
||||
|
||||
|
||||
api.add_router("dadata", dadata_router)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,66 @@
|
|||
from dataclasses import dataclass
|
||||
|
||||
from constance import config
|
||||
from ninja.errors import HttpError
|
||||
|
||||
|
||||
class DaDataDisabledError(HttpError):
|
||||
def __init__(self, message: str = "Интеграция с DaData отключена"):
|
||||
super().__init__(503, message)
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class DaDataStreet:
|
||||
value: str
|
||||
fias_id: str
|
||||
kladr_id: str
|
||||
street: str
|
||||
street_type: str
|
||||
street_with_type: str
|
||||
city: str
|
||||
region_code: str
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class DaDataHouse:
|
||||
value: str
|
||||
fias_id: str
|
||||
house: str
|
||||
house_type: str
|
||||
block: str
|
||||
postal_code: str
|
||||
street: str
|
||||
city: str
|
||||
region_code: str
|
||||
|
||||
|
||||
def require_dadata() -> str:
|
||||
if not config.DADATA_IS_ENABLED:
|
||||
raise DaDataDisabledError()
|
||||
token = (config.DADATA_TOKEN or "").strip()
|
||||
if not token:
|
||||
raise DaDataDisabledError("Не задан токен DaData")
|
||||
return token
|
||||
|
||||
|
||||
def suggest_streets(
|
||||
*,
|
||||
region_code: str,
|
||||
city: str,
|
||||
query: str,
|
||||
limit: int,
|
||||
) -> list[DaDataStreet]:
|
||||
require_dadata()
|
||||
return []
|
||||
|
||||
|
||||
def suggest_houses(
|
||||
*,
|
||||
region_code: str,
|
||||
city: str,
|
||||
street: str,
|
||||
query: str,
|
||||
limit: int,
|
||||
) -> list[DaDataHouse]:
|
||||
require_dadata()
|
||||
return []
|
||||
|
|
@ -0,0 +1,160 @@
|
|||
import re
|
||||
import zipfile
|
||||
from collections.abc import Iterator
|
||||
from pathlib import Path
|
||||
from xml.etree import ElementTree
|
||||
|
||||
from django.core.management.base import CommandError
|
||||
|
||||
KIND_ADDRESSES = "addresses"
|
||||
KIND_HOUSES = "houses"
|
||||
KIND_HIERARCHY = "hierarchy"
|
||||
KIND_MUN_HIERARCHY = "mun_hierarchy"
|
||||
KIND_ADDR_PARAMS = "addr_params"
|
||||
KIND_HOUSE_PARAMS = "house_params"
|
||||
|
||||
_FIAS_XML_PATTERNS = {
|
||||
KIND_ADDRESSES: re.compile(
|
||||
r"(?:^|/)(?P<region>\d{2})/AS_ADDR_OBJ_\d{8}_[^/]+\.XML$",
|
||||
re.IGNORECASE,
|
||||
),
|
||||
KIND_HOUSES: re.compile(
|
||||
r"(?:^|/)(?P<region>\d{2})/AS_HOUSES_\d{8}_[^/]+\.XML$",
|
||||
re.IGNORECASE,
|
||||
),
|
||||
KIND_HIERARCHY: re.compile(
|
||||
r"(?:^|/)(?P<region>\d{2})/AS_ADM_HIERARCHY_\d{8}_[^/]+\.XML$",
|
||||
re.IGNORECASE,
|
||||
),
|
||||
KIND_MUN_HIERARCHY: re.compile(
|
||||
r"(?:^|/)(?P<region>\d{2})/AS_MUN_HIERARCHY_\d{8}_[^/]+\.XML$",
|
||||
re.IGNORECASE,
|
||||
),
|
||||
KIND_ADDR_PARAMS: re.compile(
|
||||
r"(?:^|/)(?P<region>\d{2})/AS_ADDR_OBJ_PARAMS_\d{8}_[^/]+\.XML$",
|
||||
re.IGNORECASE,
|
||||
),
|
||||
KIND_HOUSE_PARAMS: re.compile(
|
||||
r"(?:^|/)(?P<region>\d{2})/AS_HOUSES_PARAMS_\d{8}_[^/]+\.XML$",
|
||||
re.IGNORECASE,
|
||||
),
|
||||
}
|
||||
|
||||
_KIND_TITLES = {
|
||||
KIND_ADDRESSES: "AS_ADDR_OBJ",
|
||||
KIND_HOUSES: "AS_HOUSES",
|
||||
KIND_HIERARCHY: "AS_ADM_HIERARCHY",
|
||||
KIND_MUN_HIERARCHY: "AS_MUN_HIERARCHY",
|
||||
KIND_ADDR_PARAMS: "AS_ADDR_OBJ_PARAMS",
|
||||
KIND_HOUSE_PARAMS: "AS_HOUSES_PARAMS",
|
||||
}
|
||||
|
||||
|
||||
def infer_region_code(path: Path | str) -> str | None:
|
||||
"""Infer the FIAS region code from a directory in the XML path."""
|
||||
parts = Path(str(path).replace("\\", "/")).parts
|
||||
return next(
|
||||
(part for part in reversed(parts[:-1]) if len(part) == 2 and part.isdigit()),
|
||||
None,
|
||||
)
|
||||
|
||||
|
||||
def is_zip_archive(path: Path) -> bool:
|
||||
return path.suffix.lower() == ".zip" or zipfile.is_zipfile(path)
|
||||
|
||||
|
||||
def normalize_region_code(region_code: str | int | None) -> str | None:
|
||||
if region_code is None or region_code == "":
|
||||
return None
|
||||
value = str(region_code)
|
||||
if len(value) > 2 or not value.isdigit():
|
||||
raise CommandError(
|
||||
"Не удалось определить код региона. Передайте его через --region-code"
|
||||
)
|
||||
return f"{int(value):02d}"
|
||||
|
||||
|
||||
def require_region_code(region_code: str | int | None) -> str:
|
||||
normalized = normalize_region_code(region_code)
|
||||
if normalized is None:
|
||||
raise CommandError(
|
||||
"Не удалось определить код региона. Передайте его через --region-code"
|
||||
)
|
||||
return normalized
|
||||
|
||||
|
||||
def list_fias_members(
|
||||
names: list[str],
|
||||
kind: str,
|
||||
region_code: str | None = None,
|
||||
) -> list[tuple[str, str]]:
|
||||
pattern = _FIAS_XML_PATTERNS[kind]
|
||||
wanted = normalize_region_code(region_code)
|
||||
found: list[tuple[str, str]] = []
|
||||
for name in names:
|
||||
match = pattern.search(name.replace("\\", "/"))
|
||||
if match is None:
|
||||
continue
|
||||
region = match.group("region")
|
||||
if wanted is not None and region != wanted:
|
||||
continue
|
||||
found.append((region, name))
|
||||
found.sort(key=lambda item: (item[0], item[1]))
|
||||
return found
|
||||
|
||||
|
||||
def iter_fias_xml(
|
||||
path: Path,
|
||||
kind: str,
|
||||
region_code: str | None = None,
|
||||
*,
|
||||
require_region: bool = True,
|
||||
optional: bool = False,
|
||||
) -> Iterator[tuple[str, str | None, Path | zipfile.ZipExtFile]]:
|
||||
"""Yield `(label, region_code, source)` for a loose XML file or ZIP members.
|
||||
|
||||
ZIP members are streamed without extracting the archive. The returned
|
||||
file object is only valid until the next iteration.
|
||||
"""
|
||||
if not path.is_file():
|
||||
raise CommandError(f"Файл не найден: {path}")
|
||||
|
||||
if is_zip_archive(path):
|
||||
yield from _iter_zip_xml(path, kind, region_code, optional=optional)
|
||||
return
|
||||
|
||||
inferred = region_code or infer_region_code(path)
|
||||
region = require_region_code(inferred) if require_region else normalize_region_code(inferred)
|
||||
yield str(path), region, path
|
||||
|
||||
|
||||
def _iter_zip_xml(
|
||||
path: Path,
|
||||
kind: str,
|
||||
region_code: str | None,
|
||||
*,
|
||||
optional: bool = False,
|
||||
) -> Iterator[tuple[str, str, zipfile.ZipExtFile]]:
|
||||
try:
|
||||
archive = zipfile.ZipFile(path)
|
||||
except zipfile.BadZipFile as error:
|
||||
raise CommandError(f"Не удалось открыть архив {path}: {error}") from error
|
||||
|
||||
with archive:
|
||||
members = list_fias_members(archive.namelist(), kind, region_code)
|
||||
if not members:
|
||||
if optional:
|
||||
return
|
||||
title = _KIND_TITLES[kind]
|
||||
if region_code:
|
||||
raise CommandError(
|
||||
f"В архиве нет файлов {title} для региона {require_region_code(region_code)}"
|
||||
)
|
||||
raise CommandError(f"В архиве нет файлов {title}")
|
||||
for region, name in members:
|
||||
with archive.open(name) as stream:
|
||||
yield name, region, stream
|
||||
|
||||
|
||||
def iterparse_xml(source: Path | zipfile.ZipExtFile):
|
||||
return ElementTree.iterparse(source, events=("end",))
|
||||
|
|
@ -0,0 +1,92 @@
|
|||
syntax = "proto3";
|
||||
|
||||
package address.v1;
|
||||
|
||||
service AddressService {
|
||||
rpc SearchRegions(SearchRequest) returns (SearchResponse);
|
||||
rpc SearchCities(SearchRequest) returns (SearchResponse);
|
||||
rpc SearchLocalities(LocalitySearchRequest) returns (SearchResponse);
|
||||
rpc SearchStreets(SearchRequest) returns (SearchResponse);
|
||||
rpc SearchHouses(SearchRequest) returns (HouseSearchResponse);
|
||||
rpc Search(UniversalSearchRequest) returns (SearchResponse);
|
||||
rpc Health(HealthRequest) returns (HealthResponse);
|
||||
}
|
||||
|
||||
enum SearchKind {
|
||||
SEARCH_KIND_UNSPECIFIED = 0;
|
||||
SEARCH_KIND_REGION = 1;
|
||||
SEARCH_KIND_CITY = 2;
|
||||
SEARCH_KIND_STREET = 3;
|
||||
}
|
||||
|
||||
message SearchRequest {
|
||||
string query = 1;
|
||||
optional string region_code = 2;
|
||||
optional int64 parent_id = 3;
|
||||
optional int32 limit = 4;
|
||||
int32 offset = 5;
|
||||
optional bool fuzzy = 6;
|
||||
}
|
||||
|
||||
message LocalitySearchRequest {
|
||||
string query = 1;
|
||||
int32 region_id = 2;
|
||||
optional int64 parent_id = 3;
|
||||
optional int32 limit = 4;
|
||||
int32 offset = 5;
|
||||
optional bool fuzzy = 6;
|
||||
}
|
||||
|
||||
message UniversalSearchRequest {
|
||||
string query = 1;
|
||||
string region_code = 2;
|
||||
optional int64 parent_id = 3;
|
||||
optional int32 limit = 4;
|
||||
int32 offset = 5;
|
||||
optional bool fuzzy = 6;
|
||||
SearchKind kind = 7;
|
||||
}
|
||||
|
||||
message Address {
|
||||
int64 id = 1;
|
||||
string fias_id = 2;
|
||||
optional int64 object_id = 3;
|
||||
optional int64 parent_id = 4;
|
||||
string name = 5;
|
||||
string type_name = 6;
|
||||
int32 level = 7;
|
||||
string region_code = 8;
|
||||
string kladr_id = 9;
|
||||
optional Address parent = 10;
|
||||
}
|
||||
|
||||
message SearchResponse {
|
||||
int32 count = 1;
|
||||
repeated Address items = 2;
|
||||
}
|
||||
|
||||
message House {
|
||||
string fias_id = 1;
|
||||
int64 object_id = 2;
|
||||
optional int64 parent_id = 3;
|
||||
string region_code = 4;
|
||||
string house_number = 5;
|
||||
optional int32 house_type = 6;
|
||||
string additional_number_1 = 7;
|
||||
optional int32 additional_type_1 = 8;
|
||||
string additional_number_2 = 9;
|
||||
optional int32 additional_type_2 = 10;
|
||||
string postal_code = 11;
|
||||
string display_number = 12;
|
||||
}
|
||||
|
||||
message HouseSearchResponse {
|
||||
int32 count = 1;
|
||||
repeated House items = 2;
|
||||
}
|
||||
|
||||
message HealthRequest {}
|
||||
|
||||
message HealthResponse {
|
||||
string status = 1;
|
||||
}
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
# NO CHECKED-IN PROTOBUF GENCODE
|
||||
# source: address.proto
|
||||
# Protobuf Python Version: 7.35.0
|
||||
"""Generated protocol buffer code."""
|
||||
from google.protobuf import descriptor as _descriptor
|
||||
from google.protobuf import descriptor_pool as _descriptor_pool
|
||||
from google.protobuf import runtime_version as _runtime_version
|
||||
from google.protobuf import symbol_database as _symbol_database
|
||||
from google.protobuf.internal import builder as _builder
|
||||
_runtime_version.ValidateProtobufRuntimeVersion(
|
||||
_runtime_version.Domain.PUBLIC,
|
||||
7,
|
||||
35,
|
||||
0,
|
||||
'',
|
||||
'address.proto'
|
||||
)
|
||||
# @@protoc_insertion_point(imports)
|
||||
|
||||
_sym_db = _symbol_database.Default()
|
||||
|
||||
|
||||
|
||||
|
||||
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\raddress.proto\x12\naddress.v1\"\xba\x01\n\rSearchRequest\x12\r\n\x05query\x18\x01 \x01(\t\x12\x18\n\x0bregion_code\x18\x02 \x01(\tH\x00\x88\x01\x01\x12\x16\n\tparent_id\x18\x03 \x01(\x03H\x01\x88\x01\x01\x12\x12\n\x05limit\x18\x04 \x01(\x05H\x02\x88\x01\x01\x12\x0e\n\x06offset\x18\x05 \x01(\x05\x12\x12\n\x05\x66uzzy\x18\x06 \x01(\x08H\x03\x88\x01\x01\x42\x0e\n\x0c_region_codeB\x0c\n\n_parent_idB\x08\n\x06_limitB\x08\n\x06_fuzzy\"\xab\x01\n\x15LocalitySearchRequest\x12\r\n\x05query\x18\x01 \x01(\t\x12\x11\n\tregion_id\x18\x02 \x01(\x05\x12\x16\n\tparent_id\x18\x03 \x01(\x03H\x00\x88\x01\x01\x12\x12\n\x05limit\x18\x04 \x01(\x05H\x01\x88\x01\x01\x12\x0e\n\x06offset\x18\x05 \x01(\x05\x12\x12\n\x05\x66uzzy\x18\x06 \x01(\x08H\x02\x88\x01\x01\x42\x0c\n\n_parent_idB\x08\n\x06_limitB\x08\n\x06_fuzzy\"\xd4\x01\n\x16UniversalSearchRequest\x12\r\n\x05query\x18\x01 \x01(\t\x12\x13\n\x0bregion_code\x18\x02 \x01(\t\x12\x16\n\tparent_id\x18\x03 \x01(\x03H\x00\x88\x01\x01\x12\x12\n\x05limit\x18\x04 \x01(\x05H\x01\x88\x01\x01\x12\x0e\n\x06offset\x18\x05 \x01(\x05\x12\x12\n\x05\x66uzzy\x18\x06 \x01(\x08H\x02\x88\x01\x01\x12$\n\x04kind\x18\x07 \x01(\x0e\x32\x16.address.v1.SearchKindB\x0c\n\n_parent_idB\x08\n\x06_limitB\x08\n\x06_fuzzy\"\xfe\x01\n\x07\x41\x64\x64ress\x12\n\n\x02id\x18\x01 \x01(\x03\x12\x0f\n\x07\x66ias_id\x18\x02 \x01(\t\x12\x16\n\tobject_id\x18\x03 \x01(\x03H\x00\x88\x01\x01\x12\x16\n\tparent_id\x18\x04 \x01(\x03H\x01\x88\x01\x01\x12\x0c\n\x04name\x18\x05 \x01(\t\x12\x11\n\ttype_name\x18\x06 \x01(\t\x12\r\n\x05level\x18\x07 \x01(\x05\x12\x13\n\x0bregion_code\x18\x08 \x01(\t\x12\x10\n\x08kladr_id\x18\t \x01(\t\x12(\n\x06parent\x18\n \x01(\x0b\x32\x13.address.v1.AddressH\x02\x88\x01\x01\x42\x0c\n\n_object_idB\x0c\n\n_parent_idB\t\n\x07_parent\"C\n\x0eSearchResponse\x12\r\n\x05\x63ount\x18\x01 \x01(\x05\x12\"\n\x05items\x18\x02 \x03(\x0b\x32\x13.address.v1.Address\"\xf7\x02\n\x05House\x12\x0f\n\x07\x66ias_id\x18\x01 \x01(\t\x12\x11\n\tobject_id\x18\x02 \x01(\x03\x12\x16\n\tparent_id\x18\x03 \x01(\x03H\x00\x88\x01\x01\x12\x13\n\x0bregion_code\x18\x04 \x01(\t\x12\x14\n\x0chouse_number\x18\x05 \x01(\t\x12\x17\n\nhouse_type\x18\x06 \x01(\x05H\x01\x88\x01\x01\x12\x1b\n\x13\x61\x64\x64itional_number_1\x18\x07 \x01(\t\x12\x1e\n\x11\x61\x64\x64itional_type_1\x18\x08 \x01(\x05H\x02\x88\x01\x01\x12\x1b\n\x13\x61\x64\x64itional_number_2\x18\t \x01(\t\x12\x1e\n\x11\x61\x64\x64itional_type_2\x18\n \x01(\x05H\x03\x88\x01\x01\x12\x13\n\x0bpostal_code\x18\x0b \x01(\t\x12\x16\n\x0e\x64isplay_number\x18\x0c \x01(\tB\x0c\n\n_parent_idB\r\n\x0b_house_typeB\x14\n\x12_additional_type_1B\x14\n\x12_additional_type_2\"F\n\x13HouseSearchResponse\x12\r\n\x05\x63ount\x18\x01 \x01(\x05\x12 \n\x05items\x18\x02 \x03(\x0b\x32\x11.address.v1.House\"\x0f\n\rHealthRequest\" \n\x0eHealthResponse\x12\x0e\n\x06status\x18\x01 \x01(\t*o\n\nSearchKind\x12\x1b\n\x17SEARCH_KIND_UNSPECIFIED\x10\x00\x12\x16\n\x12SEARCH_KIND_REGION\x10\x01\x12\x14\n\x10SEARCH_KIND_CITY\x10\x02\x12\x16\n\x12SEARCH_KIND_STREET\x10\x03\x32\x91\x04\n\x0e\x41\x64\x64ressService\x12\x46\n\rSearchRegions\x12\x19.address.v1.SearchRequest\x1a\x1a.address.v1.SearchResponse\x12\x45\n\x0cSearchCities\x12\x19.address.v1.SearchRequest\x1a\x1a.address.v1.SearchResponse\x12Q\n\x10SearchLocalities\x12!.address.v1.LocalitySearchRequest\x1a\x1a.address.v1.SearchResponse\x12\x46\n\rSearchStreets\x12\x19.address.v1.SearchRequest\x1a\x1a.address.v1.SearchResponse\x12J\n\x0cSearchHouses\x12\x19.address.v1.SearchRequest\x1a\x1f.address.v1.HouseSearchResponse\x12H\n\x06Search\x12\".address.v1.UniversalSearchRequest\x1a\x1a.address.v1.SearchResponse\x12?\n\x06Health\x12\x19.address.v1.HealthRequest\x1a\x1a.address.v1.HealthResponseb\x06proto3')
|
||||
|
||||
_globals = globals()
|
||||
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
||||
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'address_pb2', _globals)
|
||||
if not _descriptor._USE_C_DESCRIPTORS:
|
||||
DESCRIPTOR._loaded_options = None
|
||||
_globals['_SEARCHKIND']._serialized_start=1434
|
||||
_globals['_SEARCHKIND']._serialized_end=1545
|
||||
_globals['_SEARCHREQUEST']._serialized_start=30
|
||||
_globals['_SEARCHREQUEST']._serialized_end=216
|
||||
_globals['_LOCALITYSEARCHREQUEST']._serialized_start=219
|
||||
_globals['_LOCALITYSEARCHREQUEST']._serialized_end=390
|
||||
_globals['_UNIVERSALSEARCHREQUEST']._serialized_start=393
|
||||
_globals['_UNIVERSALSEARCHREQUEST']._serialized_end=605
|
||||
_globals['_ADDRESS']._serialized_start=608
|
||||
_globals['_ADDRESS']._serialized_end=862
|
||||
_globals['_SEARCHRESPONSE']._serialized_start=864
|
||||
_globals['_SEARCHRESPONSE']._serialized_end=931
|
||||
_globals['_HOUSE']._serialized_start=934
|
||||
_globals['_HOUSE']._serialized_end=1309
|
||||
_globals['_HOUSESEARCHRESPONSE']._serialized_start=1311
|
||||
_globals['_HOUSESEARCHRESPONSE']._serialized_end=1381
|
||||
_globals['_HEALTHREQUEST']._serialized_start=1383
|
||||
_globals['_HEALTHREQUEST']._serialized_end=1398
|
||||
_globals['_HEALTHRESPONSE']._serialized_start=1400
|
||||
_globals['_HEALTHRESPONSE']._serialized_end=1432
|
||||
_globals['_ADDRESSSERVICE']._serialized_start=1548
|
||||
_globals['_ADDRESSSERVICE']._serialized_end=2077
|
||||
# @@protoc_insertion_point(module_scope)
|
||||
|
|
@ -0,0 +1,147 @@
|
|||
from google.protobuf.internal import containers as _containers
|
||||
from google.protobuf.internal import enum_type_wrapper as _enum_type_wrapper
|
||||
from google.protobuf import descriptor as _descriptor
|
||||
from google.protobuf import message as _message
|
||||
from collections.abc import Iterable as _Iterable, Mapping as _Mapping
|
||||
from typing import ClassVar as _ClassVar, Optional as _Optional, Union as _Union
|
||||
|
||||
DESCRIPTOR: _descriptor.FileDescriptor
|
||||
|
||||
class SearchKind(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
|
||||
__slots__ = ()
|
||||
SEARCH_KIND_UNSPECIFIED: _ClassVar[SearchKind]
|
||||
SEARCH_KIND_REGION: _ClassVar[SearchKind]
|
||||
SEARCH_KIND_CITY: _ClassVar[SearchKind]
|
||||
SEARCH_KIND_STREET: _ClassVar[SearchKind]
|
||||
SEARCH_KIND_UNSPECIFIED: SearchKind
|
||||
SEARCH_KIND_REGION: SearchKind
|
||||
SEARCH_KIND_CITY: SearchKind
|
||||
SEARCH_KIND_STREET: SearchKind
|
||||
|
||||
class SearchRequest(_message.Message):
|
||||
__slots__ = ("query", "region_code", "parent_id", "limit", "offset", "fuzzy")
|
||||
QUERY_FIELD_NUMBER: _ClassVar[int]
|
||||
REGION_CODE_FIELD_NUMBER: _ClassVar[int]
|
||||
PARENT_ID_FIELD_NUMBER: _ClassVar[int]
|
||||
LIMIT_FIELD_NUMBER: _ClassVar[int]
|
||||
OFFSET_FIELD_NUMBER: _ClassVar[int]
|
||||
FUZZY_FIELD_NUMBER: _ClassVar[int]
|
||||
query: str
|
||||
region_code: str
|
||||
parent_id: int
|
||||
limit: int
|
||||
offset: int
|
||||
fuzzy: bool
|
||||
def __init__(self, query: _Optional[str] = ..., region_code: _Optional[str] = ..., parent_id: _Optional[int] = ..., limit: _Optional[int] = ..., offset: _Optional[int] = ..., fuzzy: _Optional[bool] = ...) -> None: ...
|
||||
|
||||
class LocalitySearchRequest(_message.Message):
|
||||
__slots__ = ("query", "region_id", "parent_id", "limit", "offset", "fuzzy")
|
||||
QUERY_FIELD_NUMBER: _ClassVar[int]
|
||||
REGION_ID_FIELD_NUMBER: _ClassVar[int]
|
||||
PARENT_ID_FIELD_NUMBER: _ClassVar[int]
|
||||
LIMIT_FIELD_NUMBER: _ClassVar[int]
|
||||
OFFSET_FIELD_NUMBER: _ClassVar[int]
|
||||
FUZZY_FIELD_NUMBER: _ClassVar[int]
|
||||
query: str
|
||||
region_id: int
|
||||
parent_id: int
|
||||
limit: int
|
||||
offset: int
|
||||
fuzzy: bool
|
||||
def __init__(self, query: _Optional[str] = ..., region_id: _Optional[int] = ..., parent_id: _Optional[int] = ..., limit: _Optional[int] = ..., offset: _Optional[int] = ..., fuzzy: _Optional[bool] = ...) -> None: ...
|
||||
|
||||
class UniversalSearchRequest(_message.Message):
|
||||
__slots__ = ("query", "region_code", "parent_id", "limit", "offset", "fuzzy", "kind")
|
||||
QUERY_FIELD_NUMBER: _ClassVar[int]
|
||||
REGION_CODE_FIELD_NUMBER: _ClassVar[int]
|
||||
PARENT_ID_FIELD_NUMBER: _ClassVar[int]
|
||||
LIMIT_FIELD_NUMBER: _ClassVar[int]
|
||||
OFFSET_FIELD_NUMBER: _ClassVar[int]
|
||||
FUZZY_FIELD_NUMBER: _ClassVar[int]
|
||||
KIND_FIELD_NUMBER: _ClassVar[int]
|
||||
query: str
|
||||
region_code: str
|
||||
parent_id: int
|
||||
limit: int
|
||||
offset: int
|
||||
fuzzy: bool
|
||||
kind: SearchKind
|
||||
def __init__(self, query: _Optional[str] = ..., region_code: _Optional[str] = ..., parent_id: _Optional[int] = ..., limit: _Optional[int] = ..., offset: _Optional[int] = ..., fuzzy: _Optional[bool] = ..., kind: _Optional[_Union[SearchKind, str]] = ...) -> None: ...
|
||||
|
||||
class Address(_message.Message):
|
||||
__slots__ = ("id", "fias_id", "object_id", "parent_id", "name", "type_name", "level", "region_code", "kladr_id", "parent")
|
||||
ID_FIELD_NUMBER: _ClassVar[int]
|
||||
FIAS_ID_FIELD_NUMBER: _ClassVar[int]
|
||||
OBJECT_ID_FIELD_NUMBER: _ClassVar[int]
|
||||
PARENT_ID_FIELD_NUMBER: _ClassVar[int]
|
||||
NAME_FIELD_NUMBER: _ClassVar[int]
|
||||
TYPE_NAME_FIELD_NUMBER: _ClassVar[int]
|
||||
LEVEL_FIELD_NUMBER: _ClassVar[int]
|
||||
REGION_CODE_FIELD_NUMBER: _ClassVar[int]
|
||||
KLADR_ID_FIELD_NUMBER: _ClassVar[int]
|
||||
PARENT_FIELD_NUMBER: _ClassVar[int]
|
||||
id: int
|
||||
fias_id: str
|
||||
object_id: int
|
||||
parent_id: int
|
||||
name: str
|
||||
type_name: str
|
||||
level: int
|
||||
region_code: str
|
||||
kladr_id: str
|
||||
parent: Address
|
||||
def __init__(self, id: _Optional[int] = ..., fias_id: _Optional[str] = ..., object_id: _Optional[int] = ..., parent_id: _Optional[int] = ..., name: _Optional[str] = ..., type_name: _Optional[str] = ..., level: _Optional[int] = ..., region_code: _Optional[str] = ..., kladr_id: _Optional[str] = ..., parent: _Optional[_Union[Address, _Mapping]] = ...) -> None: ...
|
||||
|
||||
class SearchResponse(_message.Message):
|
||||
__slots__ = ("count", "items")
|
||||
COUNT_FIELD_NUMBER: _ClassVar[int]
|
||||
ITEMS_FIELD_NUMBER: _ClassVar[int]
|
||||
count: int
|
||||
items: _containers.RepeatedCompositeFieldContainer[Address]
|
||||
def __init__(self, count: _Optional[int] = ..., items: _Optional[_Iterable[_Union[Address, _Mapping]]] = ...) -> None: ...
|
||||
|
||||
class House(_message.Message):
|
||||
__slots__ = ("fias_id", "object_id", "parent_id", "region_code", "house_number", "house_type", "additional_number_1", "additional_type_1", "additional_number_2", "additional_type_2", "postal_code", "display_number")
|
||||
FIAS_ID_FIELD_NUMBER: _ClassVar[int]
|
||||
OBJECT_ID_FIELD_NUMBER: _ClassVar[int]
|
||||
PARENT_ID_FIELD_NUMBER: _ClassVar[int]
|
||||
REGION_CODE_FIELD_NUMBER: _ClassVar[int]
|
||||
HOUSE_NUMBER_FIELD_NUMBER: _ClassVar[int]
|
||||
HOUSE_TYPE_FIELD_NUMBER: _ClassVar[int]
|
||||
ADDITIONAL_NUMBER_1_FIELD_NUMBER: _ClassVar[int]
|
||||
ADDITIONAL_TYPE_1_FIELD_NUMBER: _ClassVar[int]
|
||||
ADDITIONAL_NUMBER_2_FIELD_NUMBER: _ClassVar[int]
|
||||
ADDITIONAL_TYPE_2_FIELD_NUMBER: _ClassVar[int]
|
||||
POSTAL_CODE_FIELD_NUMBER: _ClassVar[int]
|
||||
DISPLAY_NUMBER_FIELD_NUMBER: _ClassVar[int]
|
||||
fias_id: str
|
||||
object_id: int
|
||||
parent_id: int
|
||||
region_code: str
|
||||
house_number: str
|
||||
house_type: int
|
||||
additional_number_1: str
|
||||
additional_type_1: int
|
||||
additional_number_2: str
|
||||
additional_type_2: int
|
||||
postal_code: str
|
||||
display_number: str
|
||||
def __init__(self, fias_id: _Optional[str] = ..., object_id: _Optional[int] = ..., parent_id: _Optional[int] = ..., region_code: _Optional[str] = ..., house_number: _Optional[str] = ..., house_type: _Optional[int] = ..., additional_number_1: _Optional[str] = ..., additional_type_1: _Optional[int] = ..., additional_number_2: _Optional[str] = ..., additional_type_2: _Optional[int] = ..., postal_code: _Optional[str] = ..., display_number: _Optional[str] = ...) -> None: ...
|
||||
|
||||
class HouseSearchResponse(_message.Message):
|
||||
__slots__ = ("count", "items")
|
||||
COUNT_FIELD_NUMBER: _ClassVar[int]
|
||||
ITEMS_FIELD_NUMBER: _ClassVar[int]
|
||||
count: int
|
||||
items: _containers.RepeatedCompositeFieldContainer[House]
|
||||
def __init__(self, count: _Optional[int] = ..., items: _Optional[_Iterable[_Union[House, _Mapping]]] = ...) -> None: ...
|
||||
|
||||
class HealthRequest(_message.Message):
|
||||
__slots__ = ()
|
||||
def __init__(self) -> None: ...
|
||||
|
||||
class HealthResponse(_message.Message):
|
||||
__slots__ = ("status",)
|
||||
STATUS_FIELD_NUMBER: _ClassVar[int]
|
||||
status: str
|
||||
def __init__(self, status: _Optional[str] = ...) -> None: ...
|
||||
|
|
@ -0,0 +1,355 @@
|
|||
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
|
||||
"""Client and server classes corresponding to protobuf-defined services."""
|
||||
import grpc
|
||||
import warnings
|
||||
|
||||
from address.grpc import address_pb2 as address__pb2
|
||||
|
||||
GRPC_GENERATED_VERSION = '1.82.0'
|
||||
GRPC_VERSION = grpc.__version__
|
||||
_version_not_supported = False
|
||||
|
||||
try:
|
||||
from grpc._utilities import first_version_is_lower
|
||||
_version_not_supported = first_version_is_lower(GRPC_VERSION, GRPC_GENERATED_VERSION)
|
||||
except ImportError:
|
||||
_version_not_supported = True
|
||||
|
||||
if _version_not_supported:
|
||||
raise RuntimeError(
|
||||
f'The grpc package installed is at version {GRPC_VERSION},'
|
||||
+ ' but the generated code in address_pb2_grpc.py depends on'
|
||||
+ f' grpcio>={GRPC_GENERATED_VERSION}.'
|
||||
+ f' Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}'
|
||||
+ f' or downgrade your generated code using grpcio-tools<={GRPC_VERSION}.'
|
||||
)
|
||||
|
||||
|
||||
class AddressServiceStub:
|
||||
"""Missing associated documentation comment in .proto file."""
|
||||
|
||||
def __init__(self, channel):
|
||||
"""Constructor.
|
||||
|
||||
Args:
|
||||
channel: A grpc.Channel.
|
||||
"""
|
||||
self.SearchRegions = channel.unary_unary(
|
||||
'/address.v1.AddressService/SearchRegions',
|
||||
request_serializer=address__pb2.SearchRequest.SerializeToString,
|
||||
response_deserializer=address__pb2.SearchResponse.FromString,
|
||||
_registered_method=True)
|
||||
self.SearchCities = channel.unary_unary(
|
||||
'/address.v1.AddressService/SearchCities',
|
||||
request_serializer=address__pb2.SearchRequest.SerializeToString,
|
||||
response_deserializer=address__pb2.SearchResponse.FromString,
|
||||
_registered_method=True)
|
||||
self.SearchLocalities = channel.unary_unary(
|
||||
'/address.v1.AddressService/SearchLocalities',
|
||||
request_serializer=address__pb2.LocalitySearchRequest.SerializeToString,
|
||||
response_deserializer=address__pb2.SearchResponse.FromString,
|
||||
_registered_method=True)
|
||||
self.SearchStreets = channel.unary_unary(
|
||||
'/address.v1.AddressService/SearchStreets',
|
||||
request_serializer=address__pb2.SearchRequest.SerializeToString,
|
||||
response_deserializer=address__pb2.SearchResponse.FromString,
|
||||
_registered_method=True)
|
||||
self.SearchHouses = channel.unary_unary(
|
||||
'/address.v1.AddressService/SearchHouses',
|
||||
request_serializer=address__pb2.SearchRequest.SerializeToString,
|
||||
response_deserializer=address__pb2.HouseSearchResponse.FromString,
|
||||
_registered_method=True)
|
||||
self.Search = channel.unary_unary(
|
||||
'/address.v1.AddressService/Search',
|
||||
request_serializer=address__pb2.UniversalSearchRequest.SerializeToString,
|
||||
response_deserializer=address__pb2.SearchResponse.FromString,
|
||||
_registered_method=True)
|
||||
self.Health = channel.unary_unary(
|
||||
'/address.v1.AddressService/Health',
|
||||
request_serializer=address__pb2.HealthRequest.SerializeToString,
|
||||
response_deserializer=address__pb2.HealthResponse.FromString,
|
||||
_registered_method=True)
|
||||
|
||||
|
||||
class AddressServiceServicer:
|
||||
"""Missing associated documentation comment in .proto file."""
|
||||
|
||||
def SearchRegions(self, request, context):
|
||||
"""Missing associated documentation comment in .proto file."""
|
||||
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
||||
context.set_details('Method not implemented!')
|
||||
raise NotImplementedError('Method not implemented!')
|
||||
|
||||
def SearchCities(self, request, context):
|
||||
"""Missing associated documentation comment in .proto file."""
|
||||
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
||||
context.set_details('Method not implemented!')
|
||||
raise NotImplementedError('Method not implemented!')
|
||||
|
||||
def SearchLocalities(self, request, context):
|
||||
"""Missing associated documentation comment in .proto file."""
|
||||
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
||||
context.set_details('Method not implemented!')
|
||||
raise NotImplementedError('Method not implemented!')
|
||||
|
||||
def SearchStreets(self, request, context):
|
||||
"""Missing associated documentation comment in .proto file."""
|
||||
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
||||
context.set_details('Method not implemented!')
|
||||
raise NotImplementedError('Method not implemented!')
|
||||
|
||||
def SearchHouses(self, request, context):
|
||||
"""Missing associated documentation comment in .proto file."""
|
||||
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
||||
context.set_details('Method not implemented!')
|
||||
raise NotImplementedError('Method not implemented!')
|
||||
|
||||
def Search(self, request, context):
|
||||
"""Missing associated documentation comment in .proto file."""
|
||||
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
||||
context.set_details('Method not implemented!')
|
||||
raise NotImplementedError('Method not implemented!')
|
||||
|
||||
def Health(self, request, context):
|
||||
"""Missing associated documentation comment in .proto file."""
|
||||
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
||||
context.set_details('Method not implemented!')
|
||||
raise NotImplementedError('Method not implemented!')
|
||||
|
||||
|
||||
def add_AddressServiceServicer_to_server(servicer, server):
|
||||
rpc_method_handlers = {
|
||||
'SearchRegions': grpc.unary_unary_rpc_method_handler(
|
||||
servicer.SearchRegions,
|
||||
request_deserializer=address__pb2.SearchRequest.FromString,
|
||||
response_serializer=address__pb2.SearchResponse.SerializeToString,
|
||||
),
|
||||
'SearchCities': grpc.unary_unary_rpc_method_handler(
|
||||
servicer.SearchCities,
|
||||
request_deserializer=address__pb2.SearchRequest.FromString,
|
||||
response_serializer=address__pb2.SearchResponse.SerializeToString,
|
||||
),
|
||||
'SearchLocalities': grpc.unary_unary_rpc_method_handler(
|
||||
servicer.SearchLocalities,
|
||||
request_deserializer=address__pb2.LocalitySearchRequest.FromString,
|
||||
response_serializer=address__pb2.SearchResponse.SerializeToString,
|
||||
),
|
||||
'SearchStreets': grpc.unary_unary_rpc_method_handler(
|
||||
servicer.SearchStreets,
|
||||
request_deserializer=address__pb2.SearchRequest.FromString,
|
||||
response_serializer=address__pb2.SearchResponse.SerializeToString,
|
||||
),
|
||||
'SearchHouses': grpc.unary_unary_rpc_method_handler(
|
||||
servicer.SearchHouses,
|
||||
request_deserializer=address__pb2.SearchRequest.FromString,
|
||||
response_serializer=address__pb2.HouseSearchResponse.SerializeToString,
|
||||
),
|
||||
'Search': grpc.unary_unary_rpc_method_handler(
|
||||
servicer.Search,
|
||||
request_deserializer=address__pb2.UniversalSearchRequest.FromString,
|
||||
response_serializer=address__pb2.SearchResponse.SerializeToString,
|
||||
),
|
||||
'Health': grpc.unary_unary_rpc_method_handler(
|
||||
servicer.Health,
|
||||
request_deserializer=address__pb2.HealthRequest.FromString,
|
||||
response_serializer=address__pb2.HealthResponse.SerializeToString,
|
||||
),
|
||||
}
|
||||
generic_handler = grpc.method_handlers_generic_handler(
|
||||
'address.v1.AddressService', rpc_method_handlers)
|
||||
server.add_generic_rpc_handlers((generic_handler,))
|
||||
server.add_registered_method_handlers('address.v1.AddressService', rpc_method_handlers)
|
||||
|
||||
|
||||
# This class is part of an EXPERIMENTAL API.
|
||||
class AddressService:
|
||||
"""Missing associated documentation comment in .proto file."""
|
||||
|
||||
@staticmethod
|
||||
def SearchRegions(request,
|
||||
target,
|
||||
options=(),
|
||||
channel_credentials=None,
|
||||
call_credentials=None,
|
||||
insecure=False,
|
||||
compression=None,
|
||||
wait_for_ready=None,
|
||||
timeout=None,
|
||||
metadata=None):
|
||||
return grpc.experimental.unary_unary(
|
||||
request,
|
||||
target,
|
||||
'/address.v1.AddressService/SearchRegions',
|
||||
address__pb2.SearchRequest.SerializeToString,
|
||||
address__pb2.SearchResponse.FromString,
|
||||
options,
|
||||
channel_credentials,
|
||||
insecure,
|
||||
call_credentials,
|
||||
compression,
|
||||
wait_for_ready,
|
||||
timeout,
|
||||
metadata,
|
||||
_registered_method=True)
|
||||
|
||||
@staticmethod
|
||||
def SearchCities(request,
|
||||
target,
|
||||
options=(),
|
||||
channel_credentials=None,
|
||||
call_credentials=None,
|
||||
insecure=False,
|
||||
compression=None,
|
||||
wait_for_ready=None,
|
||||
timeout=None,
|
||||
metadata=None):
|
||||
return grpc.experimental.unary_unary(
|
||||
request,
|
||||
target,
|
||||
'/address.v1.AddressService/SearchCities',
|
||||
address__pb2.SearchRequest.SerializeToString,
|
||||
address__pb2.SearchResponse.FromString,
|
||||
options,
|
||||
channel_credentials,
|
||||
insecure,
|
||||
call_credentials,
|
||||
compression,
|
||||
wait_for_ready,
|
||||
timeout,
|
||||
metadata,
|
||||
_registered_method=True)
|
||||
|
||||
@staticmethod
|
||||
def SearchLocalities(request,
|
||||
target,
|
||||
options=(),
|
||||
channel_credentials=None,
|
||||
call_credentials=None,
|
||||
insecure=False,
|
||||
compression=None,
|
||||
wait_for_ready=None,
|
||||
timeout=None,
|
||||
metadata=None):
|
||||
return grpc.experimental.unary_unary(
|
||||
request,
|
||||
target,
|
||||
'/address.v1.AddressService/SearchLocalities',
|
||||
address__pb2.LocalitySearchRequest.SerializeToString,
|
||||
address__pb2.SearchResponse.FromString,
|
||||
options,
|
||||
channel_credentials,
|
||||
insecure,
|
||||
call_credentials,
|
||||
compression,
|
||||
wait_for_ready,
|
||||
timeout,
|
||||
metadata,
|
||||
_registered_method=True)
|
||||
|
||||
@staticmethod
|
||||
def SearchStreets(request,
|
||||
target,
|
||||
options=(),
|
||||
channel_credentials=None,
|
||||
call_credentials=None,
|
||||
insecure=False,
|
||||
compression=None,
|
||||
wait_for_ready=None,
|
||||
timeout=None,
|
||||
metadata=None):
|
||||
return grpc.experimental.unary_unary(
|
||||
request,
|
||||
target,
|
||||
'/address.v1.AddressService/SearchStreets',
|
||||
address__pb2.SearchRequest.SerializeToString,
|
||||
address__pb2.SearchResponse.FromString,
|
||||
options,
|
||||
channel_credentials,
|
||||
insecure,
|
||||
call_credentials,
|
||||
compression,
|
||||
wait_for_ready,
|
||||
timeout,
|
||||
metadata,
|
||||
_registered_method=True)
|
||||
|
||||
@staticmethod
|
||||
def SearchHouses(request,
|
||||
target,
|
||||
options=(),
|
||||
channel_credentials=None,
|
||||
call_credentials=None,
|
||||
insecure=False,
|
||||
compression=None,
|
||||
wait_for_ready=None,
|
||||
timeout=None,
|
||||
metadata=None):
|
||||
return grpc.experimental.unary_unary(
|
||||
request,
|
||||
target,
|
||||
'/address.v1.AddressService/SearchHouses',
|
||||
address__pb2.SearchRequest.SerializeToString,
|
||||
address__pb2.HouseSearchResponse.FromString,
|
||||
options,
|
||||
channel_credentials,
|
||||
insecure,
|
||||
call_credentials,
|
||||
compression,
|
||||
wait_for_ready,
|
||||
timeout,
|
||||
metadata,
|
||||
_registered_method=True)
|
||||
|
||||
@staticmethod
|
||||
def Search(request,
|
||||
target,
|
||||
options=(),
|
||||
channel_credentials=None,
|
||||
call_credentials=None,
|
||||
insecure=False,
|
||||
compression=None,
|
||||
wait_for_ready=None,
|
||||
timeout=None,
|
||||
metadata=None):
|
||||
return grpc.experimental.unary_unary(
|
||||
request,
|
||||
target,
|
||||
'/address.v1.AddressService/Search',
|
||||
address__pb2.UniversalSearchRequest.SerializeToString,
|
||||
address__pb2.SearchResponse.FromString,
|
||||
options,
|
||||
channel_credentials,
|
||||
insecure,
|
||||
call_credentials,
|
||||
compression,
|
||||
wait_for_ready,
|
||||
timeout,
|
||||
metadata,
|
||||
_registered_method=True)
|
||||
|
||||
@staticmethod
|
||||
def Health(request,
|
||||
target,
|
||||
options=(),
|
||||
channel_credentials=None,
|
||||
call_credentials=None,
|
||||
insecure=False,
|
||||
compression=None,
|
||||
wait_for_ready=None,
|
||||
timeout=None,
|
||||
metadata=None):
|
||||
return grpc.experimental.unary_unary(
|
||||
request,
|
||||
target,
|
||||
'/address.v1.AddressService/Health',
|
||||
address__pb2.HealthRequest.SerializeToString,
|
||||
address__pb2.HealthResponse.FromString,
|
||||
options,
|
||||
channel_credentials,
|
||||
insecure,
|
||||
call_credentials,
|
||||
compression,
|
||||
wait_for_ready,
|
||||
timeout,
|
||||
metadata,
|
||||
_registered_method=True)
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
from concurrent import futures
|
||||
|
||||
import grpc
|
||||
from django.conf import settings
|
||||
from grpc_reflection.v1alpha import reflection
|
||||
|
||||
from address.grpc import address_pb2, address_pb2_grpc
|
||||
from address.grpc.servicer import AddressServicer
|
||||
|
||||
|
||||
def listen_address(host: str | None = None, port: int | None = None) -> str:
|
||||
return f"{host or settings.GRPC_HOST}:{settings.GRPC_PORT if port is None else port}"
|
||||
|
||||
|
||||
def create_server(host: str | None = None, port: int | None = None) -> tuple[grpc.Server, str]:
|
||||
server = grpc.server(futures.ThreadPoolExecutor(max_workers=settings.GRPC_WORKERS))
|
||||
address_pb2_grpc.add_AddressServiceServicer_to_server(AddressServicer(), server)
|
||||
service_names = (
|
||||
address_pb2.DESCRIPTOR.services_by_name["AddressService"].full_name,
|
||||
reflection.SERVICE_NAME,
|
||||
)
|
||||
reflection.enable_server_reflection(service_names, server)
|
||||
address = listen_address(host, port)
|
||||
bound = server.add_insecure_port(address)
|
||||
if bound == 0:
|
||||
raise RuntimeError(f"Не удалось открыть порт {address}")
|
||||
return server, f"{host or settings.GRPC_HOST}:{bound}"
|
||||
|
||||
|
||||
def serve(host: str | None = None, port: int | None = None) -> None:
|
||||
server, address = create_server(host, port)
|
||||
server.start()
|
||||
server.wait_for_termination()
|
||||
|
|
@ -0,0 +1,190 @@
|
|||
import grpc
|
||||
|
||||
from address.api import (
|
||||
LOCALITY_LEVELS,
|
||||
PARENT_CHAIN,
|
||||
STREET_LEVELS,
|
||||
LocalitySearchParams,
|
||||
SearchParams,
|
||||
search,
|
||||
search_houses,
|
||||
)
|
||||
from address.grpc import address_pb2, address_pb2_grpc
|
||||
from address.models import AddressObject, format_region_code
|
||||
|
||||
_KIND_LEVELS = {
|
||||
address_pb2.SEARCH_KIND_UNSPECIFIED: tuple(level.value for level in AddressObject.Level),
|
||||
address_pb2.SEARCH_KIND_REGION: (AddressObject.Level.REGION,),
|
||||
address_pb2.SEARCH_KIND_CITY: (AddressObject.Level.CITY, AddressObject.Level.SETTLEMENT),
|
||||
address_pb2.SEARCH_KIND_STREET: STREET_LEVELS,
|
||||
}
|
||||
|
||||
_REGION_REQUIRED = "Для поиска необходимо указать region_code"
|
||||
_REGION_ID_REQUIRED = "Для поиска необходимо указать region_id"
|
||||
|
||||
|
||||
def _has_field(message, name: str) -> bool:
|
||||
field = message.DESCRIPTOR.fields_by_name.get(name)
|
||||
return field is not None and field.has_presence and message.HasField(name)
|
||||
|
||||
|
||||
def _optional_text(message, name: str) -> str | None:
|
||||
field = message.DESCRIPTOR.fields_by_name.get(name)
|
||||
if field is None:
|
||||
return None
|
||||
if field.has_presence and not message.HasField(name):
|
||||
return None
|
||||
value = getattr(message, name).strip()
|
||||
return value or None
|
||||
|
||||
|
||||
def _optional_int(message, name: str) -> int | None:
|
||||
if not _has_field(message, name):
|
||||
return None
|
||||
return getattr(message, name)
|
||||
|
||||
|
||||
def _search_params(message) -> SearchParams:
|
||||
return SearchParams(
|
||||
query=message.query,
|
||||
region_code=_optional_text(message, "region_code"),
|
||||
parent_id=_optional_int(message, "parent_id"),
|
||||
limit=message.limit if _has_field(message, "limit") else 20,
|
||||
offset=max(message.offset, 0),
|
||||
fuzzy=message.fuzzy if _has_field(message, "fuzzy") else True,
|
||||
)
|
||||
|
||||
|
||||
def _region_code(value) -> str:
|
||||
return value if isinstance(value, str) else format_region_code(value)
|
||||
|
||||
|
||||
def _postal_code(value) -> str:
|
||||
if not value:
|
||||
return ""
|
||||
if isinstance(value, str):
|
||||
return value
|
||||
return f"{value:06d}"
|
||||
|
||||
|
||||
def _to_address(item, *, with_parent: bool = False) -> address_pb2.Address:
|
||||
message = address_pb2.Address(
|
||||
id=item.id,
|
||||
fias_id=str(item.fias_id),
|
||||
name=item.name,
|
||||
type_name=item.type_name,
|
||||
level=item.level,
|
||||
region_code=_region_code(item.region_code),
|
||||
kladr_id=item.kladr_id or "",
|
||||
)
|
||||
if item.object_id is not None:
|
||||
message.object_id = item.object_id
|
||||
if item.parent_id is not None:
|
||||
message.parent_id = item.parent_id
|
||||
if with_parent:
|
||||
parent = getattr(item, "parent", None)
|
||||
if parent is not None:
|
||||
message.parent.CopyFrom(_to_address(parent))
|
||||
return message
|
||||
|
||||
|
||||
def _to_house(item) -> address_pb2.House:
|
||||
message = address_pb2.House(
|
||||
fias_id=str(item.fias_id),
|
||||
object_id=item.object_id,
|
||||
region_code=_region_code(item.region_code),
|
||||
house_number=item.house_number or "",
|
||||
additional_number_1=item.additional_number_1 or "",
|
||||
additional_number_2=item.additional_number_2 or "",
|
||||
postal_code=_postal_code(item.postal_code),
|
||||
display_number=item.display_number,
|
||||
)
|
||||
if item.parent_id is not None:
|
||||
message.parent_id = item.parent_id
|
||||
if item.house_type is not None:
|
||||
message.house_type = item.house_type
|
||||
if item.additional_type_1 is not None:
|
||||
message.additional_type_1 = item.additional_type_1
|
||||
if item.additional_type_2 is not None:
|
||||
message.additional_type_2 = item.additional_type_2
|
||||
return message
|
||||
|
||||
|
||||
def _search_response(result, *, with_parent: bool = False) -> address_pb2.SearchResponse:
|
||||
return address_pb2.SearchResponse(
|
||||
count=result.count,
|
||||
items=[_to_address(item, with_parent=with_parent) for item in result.items],
|
||||
)
|
||||
|
||||
|
||||
class AddressServicer(address_pb2_grpc.AddressServiceServicer):
|
||||
def SearchRegions(self, request, context):
|
||||
return _search_response(search((AddressObject.Level.REGION,), _search_params(request)))
|
||||
|
||||
def SearchCities(self, request, context):
|
||||
return _search_response(
|
||||
search(
|
||||
(AddressObject.Level.CITY, AddressObject.Level.SETTLEMENT),
|
||||
_search_params(request),
|
||||
)
|
||||
)
|
||||
|
||||
def SearchLocalities(self, request, context):
|
||||
if request.region_id <= 0:
|
||||
context.abort(grpc.StatusCode.INVALID_ARGUMENT, _REGION_ID_REQUIRED)
|
||||
params = LocalitySearchParams(
|
||||
query=request.query,
|
||||
region_id=request.region_id,
|
||||
region_code=str(request.region_id).zfill(2),
|
||||
parent_id=_optional_int(request, "parent_id"),
|
||||
limit=request.limit if _has_field(request, "limit") else 20,
|
||||
offset=max(request.offset, 0),
|
||||
fuzzy=request.fuzzy if _has_field(request, "fuzzy") else True,
|
||||
)
|
||||
return _search_response(
|
||||
search(
|
||||
LOCALITY_LEVELS,
|
||||
params,
|
||||
select_related=PARENT_CHAIN,
|
||||
prefer_city_types=True,
|
||||
),
|
||||
with_parent=True,
|
||||
)
|
||||
|
||||
def SearchStreets(self, request, context):
|
||||
return _search_response(
|
||||
search(
|
||||
STREET_LEVELS,
|
||||
_search_params(request),
|
||||
select_related=PARENT_CHAIN,
|
||||
include_planning_children=True,
|
||||
),
|
||||
with_parent=True,
|
||||
)
|
||||
|
||||
def SearchHouses(self, request, context):
|
||||
result = search_houses(_search_params(request))
|
||||
return address_pb2.HouseSearchResponse(
|
||||
count=result.count,
|
||||
items=[_to_house(item) for item in result.items],
|
||||
)
|
||||
|
||||
def Search(self, request, context):
|
||||
region_code = request.region_code.strip()
|
||||
if not region_code:
|
||||
context.abort(grpc.StatusCode.INVALID_ARGUMENT, _REGION_REQUIRED)
|
||||
params = _search_params(request)
|
||||
params.region_code = region_code
|
||||
related = PARENT_CHAIN if request.kind == address_pb2.SEARCH_KIND_STREET else ()
|
||||
return _search_response(
|
||||
search(
|
||||
_KIND_LEVELS[request.kind],
|
||||
params,
|
||||
select_related=related,
|
||||
include_planning_children=request.kind == address_pb2.SEARCH_KIND_STREET,
|
||||
),
|
||||
with_parent=request.kind == address_pb2.SEARCH_KIND_STREET,
|
||||
)
|
||||
|
||||
def Health(self, request, context):
|
||||
return address_pb2.HealthResponse(status="ok")
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
from django.core.management.base import BaseCommand
|
||||
|
||||
from address.management.commands.import_hierarchy import SKIP_HOUSE_PARENT_LEVELS
|
||||
from address.models import House
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
help = "Удалить дома, лежащие на субъекте, районе, городе или НП без улицы"
|
||||
|
||||
def add_arguments(self, parser):
|
||||
parser.add_argument(
|
||||
"--dry-run",
|
||||
action="store_true",
|
||||
help="Только посчитать, не удалять",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--region-code",
|
||||
type=int,
|
||||
help="Ограничить удаление одним регионом",
|
||||
)
|
||||
|
||||
def handle(self, *args, **options):
|
||||
queryset = House.objects.filter(parent__level__in=SKIP_HOUSE_PARENT_LEVELS)
|
||||
region_code = options["region_code"]
|
||||
if region_code is not None:
|
||||
queryset = queryset.filter(region_code=region_code)
|
||||
|
||||
count = queryset.count()
|
||||
if options["dry_run"]:
|
||||
self.stdout.write(f"Будет удалено домов: {count}")
|
||||
return
|
||||
|
||||
deleted, _ = queryset.delete()
|
||||
self.stdout.write(self.style.SUCCESS(f"Удалено домов: {deleted}"))
|
||||
|
|
@ -1,11 +1,120 @@
|
|||
from pathlib import Path
|
||||
from uuid import UUID
|
||||
from xml.etree import ElementTree
|
||||
from zipfile import BadZipFile
|
||||
|
||||
from django.core.management.base import BaseCommand, CommandError
|
||||
|
||||
from address.fias_archive import KIND_ADDRESSES, iter_fias_xml, iterparse_xml
|
||||
from address.models import AddressObject
|
||||
|
||||
|
||||
def normalize_type_name(value: str) -> str:
|
||||
return value.casefold().replace("ё", "е").strip().rstrip(".")
|
||||
|
||||
|
||||
def _types(*names: str) -> frozenset[str]:
|
||||
return frozenset(normalize_type_name(name) for name in names)
|
||||
|
||||
|
||||
IMPORT_TYPES = {
|
||||
AddressObject.Level.REGION: _types(
|
||||
"край", "обл.", "респ.", "а.обл.", "а.окр.", "г.", "г.ф.з.", "пос.", "АО", "Чувашия"
|
||||
),
|
||||
AddressObject.Level.DISTRICT: _types("р-н", "у.", "г."),
|
||||
AddressObject.Level.CITY: _types("г.", "пгт.", "рп.", "с.", "п."),
|
||||
AddressObject.Level.SETTLEMENT: _types(
|
||||
"г.",
|
||||
"с.",
|
||||
"п.",
|
||||
"пгт.",
|
||||
"рп.",
|
||||
"д.",
|
||||
"нп.",
|
||||
"х.",
|
||||
"кп.",
|
||||
"ост-в",
|
||||
"аал",
|
||||
"арбан",
|
||||
"аул",
|
||||
"дп.",
|
||||
"гп.",
|
||||
"ст-ца",
|
||||
"сл.",
|
||||
"у.",
|
||||
"зим.",
|
||||
"киш.",
|
||||
"в-ки",
|
||||
"з-ка",
|
||||
"п-к",
|
||||
"сп.",
|
||||
"с/с",
|
||||
),
|
||||
AddressObject.Level.PLANNING: _types(
|
||||
"тер.",
|
||||
"тер. снт",
|
||||
"снт",
|
||||
"кв-л",
|
||||
"мкр.",
|
||||
"тер.сосн",
|
||||
"сад",
|
||||
"тер. днт",
|
||||
"м-в",
|
||||
"тер. тсн",
|
||||
"днп",
|
||||
"тер. дпк",
|
||||
"ус.",
|
||||
"тер. днп",
|
||||
"тер. пк",
|
||||
"тер. спк",
|
||||
"тер. сно",
|
||||
"тер. снп",
|
||||
"тер. тсж",
|
||||
"тер. онт",
|
||||
"тер. онп",
|
||||
"тер. опк",
|
||||
"тер. оно",
|
||||
),
|
||||
AddressObject.Level.STREET: _types(
|
||||
"ул.",
|
||||
"пер.",
|
||||
"пр-кт",
|
||||
"ш.",
|
||||
"пр-д",
|
||||
"туп.",
|
||||
"б-р",
|
||||
"пл.",
|
||||
"проул.",
|
||||
"ал.",
|
||||
"х.",
|
||||
"ст.",
|
||||
"уч-к",
|
||||
"пер-д",
|
||||
"пл-ка",
|
||||
"ост-в",
|
||||
"с-к",
|
||||
"тер.",
|
||||
"кв-л",
|
||||
"мкр.",
|
||||
"лн.",
|
||||
"тракт",
|
||||
"вал",
|
||||
"наб.",
|
||||
"к-цо",
|
||||
"ряд",
|
||||
"ряды",
|
||||
"пр-к",
|
||||
"пр-ка",
|
||||
"пр-лок",
|
||||
),
|
||||
}
|
||||
|
||||
|
||||
def should_import_type(type_name: str, level: int) -> bool:
|
||||
allowed = IMPORT_TYPES.get(level)
|
||||
return allowed is not None and type_name in allowed
|
||||
|
||||
|
||||
REQUIRED_ATTRIBUTES = (
|
||||
"OBJECTID",
|
||||
"OBJECTGUID",
|
||||
|
|
@ -17,16 +126,8 @@ REQUIRED_ATTRIBUTES = (
|
|||
)
|
||||
|
||||
|
||||
def infer_region_code(path: Path) -> str | None:
|
||||
"""Infer the FIAS region code from a directory in the XML path."""
|
||||
return next(
|
||||
(part for part in reversed(path.parts[:-1]) if len(part) == 2 and part.isdigit()),
|
||||
None,
|
||||
)
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
help = "Импорт адресных объектов из XML выгрузки ГАР/ФИАС"
|
||||
help = "Импорт адресных объектов из XML или ZIP выгрузки ГАР/ФИАС"
|
||||
|
||||
def add_arguments(self, parser):
|
||||
parser.add_argument("file", type=Path)
|
||||
|
|
@ -39,25 +140,42 @@ class Command(BaseCommand):
|
|||
def handle(self, *args, **options):
|
||||
path = options["file"]
|
||||
batch_size = options["batch_size"]
|
||||
if not path.is_file():
|
||||
raise CommandError(f"Файл не найден: {path}")
|
||||
if batch_size < 1:
|
||||
raise CommandError("Размер пакета должен быть больше нуля")
|
||||
|
||||
region_code = options["region_code"] or infer_region_code(path)
|
||||
if not region_code or len(region_code) > 2 or not region_code.isdigit():
|
||||
raise CommandError(
|
||||
"Не удалось определить код региона. Передайте его через --region-code"
|
||||
)
|
||||
region_code = region_code.zfill(2)
|
||||
|
||||
objects = []
|
||||
imported = 0
|
||||
try:
|
||||
for _, element in ElementTree.iterparse(path, events=("end",)):
|
||||
for label, region_code, source in iter_fias_xml(
|
||||
path, KIND_ADDRESSES, options["region_code"]
|
||||
):
|
||||
count = self._import_source(source, int(region_code), batch_size)
|
||||
imported += count
|
||||
self.stdout.write(f"{label}: {count}")
|
||||
except (ElementTree.ParseError, OSError, BadZipFile) as error:
|
||||
raise CommandError(f"Не удалось прочитать XML {path}: {error}") from error
|
||||
|
||||
self.stdout.write(self.style.SUCCESS(f"Импортировано: {imported}"))
|
||||
|
||||
def _import_source(self, source, region_code: int, batch_size: int) -> int:
|
||||
objects = []
|
||||
imported = 0
|
||||
for _, element in iterparse_xml(source):
|
||||
if element.tag.rsplit("}", 1)[-1] != "OBJECT":
|
||||
continue
|
||||
if element.attrib.get("ISACTUAL") != "1":
|
||||
if (
|
||||
element.attrib.get("ISACTUAL") != "1"
|
||||
or element.attrib.get("ISACTIVE") != "1"
|
||||
):
|
||||
element.clear()
|
||||
continue
|
||||
type_name = normalize_type_name(element.attrib.get("TYPENAME", ""))
|
||||
try:
|
||||
level = int(element.attrib.get("LEVEL", ""))
|
||||
except (TypeError, ValueError):
|
||||
level = 0
|
||||
if type_name in AddressObject.STREET_EXTRA_TYPE_NAMES:
|
||||
level = AddressObject.Level.PLANNING
|
||||
if not should_import_type(type_name, level):
|
||||
element.clear()
|
||||
continue
|
||||
objects.append(self._make_object(element.attrib, region_code))
|
||||
|
|
@ -66,16 +184,13 @@ class Command(BaseCommand):
|
|||
self._save(objects, batch_size)
|
||||
imported += len(objects)
|
||||
objects.clear()
|
||||
except (ElementTree.ParseError, OSError) as error:
|
||||
raise CommandError(f"Не удалось прочитать XML {path}: {error}") from error
|
||||
|
||||
if objects:
|
||||
self._save(objects, batch_size)
|
||||
imported += len(objects)
|
||||
self.stdout.write(self.style.SUCCESS(f"Импортировано: {imported}"))
|
||||
return imported
|
||||
|
||||
@staticmethod
|
||||
def _make_object(attributes: dict[str, str], region_code: str) -> AddressObject:
|
||||
def _make_object(attributes: dict[str, str], region_code: int) -> AddressObject:
|
||||
missing = [name for name in REQUIRED_ATTRIBUTES if not attributes.get(name)]
|
||||
if missing:
|
||||
record_id = attributes.get("ID", "неизвестен")
|
||||
|
|
@ -83,12 +198,16 @@ class Command(BaseCommand):
|
|||
f"У записи {record_id} отсутствуют атрибуты: {', '.join(missing)}"
|
||||
)
|
||||
try:
|
||||
type_name = attributes["TYPENAME"].strip()
|
||||
level = int(attributes["LEVEL"])
|
||||
if normalize_type_name(type_name) in AddressObject.STREET_EXTRA_TYPE_NAMES:
|
||||
level = AddressObject.Level.PLANNING
|
||||
return AddressObject(
|
||||
fias_id=UUID(attributes["OBJECTGUID"]),
|
||||
object_id=int(attributes["OBJECTID"]),
|
||||
name=attributes["NAME"].strip(),
|
||||
type_name=attributes["TYPENAME"].strip(),
|
||||
level=int(attributes["LEVEL"]),
|
||||
type_name=type_name,
|
||||
level=level,
|
||||
region_code=region_code,
|
||||
is_active=attributes["ISACTIVE"] == "1",
|
||||
)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,81 @@
|
|||
from pathlib import Path
|
||||
|
||||
from django.core.management import call_command
|
||||
from django.core.management.base import BaseCommand, CommandError
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
help = "Импорт адресов, домов и иерархии из архива ГАР/ФИАС без распаковки"
|
||||
|
||||
def add_arguments(self, parser):
|
||||
parser.add_argument("file", type=Path)
|
||||
parser.add_argument("--batch-size", type=int, default=2000)
|
||||
parser.add_argument(
|
||||
"--region-code",
|
||||
action="append",
|
||||
dest="region_codes",
|
||||
help="Код региона (можно несколько: --region-code 25 --region-code 27)",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--houses-region-code",
|
||||
action="append",
|
||||
dest="houses_region_codes",
|
||||
help="Регионы, для которых импортировать дома (по умолчанию те же, что адреса)",
|
||||
)
|
||||
|
||||
def handle(self, *args, **options):
|
||||
path = options["file"]
|
||||
batch_size = options["batch_size"]
|
||||
if not path.is_file():
|
||||
raise CommandError(f"Файл не найден: {path}")
|
||||
if batch_size < 1:
|
||||
raise CommandError("Размер пакета должен быть больше нуля")
|
||||
|
||||
region_codes = self._parse_region_codes(options["region_codes"])
|
||||
houses_codes = set(self._parse_region_codes(options["houses_region_codes"]))
|
||||
extra = {"batch_size": batch_size}
|
||||
|
||||
if region_codes:
|
||||
for region_code in region_codes:
|
||||
self._import_region(
|
||||
path,
|
||||
{**extra, "region_code": region_code},
|
||||
import_houses=not houses_codes or region_code in houses_codes,
|
||||
)
|
||||
elif houses_codes:
|
||||
self.stdout.write("Импорт адресных объектов (все регионы)")
|
||||
call_command("import_addresses", path, **extra)
|
||||
for region_code in sorted(houses_codes):
|
||||
self.stdout.write(f"Импорт домов (регион {region_code})")
|
||||
call_command("import_houses", path, region_code=region_code, **extra)
|
||||
self.stdout.write("Импорт иерархии (все регионы)")
|
||||
call_command("import_hierarchy", path, **extra)
|
||||
else:
|
||||
self._import_region(path, extra)
|
||||
self.stdout.write(self.style.SUCCESS(f"Импорт из {path} завершён"))
|
||||
|
||||
def _import_region(self, path: Path, extra: dict, *, import_houses: bool = True) -> None:
|
||||
region = extra.get("region_code")
|
||||
title = f"регион {region}" if region else "все регионы"
|
||||
self.stdout.write(f"Импорт адресных объектов ({title})")
|
||||
call_command("import_addresses", path, **extra)
|
||||
if import_houses:
|
||||
self.stdout.write(f"Импорт домов ({title})")
|
||||
call_command("import_houses", path, **extra)
|
||||
self.stdout.write(f"Импорт иерархии ({title})")
|
||||
call_command("import_hierarchy", path, **extra)
|
||||
|
||||
@staticmethod
|
||||
def _parse_region_codes(values: list[str] | None) -> list[str]:
|
||||
if not values:
|
||||
return []
|
||||
codes: list[str] = []
|
||||
for value in values:
|
||||
for part in value.split(","):
|
||||
code = part.strip()
|
||||
if not code:
|
||||
continue
|
||||
if not code.isdigit() or len(code) > 2:
|
||||
raise CommandError(f"Некорректный код региона: {code}")
|
||||
codes.append(f"{int(code):02d}")
|
||||
return list(dict.fromkeys(codes))
|
||||
|
|
@ -0,0 +1,244 @@
|
|||
from pathlib import Path
|
||||
from xml.etree import ElementTree
|
||||
from zipfile import BadZipFile
|
||||
|
||||
from django.core.management.base import BaseCommand, CommandError
|
||||
|
||||
from address.fias_archive import (
|
||||
KIND_HIERARCHY,
|
||||
KIND_MUN_HIERARCHY,
|
||||
is_zip_archive,
|
||||
iter_fias_xml,
|
||||
iterparse_xml,
|
||||
)
|
||||
from address.models import AddressObject, House
|
||||
|
||||
HOUSE_PARENT_LEVELS = (
|
||||
AddressObject.Level.STREET,
|
||||
AddressObject.Level.PLANNING,
|
||||
)
|
||||
SKIP_HOUSE_PARENT_LEVELS = frozenset(
|
||||
{
|
||||
AddressObject.Level.REGION,
|
||||
AddressObject.Level.DISTRICT,
|
||||
AddressObject.Level.MUNICIPAL_DISTRICT,
|
||||
AddressObject.Level.MUNICIPAL_SETTLEMENT,
|
||||
AddressObject.Level.CITY,
|
||||
AddressObject.Level.SETTLEMENT,
|
||||
}
|
||||
)
|
||||
SKIP_HOUSE = object()
|
||||
ObjectInfo = tuple[int, int, str]
|
||||
|
||||
|
||||
def parse_path(path: str, object_id: int) -> list[int]:
|
||||
ancestor_ids = [int(part) for part in path.split(".") if part]
|
||||
if ancestor_ids and ancestor_ids[-1] == object_id:
|
||||
ancestor_ids.pop()
|
||||
ancestor_ids.reverse()
|
||||
return ancestor_ids
|
||||
|
||||
|
||||
def item_ancestor_ids(attributes: dict[str, str], object_id: int) -> list[int]:
|
||||
ancestor_ids = parse_path(attributes.get("PATH", ""), object_id)
|
||||
if ancestor_ids:
|
||||
return ancestor_ids
|
||||
try:
|
||||
parent_object_id = int(attributes.get("PARENTOBJID") or 0)
|
||||
except (TypeError, ValueError):
|
||||
return []
|
||||
return [parent_object_id] if parent_object_id else []
|
||||
|
||||
|
||||
def resolve_parent_pk(
|
||||
object_id: int,
|
||||
ancestor_ids: list[int],
|
||||
objects: dict[int, ObjectInfo],
|
||||
) -> int | None:
|
||||
child = objects.get(object_id)
|
||||
if child is None:
|
||||
return None
|
||||
child_pk, _child_level, _type_name = child
|
||||
for ancestor_id in ancestor_ids:
|
||||
ancestor = objects.get(ancestor_id)
|
||||
if ancestor is None:
|
||||
continue
|
||||
parent_pk, _parent_level, _type_name = ancestor
|
||||
if parent_pk == child_pk:
|
||||
continue
|
||||
return parent_pk
|
||||
return None
|
||||
|
||||
|
||||
def resolve_house_parent_pk(
|
||||
ancestor_ids: list[int],
|
||||
objects: dict[int, ObjectInfo],
|
||||
) -> int | object | None:
|
||||
if ancestor_ids and ancestor_ids[0] not in objects:
|
||||
return SKIP_HOUSE
|
||||
for ancestor_id in ancestor_ids:
|
||||
ancestor = objects.get(ancestor_id)
|
||||
if ancestor is None:
|
||||
continue
|
||||
parent_pk, parent_level, _type_name = ancestor
|
||||
if parent_level in SKIP_HOUSE_PARENT_LEVELS:
|
||||
return SKIP_HOUSE
|
||||
if parent_level in HOUSE_PARENT_LEVELS:
|
||||
return parent_pk
|
||||
return None
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
help = "Заполнить parent из XML или ZIP AS_ADM_HIERARCHY и AS_MUN_HIERARCHY"
|
||||
|
||||
def add_arguments(self, parser):
|
||||
parser.add_argument("file", type=Path)
|
||||
parser.add_argument("--batch-size", type=int, default=2000)
|
||||
parser.add_argument(
|
||||
"--region-code",
|
||||
help="Код региона ФИАС (по умолчанию определяется по каталогу файла)",
|
||||
)
|
||||
|
||||
def handle(self, *args, **options):
|
||||
path = options["file"]
|
||||
batch_size = options["batch_size"]
|
||||
if batch_size < 1:
|
||||
raise CommandError("Размер пакета должен быть больше нуля")
|
||||
|
||||
updated_addresses = 0
|
||||
updated_houses = 0
|
||||
skipped_houses = 0
|
||||
sources = [
|
||||
(KIND_HIERARCHY, False, False),
|
||||
]
|
||||
if is_zip_archive(path):
|
||||
sources.append((KIND_MUN_HIERARCHY, True, True))
|
||||
try:
|
||||
for kind, optional, empty_only in sources:
|
||||
for label, region_code, source in iter_fias_xml(
|
||||
path,
|
||||
kind,
|
||||
options["region_code"],
|
||||
require_region=False,
|
||||
optional=optional,
|
||||
):
|
||||
addresses, houses, skipped = self._import_source(
|
||||
source,
|
||||
region_code,
|
||||
batch_size,
|
||||
empty_only=empty_only,
|
||||
)
|
||||
updated_addresses += addresses
|
||||
updated_houses += houses
|
||||
skipped_houses += skipped
|
||||
self.stdout.write(
|
||||
f"{label}: адресов {addresses}, домов {houses}, пропущено {skipped}"
|
||||
)
|
||||
except (ElementTree.ParseError, OSError, BadZipFile) as error:
|
||||
raise CommandError(f"Не удалось прочитать XML {path}: {error}") from error
|
||||
|
||||
self.stdout.write(
|
||||
self.style.SUCCESS(
|
||||
f"Обновлено родителей: {updated_addresses} адресных объектов, "
|
||||
f"{updated_houses} домов, пропущено домов: {skipped_houses}"
|
||||
)
|
||||
)
|
||||
|
||||
def _import_source(
|
||||
self,
|
||||
source,
|
||||
region_code: str | None,
|
||||
batch_size: int,
|
||||
*,
|
||||
empty_only: bool = False,
|
||||
) -> tuple[int, int, int]:
|
||||
queryset = AddressObject.objects.filter(object_id__isnull=False)
|
||||
house_queryset = House.objects.all()
|
||||
if region_code:
|
||||
code = int(region_code)
|
||||
queryset = queryset.filter(region_code=code)
|
||||
house_queryset = house_queryset.filter(region_code=code)
|
||||
records = {
|
||||
object_id: (pk, level, parent_id)
|
||||
for object_id, pk, level, parent_id in queryset.values_list(
|
||||
"object_id", "id", "level", "parent_id"
|
||||
)
|
||||
}
|
||||
objects = {
|
||||
object_id: (pk, level, type_name)
|
||||
for object_id, pk, level, type_name in queryset.values_list(
|
||||
"object_id", "id", "level", "type_name"
|
||||
)
|
||||
}
|
||||
houses = set() if empty_only else set(house_queryset.values_list("object_id", flat=True))
|
||||
|
||||
address_updates: dict[int, AddressObject] = {}
|
||||
house_updates: dict[int, House] = {}
|
||||
fallback_addresses: dict[int, AddressObject] = {}
|
||||
fallback_houses: dict[int, House] = {}
|
||||
house_deletes: set[int] = set()
|
||||
for _, element in iterparse_xml(source):
|
||||
if element.tag.rsplit("}", 1)[-1] != "ITEM":
|
||||
continue
|
||||
attributes = element.attrib
|
||||
element.clear()
|
||||
is_active = attributes.get("ISACTIVE") == "1"
|
||||
try:
|
||||
object_id = int(attributes["OBJECTID"])
|
||||
except (KeyError, TypeError, ValueError):
|
||||
continue
|
||||
ancestor_ids = item_ancestor_ids(attributes, object_id)
|
||||
if object_id in records:
|
||||
pk, _level, parent_id = records[object_id]
|
||||
if empty_only and parent_id is not None:
|
||||
continue
|
||||
parent_pk = resolve_parent_pk(object_id, ancestor_ids, objects)
|
||||
update = AddressObject(pk=pk, parent_id=parent_pk)
|
||||
if is_active:
|
||||
address_updates[pk] = update
|
||||
fallback_addresses.pop(pk, None)
|
||||
elif pk not in address_updates:
|
||||
fallback_addresses[pk] = update
|
||||
elif object_id in houses:
|
||||
parent_pk = resolve_house_parent_pk(ancestor_ids, objects)
|
||||
if parent_pk is SKIP_HOUSE:
|
||||
if is_active:
|
||||
house_deletes.add(object_id)
|
||||
house_updates.pop(object_id, None)
|
||||
fallback_houses.pop(object_id, None)
|
||||
elif object_id not in house_updates:
|
||||
house_deletes.add(object_id)
|
||||
continue
|
||||
update = House(pk=object_id, parent_id=parent_pk)
|
||||
if is_active:
|
||||
house_updates[object_id] = update
|
||||
fallback_houses.pop(object_id, None)
|
||||
house_deletes.discard(object_id)
|
||||
elif object_id not in house_updates:
|
||||
fallback_houses[object_id] = update
|
||||
|
||||
address_updates.update(
|
||||
{pk: obj for pk, obj in fallback_addresses.items() if pk not in address_updates}
|
||||
)
|
||||
house_updates.update(
|
||||
{oid: obj for oid, obj in fallback_houses.items() if oid not in house_updates}
|
||||
)
|
||||
|
||||
house_updates = {
|
||||
oid: obj for oid, obj in house_updates.items() if oid not in house_deletes
|
||||
}
|
||||
updated_addresses = self._bulk_update(
|
||||
address_updates, AddressObject, ["parent"], batch_size
|
||||
)
|
||||
updated_houses = self._bulk_update(house_updates, House, ["parent"], batch_size)
|
||||
skipped_houses = 0
|
||||
if house_deletes:
|
||||
skipped_houses, _ = House.objects.filter(object_id__in=house_deletes).delete()
|
||||
return updated_addresses, updated_houses, skipped_houses
|
||||
|
||||
@staticmethod
|
||||
def _bulk_update(updates: dict, model, fields: list[str], batch_size: int) -> int:
|
||||
batch = list(updates.values())
|
||||
for start in range(0, len(batch), batch_size):
|
||||
model.objects.bulk_update(batch[start : start + batch_size], fields)
|
||||
return len(batch)
|
||||
|
|
@ -1,24 +1,33 @@
|
|||
from datetime import date
|
||||
from pathlib import Path
|
||||
from uuid import UUID
|
||||
from xml.etree import ElementTree
|
||||
from zipfile import BadZipFile
|
||||
|
||||
from django.core.management.base import BaseCommand, CommandError
|
||||
|
||||
from address.management.commands.import_addresses import infer_region_code
|
||||
from address.fias_archive import KIND_HOUSES, iter_fias_xml, iterparse_xml
|
||||
from address.models import House
|
||||
|
||||
IMPORT_HOUSE_TYPES = frozenset(
|
||||
{
|
||||
House.Type.POSSESSION,
|
||||
House.Type.HOUSE,
|
||||
House.Type.HOUSEHOLD,
|
||||
House.Type.LITERA,
|
||||
House.Type.BLOCK,
|
||||
}
|
||||
)
|
||||
|
||||
REQUIRED_ATTRIBUTES = (
|
||||
"OBJECTID",
|
||||
"OBJECTGUID",
|
||||
"UPDATEDATE",
|
||||
"ISACTUAL",
|
||||
"ISACTIVE",
|
||||
)
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
help = "Импорт домов из XML HOUSES выгрузки ГАР/ФИАС"
|
||||
help = "Импорт домов из XML или ZIP HOUSES выгрузки ГАР/ФИАС"
|
||||
|
||||
def add_arguments(self, parser):
|
||||
parser.add_argument("file", type=Path)
|
||||
|
|
@ -31,25 +40,45 @@ class Command(BaseCommand):
|
|||
def handle(self, *args, **options):
|
||||
path = options["file"]
|
||||
batch_size = options["batch_size"]
|
||||
if not path.is_file():
|
||||
raise CommandError(f"Файл не найден: {path}")
|
||||
if batch_size < 1:
|
||||
raise CommandError("Размер пакета должен быть больше нуля")
|
||||
|
||||
region_code = options["region_code"] or infer_region_code(path)
|
||||
if not region_code or len(region_code) > 2 or not region_code.isdigit():
|
||||
raise CommandError(
|
||||
"Не удалось определить код региона. Передайте его через --region-code"
|
||||
)
|
||||
region_code = region_code.zfill(2)
|
||||
|
||||
objects = []
|
||||
imported = 0
|
||||
try:
|
||||
for _, element in ElementTree.iterparse(path, events=("end",)):
|
||||
for label, region_code, source in iter_fias_xml(
|
||||
path, KIND_HOUSES, options["region_code"]
|
||||
):
|
||||
count = self._import_source(source, int(region_code), batch_size)
|
||||
imported += count
|
||||
self.stdout.write(f"{label}: {count}")
|
||||
except (ElementTree.ParseError, OSError, BadZipFile) as error:
|
||||
raise CommandError(f"Не удалось прочитать XML {path}: {error}") from error
|
||||
|
||||
self.stdout.write(self.style.SUCCESS(f"Импортировано домов: {imported}"))
|
||||
|
||||
def _import_source(self, source, region_code: int, batch_size: int) -> int:
|
||||
objects = []
|
||||
imported = 0
|
||||
for _, element in iterparse_xml(source):
|
||||
if element.tag.rsplit("}", 1)[-1] != "HOUSE":
|
||||
continue
|
||||
if element.attrib.get("ISACTUAL") != "1":
|
||||
if (
|
||||
element.attrib.get("ISACTUAL") != "1"
|
||||
or element.attrib.get("ISACTIVE") != "1"
|
||||
):
|
||||
element.clear()
|
||||
continue
|
||||
raw_type = element.attrib.get("HOUSETYPE")
|
||||
if raw_type:
|
||||
try:
|
||||
house_type = int(raw_type)
|
||||
except ValueError:
|
||||
house_type = None
|
||||
else:
|
||||
if (
|
||||
house_type in House.Type.values
|
||||
and house_type not in IMPORT_HOUSE_TYPES
|
||||
):
|
||||
element.clear()
|
||||
continue
|
||||
objects.append(self._make_house(element.attrib, region_code))
|
||||
|
|
@ -58,16 +87,13 @@ class Command(BaseCommand):
|
|||
self._save(objects, batch_size)
|
||||
imported += len(objects)
|
||||
objects.clear()
|
||||
except (ElementTree.ParseError, OSError) as error:
|
||||
raise CommandError(f"Не удалось прочитать XML {path}: {error}") from error
|
||||
|
||||
if objects:
|
||||
self._save(objects, batch_size)
|
||||
imported += len(objects)
|
||||
self.stdout.write(self.style.SUCCESS(f"Импортировано домов: {imported}"))
|
||||
return imported
|
||||
|
||||
@staticmethod
|
||||
def _make_house(attributes: dict[str, str], region_code: str) -> House:
|
||||
def _make_house(attributes: dict[str, str], region_code: int) -> House:
|
||||
missing = [name for name in REQUIRED_ATTRIBUTES if not attributes.get(name)]
|
||||
if missing:
|
||||
record_id = attributes.get("ID", "неизвестен")
|
||||
|
|
@ -79,20 +105,22 @@ class Command(BaseCommand):
|
|||
object_id=int(attributes["OBJECTID"]),
|
||||
fias_id=UUID(attributes["OBJECTGUID"]),
|
||||
region_code=region_code,
|
||||
house_number=attributes.get("HOUSENUM", "").strip(),
|
||||
house_number=Command._optional_text(attributes.get("HOUSENUM")),
|
||||
house_type=Command._optional_type(attributes, "HOUSETYPE"),
|
||||
additional_number_1=attributes.get("ADDNUM1", "").strip(),
|
||||
additional_number_1=Command._optional_text(attributes.get("ADDNUM1")),
|
||||
additional_type_1=Command._optional_type(attributes, "ADDTYPE1"),
|
||||
additional_number_2=attributes.get("ADDNUM2", "").strip(),
|
||||
additional_number_2=Command._optional_text(attributes.get("ADDNUM2")),
|
||||
additional_type_2=Command._optional_type(attributes, "ADDTYPE2"),
|
||||
source_updated_at=date.fromisoformat(attributes["UPDATEDATE"]),
|
||||
is_actual=attributes["ISACTUAL"] == "1",
|
||||
is_active=attributes["ISACTIVE"] == "1",
|
||||
)
|
||||
except (TypeError, ValueError) as error:
|
||||
record_id = attributes.get("ID", "неизвестен")
|
||||
raise CommandError(f"Некорректные данные дома {record_id}: {error}") from error
|
||||
|
||||
@staticmethod
|
||||
def _optional_text(value: str | None) -> str | None:
|
||||
text = (value or "").strip()
|
||||
return text or None
|
||||
|
||||
@staticmethod
|
||||
def _optional_type(attributes: dict[str, str], name: str) -> int | None:
|
||||
value = attributes.get(name)
|
||||
|
|
@ -111,9 +139,9 @@ class Command(BaseCommand):
|
|||
objects,
|
||||
batch_size=batch_size,
|
||||
update_conflicts=True,
|
||||
unique_fields=("fias_id",),
|
||||
unique_fields=("object_id",),
|
||||
update_fields=(
|
||||
"object_id",
|
||||
"fias_id",
|
||||
"region_code",
|
||||
"house_number",
|
||||
"house_type",
|
||||
|
|
@ -121,8 +149,5 @@ class Command(BaseCommand):
|
|||
"additional_type_1",
|
||||
"additional_number_2",
|
||||
"additional_type_2",
|
||||
"source_updated_at",
|
||||
"is_actual",
|
||||
"is_active",
|
||||
),
|
||||
)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,80 @@
|
|||
from pathlib import Path
|
||||
from xml.etree import ElementTree
|
||||
from zipfile import BadZipFile
|
||||
|
||||
from django.core.management.base import BaseCommand, CommandError
|
||||
|
||||
from address.fias_archive import KIND_ADDR_PARAMS, iter_fias_xml, iterparse_xml
|
||||
from address.models import AddressObject
|
||||
|
||||
KLADR_TYPE_ID = "10"
|
||||
KLADR_CODE_LENGTHS = frozenset({13, 17})
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
help = "Заполнить код КЛАДР адресных объектов из XML PARAMS ГАР/ФИАС (TYPEID=10)"
|
||||
|
||||
def add_arguments(self, parser):
|
||||
parser.add_argument("file", type=Path)
|
||||
parser.add_argument("--batch-size", type=int, default=2000)
|
||||
parser.add_argument(
|
||||
"--region-code",
|
||||
help="Код региона ФИАС (по умолчанию определяется по каталогу файла)",
|
||||
)
|
||||
|
||||
def handle(self, *args, **options):
|
||||
path = options["file"]
|
||||
batch_size = options["batch_size"]
|
||||
if batch_size < 1:
|
||||
raise CommandError("Размер пакета должен быть больше нуля")
|
||||
|
||||
updated = 0
|
||||
try:
|
||||
for label, region_code, source in iter_fias_xml(
|
||||
path,
|
||||
KIND_ADDR_PARAMS,
|
||||
options["region_code"],
|
||||
require_region=False,
|
||||
):
|
||||
count = self._import_source(source, region_code, batch_size)
|
||||
updated += count
|
||||
self.stdout.write(f"{label}: {count}")
|
||||
except (ElementTree.ParseError, OSError, BadZipFile) as error:
|
||||
raise CommandError(f"Не удалось прочитать XML {path}: {error}") from error
|
||||
|
||||
self.stdout.write(self.style.SUCCESS(f"Обновлено кодов КЛАДР: {updated}"))
|
||||
|
||||
def _import_source(self, source, region_code: str | None, batch_size: int) -> int:
|
||||
objects = AddressObject.objects.filter(object_id__isnull=False)
|
||||
if region_code:
|
||||
objects = objects.filter(region_code=int(region_code))
|
||||
object_ids = dict(objects.values_list("object_id", "id"))
|
||||
|
||||
codes: dict[int, str] = {}
|
||||
for _, element in iterparse_xml(source):
|
||||
if element.tag.rsplit("}", 1)[-1] != "PARAM":
|
||||
continue
|
||||
attributes = element.attrib
|
||||
element.clear()
|
||||
if attributes.get("TYPEID") != KLADR_TYPE_ID:
|
||||
continue
|
||||
if attributes.get("CHANGEIDEND") != "0":
|
||||
continue
|
||||
value = attributes.get("VALUE", "").strip()
|
||||
if len(value) not in KLADR_CODE_LENGTHS or not value.isdigit():
|
||||
continue
|
||||
try:
|
||||
object_id = int(attributes["OBJECTID"])
|
||||
except (KeyError, TypeError, ValueError):
|
||||
continue
|
||||
pk = object_ids.get(object_id)
|
||||
if pk is not None:
|
||||
codes[pk] = value
|
||||
return self._bulk_update(codes, batch_size)
|
||||
|
||||
@staticmethod
|
||||
def _bulk_update(codes: dict[int, str], batch_size: int) -> int:
|
||||
batch = [AddressObject(pk=pk, kladr_id=code) for pk, code in codes.items()]
|
||||
for start in range(0, len(batch), batch_size):
|
||||
AddressObject.objects.bulk_update(batch[start : start + batch_size], ["kladr_id"])
|
||||
return len(batch)
|
||||
|
|
@ -0,0 +1,78 @@
|
|||
from pathlib import Path
|
||||
from xml.etree import ElementTree
|
||||
from zipfile import BadZipFile
|
||||
|
||||
from django.core.management.base import BaseCommand, CommandError
|
||||
|
||||
from address.fias_archive import KIND_HOUSE_PARAMS, iter_fias_xml, iterparse_xml
|
||||
from address.models import House
|
||||
|
||||
POSTAL_TYPE_ID = "5"
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
help = "Заполнить почтовый индекс домов из XML PARAMS ГАР/ФИАС (TYPEID=5)"
|
||||
|
||||
def add_arguments(self, parser):
|
||||
parser.add_argument("file", type=Path)
|
||||
parser.add_argument("--batch-size", type=int, default=2000)
|
||||
parser.add_argument(
|
||||
"--region-code",
|
||||
help="Код региона ФИАС (по умолчанию определяется по каталогу файла)",
|
||||
)
|
||||
|
||||
def handle(self, *args, **options):
|
||||
path = options["file"]
|
||||
batch_size = options["batch_size"]
|
||||
if batch_size < 1:
|
||||
raise CommandError("Размер пакета должен быть больше нуля")
|
||||
|
||||
updated = 0
|
||||
try:
|
||||
for label, region_code, source in iter_fias_xml(
|
||||
path,
|
||||
KIND_HOUSE_PARAMS,
|
||||
options["region_code"],
|
||||
require_region=False,
|
||||
):
|
||||
count = self._import_source(source, region_code, batch_size)
|
||||
updated += count
|
||||
self.stdout.write(f"{label}: {count}")
|
||||
except (ElementTree.ParseError, OSError, BadZipFile) as error:
|
||||
raise CommandError(f"Не удалось прочитать XML {path}: {error}") from error
|
||||
|
||||
self.stdout.write(self.style.SUCCESS(f"Обновлено индексов: {updated} домов"))
|
||||
|
||||
def _import_source(self, source, region_code: str | None, batch_size: int) -> int:
|
||||
houses = House.objects.all()
|
||||
if region_code:
|
||||
houses = houses.filter(region_code=int(region_code))
|
||||
known_ids = set(houses.values_list("pk", flat=True))
|
||||
|
||||
house_codes: dict[int, int] = {}
|
||||
for _, element in iterparse_xml(source):
|
||||
if element.tag.rsplit("}", 1)[-1] != "PARAM":
|
||||
continue
|
||||
attributes = element.attrib
|
||||
element.clear()
|
||||
if attributes.get("TYPEID") != POSTAL_TYPE_ID:
|
||||
continue
|
||||
if attributes.get("CHANGEIDEND") != "0":
|
||||
continue
|
||||
value = attributes.get("VALUE", "").strip()
|
||||
if len(value) != 6 or not value.isdigit():
|
||||
continue
|
||||
try:
|
||||
object_id = int(attributes["OBJECTID"])
|
||||
except (KeyError, TypeError, ValueError):
|
||||
continue
|
||||
if object_id in known_ids:
|
||||
house_codes[object_id] = int(value)
|
||||
return self._bulk_update(house_codes, batch_size)
|
||||
|
||||
@staticmethod
|
||||
def _bulk_update(codes: dict[int, int], batch_size: int) -> int:
|
||||
batch = [House(pk=pk, postal_code=code) for pk, code in codes.items()]
|
||||
for start in range(0, len(batch), batch_size):
|
||||
House.objects.bulk_update(batch[start : start + batch_size], ["postal_code"])
|
||||
return len(batch)
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
from django.core.management.base import BaseCommand
|
||||
|
||||
from address.grpc.server import create_server
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
help = "Запустить gRPC-сервер поиска адресов"
|
||||
|
||||
def add_arguments(self, parser):
|
||||
parser.add_argument("--host", help="Адрес прослушивания (по умолчанию GRPC_HOST)")
|
||||
parser.add_argument("--port", type=int, help="Порт (по умолчанию GRPC_PORT)")
|
||||
|
||||
def handle(self, *args, **options):
|
||||
server, address = create_server(host=options["host"], port=options["port"])
|
||||
self.stdout.write(f"gRPC слушает {address}")
|
||||
server.start()
|
||||
server.wait_for_termination()
|
||||
|
|
@ -1,81 +1,73 @@
|
|||
# Generated by Django 5.2
|
||||
# Generated by Django 5.2.17 on 2026-08-31 06:11
|
||||
|
||||
import django.db.models.deletion
|
||||
import uuid
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
dependencies = []
|
||||
|
||||
dependencies = [
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name="AddressObject",
|
||||
name='AddressObject',
|
||||
fields=[
|
||||
(
|
||||
"id",
|
||||
models.BigAutoField(
|
||||
auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
|
||||
),
|
||||
),
|
||||
(
|
||||
"fias_id",
|
||||
models.UUIDField(default=uuid.uuid4, unique=True, verbose_name="GUID ФИАС"),
|
||||
),
|
||||
(
|
||||
"object_id",
|
||||
models.BigIntegerField(
|
||||
blank=True, db_index=True, null=True, verbose_name="ID ФИАС"
|
||||
),
|
||||
),
|
||||
("name", models.CharField(db_index=True, max_length=255, verbose_name="Название")),
|
||||
("type_name", models.CharField(blank=True, max_length=50, verbose_name="Тип")),
|
||||
(
|
||||
"level",
|
||||
models.PositiveSmallIntegerField(
|
||||
choices=[
|
||||
(1, "Регион"),
|
||||
(5, "Город"),
|
||||
(6, "Населённый пункт"),
|
||||
(8, "Улица"),
|
||||
],
|
||||
db_index=True,
|
||||
),
|
||||
),
|
||||
(
|
||||
"region_code",
|
||||
models.CharField(db_index=True, max_length=2, verbose_name="Код региона"),
|
||||
),
|
||||
(
|
||||
"postal_code",
|
||||
models.CharField(
|
||||
blank=True, db_index=True, max_length=6, verbose_name="Индекс"
|
||||
),
|
||||
),
|
||||
("is_active", models.BooleanField(db_index=True, default=True)),
|
||||
(
|
||||
"parent",
|
||||
models.ForeignKey(
|
||||
blank=True,
|
||||
null=True,
|
||||
on_delete=django.db.models.deletion.CASCADE,
|
||||
related_name="children",
|
||||
to="address.addressobject",
|
||||
verbose_name="Родитель",
|
||||
),
|
||||
),
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('fias_id', models.UUIDField(default=uuid.uuid4, unique=True, verbose_name='GUID ФИАС')),
|
||||
('object_id', models.BigIntegerField(blank=True, db_index=True, null=True, verbose_name='ID ФИАС')),
|
||||
('name', models.CharField(db_index=True, max_length=255, verbose_name='Название')),
|
||||
('type_name', models.CharField(blank=True, max_length=50, verbose_name='Тип')),
|
||||
('level', models.PositiveSmallIntegerField(choices=[(1, 'Субъект РФ'), (2, 'Район'), (3, 'Муниципальный район'), (4, 'Поселение'), (5, 'Город'), (6, 'Населённый пункт'), (7, 'Планировочная структура'), (8, 'Улица')], db_index=True)),
|
||||
('region_code', models.PositiveSmallIntegerField(db_index=True, verbose_name='Код субъекта РФ')),
|
||||
('kladr_id', models.CharField(blank=True, db_index=True, max_length=17, verbose_name='Код КЛАДР')),
|
||||
('is_active', models.BooleanField(db_index=True, default=True)),
|
||||
('parent', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='children', to='address.addressobject', verbose_name='Родитель')),
|
||||
],
|
||||
options={
|
||||
"verbose_name": "Адресный объект",
|
||||
"verbose_name_plural": "Адресные объекты",
|
||||
"ordering": ("name",),
|
||||
"indexes": [
|
||||
models.Index(
|
||||
fields=["level", "region_code", "name"],
|
||||
name="addr_level_region_name",
|
||||
),
|
||||
models.Index(fields=["parent", "level", "name"], name="addr_parent_level_name"),
|
||||
],
|
||||
'verbose_name': 'Адресный объект',
|
||||
'verbose_name_plural': 'Адресные объекты',
|
||||
'ordering': ('name',),
|
||||
},
|
||||
)
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='House',
|
||||
fields=[
|
||||
('object_id', models.BigIntegerField(primary_key=True, serialize=False, verbose_name='ID ФИАС')),
|
||||
('fias_id', models.UUIDField(verbose_name='GUID ФИАС')),
|
||||
('region_code', models.PositiveSmallIntegerField(db_index=True, verbose_name='Код субъекта РФ')),
|
||||
('house_number', models.CharField(blank=True, max_length=50, null=True, verbose_name='Номер')),
|
||||
('house_type', models.PositiveSmallIntegerField(blank=True, choices=[(1, 'Владение'), (2, 'Дом'), (3, 'Домовладение'), (4, 'Гараж'), (5, 'Здание'), (6, 'Шахта'), (7, 'Строение'), (8, 'Сооружение'), (9, 'Литера'), (10, 'Корпус'), (11, 'Подвал'), (12, 'Котельная'), (13, 'Погреб'), (14, 'Объект незавершенного строительства')], null=True)),
|
||||
('additional_number_1', models.CharField(blank=True, max_length=50, null=True)),
|
||||
('additional_type_1', models.PositiveSmallIntegerField(blank=True, choices=[(1, 'Владение'), (2, 'Дом'), (3, 'Домовладение'), (4, 'Гараж'), (5, 'Здание'), (6, 'Шахта'), (7, 'Строение'), (8, 'Сооружение'), (9, 'Литера'), (10, 'Корпус'), (11, 'Подвал'), (12, 'Котельная'), (13, 'Погреб'), (14, 'Объект незавершенного строительства')], null=True)),
|
||||
('additional_number_2', models.CharField(blank=True, max_length=50, null=True)),
|
||||
('additional_type_2', models.PositiveSmallIntegerField(blank=True, choices=[(1, 'Владение'), (2, 'Дом'), (3, 'Домовладение'), (4, 'Гараж'), (5, 'Здание'), (6, 'Шахта'), (7, 'Строение'), (8, 'Сооружение'), (9, 'Литера'), (10, 'Корпус'), (11, 'Подвал'), (12, 'Котельная'), (13, 'Погреб'), (14, 'Объект незавершенного строительства')], null=True)),
|
||||
('postal_code', models.PositiveIntegerField(blank=True, db_index=True, null=True, verbose_name='Индекс')),
|
||||
('parent', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='houses', to='address.addressobject', verbose_name='Родительский адресный объект')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'Дом',
|
||||
'verbose_name_plural': 'Дома',
|
||||
'ordering': ('house_number', 'additional_number_1', 'additional_number_2'),
|
||||
},
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='addressobject',
|
||||
index=models.Index(fields=['level', 'region_code', 'name'], name='addr_level_region_name'),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='addressobject',
|
||||
index=models.Index(fields=['parent', 'level', 'name'], name='addr_parent_level_name'),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='house',
|
||||
index=models.Index(fields=['parent', 'house_number'], name='house_parent_number'),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='house',
|
||||
index=models.Index(fields=['region_code', 'house_number'], name='house_region_number'),
|
||||
),
|
||||
]
|
||||
|
|
|
|||
|
|
@ -1,149 +0,0 @@
|
|||
# Generated by Django 5.2.17 on 2026-08-28 05:39
|
||||
|
||||
import uuid
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
("address", "0001_initial"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name="House",
|
||||
fields=[
|
||||
(
|
||||
"id",
|
||||
models.BigAutoField(
|
||||
auto_created=True,
|
||||
primary_key=True,
|
||||
serialize=False,
|
||||
verbose_name="ID",
|
||||
),
|
||||
),
|
||||
(
|
||||
"object_id",
|
||||
models.BigIntegerField(unique=True, verbose_name="ID ФИАС"),
|
||||
),
|
||||
(
|
||||
"fias_id",
|
||||
models.UUIDField(default=uuid.uuid4, unique=True, verbose_name="GUID ФИАС"),
|
||||
),
|
||||
(
|
||||
"region_code",
|
||||
models.CharField(db_index=True, max_length=2, verbose_name="Код региона"),
|
||||
),
|
||||
(
|
||||
"house_number",
|
||||
models.CharField(blank=True, max_length=50, verbose_name="Номер"),
|
||||
),
|
||||
(
|
||||
"house_type",
|
||||
models.PositiveSmallIntegerField(
|
||||
blank=True,
|
||||
choices=[
|
||||
(1, "Владение"),
|
||||
(2, "Дом"),
|
||||
(3, "Домовладение"),
|
||||
(4, "Гараж"),
|
||||
(5, "Здание"),
|
||||
(6, "Шахта"),
|
||||
(7, "Строение"),
|
||||
(8, "Сооружение"),
|
||||
(9, "Литера"),
|
||||
(10, "Корпус"),
|
||||
(11, "Подвал"),
|
||||
(12, "Котельная"),
|
||||
(13, "Погреб"),
|
||||
(14, "Объект незавершенного строительства"),
|
||||
],
|
||||
null=True,
|
||||
),
|
||||
),
|
||||
("additional_number_1", models.CharField(blank=True, max_length=50)),
|
||||
(
|
||||
"additional_type_1",
|
||||
models.PositiveSmallIntegerField(
|
||||
blank=True,
|
||||
choices=[
|
||||
(1, "Владение"),
|
||||
(2, "Дом"),
|
||||
(3, "Домовладение"),
|
||||
(4, "Гараж"),
|
||||
(5, "Здание"),
|
||||
(6, "Шахта"),
|
||||
(7, "Строение"),
|
||||
(8, "Сооружение"),
|
||||
(9, "Литера"),
|
||||
(10, "Корпус"),
|
||||
(11, "Подвал"),
|
||||
(12, "Котельная"),
|
||||
(13, "Погреб"),
|
||||
(14, "Объект незавершенного строительства"),
|
||||
],
|
||||
null=True,
|
||||
),
|
||||
),
|
||||
("additional_number_2", models.CharField(blank=True, max_length=50)),
|
||||
(
|
||||
"additional_type_2",
|
||||
models.PositiveSmallIntegerField(
|
||||
blank=True,
|
||||
choices=[
|
||||
(1, "Владение"),
|
||||
(2, "Дом"),
|
||||
(3, "Домовладение"),
|
||||
(4, "Гараж"),
|
||||
(5, "Здание"),
|
||||
(6, "Шахта"),
|
||||
(7, "Строение"),
|
||||
(8, "Сооружение"),
|
||||
(9, "Литера"),
|
||||
(10, "Корпус"),
|
||||
(11, "Подвал"),
|
||||
(12, "Котельная"),
|
||||
(13, "Погреб"),
|
||||
(14, "Объект незавершенного строительства"),
|
||||
],
|
||||
null=True,
|
||||
),
|
||||
),
|
||||
(
|
||||
"source_updated_at",
|
||||
models.DateField(verbose_name="Дата обновления ФИАС"),
|
||||
),
|
||||
("is_actual", models.BooleanField(db_index=True, default=True)),
|
||||
("is_active", models.BooleanField(db_index=True, default=True)),
|
||||
(
|
||||
"parent",
|
||||
models.ForeignKey(
|
||||
blank=True,
|
||||
null=True,
|
||||
on_delete=django.db.models.deletion.SET_NULL,
|
||||
related_name="houses",
|
||||
to="address.addressobject",
|
||||
verbose_name="Родительский адресный объект",
|
||||
),
|
||||
),
|
||||
],
|
||||
options={
|
||||
"verbose_name": "Дом",
|
||||
"verbose_name_plural": "Дома",
|
||||
"ordering": (
|
||||
"house_number",
|
||||
"additional_number_1",
|
||||
"additional_number_2",
|
||||
),
|
||||
"indexes": [
|
||||
models.Index(fields=["parent", "house_number"], name="house_parent_number"),
|
||||
models.Index(
|
||||
fields=["region_code", "house_number"],
|
||||
name="house_region_number",
|
||||
),
|
||||
],
|
||||
},
|
||||
),
|
||||
]
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
from django.contrib.postgres.operations import TrigramExtension
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
def create_trgm_indexes(apps, schema_editor):
|
||||
if schema_editor.connection.vendor != "postgresql":
|
||||
return
|
||||
quote = schema_editor.quote_name
|
||||
address = quote(apps.get_model("address", "AddressObject")._meta.db_table)
|
||||
house = quote(apps.get_model("address", "House")._meta.db_table)
|
||||
schema_editor.execute(
|
||||
f"CREATE INDEX IF NOT EXISTS addr_name_trgm ON {address} "
|
||||
f"USING gin (replace(lower(name), 'ё', 'е') gin_trgm_ops)"
|
||||
)
|
||||
schema_editor.execute(
|
||||
f"CREATE INDEX IF NOT EXISTS house_number_trgm ON {house} "
|
||||
f"USING gin (house_number gin_trgm_ops)"
|
||||
)
|
||||
schema_editor.execute(
|
||||
f"CREATE INDEX IF NOT EXISTS house_add1_trgm ON {house} "
|
||||
f"USING gin (additional_number_1 gin_trgm_ops)"
|
||||
)
|
||||
schema_editor.execute(
|
||||
f"CREATE INDEX IF NOT EXISTS house_add2_trgm ON {house} "
|
||||
f"USING gin (additional_number_2 gin_trgm_ops)"
|
||||
)
|
||||
|
||||
|
||||
def drop_trgm_indexes(apps, schema_editor):
|
||||
if schema_editor.connection.vendor != "postgresql":
|
||||
return
|
||||
for name in ("addr_name_trgm", "house_number_trgm", "house_add1_trgm", "house_add2_trgm"):
|
||||
schema_editor.execute(f"DROP INDEX IF EXISTS {schema_editor.quote_name(name)}")
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
("address", "0001_initial"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
TrigramExtension(),
|
||||
migrations.RunPython(create_trgm_indexes, drop_trgm_indexes),
|
||||
]
|
||||
|
|
@ -5,13 +5,23 @@ from django.db import models
|
|||
from address.object_types import ADDRESS_OBJECT_TYPE_SHORT_NAMES, AddressObjectType
|
||||
|
||||
|
||||
def format_region_code(code: int | str) -> str:
|
||||
return f"{int(code):02d}"
|
||||
|
||||
|
||||
class AddressObject(models.Model):
|
||||
class Level(models.IntegerChoices):
|
||||
REGION = 1, "Регион"
|
||||
REGION = 1, "Субъект РФ"
|
||||
DISTRICT = 2, "Район"
|
||||
MUNICIPAL_DISTRICT = 3, "Муниципальный район"
|
||||
MUNICIPAL_SETTLEMENT = 4, "Поселение"
|
||||
CITY = 5, "Город"
|
||||
SETTLEMENT = 6, "Населённый пункт"
|
||||
PLANNING = 7, "Планировочная структура"
|
||||
STREET = 8, "Улица"
|
||||
|
||||
STREET_EXTRA_TYPE_NAMES = frozenset({"снт", "тер. снт"})
|
||||
|
||||
Type = AddressObjectType
|
||||
TYPE_SHORT_NAMES = ADDRESS_OBJECT_TYPE_SHORT_NAMES
|
||||
|
||||
|
|
@ -28,8 +38,8 @@ class AddressObject(models.Model):
|
|||
name = models.CharField(max_length=255, db_index=True, verbose_name="Название")
|
||||
type_name = models.CharField(max_length=50, blank=True, verbose_name="Тип")
|
||||
level = models.PositiveSmallIntegerField(choices=Level.choices, db_index=True)
|
||||
region_code = models.CharField(max_length=2, db_index=True, verbose_name="Код региона")
|
||||
postal_code = models.CharField(max_length=6, blank=True, db_index=True, verbose_name="Индекс")
|
||||
region_code = models.PositiveSmallIntegerField(db_index=True, verbose_name="Код субъекта РФ")
|
||||
kladr_id = models.CharField(max_length=17, blank=True, db_index=True, verbose_name="Код КЛАДР")
|
||||
is_active = models.BooleanField(default=True, db_index=True)
|
||||
|
||||
class Meta:
|
||||
|
|
@ -37,6 +47,7 @@ class AddressObject(models.Model):
|
|||
indexes = [
|
||||
models.Index(fields=("level", "region_code", "name"), name="addr_level_region_name"),
|
||||
models.Index(fields=("parent", "level", "name"), name="addr_parent_level_name"),
|
||||
# GIN pg_trgm indexes are created in 0002_pg_trgm_indexes (PostgreSQL only).
|
||||
]
|
||||
verbose_name = "Адресный объект"
|
||||
verbose_name_plural = "Адресные объекты"
|
||||
|
|
@ -79,8 +90,8 @@ class House(models.Model):
|
|||
14: "ОНС",
|
||||
}
|
||||
|
||||
object_id = models.BigIntegerField(unique=True, verbose_name="ID ФИАС")
|
||||
fias_id = models.UUIDField(default=uuid.uuid4, unique=True, verbose_name="GUID ФИАС")
|
||||
object_id = models.BigIntegerField(primary_key=True, verbose_name="ID ФИАС")
|
||||
fias_id = models.UUIDField(verbose_name="GUID ФИАС")
|
||||
parent = models.ForeignKey(
|
||||
AddressObject,
|
||||
null=True,
|
||||
|
|
@ -89,20 +100,20 @@ class House(models.Model):
|
|||
related_name="houses",
|
||||
verbose_name="Родительский адресный объект",
|
||||
)
|
||||
region_code = models.CharField(max_length=2, db_index=True, verbose_name="Код региона")
|
||||
house_number = models.CharField(max_length=50, blank=True, verbose_name="Номер")
|
||||
region_code = models.PositiveSmallIntegerField(db_index=True, verbose_name="Код субъекта РФ")
|
||||
house_number = models.CharField(max_length=50, blank=True, null=True, verbose_name="Номер")
|
||||
house_type = models.PositiveSmallIntegerField(choices=Type.choices, null=True, blank=True)
|
||||
additional_number_1 = models.CharField(max_length=50, blank=True)
|
||||
additional_number_1 = models.CharField(max_length=50, blank=True, null=True)
|
||||
additional_type_1 = models.PositiveSmallIntegerField(
|
||||
choices=Type.choices, null=True, blank=True
|
||||
)
|
||||
additional_number_2 = models.CharField(max_length=50, blank=True)
|
||||
additional_number_2 = models.CharField(max_length=50, blank=True, null=True)
|
||||
additional_type_2 = models.PositiveSmallIntegerField(
|
||||
choices=Type.choices, null=True, blank=True
|
||||
)
|
||||
source_updated_at = models.DateField(verbose_name="Дата обновления ФИАС")
|
||||
is_actual = models.BooleanField(default=True, db_index=True)
|
||||
is_active = models.BooleanField(default=True, db_index=True)
|
||||
postal_code = models.PositiveIntegerField(
|
||||
null=True, blank=True, db_index=True, verbose_name="Индекс"
|
||||
)
|
||||
|
||||
class Meta:
|
||||
ordering = ("house_number", "additional_number_1", "additional_number_2")
|
||||
|
|
|
|||
|
|
@ -7,6 +7,9 @@ env = environ.Env(
|
|||
DJANGO_DEBUG=(bool, False),
|
||||
DJANGO_ALLOWED_HOSTS=(list, ["localhost", "127.0.0.1"]),
|
||||
URL_PREFIX=(str, "api-address"),
|
||||
GRPC_HOST=(str, "[::]"),
|
||||
GRPC_PORT=(int, 50051),
|
||||
GRPC_WORKERS=(int, 10),
|
||||
)
|
||||
environ.Env.read_env(BASE_DIR / ".env")
|
||||
|
||||
|
|
@ -14,6 +17,9 @@ SECRET_KEY = env("DJANGO_SECRET_KEY", default="unsafe-development-key")
|
|||
DEBUG = env.bool("DJANGO_DEBUG")
|
||||
ALLOWED_HOSTS = env.list("DJANGO_ALLOWED_HOSTS")
|
||||
URL_PREFIX = env("URL_PREFIX").strip("/")
|
||||
GRPC_HOST = env("GRPC_HOST")
|
||||
GRPC_PORT = env.int("GRPC_PORT")
|
||||
GRPC_WORKERS = env.int("GRPC_WORKERS")
|
||||
|
||||
INSTALLED_APPS = [
|
||||
"django.contrib.admin",
|
||||
|
|
@ -23,6 +29,8 @@ INSTALLED_APPS = [
|
|||
"django.contrib.messages",
|
||||
"django.contrib.staticfiles",
|
||||
"django.contrib.postgres",
|
||||
"constance",
|
||||
"constance.backends.database",
|
||||
"address.apps.AddressConfig",
|
||||
]
|
||||
|
||||
|
|
@ -69,3 +77,22 @@ USE_TZ = True
|
|||
STATIC_URL = f"/{URL_PREFIX + '/' if URL_PREFIX else ''}django_static/"
|
||||
STATIC_ROOT = BASE_DIR / "staticfiles"
|
||||
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
|
||||
|
||||
CONSTANCE_BACKEND = "constance.backends.database.DatabaseBackend"
|
||||
CONSTANCE_ADDITIONAL_FIELDS = {
|
||||
"dadata_token": [
|
||||
"django.forms.fields.CharField",
|
||||
{
|
||||
"widget": "django.forms.PasswordInput",
|
||||
"widget_kwargs": {"render_value": True},
|
||||
"required": False,
|
||||
},
|
||||
],
|
||||
}
|
||||
CONSTANCE_CONFIG = {
|
||||
"DADATA_IS_ENABLED": (False, "Включить интеграцию с DaData"),
|
||||
"DADATA_TOKEN": ("", "API-токен DaData", "dadata_token"),
|
||||
}
|
||||
CONSTANCE_CONFIG_FIELDSETS = {
|
||||
"DaData": ("DADATA_IS_ENABLED", "DADATA_TOKEN"),
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,61 @@
|
|||
import uuid
|
||||
|
||||
import pytest
|
||||
from django.contrib.auth.models import User
|
||||
from django.test import Client
|
||||
|
||||
from address.models import AddressObject, House
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def admin_client(db):
|
||||
user = User.objects.create_superuser("admin", "admin@example.com", "secret")
|
||||
client = Client()
|
||||
client.force_login(user)
|
||||
return client
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_address_admin_has_children_filter_link(admin_client):
|
||||
parent = AddressObject.objects.create(
|
||||
fias_id=uuid.uuid4(),
|
||||
name="Владивосток",
|
||||
type_name="г",
|
||||
level=AddressObject.Level.CITY,
|
||||
region_code=25,
|
||||
)
|
||||
child = AddressObject.objects.create(
|
||||
fias_id=uuid.uuid4(),
|
||||
name="Светланская",
|
||||
type_name="ул",
|
||||
level=AddressObject.Level.STREET,
|
||||
region_code=25,
|
||||
parent=parent,
|
||||
)
|
||||
House.objects.create(
|
||||
object_id=500,
|
||||
fias_id=uuid.uuid4(),
|
||||
region_code=25,
|
||||
house_number="10",
|
||||
house_type=House.Type.HOUSE,
|
||||
parent=parent,
|
||||
)
|
||||
|
||||
response = admin_client.get("/api-address/admin/address/addressobject/")
|
||||
assert response.status_code == 200
|
||||
html = response.content.decode()
|
||||
assert f"?parent={parent.pk}" in html
|
||||
assert "объекты (1)" in html
|
||||
assert "дома (1)" in html
|
||||
|
||||
response = admin_client.get(
|
||||
f"/api-address/admin/address/addressobject/?parent={parent.pk}"
|
||||
)
|
||||
assert response.status_code == 200
|
||||
html = response.content.decode()
|
||||
assert child.name in html
|
||||
assert parent.name not in html or html.count(child.name) >= 1
|
||||
|
||||
response = admin_client.get(f"/api-address/admin/address/house/?parent={parent.pk}")
|
||||
assert response.status_code == 200
|
||||
assert "д. 10" in response.content.decode()
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
import uuid
|
||||
|
||||
import pytest
|
||||
from django.db import connection
|
||||
from django.test import Client
|
||||
|
||||
from address.models import AddressObject
|
||||
|
|
@ -53,6 +54,306 @@ def test_streets_can_be_filtered_by_parent(addresses):
|
|||
assert response.json()["count"] == 1
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_streets_can_be_filtered_by_region_without_parent(addresses):
|
||||
response = Client().get("/api-address/streets", {"region_code": "25"})
|
||||
assert response.status_code == 200
|
||||
assert response.json()["count"] == 1
|
||||
assert response.json()["items"][0]["name"] == "Светланская"
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_streets_include_parent_object(addresses):
|
||||
region, city = addresses
|
||||
response = Client().get("/api-address/streets", {"region_code": "25", "query": "свет"})
|
||||
|
||||
assert response.status_code == 200
|
||||
item = response.json()["items"][0]
|
||||
assert item["name"] == "Светланская"
|
||||
assert item["parent"]["id"] == city.pk
|
||||
assert item["parent"]["name"] == "Владивосток"
|
||||
assert item["parent"]["level"] == AddressObject.Level.CITY
|
||||
assert item["parent"]["parent_id"] == region.pk
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_streets_include_planning_structures(addresses):
|
||||
_, city = addresses
|
||||
snt = AddressObject.objects.create(
|
||||
fias_id=uuid.uuid4(),
|
||||
name="Авиатор",
|
||||
type_name="снт",
|
||||
level=AddressObject.Level.PLANNING,
|
||||
region_code="25",
|
||||
parent=city,
|
||||
)
|
||||
AddressObject.objects.create(
|
||||
fias_id=uuid.uuid4(),
|
||||
name="Ильмовый",
|
||||
type_name="мкр.",
|
||||
level=AddressObject.Level.PLANNING,
|
||||
region_code="25",
|
||||
parent=city,
|
||||
)
|
||||
AddressObject.objects.create(
|
||||
fias_id=uuid.uuid4(),
|
||||
name="Центр",
|
||||
type_name="кв-л",
|
||||
level=AddressObject.Level.PLANNING,
|
||||
region_code="25",
|
||||
parent=city,
|
||||
)
|
||||
AddressObject.objects.create(
|
||||
fias_id=uuid.uuid4(),
|
||||
name="Трудовое",
|
||||
type_name="п",
|
||||
level=AddressObject.Level.SETTLEMENT,
|
||||
region_code="25",
|
||||
parent=city,
|
||||
)
|
||||
|
||||
response = Client().get("/api-address/streets", {"parent_id": city.pk, "fuzzy": "false"})
|
||||
|
||||
assert response.status_code == 200
|
||||
names = {item["name"] for item in response.json()["items"]}
|
||||
assert names == {"Светланская", "Авиатор", "Ильмовый", "Центр"}
|
||||
assert snt.pk in {item["id"] for item in response.json()["items"]}
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_streets_include_streets_inside_snt(addresses):
|
||||
_, city = addresses
|
||||
snt = AddressObject.objects.create(
|
||||
fias_id=uuid.uuid4(),
|
||||
name="Сокол",
|
||||
type_name="снт",
|
||||
level=AddressObject.Level.PLANNING,
|
||||
region_code="25",
|
||||
parent=city,
|
||||
)
|
||||
inner = AddressObject.objects.create(
|
||||
fias_id=uuid.uuid4(),
|
||||
name="2-я Садовая",
|
||||
type_name="ул",
|
||||
level=AddressObject.Level.STREET,
|
||||
region_code="25",
|
||||
parent=snt,
|
||||
)
|
||||
|
||||
response = Client().get("/api-address/streets", {"parent_id": city.pk, "fuzzy": "false"})
|
||||
|
||||
assert response.status_code == 200
|
||||
items = {item["name"]: item for item in response.json()["items"]}
|
||||
assert set(items) == {"Светланская", "Сокол", "2-я Садовая"}
|
||||
assert items["2-я Садовая"]["parent"]["id"] == snt.pk
|
||||
assert items["2-я Садовая"]["parent"]["name"] == "Сокол"
|
||||
assert inner.pk == items["2-я Садовая"]["id"]
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_streets_include_streets_of_settlement_in_district(addresses):
|
||||
region, _city = addresses
|
||||
district = AddressObject.objects.create(
|
||||
fias_id=uuid.uuid4(),
|
||||
name="Лазовский",
|
||||
type_name="р-н",
|
||||
level=AddressObject.Level.DISTRICT,
|
||||
region_code="25",
|
||||
parent=region,
|
||||
)
|
||||
village = AddressObject.objects.create(
|
||||
fias_id=uuid.uuid4(),
|
||||
name="Лазо",
|
||||
type_name="с.",
|
||||
level=AddressObject.Level.SETTLEMENT,
|
||||
region_code="25",
|
||||
parent=district,
|
||||
)
|
||||
AddressObject.objects.create(
|
||||
fias_id=uuid.uuid4(),
|
||||
name="С.Лазо",
|
||||
type_name="ул.",
|
||||
level=AddressObject.Level.STREET,
|
||||
region_code="25",
|
||||
parent=village,
|
||||
)
|
||||
|
||||
response = Client().get("/api-address/streets", {"parent_id": district.pk, "fuzzy": "false"})
|
||||
|
||||
assert response.status_code == 200
|
||||
assert {item["name"] for item in response.json()["items"]} == {"С.Лазо"}
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_localities_are_settlements_in_region_excluding_streets(addresses):
|
||||
region, city = addresses
|
||||
district = AddressObject.objects.create(
|
||||
fias_id=uuid.UUID("43466e8d-ebc4-4d46-9010-1099778371f7"),
|
||||
name="Комсомольский",
|
||||
type_name="р-н",
|
||||
level=AddressObject.Level.DISTRICT,
|
||||
region_code="25",
|
||||
parent=region,
|
||||
)
|
||||
rural = AddressObject.objects.create(
|
||||
fias_id=uuid.UUID("a9a983b7-9ae9-4206-8328-924493f03230"),
|
||||
name="Джигда",
|
||||
type_name="с.",
|
||||
level=AddressObject.Level.SETTLEMENT,
|
||||
region_code="25",
|
||||
parent=district,
|
||||
)
|
||||
settlement = AddressObject.objects.create(
|
||||
fias_id=uuid.uuid4(),
|
||||
name="Трудовое",
|
||||
type_name="п",
|
||||
level=AddressObject.Level.SETTLEMENT,
|
||||
region_code="25",
|
||||
parent=city,
|
||||
)
|
||||
AddressObject.objects.create(
|
||||
fias_id=uuid.uuid4(),
|
||||
name="Хабаровск",
|
||||
type_name="г",
|
||||
level=AddressObject.Level.CITY,
|
||||
region_code="27",
|
||||
)
|
||||
|
||||
response = Client().get("/api-address/localities", {"region_id": "25", "query": "комс"})
|
||||
|
||||
assert response.status_code == 200
|
||||
items = response.json()["items"]
|
||||
assert items[0]["fias_id"] == "43466e8d-ebc4-4d46-9010-1099778371f7"
|
||||
assert items[0]["name"] == "Комсомольский"
|
||||
|
||||
response = Client().get("/api-address/localities", {"region_id": "25", "query": "джигд"})
|
||||
assert response.status_code == 200
|
||||
assert response.json()["items"][0]["fias_id"] == "a9a983b7-9ae9-4206-8328-924493f03230"
|
||||
assert response.json()["items"][0]["type_name"] == "с."
|
||||
|
||||
response = Client().get("/api-address/localities", {"region_id": "25"})
|
||||
items = response.json()["items"]
|
||||
assert {item["name"] for item in items} == {
|
||||
"Владивосток",
|
||||
"Трудовое",
|
||||
"Комсомольский",
|
||||
"Джигда",
|
||||
}
|
||||
assert {item["id"] for item in items} == {city.pk, settlement.pk, district.pk, rural.pk}
|
||||
assert region.name not in {item["name"] for item in items}
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_localities_exclude_municipal_branch(addresses):
|
||||
region, city = addresses
|
||||
AddressObject.objects.create(
|
||||
fias_id=uuid.uuid4(),
|
||||
name="Дальнереченский",
|
||||
type_name="м.р-н",
|
||||
level=AddressObject.Level.MUNICIPAL_DISTRICT,
|
||||
region_code="25",
|
||||
parent=region,
|
||||
)
|
||||
AddressObject.objects.create(
|
||||
fias_id=uuid.uuid4(),
|
||||
name="Сальское",
|
||||
type_name="с.п.",
|
||||
level=AddressObject.Level.MUNICIPAL_SETTLEMENT,
|
||||
region_code="25",
|
||||
parent=region,
|
||||
)
|
||||
|
||||
response = Client().get("/api-address/localities", {"region_id": "25", "limit": "100"})
|
||||
|
||||
assert response.status_code == 200
|
||||
names = {item["name"] for item in response.json()["items"]}
|
||||
assert names == {city.name}
|
||||
assert "Дальнереченский" not in names
|
||||
assert "Сальское" not in names
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_localities_include_district_parent(addresses):
|
||||
region, _city = addresses
|
||||
district = AddressObject.objects.create(
|
||||
fias_id=uuid.uuid4(),
|
||||
name="Лазовский",
|
||||
type_name="р-н",
|
||||
level=AddressObject.Level.DISTRICT,
|
||||
region_code="25",
|
||||
parent=region,
|
||||
)
|
||||
AddressObject.objects.create(
|
||||
fias_id=uuid.uuid4(),
|
||||
name="Лазо",
|
||||
type_name="с.",
|
||||
level=AddressObject.Level.SETTLEMENT,
|
||||
region_code="25",
|
||||
parent=district,
|
||||
)
|
||||
|
||||
response = Client().get(
|
||||
"/api-address/localities",
|
||||
{"region_id": "25", "fuzzy": "false", "limit": 100},
|
||||
)
|
||||
|
||||
assert response.status_code == 200
|
||||
item = next(row for row in response.json()["items"] if row["name"] == "Лазо")
|
||||
assert item["parent"]["id"] == district.pk
|
||||
assert item["parent"]["name"] == "Лазовский"
|
||||
assert item["parent"]["type_name"] == "р-н"
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_localities_order_cities_then_pgt(addresses):
|
||||
region, city = addresses
|
||||
AddressObject.objects.create(
|
||||
fias_id=uuid.uuid4(),
|
||||
name="Андреевка",
|
||||
type_name="с.",
|
||||
level=AddressObject.Level.SETTLEMENT,
|
||||
region_code="25",
|
||||
parent=region,
|
||||
)
|
||||
AddressObject.objects.create(
|
||||
fias_id=uuid.uuid4(),
|
||||
name="Трудовое",
|
||||
type_name="пгт.",
|
||||
level=AddressObject.Level.CITY,
|
||||
region_code="25",
|
||||
parent=region,
|
||||
)
|
||||
AddressObject.objects.create(
|
||||
fias_id=uuid.uuid4(),
|
||||
name="Артём",
|
||||
type_name="г.",
|
||||
level=AddressObject.Level.CITY,
|
||||
region_code="25",
|
||||
parent=region,
|
||||
)
|
||||
|
||||
response = Client().get(
|
||||
"/api-address/localities",
|
||||
{"region_id": "25", "fuzzy": "false"},
|
||||
)
|
||||
|
||||
assert response.status_code == 200
|
||||
items = response.json()["items"]
|
||||
assert [(item["type_name"], item["name"]) for item in items] == [
|
||||
("г.", "Артём"),
|
||||
("г", "Владивосток"),
|
||||
("пгт.", "Трудовое"),
|
||||
("с.", "Андреевка"),
|
||||
]
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_localities_require_region_id(addresses):
|
||||
response = Client().get("/api-address/localities")
|
||||
|
||||
assert response.status_code == 422
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_search_tolerates_typo(addresses):
|
||||
response = Client().get("/api-address/cities", {"query": "Владивостак"})
|
||||
|
|
@ -60,6 +361,35 @@ def test_search_tolerates_typo(addresses):
|
|||
assert response.json()["items"][0]["name"] == "Владивосток"
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_search_treats_yo_as_ye(addresses):
|
||||
AddressObject.objects.create(
|
||||
fias_id=uuid.uuid4(),
|
||||
name="Орёл",
|
||||
type_name="г",
|
||||
level=5,
|
||||
region_code=57,
|
||||
)
|
||||
|
||||
response = Client().get("/api-address/cities", {"query": "орел", "region_code": "57"})
|
||||
|
||||
assert response.status_code == 200
|
||||
assert response.json()["items"][0]["name"] == "Орёл"
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_strict_search_matches_folded_name(addresses):
|
||||
if connection.vendor != "postgresql":
|
||||
pytest.skip("folded ILIKE needs PostgreSQL")
|
||||
|
||||
response = Client().get(
|
||||
"/api-address/cities",
|
||||
{"query": "ВЛАД", "region_code": "25", "fuzzy": "false"},
|
||||
)
|
||||
assert response.status_code == 200
|
||||
assert response.json()["items"][0]["name"] == "Владивосток"
|
||||
|
||||
|
||||
def test_health():
|
||||
response = Client().get("/api-address/health")
|
||||
assert response.status_code == 200
|
||||
|
|
|
|||
|
|
@ -0,0 +1,72 @@
|
|||
import pytest
|
||||
from constance.test import override_config
|
||||
from django.test import Client
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_dadata_streets_require_region_and_city():
|
||||
response = Client().get("/api-address/dadata/streets")
|
||||
|
||||
assert response.status_code == 422
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_dadata_streets_disabled_by_default():
|
||||
response = Client().get(
|
||||
"/api-address/dadata/streets",
|
||||
{"region_code": "28", "city": "Благовещенск"},
|
||||
)
|
||||
|
||||
assert response.status_code == 503
|
||||
assert response.json() == {"detail": "Интеграция с DaData отключена"}
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
@override_config(DADATA_IS_ENABLED=True)
|
||||
def test_dadata_streets_require_token_when_enabled():
|
||||
response = Client().get(
|
||||
"/api-address/dadata/streets",
|
||||
{"region_code": "28", "city": "Благовещенск", "query": "ленин"},
|
||||
)
|
||||
|
||||
assert response.status_code == 503
|
||||
assert response.json() == {"detail": "Не задан токен DaData"}
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
@override_config(DADATA_IS_ENABLED=True, DADATA_TOKEN="test-token")
|
||||
def test_dadata_streets_return_empty_without_integration():
|
||||
response = Client().get(
|
||||
"/api-address/dadata/streets",
|
||||
{"region_code": "28", "city": "Благовещенск", "query": "ленин"},
|
||||
)
|
||||
|
||||
assert response.status_code == 200
|
||||
assert response.json() == {"count": 0, "items": []}
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_dadata_houses_require_street():
|
||||
response = Client().get(
|
||||
"/api-address/dadata/houses",
|
||||
{"region_code": "28", "city": "Благовещенск"},
|
||||
)
|
||||
|
||||
assert response.status_code == 422
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
@override_config(DADATA_IS_ENABLED=True, DADATA_TOKEN="test-token")
|
||||
def test_dadata_houses_return_empty_without_integration():
|
||||
response = Client().get(
|
||||
"/api-address/dadata/houses",
|
||||
{
|
||||
"region_code": "28",
|
||||
"city": "Благовещенск",
|
||||
"street": "Ленина",
|
||||
"query": "10",
|
||||
},
|
||||
)
|
||||
|
||||
assert response.status_code == 200
|
||||
assert response.json() == {"count": 0, "items": []}
|
||||
|
|
@ -0,0 +1,82 @@
|
|||
from uuid import uuid4
|
||||
|
||||
import pytest
|
||||
from django.core.management import call_command
|
||||
|
||||
from address.models import AddressObject, House
|
||||
|
||||
|
||||
def _object(
|
||||
*, object_id: int, name: str, level: int, type_name: str, region_code=25
|
||||
) -> AddressObject:
|
||||
return AddressObject.objects.create(
|
||||
fias_id=uuid4(),
|
||||
object_id=object_id,
|
||||
name=name,
|
||||
type_name=type_name,
|
||||
level=level,
|
||||
region_code=region_code,
|
||||
)
|
||||
|
||||
|
||||
def _house(*, object_id: int, parent: AddressObject, region_code: int = 25) -> House:
|
||||
return House.objects.create(
|
||||
fias_id=uuid4(),
|
||||
object_id=object_id,
|
||||
parent=parent,
|
||||
region_code=region_code,
|
||||
house_number=str(object_id),
|
||||
house_type=House.Type.HOUSE,
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_deletes_houses_on_city_district_and_settlement():
|
||||
city = _object(object_id=100, name="Владивосток", level=5, type_name="г")
|
||||
district = _object(object_id=200, name="Красноармейский", level=2, type_name="р-н")
|
||||
village = _object(object_id=300, name="Новонежино", level=6, type_name="с.")
|
||||
settlement = _object(object_id=400, name="Трудовое", level=6, type_name="п")
|
||||
hamlet = _object(object_id=800, name="Ключи", level=6, type_name="д")
|
||||
street = _object(object_id=500, name="Светланская", level=8, type_name="ул")
|
||||
snt = _object(object_id=600, name="Авиатор", level=7, type_name="снт")
|
||||
municipal = _object(object_id=700, name="Джигдинское", level=4, type_name="с.п.")
|
||||
|
||||
_house(object_id=1, parent=city)
|
||||
_house(object_id=2, parent=district)
|
||||
_house(object_id=3, parent=village)
|
||||
_house(object_id=4, parent=settlement)
|
||||
keep_street = _house(object_id=5, parent=street)
|
||||
keep_snt = _house(object_id=6, parent=snt)
|
||||
_house(object_id=7, parent=municipal)
|
||||
_house(object_id=8, parent=hamlet)
|
||||
|
||||
call_command("delete_houses")
|
||||
|
||||
assert set(House.objects.values_list("object_id", flat=True)) == {
|
||||
keep_street.object_id,
|
||||
keep_snt.object_id,
|
||||
}
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_dry_run_does_not_delete():
|
||||
settlement = _object(object_id=400, name="Трудовое", level=6, type_name="п")
|
||||
_house(object_id=1, parent=settlement)
|
||||
|
||||
call_command("delete_houses", dry_run=True)
|
||||
|
||||
assert House.objects.filter(object_id=1).exists()
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_region_code_limits_deletion():
|
||||
settlement_25 = _object(object_id=400, name="Трудовое", level=6, type_name="п")
|
||||
settlement_27 = _object(
|
||||
object_id=401, name="Хурба", level=6, type_name="п", region_code=27
|
||||
)
|
||||
_house(object_id=1, parent=settlement_25, region_code=25)
|
||||
keep = _house(object_id=2, parent=settlement_27, region_code=27)
|
||||
|
||||
call_command("delete_houses", region_code=25)
|
||||
|
||||
assert list(House.objects.values_list("object_id", flat=True)) == [keep.object_id]
|
||||
|
|
@ -0,0 +1,90 @@
|
|||
import zipfile
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
from django.core.management.base import CommandError
|
||||
|
||||
from address.fias_archive import (
|
||||
KIND_ADDRESSES,
|
||||
KIND_ADDR_PARAMS,
|
||||
KIND_HIERARCHY,
|
||||
KIND_HOUSE_PARAMS,
|
||||
KIND_HOUSES,
|
||||
KIND_MUN_HIERARCHY,
|
||||
infer_region_code,
|
||||
iter_fias_xml,
|
||||
list_fias_members,
|
||||
)
|
||||
|
||||
|
||||
NAMES = [
|
||||
"AS_ADDR_OBJ_TYPES_20260827_aaaa.XML",
|
||||
"25/AS_ADDR_OBJ_20260827_c8c60935-db01-4652-8977-53afcfb4f379.XML",
|
||||
"25/AS_ADDR_OBJ_PARAMS_20260827_bbbb.XML",
|
||||
"25/AS_ADDR_OBJ_DIVISION_20260827_cccc.XML",
|
||||
"25/AS_HOUSES_20260827_10a37bf2-3964-45d4-9094-ad39688cf099.XML",
|
||||
"25/AS_HOUSES_PARAMS_20260827_dddd.XML",
|
||||
"25/AS_ADM_HIERARCHY_20260827_19e88f9d-7cc4-4175-9783-e980fde63274.XML",
|
||||
"25/AS_MUN_HIERARCHY_20260827_eeee.XML",
|
||||
"77/AS_ADDR_OBJ_20260827_ffff.XML",
|
||||
]
|
||||
|
||||
|
||||
def test_lists_only_data_xml_and_skips_params_types_and_mun_hierarchy():
|
||||
assert list_fias_members(NAMES, KIND_ADDRESSES) == [
|
||||
("25", "25/AS_ADDR_OBJ_20260827_c8c60935-db01-4652-8977-53afcfb4f379.XML"),
|
||||
("77", "77/AS_ADDR_OBJ_20260827_ffff.XML"),
|
||||
]
|
||||
assert list_fias_members(NAMES, KIND_HOUSES) == [
|
||||
("25", "25/AS_HOUSES_20260827_10a37bf2-3964-45d4-9094-ad39688cf099.XML"),
|
||||
]
|
||||
assert list_fias_members(NAMES, KIND_HIERARCHY) == [
|
||||
("25", "25/AS_ADM_HIERARCHY_20260827_19e88f9d-7cc4-4175-9783-e980fde63274.XML"),
|
||||
]
|
||||
assert list_fias_members(NAMES, KIND_MUN_HIERARCHY) == [
|
||||
("25", "25/AS_MUN_HIERARCHY_20260827_eeee.XML"),
|
||||
]
|
||||
assert list_fias_members(NAMES, KIND_ADDR_PARAMS) == [
|
||||
("25", "25/AS_ADDR_OBJ_PARAMS_20260827_bbbb.XML"),
|
||||
]
|
||||
assert list_fias_members(NAMES, KIND_HOUSE_PARAMS) == [
|
||||
("25", "25/AS_HOUSES_PARAMS_20260827_dddd.XML"),
|
||||
]
|
||||
|
||||
|
||||
def test_filters_zip_members_by_region():
|
||||
assert list_fias_members(NAMES, KIND_ADDRESSES, region_code="25") == [
|
||||
("25", "25/AS_ADDR_OBJ_20260827_c8c60935-db01-4652-8977-53afcfb4f379.XML"),
|
||||
]
|
||||
|
||||
|
||||
def test_infer_region_code_from_zip_member_path():
|
||||
assert infer_region_code("25/AS_ADDR_OBJ_20260827_abcd.XML") == "25"
|
||||
assert infer_region_code(Path("/data/77/AS_HOUSES.xml")) == "77"
|
||||
assert infer_region_code("AS_ADDR_OBJ.xml") is None
|
||||
|
||||
|
||||
def test_iter_fias_xml_reads_zip_member_without_extracting(tmp_path):
|
||||
archive = tmp_path / "gar_xml.zip"
|
||||
member = "25/AS_ADDR_OBJ_20260827_11111111-1111-1111-1111-111111111111.XML"
|
||||
with zipfile.ZipFile(archive, "w") as zf:
|
||||
zf.writestr(member, "<ADDRESSOBJECTS />")
|
||||
zf.writestr("25/AS_ADDR_OBJ_PARAMS_20260827_2222.XML", "<PARAMS />")
|
||||
|
||||
sources = [
|
||||
(label, region, source.read())
|
||||
for label, region, source in iter_fias_xml(archive, KIND_ADDRESSES)
|
||||
]
|
||||
assert [(label, region) for label, region, _data in sources] == [(member, "25")]
|
||||
assert sources[0][2] == b"<ADDRESSOBJECTS />"
|
||||
extracted = [path for path in tmp_path.rglob("*") if path != archive and path.is_file()]
|
||||
assert extracted == []
|
||||
|
||||
|
||||
def test_iter_fias_xml_rejects_zip_without_matching_files(tmp_path):
|
||||
archive = tmp_path / "empty.zip"
|
||||
with zipfile.ZipFile(archive, "w") as zf:
|
||||
zf.writestr("25/AS_ADDR_OBJ_PARAMS_20260827_2222.XML", "<PARAMS />")
|
||||
|
||||
with pytest.raises(CommandError, match="AS_ADDR_OBJ"):
|
||||
list(iter_fias_xml(archive, KIND_ADDRESSES))
|
||||
|
|
@ -0,0 +1,169 @@
|
|||
import uuid
|
||||
|
||||
import grpc
|
||||
import pytest
|
||||
|
||||
from address.grpc import address_pb2, address_pb2_grpc
|
||||
from address.grpc.server import create_server
|
||||
from address.grpc.servicer import AddressServicer
|
||||
from address.models import AddressObject, House
|
||||
|
||||
|
||||
class _Context:
|
||||
def abort(self, code, details):
|
||||
error = grpc.RpcError(details)
|
||||
error.code = lambda: code
|
||||
error.details = lambda: details
|
||||
raise error
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def addresses(db):
|
||||
region = AddressObject.objects.create(
|
||||
fias_id=uuid.uuid4(), name="Приморский", type_name="край", level=1, region_code="25"
|
||||
)
|
||||
city = AddressObject.objects.create(
|
||||
fias_id=uuid.uuid4(),
|
||||
name="Владивосток",
|
||||
type_name="г",
|
||||
level=5,
|
||||
region_code="25",
|
||||
parent=region,
|
||||
)
|
||||
AddressObject.objects.create(
|
||||
fias_id=uuid.uuid4(),
|
||||
name="Светланская",
|
||||
type_name="ул",
|
||||
level=8,
|
||||
region_code="25",
|
||||
parent=city,
|
||||
)
|
||||
return region, city
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_search_cities(addresses):
|
||||
response = AddressServicer().SearchCities(
|
||||
address_pb2.SearchRequest(query="влад", region_code="25"),
|
||||
_Context(),
|
||||
)
|
||||
|
||||
assert response.count == 1
|
||||
assert response.items[0].name == "Владивосток"
|
||||
assert response.items[0].region_code == "25"
|
||||
assert response.items[0].parent_id == addresses[0].pk
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_search_requires_region_code(addresses):
|
||||
with pytest.raises(grpc.RpcError) as error:
|
||||
AddressServicer().Search(
|
||||
address_pb2.UniversalSearchRequest(query="Владивосток"),
|
||||
_Context(),
|
||||
)
|
||||
|
||||
assert error.value.code() == grpc.StatusCode.INVALID_ARGUMENT
|
||||
assert error.value.details() == "Для поиска необходимо указать region_code"
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_search_streets_by_parent(addresses):
|
||||
region, city = addresses
|
||||
response = AddressServicer().SearchStreets(
|
||||
address_pb2.SearchRequest(parent_id=city.pk),
|
||||
_Context(),
|
||||
)
|
||||
|
||||
assert response.count == 1
|
||||
assert response.items[0].name == "Светланская"
|
||||
assert response.items[0].HasField("parent")
|
||||
assert response.items[0].parent.id == city.pk
|
||||
assert response.items[0].parent.name == "Владивосток"
|
||||
assert response.items[0].parent.level == AddressObject.Level.CITY
|
||||
assert response.items[0].parent.parent_id == region.pk
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_search_localities(addresses):
|
||||
response = AddressServicer().SearchLocalities(
|
||||
address_pb2.LocalitySearchRequest(region_id=25, query="влад"),
|
||||
_Context(),
|
||||
)
|
||||
|
||||
assert response.items[0].name == "Владивосток"
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_universal_search_by_kind(addresses):
|
||||
response = AddressServicer().Search(
|
||||
address_pb2.UniversalSearchRequest(
|
||||
query="влад",
|
||||
region_code="25",
|
||||
kind=address_pb2.SEARCH_KIND_CITY,
|
||||
),
|
||||
_Context(),
|
||||
)
|
||||
|
||||
assert response.items[0].name == "Владивосток"
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_search_localities_requires_region_id(addresses):
|
||||
with pytest.raises(grpc.RpcError) as error:
|
||||
AddressServicer().SearchLocalities(
|
||||
address_pb2.LocalitySearchRequest(),
|
||||
_Context(),
|
||||
)
|
||||
|
||||
assert error.value.code() == grpc.StatusCode.INVALID_ARGUMENT
|
||||
assert error.value.details() == "Для поиска необходимо указать region_id"
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_search_houses_by_parent_and_number(addresses):
|
||||
street = AddressObject.objects.get(name="Светланская")
|
||||
house = House.objects.create(
|
||||
fias_id=uuid.uuid4(),
|
||||
object_id=500,
|
||||
parent=street,
|
||||
region_code=25,
|
||||
house_number="10",
|
||||
house_type=House.Type.HOUSE,
|
||||
additional_number_1="3",
|
||||
additional_type_1=House.Type.BLOCK,
|
||||
)
|
||||
|
||||
response = AddressServicer().SearchHouses(
|
||||
address_pb2.SearchRequest(parent_id=street.pk, query="10"),
|
||||
_Context(),
|
||||
)
|
||||
|
||||
assert response.count == 1
|
||||
item = response.items[0]
|
||||
assert item.fias_id == str(house.fias_id)
|
||||
assert item.object_id == 500
|
||||
assert item.parent_id == street.pk
|
||||
assert item.region_code == "25"
|
||||
assert item.house_number == "10"
|
||||
assert item.house_type == 2
|
||||
assert item.additional_number_1 == "3"
|
||||
assert item.additional_type_1 == 10
|
||||
assert item.display_number == "д. 10 к. 3"
|
||||
|
||||
|
||||
def test_health():
|
||||
response = AddressServicer().Health(address_pb2.HealthRequest(), _Context())
|
||||
assert response.status == "ok"
|
||||
|
||||
|
||||
def test_server_serves_health_over_channel():
|
||||
server, address = create_server(host="127.0.0.1", port=0)
|
||||
server.start()
|
||||
try:
|
||||
with grpc.insecure_channel(address) as channel:
|
||||
stub = address_pb2_grpc.AddressServiceStub(channel)
|
||||
response = stub.Health(address_pb2.HealthRequest())
|
||||
finally:
|
||||
server.stop(grace=None)
|
||||
|
||||
assert response.status == "ok"
|
||||
|
|
@ -20,21 +20,18 @@ def test_houses_are_searched_by_parent_and_number():
|
|||
fias_id=uuid.uuid4(),
|
||||
object_id=500,
|
||||
parent=street,
|
||||
region_code="25",
|
||||
region_code=25,
|
||||
house_number="10",
|
||||
house_type=House.Type.HOUSE,
|
||||
additional_number_1="3",
|
||||
additional_type_1=House.Type.BLOCK,
|
||||
source_updated_at="2026-01-02",
|
||||
)
|
||||
House.objects.create(
|
||||
fias_id=uuid.uuid4(),
|
||||
object_id=501,
|
||||
parent=street,
|
||||
region_code="25",
|
||||
region_code=25,
|
||||
house_number="11",
|
||||
source_updated_at="2026-01-02",
|
||||
is_active=False,
|
||||
)
|
||||
|
||||
response = Client().get("/api-address/houses", {"parent_id": street.pk, "query": "10"})
|
||||
|
|
@ -54,6 +51,7 @@ def test_houses_are_searched_by_parent_and_number():
|
|||
"additional_type_1": 10,
|
||||
"additional_number_2": "",
|
||||
"additional_type_2": None,
|
||||
"postal_code": "",
|
||||
"display_number": "д. 10 к. 3",
|
||||
}
|
||||
],
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ def test_imports_and_updates_fias_xml(tmp_path):
|
|||
city = AddressObject.objects.get(fias_id=UUID("11111111-1111-1111-1111-111111111111"))
|
||||
assert city.object_id == 100
|
||||
assert city.name == "Владивосток"
|
||||
assert city.region_code == "25"
|
||||
assert city.region_code == 25
|
||||
assert city.is_active is True
|
||||
assert AddressObject.objects.count() == 1
|
||||
|
||||
|
|
@ -78,3 +78,189 @@ def test_region_code_is_required_when_it_cannot_be_inferred(tmp_path):
|
|||
|
||||
with pytest.raises(CommandError, match="--region-code"):
|
||||
call_command("import_addresses", xml)
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_skips_inactive_objects(tmp_path):
|
||||
region_dir = tmp_path / "27"
|
||||
region_dir.mkdir()
|
||||
xml = region_dir / "AS_ADDR_OBJ.xml"
|
||||
xml.write_text(
|
||||
"""<?xml version="1.0" encoding="utf-8"?>
|
||||
<ADDRESSOBJECTS>
|
||||
<OBJECT ID="1" OBJECTID="100" OBJECTGUID="11111111-1111-1111-1111-111111111111"
|
||||
NAME="Хабаровск" TYPENAME="г" LEVEL="5" ISACTUAL="1" ISACTIVE="1" />
|
||||
<OBJECT ID="2" OBJECTID="425474" OBJECTGUID="1bede387-3c7d-46f3-b557-f45e0e50a26a"
|
||||
NAME="0-я" TYPENAME="ул" LEVEL="8" ISACTUAL="1" ISACTIVE="0" />
|
||||
</ADDRESSOBJECTS>""",
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
call_command("import_addresses", xml)
|
||||
|
||||
city = AddressObject.objects.get()
|
||||
assert city.name == "Хабаровск"
|
||||
assert city.is_active is True
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_skips_garage_cooperative_types(tmp_path):
|
||||
region_dir = tmp_path / "25"
|
||||
region_dir.mkdir()
|
||||
xml = region_dir / "AS_ADDR_OBJ.xml"
|
||||
xml.write_text(
|
||||
"""<?xml version="1.0" encoding="utf-8"?>
|
||||
<ADDRESSOBJECTS>
|
||||
<OBJECT ID="1" OBJECTID="100" OBJECTGUID="11111111-1111-1111-1111-111111111111"
|
||||
NAME="Владивосток" TYPENAME="г" LEVEL="5" ISACTUAL="1" ISACTIVE="1" />
|
||||
<OBJECT ID="2" OBJECTID="200" OBJECTGUID="33333333-3333-3333-3333-333333333333"
|
||||
NAME="Мотор" TYPENAME="гск" LEVEL="8" ISACTUAL="1" ISACTIVE="1" />
|
||||
<OBJECT ID="3" OBJECTID="201" OBJECTGUID="44444444-4444-4444-4444-444444444444"
|
||||
NAME="1" TYPENAME="тер. ГСК" LEVEL="7" ISACTUAL="1" ISACTIVE="1" />
|
||||
</ADDRESSOBJECTS>""",
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
call_command("import_addresses", xml)
|
||||
|
||||
assert AddressObject.objects.count() == 1
|
||||
assert AddressObject.objects.get().name == "Владивосток"
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_skips_kilometer_markers(tmp_path):
|
||||
region_dir = tmp_path / "27"
|
||||
region_dir.mkdir()
|
||||
xml = region_dir / "AS_ADDR_OBJ.xml"
|
||||
xml.write_text(
|
||||
"""<?xml version="1.0" encoding="utf-8"?>
|
||||
<ADDRESSOBJECTS>
|
||||
<OBJECT ID="1" OBJECTID="100" OBJECTGUID="11111111-1111-1111-1111-111111111111"
|
||||
NAME="Хабаровск" TYPENAME="г" LEVEL="5" ISACTUAL="1" ISACTIVE="1" />
|
||||
<OBJECT ID="2" OBJECTID="105657917" OBJECTGUID="e46c7b87-51b9-4261-82ae-1830cdfbe000"
|
||||
NAME="104-й" TYPENAME="км" LEVEL="8" ISACTUAL="1" ISACTIVE="1" />
|
||||
</ADDRESSOBJECTS>""",
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
call_command("import_addresses", xml)
|
||||
|
||||
assert AddressObject.objects.count() == 1
|
||||
assert AddressObject.objects.get().name == "Хабаровск"
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_skips_urban_and_municipal_okrugs(tmp_path):
|
||||
region_dir = tmp_path / "25"
|
||||
region_dir.mkdir()
|
||||
xml = region_dir / "AS_ADDR_OBJ.xml"
|
||||
xml.write_text(
|
||||
"""<?xml version="1.0" encoding="utf-8"?>
|
||||
<ADDRESSOBJECTS>
|
||||
<OBJECT ID="1" OBJECTID="100" OBJECTGUID="11111111-1111-1111-1111-111111111111"
|
||||
NAME="Владивосток" TYPENAME="г" LEVEL="5" ISACTUAL="1" ISACTIVE="1" />
|
||||
<OBJECT ID="2" OBJECTID="200" OBJECTGUID="22222222-2222-2222-2222-222222222222"
|
||||
NAME="Арсеньевский" TYPENAME="г.о." LEVEL="3" ISACTUAL="1" ISACTIVE="1" />
|
||||
<OBJECT ID="3" OBJECTID="201" OBJECTGUID="33333333-3333-3333-3333-333333333333"
|
||||
NAME="Анучинский" TYPENAME="м.о." LEVEL="3" ISACTUAL="1" ISACTIVE="1" />
|
||||
<OBJECT ID="4" OBJECTID="202" OBJECTGUID="44444444-4444-4444-4444-444444444444"
|
||||
NAME="Дальнереченский" TYPENAME="м.р-н" LEVEL="3" ISACTUAL="1" ISACTIVE="1" />
|
||||
<OBJECT ID="5" OBJECTID="203" OBJECTGUID="55555555-5555-5555-5555-555555555555"
|
||||
NAME="Сальское" TYPENAME="с.п." LEVEL="4" ISACTUAL="1" ISACTIVE="1" />
|
||||
<OBJECT ID="6" OBJECTID="204" OBJECTGUID="66666666-6666-6666-6666-666666666666"
|
||||
NAME="Кировское" TYPENAME="г.п." LEVEL="4" ISACTUAL="1" ISACTIVE="1" />
|
||||
</ADDRESSOBJECTS>""",
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
call_command("import_addresses", xml)
|
||||
|
||||
assert AddressObject.objects.count() == 1
|
||||
assert AddressObject.objects.get().name == "Владивосток"
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_imports_chuvashia_as_region(tmp_path):
|
||||
region_dir = tmp_path / "21"
|
||||
region_dir.mkdir()
|
||||
xml = region_dir / "AS_ADDR_OBJ.xml"
|
||||
xml.write_text(
|
||||
"""<?xml version="1.0" encoding="utf-8"?>
|
||||
<ADDRESSOBJECTS>
|
||||
<OBJECT ID="1" OBJECTID="259389" OBJECTGUID="878fc621-3708-46c7-a97f-5a13a4176b3e"
|
||||
NAME="Чувашская Республика -" TYPENAME="Чувашия" LEVEL="1"
|
||||
ISACTUAL="1" ISACTIVE="1" />
|
||||
</ADDRESSOBJECTS>""",
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
call_command("import_addresses", xml)
|
||||
|
||||
subject = AddressObject.objects.get()
|
||||
assert subject.level == AddressObject.Level.REGION
|
||||
assert subject.type_name == "Чувашия"
|
||||
assert subject.region_code == 21
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_imports_snt_as_planning_structure(tmp_path):
|
||||
region_dir = tmp_path / "25"
|
||||
region_dir.mkdir()
|
||||
xml = region_dir / "AS_ADDR_OBJ.xml"
|
||||
xml.write_text(
|
||||
"""<?xml version="1.0" encoding="utf-8"?>
|
||||
<ADDRESSOBJECTS>
|
||||
<OBJECT ID="1" OBJECTID="400" OBJECTGUID="aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"
|
||||
NAME="Абрикос" TYPENAME="снт" LEVEL="6" ISACTUAL="1" ISACTIVE="1" />
|
||||
<OBJECT ID="2" OBJECTID="401" OBJECTGUID="bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb"
|
||||
NAME="Рассвет" TYPENAME="тер. СНТ" LEVEL="8" ISACTUAL="1" ISACTIVE="1" />
|
||||
</ADDRESSOBJECTS>""",
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
call_command("import_addresses", xml)
|
||||
|
||||
snt = AddressObject.objects.get(name="Абрикос")
|
||||
territory = AddressObject.objects.get(name="Рассвет")
|
||||
assert snt.level == AddressObject.Level.PLANNING
|
||||
assert snt.type_name == "снт"
|
||||
assert territory.level == AddressObject.Level.PLANNING
|
||||
assert territory.type_name == "тер. СНТ"
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_skips_non_residential_and_railway_types(tmp_path):
|
||||
region_dir = tmp_path / "25"
|
||||
region_dir.mkdir()
|
||||
xml = region_dir / "AS_ADDR_OBJ.xml"
|
||||
xml.write_text(
|
||||
"""<?xml version="1.0" encoding="utf-8"?>
|
||||
<ADDRESSOBJECTS>
|
||||
<OBJECT ID="1" OBJECTID="100" OBJECTGUID="11111111-1111-1111-1111-111111111111"
|
||||
NAME="Владивосток" TYPENAME="г" LEVEL="5" ISACTUAL="1" ISACTIVE="1" />
|
||||
<OBJECT ID="2" OBJECTID="101" OBJECTGUID="22222222-2222-2222-2222-222222222222"
|
||||
NAME="Вокзальная" TYPENAME="ст." LEVEL="8" ISACTUAL="1" ISACTIVE="1" />
|
||||
<OBJECT ID="3" OBJECTID="102" OBJECTGUID="33333333-3333-3333-3333-333333333333"
|
||||
NAME="Южный" TYPENAME="сад" LEVEL="7" ISACTUAL="1" ISACTIVE="1" />
|
||||
<OBJECT ID="4" OBJECTID="200" OBJECTGUID="44444444-4444-4444-4444-444444444444"
|
||||
NAME="Раздольное" TYPENAME="ж/д ст." LEVEL="6" ISACTUAL="1" ISACTIVE="1" />
|
||||
<OBJECT ID="5" OBJECTID="201" OBJECTGUID="55555555-5555-5555-5555-555555555555"
|
||||
NAME="Сибирцево" TYPENAME="ст." LEVEL="6" ISACTUAL="1" ISACTIVE="1" />
|
||||
<OBJECT ID="6" OBJECTID="202" OBJECTGUID="66666666-6666-6666-6666-666666666666"
|
||||
NAME="Приморский" TYPENAME="сад" LEVEL="8" ISACTUAL="1" ISACTIVE="1" />
|
||||
<OBJECT ID="7" OBJECTID="203" OBJECTGUID="77777777-7777-7777-7777-777777777777"
|
||||
NAME="Мотор" TYPENAME="г-к" LEVEL="8" ISACTUAL="1" ISACTIVE="1" />
|
||||
<OBJECT ID="8" OBJECTID="204" OBJECTGUID="88888888-8888-8888-8888-888888888888"
|
||||
NAME="Центральный" TYPENAME="сквер" LEVEL="7" ISACTUAL="1" ISACTIVE="1" />
|
||||
<OBJECT ID="9" OBJECTID="205" OBJECTGUID="99999999-9999-9999-9999-999999999999"
|
||||
NAME="1" TYPENAME="стр." LEVEL="8" ISACTUAL="1" ISACTIVE="1" />
|
||||
<OBJECT ID="10" OBJECTID="206" OBJECTGUID="aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"
|
||||
NAME="Аяно-Майская" TYPENAME="межсел.тер." LEVEL="4" ISACTUAL="1" ISACTIVE="1" />
|
||||
</ADDRESSOBJECTS>""",
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
call_command("import_addresses", xml)
|
||||
|
||||
names = set(AddressObject.objects.values_list("name", flat=True))
|
||||
assert names == {"Владивосток", "Вокзальная", "Южный"}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,123 @@
|
|||
import zipfile
|
||||
from uuid import UUID
|
||||
|
||||
import pytest
|
||||
from django.core.management import call_command
|
||||
|
||||
from address.models import AddressObject, House
|
||||
|
||||
ADDR_XML = """<?xml version="1.0" encoding="utf-8"?>
|
||||
<ADDRESSOBJECTS>
|
||||
<OBJECT ID="1" OBJECTID="1" OBJECTGUID="aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"
|
||||
NAME="Приморский" TYPENAME="край" LEVEL="1" ISACTUAL="1" ISACTIVE="1" />
|
||||
<OBJECT ID="2" OBJECTID="100" OBJECTGUID="11111111-1111-1111-1111-111111111111"
|
||||
NAME="Владивосток" TYPENAME="г" LEVEL="5" ISACTUAL="1" ISACTIVE="1" />
|
||||
<OBJECT ID="3" OBJECTID="101" OBJECTGUID="22222222-2222-2222-2222-222222222222"
|
||||
NAME="Светланская" TYPENAME="ул" LEVEL="8" ISACTUAL="1" ISACTIVE="1" />
|
||||
<OBJECT ID="4" OBJECTID="200" OBJECTGUID="33333333-3333-3333-3333-333333333333"
|
||||
NAME="Мотор" TYPENAME="гск" LEVEL="8" ISACTUAL="1" ISACTIVE="1" />
|
||||
</ADDRESSOBJECTS>"""
|
||||
|
||||
HOUSE_XML = """<HOUSES>
|
||||
<HOUSE ID="1" OBJECTID="500" OBJECTGUID="44444444-4444-4444-4444-444444444444"
|
||||
HOUSENUM="10" HOUSETYPE="2" ISACTUAL="1" ISACTIVE="1" />
|
||||
<HOUSE ID="2" OBJECTID="501" OBJECTGUID="55555555-5555-5555-5555-555555555555"
|
||||
HOUSENUM="1" HOUSETYPE="4" ISACTUAL="1" ISACTIVE="1" />
|
||||
</HOUSES>"""
|
||||
|
||||
HIERARCHY_XML = """<ITEMS>
|
||||
<ITEM OBJECTID="100" PARENTOBJID="1" PATH="1.100" ISACTIVE="1" />
|
||||
<ITEM OBJECTID="101" PARENTOBJID="100" PATH="1.100.101" ISACTIVE="1" />
|
||||
<ITEM OBJECTID="500" PARENTOBJID="101" PATH="1.100.101.500" ISACTIVE="1" />
|
||||
</ITEMS>"""
|
||||
|
||||
|
||||
def _gar_zip(tmp_path, *, extra: dict[str, str] | None = None):
|
||||
archive = tmp_path / "gar_xml.zip"
|
||||
files = {
|
||||
"25/AS_ADDR_OBJ_20260827_aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa.XML": ADDR_XML,
|
||||
"25/AS_HOUSES_20260827_bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb.XML": HOUSE_XML,
|
||||
"25/AS_ADM_HIERARCHY_20260827_cccccccc-cccc-cccc-cccc-cccccccccccc.XML": HIERARCHY_XML,
|
||||
"25/AS_ADDR_OBJ_PARAMS_20260827_dddddddd-dddd-dddd-dddd-dddddddddddd.XML": "<PARAMS />",
|
||||
"77/AS_ADDR_OBJ_20260827_eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee.XML": """<?xml version="1.0"?>
|
||||
<ADDRESSOBJECTS>
|
||||
<OBJECT ID="9" OBJECTID="900" OBJECTGUID="99999999-9999-9999-9999-999999999999"
|
||||
NAME="Москва" TYPENAME="г" LEVEL="5" ISACTUAL="1" ISACTIVE="1" />
|
||||
</ADDRESSOBJECTS>""",
|
||||
"77/AS_HOUSES_20260827_ffffffffffff-ffff-ffff-ffff-ffffffffffff.XML": "<HOUSES />",
|
||||
"77/AS_ADM_HIERARCHY_20260827_00000000-0000-0000-0000-000000000000.XML": "<ITEMS />",
|
||||
}
|
||||
if extra:
|
||||
files.update(extra)
|
||||
with zipfile.ZipFile(archive, "w") as zf:
|
||||
for name, content in files.items():
|
||||
zf.writestr(name, content)
|
||||
return archive
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_import_commands_read_zip_without_extracting(tmp_path):
|
||||
archive = _gar_zip(tmp_path)
|
||||
|
||||
call_command("import_addresses", archive, region_code="25")
|
||||
call_command("import_houses", archive, region_code="25")
|
||||
call_command("import_hierarchy", archive, region_code="25")
|
||||
|
||||
assert AddressObject.objects.count() == 3
|
||||
city = AddressObject.objects.get(fias_id=UUID("11111111-1111-1111-1111-111111111111"))
|
||||
street = AddressObject.objects.get(name="Светланская")
|
||||
house = House.objects.get()
|
||||
assert city.region_code == 25
|
||||
assert street.parent_id == city.pk
|
||||
assert house.house_number == "10"
|
||||
assert house.parent_id == street.pk
|
||||
extracted = [path for path in tmp_path.rglob("*") if path != archive and path.is_file()]
|
||||
assert extracted == []
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_import_gar_imports_all_regions_from_zip(tmp_path):
|
||||
archive = _gar_zip(tmp_path)
|
||||
|
||||
call_command("import_gar", archive)
|
||||
|
||||
assert AddressObject.objects.filter(region_code=25).count() == 3
|
||||
assert AddressObject.objects.filter(name="Москва").exists()
|
||||
house = House.objects.get()
|
||||
street = AddressObject.objects.get(name="Светланская")
|
||||
assert house.parent_id == street.pk
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_import_gar_can_limit_to_one_region(tmp_path):
|
||||
archive = _gar_zip(tmp_path)
|
||||
|
||||
call_command("import_gar", archive, region_codes=["25"])
|
||||
|
||||
assert AddressObject.objects.filter(name="Москва").exists() is False
|
||||
assert AddressObject.objects.count() == 3
|
||||
assert House.objects.count() == 1
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_import_gar_accepts_several_region_codes(tmp_path):
|
||||
archive = _gar_zip(tmp_path)
|
||||
|
||||
call_command("import_gar", archive, region_codes=["25", "77"])
|
||||
|
||||
assert AddressObject.objects.filter(region_code=25).count() == 3
|
||||
assert AddressObject.objects.filter(name="Москва").exists()
|
||||
assert House.objects.count() == 1
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_import_gar_can_import_houses_only_for_selected_regions(tmp_path):
|
||||
archive = _gar_zip(tmp_path)
|
||||
|
||||
call_command("import_gar", archive, houses_region_codes=["25"])
|
||||
|
||||
assert AddressObject.objects.filter(name="Москва").exists()
|
||||
assert AddressObject.objects.filter(region_code=25).count() == 3
|
||||
house = House.objects.get()
|
||||
assert house.region_code == 25
|
||||
assert house.parent_id == AddressObject.objects.get(name="Светланская").pk
|
||||
|
|
@ -0,0 +1,372 @@
|
|||
import zipfile
|
||||
from uuid import uuid4
|
||||
|
||||
import pytest
|
||||
from django.core.management import call_command
|
||||
from django.core.management.base import CommandError
|
||||
|
||||
from address.models import AddressObject, House
|
||||
|
||||
|
||||
def _object(
|
||||
*,
|
||||
object_id: int,
|
||||
name: str,
|
||||
level: int,
|
||||
type_name: str = "г",
|
||||
region_code: str = "25",
|
||||
) -> AddressObject:
|
||||
return AddressObject.objects.create(
|
||||
fias_id=uuid4(),
|
||||
object_id=object_id,
|
||||
name=name,
|
||||
type_name=type_name,
|
||||
level=level,
|
||||
region_code=region_code,
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_links_street_to_nearest_imported_ancestor(tmp_path):
|
||||
region_dir = tmp_path / "25"
|
||||
region_dir.mkdir()
|
||||
region = _object(object_id=1, name="Приморский", level=1, type_name="край")
|
||||
city = _object(object_id=100, name="Владивосток", level=5)
|
||||
planning = _object(object_id=200, name="Центр", level=7, type_name="р-н")
|
||||
street = _object(object_id=101, name="Светланская", level=8, type_name="ул")
|
||||
xml = region_dir / "AS_ADM_HIERARCHY.xml"
|
||||
xml.write_text(
|
||||
"""<ITEMS>
|
||||
<ITEM OBJECTID="100" PARENTOBJID="1" PATH="1.100" ISACTIVE="1" />
|
||||
<ITEM OBJECTID="200" PARENTOBJID="100" PATH="1.100.200" ISACTIVE="1" />
|
||||
<ITEM OBJECTID="101" PARENTOBJID="200" PATH="1.100.200.101" ISACTIVE="1" />
|
||||
<ITEM OBJECTID="999" PARENTOBJID="101" PATH="1.100.101.999" ISACTIVE="1" />
|
||||
<ITEM OBJECTID="101" PARENTOBJID="200" PATH="1.100.200.101" ISACTIVE="0" />
|
||||
</ITEMS>""",
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
call_command("import_hierarchy", xml)
|
||||
|
||||
city.refresh_from_db()
|
||||
planning.refresh_from_db()
|
||||
street.refresh_from_db()
|
||||
assert city.parent_id == region.pk
|
||||
assert planning.parent_id == city.pk
|
||||
assert street.parent_id == planning.pk
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_settlement_prefers_city_over_region(tmp_path):
|
||||
region_dir = tmp_path / "25"
|
||||
region_dir.mkdir()
|
||||
region = _object(object_id=1, name="Приморский", level=1, type_name="край")
|
||||
city = _object(object_id=100, name="Владивосток", level=5)
|
||||
settlement = _object(object_id=300, name="Трудовое", level=6, type_name="п")
|
||||
xml = region_dir / "AS_ADM_HIERARCHY.xml"
|
||||
xml.write_text(
|
||||
"""<ITEMS>
|
||||
<ITEM OBJECTID="300" PARENTOBJID="100" PATH="1.100.300" ISACTIVE="1" />
|
||||
</ITEMS>""",
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
call_command("import_hierarchy", xml)
|
||||
|
||||
settlement.refresh_from_db()
|
||||
assert settlement.parent_id == city.pk
|
||||
region.refresh_from_db()
|
||||
assert region.parent_id is None
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_links_settlement_to_district_instead_of_region(tmp_path):
|
||||
region_dir = tmp_path / "25"
|
||||
region_dir.mkdir()
|
||||
_object(object_id=1, name="Приморский", level=1, type_name="край")
|
||||
district = _object(object_id=200, name="Лазовский", level=2, type_name="р-н")
|
||||
settlement = _object(object_id=300, name="Лазо", level=6, type_name="с.")
|
||||
xml = region_dir / "AS_ADM_HIERARCHY.xml"
|
||||
xml.write_text(
|
||||
"""<ITEMS>
|
||||
<ITEM OBJECTID="200" PARENTOBJID="1" PATH="1.200" ISACTIVE="1" />
|
||||
<ITEM OBJECTID="300" PARENTOBJID="200" PATH="1.200.300" ISACTIVE="1" />
|
||||
</ITEMS>""",
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
call_command("import_hierarchy", xml)
|
||||
|
||||
settlement.refresh_from_db()
|
||||
assert settlement.parent_id == district.pk
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_links_street_to_snt_when_there_is_no_city(tmp_path):
|
||||
region_dir = tmp_path / "27"
|
||||
region_dir.mkdir()
|
||||
_object(object_id=1, name="Хабаровский", level=1, type_name="край", region_code="27")
|
||||
_object(object_id=200, name="Комсомольский", level=2, type_name="р-н", region_code="27")
|
||||
snt = _object(
|
||||
object_id=400, name="Амурские зори", level=7, type_name="тер. СНТ", region_code="27"
|
||||
)
|
||||
street = _object(object_id=101, name="10-я", level=8, type_name="ул.", region_code="27")
|
||||
xml = region_dir / "AS_ADM_HIERARCHY.xml"
|
||||
xml.write_text(
|
||||
"""<ITEMS>
|
||||
<ITEM OBJECTID="101" PARENTOBJID="400" PATH="1.200.400.101" ISACTIVE="1" />
|
||||
</ITEMS>""",
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
call_command("import_hierarchy", xml)
|
||||
|
||||
street.refresh_from_db()
|
||||
assert street.parent_id == snt.pk
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_links_street_to_federal_city_region(tmp_path):
|
||||
region_dir = tmp_path / "78"
|
||||
region_dir.mkdir()
|
||||
city = _object(
|
||||
object_id=1414662,
|
||||
name="Санкт-Петербург",
|
||||
level=1,
|
||||
type_name="г.",
|
||||
region_code="78",
|
||||
)
|
||||
street = _object(
|
||||
object_id=1422964,
|
||||
name="1-й Муринский",
|
||||
level=8,
|
||||
type_name="пр-кт",
|
||||
region_code="78",
|
||||
)
|
||||
xml = region_dir / "AS_ADM_HIERARCHY.xml"
|
||||
xml.write_text(
|
||||
"""<ITEMS>
|
||||
<ITEM OBJECTID="1422964" PARENTOBJID="1414662" PATH="1414662.1422964" ISACTIVE="1" />
|
||||
</ITEMS>""",
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
call_command("import_hierarchy", xml)
|
||||
|
||||
street.refresh_from_db()
|
||||
assert street.parent_id == city.pk
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_links_street_to_krai_when_it_is_the_nearest_ancestor(tmp_path):
|
||||
region_dir = tmp_path / "25"
|
||||
region_dir.mkdir()
|
||||
krai = _object(object_id=1, name="Приморский", level=1, type_name="край")
|
||||
street = _object(object_id=101, name="Светланская", level=8, type_name="ул")
|
||||
xml = region_dir / "AS_ADM_HIERARCHY.xml"
|
||||
xml.write_text(
|
||||
"""<ITEMS>
|
||||
<ITEM OBJECTID="101" PARENTOBJID="1" PATH="1.101" ISACTIVE="1" />
|
||||
</ITEMS>""",
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
call_command("import_hierarchy", xml)
|
||||
|
||||
street.refresh_from_db()
|
||||
assert street.parent_id == krai.pk
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_links_house_to_street(tmp_path):
|
||||
region_dir = tmp_path / "25"
|
||||
region_dir.mkdir()
|
||||
_object(object_id=1, name="Приморский", level=1, type_name="край")
|
||||
_object(object_id=100, name="Владивосток", level=5)
|
||||
street = _object(object_id=101, name="Светланская", level=8, type_name="ул")
|
||||
house = House.objects.create(
|
||||
object_id=500,
|
||||
fias_id=uuid4(),
|
||||
region_code="25",
|
||||
house_number="10",
|
||||
house_type=House.Type.HOUSE,
|
||||
)
|
||||
xml = region_dir / "AS_ADM_HIERARCHY.xml"
|
||||
xml.write_text(
|
||||
"""<ITEMS>
|
||||
<ITEM OBJECTID="500" PARENTOBJID="101" PATH="1.100.101.500" ISACTIVE="1" />
|
||||
</ITEMS>""",
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
call_command("import_hierarchy", xml)
|
||||
|
||||
house.refresh_from_db()
|
||||
assert house.parent_id == street.pk
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_links_house_using_inactive_hierarchy_when_no_active_item(tmp_path):
|
||||
region_dir = tmp_path / "25"
|
||||
region_dir.mkdir()
|
||||
_object(object_id=1, name="Приморский", level=1, type_name="край")
|
||||
_object(object_id=100, name="Партизанск", level=5)
|
||||
street = _object(object_id=381667, name="Индустриальная", level=8, type_name="ул")
|
||||
house = House.objects.create(
|
||||
object_id=46594862,
|
||||
fias_id=uuid4(),
|
||||
region_code="25",
|
||||
house_number="2в",
|
||||
house_type=House.Type.HOUSEHOLD,
|
||||
)
|
||||
xml = region_dir / "AS_ADM_HIERARCHY.xml"
|
||||
xml.write_text(
|
||||
"""<ITEMS>
|
||||
<ITEM OBJECTID="46594862" PARENTOBJID="381667" PATH="1.100.381667.46594862" ISACTIVE="0" />
|
||||
</ITEMS>""",
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
call_command("import_hierarchy", xml)
|
||||
|
||||
house.refresh_from_db()
|
||||
assert house.parent_id == street.pk
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_skips_house_when_nearest_parent_was_not_imported(tmp_path):
|
||||
region_dir = tmp_path / "25"
|
||||
region_dir.mkdir()
|
||||
_object(object_id=1, name="Приморский", level=1, type_name="край")
|
||||
_object(object_id=100, name="Владивосток", level=5)
|
||||
House.objects.create(
|
||||
object_id=500,
|
||||
fias_id=uuid4(),
|
||||
region_code="25",
|
||||
house_number="10",
|
||||
house_type=House.Type.HOUSE,
|
||||
)
|
||||
xml = region_dir / "AS_ADM_HIERARCHY.xml"
|
||||
xml.write_text(
|
||||
"""<ITEMS>
|
||||
<ITEM OBJECTID="500" PARENTOBJID="900" PATH="1.100.900.500" ISACTIVE="1" />
|
||||
</ITEMS>""",
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
call_command("import_hierarchy", xml)
|
||||
|
||||
assert not House.objects.filter(object_id=500).exists()
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
@pytest.mark.parametrize(
|
||||
("parent_id", "level", "type_name", "name"),
|
||||
[
|
||||
(100, 5, "г.", "Уссурийск"),
|
||||
(200, 2, "р-н", "Красноармейский"),
|
||||
(300, 6, "п", "Трудовое"),
|
||||
(400, 4, "с.п.", "Джигдинское"),
|
||||
],
|
||||
)
|
||||
def test_skips_house_when_parent_is_locality(tmp_path, parent_id, level, type_name, name):
|
||||
region_dir = tmp_path / "25"
|
||||
region_dir.mkdir()
|
||||
_object(object_id=1, name="Приморский", level=1, type_name="край")
|
||||
_object(object_id=parent_id, name=name, level=level, type_name=type_name)
|
||||
House.objects.create(
|
||||
object_id=500,
|
||||
fias_id=uuid4(),
|
||||
region_code="25",
|
||||
house_number="1",
|
||||
house_type=House.Type.HOUSE,
|
||||
)
|
||||
xml = region_dir / "AS_ADM_HIERARCHY.xml"
|
||||
xml.write_text(
|
||||
f"""<ITEMS>
|
||||
<ITEM OBJECTID="500" PARENTOBJID="{parent_id}" PATH="1.{parent_id}.500" ISACTIVE="1" />
|
||||
</ITEMS>""",
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
call_command("import_hierarchy", xml)
|
||||
|
||||
assert not House.objects.filter(object_id=500).exists()
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_links_snt_to_city_and_house_to_snt(tmp_path):
|
||||
region_dir = tmp_path / "25"
|
||||
region_dir.mkdir()
|
||||
_object(object_id=1, name="Приморский", level=1, type_name="край")
|
||||
city = _object(object_id=100, name="Владивосток", level=5)
|
||||
snt = _object(object_id=400, name="Авиатор", level=7, type_name="снт")
|
||||
house = House.objects.create(
|
||||
object_id=500,
|
||||
fias_id=uuid4(),
|
||||
region_code="25",
|
||||
house_number="10",
|
||||
house_type=House.Type.HOUSE,
|
||||
)
|
||||
xml = region_dir / "AS_ADM_HIERARCHY.xml"
|
||||
xml.write_text(
|
||||
"""<ITEMS>
|
||||
<ITEM OBJECTID="400" PARENTOBJID="100" PATH="1.100.400" ISACTIVE="1" />
|
||||
<ITEM OBJECTID="500" PARENTOBJID="400" PATH="1.100.400.500" ISACTIVE="1" />
|
||||
</ITEMS>""",
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
call_command("import_hierarchy", xml)
|
||||
|
||||
snt.refresh_from_db()
|
||||
house.refresh_from_db()
|
||||
assert snt.parent_id == city.pk
|
||||
assert house.parent_id == snt.pk
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_fills_empty_parents_from_mun_hierarchy_zip(tmp_path):
|
||||
archive = tmp_path / "gar_xml.zip"
|
||||
region = _object(object_id=1, name="Хабаровский", level=1, type_name="край", region_code="27")
|
||||
district = _object(
|
||||
object_id=10,
|
||||
name="Аяно-Майский",
|
||||
level=AddressObject.Level.DISTRICT,
|
||||
type_name="р-н",
|
||||
region_code="27",
|
||||
)
|
||||
village = _object(
|
||||
object_id=20,
|
||||
name="Джигда",
|
||||
level=AddressObject.Level.SETTLEMENT,
|
||||
type_name="с.",
|
||||
region_code="27",
|
||||
)
|
||||
with zipfile.ZipFile(archive, "w") as zf:
|
||||
zf.writestr(
|
||||
"27/AS_ADM_HIERARCHY_20260827_aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa.XML",
|
||||
"""<ITEMS>
|
||||
<ITEM OBJECTID="1" PARENTOBJID="0" PATH="1" ISACTIVE="1" />
|
||||
</ITEMS>""",
|
||||
)
|
||||
zf.writestr(
|
||||
"27/AS_MUN_HIERARCHY_20260827_bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb.XML",
|
||||
"""<ITEMS>
|
||||
<ITEM OBJECTID="10" PARENTOBJID="1" PATH="1.10" ISACTIVE="1" />
|
||||
<ITEM OBJECTID="20" PARENTOBJID="10" PATH="1.10.20" ISACTIVE="1" />
|
||||
</ITEMS>""",
|
||||
)
|
||||
|
||||
call_command("import_hierarchy", archive, region_code="27")
|
||||
|
||||
district.refresh_from_db()
|
||||
village.refresh_from_db()
|
||||
assert district.parent_id == region.pk
|
||||
assert village.parent_id == district.pk
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_hierarchy_file_must_exist(tmp_path):
|
||||
with pytest.raises(CommandError, match="Файл не найден"):
|
||||
call_command("import_hierarchy", tmp_path / "missing.xml")
|
||||
|
|
@ -19,6 +19,8 @@ def test_imports_and_updates_houses_xml(tmp_path):
|
|||
UPDATEDATE="2026-01-02" ISACTUAL="1" ISACTIVE="1" />
|
||||
<HOUSE ID="2" OBJECTID="501" OBJECTGUID="44444444-4444-4444-4444-444444444444"
|
||||
HOUSENUM="12" UPDATEDATE="2026-01-02" ISACTUAL="0" ISACTIVE="1" />
|
||||
<HOUSE ID="3" OBJECTID="502" OBJECTGUID="55555555-5555-5555-5555-555555555555"
|
||||
HOUSENUM="14" UPDATEDATE="2026-01-02" ISACTUAL="1" ISACTIVE="0" />
|
||||
</HOUSES>""",
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
|
@ -27,9 +29,8 @@ def test_imports_and_updates_houses_xml(tmp_path):
|
|||
|
||||
house = House.objects.get(fias_id=UUID("33333333-3333-3333-3333-333333333333"))
|
||||
assert house.object_id == 500
|
||||
assert house.region_code == "25"
|
||||
assert house.region_code == 25
|
||||
assert house.display_number == "д. 10 к. 3"
|
||||
assert house.is_actual is True
|
||||
assert House.objects.count() == 1
|
||||
|
||||
xml.write_text(
|
||||
|
|
@ -44,7 +45,7 @@ def test_imports_and_updates_houses_xml(tmp_path):
|
|||
|
||||
house.refresh_from_db()
|
||||
assert house.house_number == "10А"
|
||||
assert house.additional_number_1 == ""
|
||||
assert house.additional_number_1 is None
|
||||
assert House.objects.count() == 1
|
||||
|
||||
|
||||
|
|
@ -64,6 +65,54 @@ def test_rejects_unknown_house_type(tmp_path):
|
|||
call_command("import_houses", xml, region_code="25")
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_skips_non_residential_house_types(tmp_path):
|
||||
region_dir = tmp_path / "25"
|
||||
region_dir.mkdir()
|
||||
xml = region_dir / "AS_HOUSES.xml"
|
||||
xml.write_text(
|
||||
"""<HOUSES>
|
||||
<HOUSE ID="1" OBJECTID="500" OBJECTGUID="33333333-3333-3333-3333-333333333333"
|
||||
HOUSENUM="10" HOUSETYPE="2" UPDATEDATE="2026-01-02"
|
||||
ISACTUAL="1" ISACTIVE="1" />
|
||||
<HOUSE ID="2" OBJECTID="501" OBJECTGUID="44444444-4444-4444-4444-444444444444"
|
||||
HOUSENUM="1" HOUSETYPE="4" UPDATEDATE="2026-01-02"
|
||||
ISACTUAL="1" ISACTIVE="1" />
|
||||
<HOUSE ID="3" OBJECTID="502" OBJECTGUID="55555555-5555-5555-5555-555555555555"
|
||||
HOUSENUM="2" HOUSETYPE="6" UPDATEDATE="2026-01-02"
|
||||
ISACTUAL="1" ISACTIVE="1" />
|
||||
<HOUSE ID="4" OBJECTID="503" OBJECTGUID="66666666-6666-6666-6666-666666666666"
|
||||
HOUSENUM="3" HOUSETYPE="11" UPDATEDATE="2026-01-02"
|
||||
ISACTUAL="1" ISACTIVE="1" />
|
||||
<HOUSE ID="5" OBJECTID="504" OBJECTGUID="77777777-7777-7777-7777-777777777777"
|
||||
HOUSENUM="4" HOUSETYPE="12" UPDATEDATE="2026-01-02"
|
||||
ISACTUAL="1" ISACTIVE="1" />
|
||||
<HOUSE ID="6" OBJECTID="505" OBJECTGUID="88888888-8888-8888-8888-888888888888"
|
||||
HOUSENUM="5" HOUSETYPE="13" UPDATEDATE="2026-01-02"
|
||||
ISACTUAL="1" ISACTIVE="1" />
|
||||
<HOUSE ID="7" OBJECTID="506" OBJECTGUID="99999999-9999-9999-9999-999999999999"
|
||||
HOUSENUM="6" HOUSETYPE="8" UPDATEDATE="2026-01-02"
|
||||
ISACTUAL="1" ISACTIVE="1" />
|
||||
<HOUSE ID="8" OBJECTID="507" OBJECTGUID="aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"
|
||||
HOUSENUM="7" HOUSETYPE="14" UPDATEDATE="2026-01-02"
|
||||
ISACTUAL="1" ISACTIVE="1" />
|
||||
<HOUSE ID="9" OBJECTID="508" OBJECTGUID="bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb"
|
||||
HOUSENUM="1" HOUSETYPE="5" UPDATEDATE="2026-01-02"
|
||||
ISACTUAL="1" ISACTIVE="1" />
|
||||
<HOUSE ID="10" OBJECTID="509" OBJECTGUID="cccccccc-cccc-cccc-cccc-cccccccccccc"
|
||||
HOUSENUM="8" HOUSETYPE="7" UPDATEDATE="2026-01-02"
|
||||
ISACTUAL="1" ISACTIVE="1" />
|
||||
</HOUSES>""",
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
call_command("import_houses", xml)
|
||||
|
||||
house = House.objects.get()
|
||||
assert house.house_number == "10"
|
||||
assert house.house_type == House.Type.HOUSE
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_keeps_last_house_when_fias_id_repeats_in_one_batch(tmp_path):
|
||||
region_dir = tmp_path / "25"
|
||||
|
|
@ -73,7 +122,7 @@ def test_keeps_last_house_when_fias_id_repeats_in_one_batch(tmp_path):
|
|||
"""<HOUSES>
|
||||
<HOUSE ID="1" OBJECTID="500" OBJECTGUID="33333333-3333-3333-3333-333333333333"
|
||||
HOUSENUM="10" HOUSETYPE="2" UPDATEDATE="2026-01-02"
|
||||
ISACTUAL="1" ISACTIVE="0" />
|
||||
ISACTUAL="1" ISACTIVE="1" />
|
||||
<HOUSE ID="2" OBJECTID="500" OBJECTGUID="33333333-3333-3333-3333-333333333333"
|
||||
HOUSENUM="10А" HOUSETYPE="2" UPDATEDATE="2026-02-03"
|
||||
ISACTUAL="1" ISACTIVE="1" />
|
||||
|
|
@ -86,4 +135,3 @@ def test_keeps_last_house_when_fias_id_repeats_in_one_batch(tmp_path):
|
|||
house = House.objects.get(fias_id=UUID("33333333-3333-3333-3333-333333333333"))
|
||||
assert House.objects.count() == 1
|
||||
assert house.house_number == "10А"
|
||||
assert house.is_actual is True
|
||||
|
|
|
|||
|
|
@ -0,0 +1,89 @@
|
|||
import zipfile
|
||||
from uuid import uuid4
|
||||
|
||||
import pytest
|
||||
from django.core.management import call_command
|
||||
from django.core.management.base import CommandError
|
||||
|
||||
from address.models import AddressObject
|
||||
|
||||
|
||||
def _object(*, object_id: int, name: str = "Владивосток") -> AddressObject:
|
||||
return AddressObject.objects.create(
|
||||
fias_id=uuid4(),
|
||||
object_id=object_id,
|
||||
name=name,
|
||||
type_name="г",
|
||||
level=5,
|
||||
region_code="25",
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_fills_kladr_id(tmp_path):
|
||||
region_dir = tmp_path / "25"
|
||||
region_dir.mkdir()
|
||||
city = _object(object_id=100)
|
||||
other = _object(object_id=101, name="Артем")
|
||||
xml = region_dir / "AS_ADDR_OBJ_PARAMS.xml"
|
||||
xml.write_text(
|
||||
"""<PARAMS>
|
||||
<PARAM OBJECTID="100" TYPEID="10" VALUE="2500000100000" CHANGEIDEND="0" />
|
||||
<PARAM OBJECTID="100" TYPEID="10" VALUE="250000010000099" CHANGEIDEND="123" />
|
||||
<PARAM OBJECTID="100" TYPEID="11" VALUE="2500000100000" CHANGEIDEND="0" />
|
||||
<PARAM OBJECTID="101" TYPEID="10" VALUE="abc" CHANGEIDEND="0" />
|
||||
<PARAM OBJECTID="999" TYPEID="10" VALUE="2500000200000" CHANGEIDEND="0" />
|
||||
</PARAMS>""",
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
call_command("import_kladr", xml)
|
||||
|
||||
city.refresh_from_db()
|
||||
other.refresh_from_db()
|
||||
assert city.kladr_id == "2500000100000"
|
||||
assert other.kladr_id == ""
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_keeps_last_current_kladr_id(tmp_path):
|
||||
region_dir = tmp_path / "25"
|
||||
region_dir.mkdir()
|
||||
city = _object(object_id=100)
|
||||
xml = region_dir / "AS_ADDR_OBJ_PARAMS.xml"
|
||||
xml.write_text(
|
||||
"""<PARAMS>
|
||||
<PARAM OBJECTID="100" TYPEID="10" VALUE="2500000100000" CHANGEIDEND="0" />
|
||||
<PARAM OBJECTID="100" TYPEID="10" VALUE="25000001000001700" CHANGEIDEND="0" />
|
||||
</PARAMS>""",
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
call_command("import_kladr", xml)
|
||||
|
||||
city.refresh_from_db()
|
||||
assert city.kladr_id == "25000001000001700"
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_kladr_file_must_exist(tmp_path):
|
||||
with pytest.raises(CommandError, match="Файл не найден"):
|
||||
call_command("import_kladr", tmp_path / "missing.xml")
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_fills_kladr_id_from_zip(tmp_path):
|
||||
city = _object(object_id=100)
|
||||
archive = tmp_path / "gar_xml.zip"
|
||||
with zipfile.ZipFile(archive, "w") as zf:
|
||||
zf.writestr(
|
||||
"25/AS_ADDR_OBJ_PARAMS_20260827_bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb.XML",
|
||||
"""<PARAMS>
|
||||
<PARAM OBJECTID="100" TYPEID="10" VALUE="2500000100000" CHANGEIDEND="0" />
|
||||
</PARAMS>""",
|
||||
)
|
||||
|
||||
call_command("import_kladr", archive, region_code="25")
|
||||
|
||||
city.refresh_from_db()
|
||||
assert city.kladr_id == "2500000100000"
|
||||
|
|
@ -0,0 +1,89 @@
|
|||
import zipfile
|
||||
from uuid import uuid4
|
||||
|
||||
import pytest
|
||||
from django.core.management import call_command
|
||||
from django.core.management.base import CommandError
|
||||
|
||||
from address.models import House
|
||||
|
||||
|
||||
def _house(*, object_id: int, number: str = "10") -> House:
|
||||
return House.objects.create(
|
||||
object_id=object_id,
|
||||
fias_id=uuid4(),
|
||||
region_code="25",
|
||||
house_number=number,
|
||||
house_type=House.Type.HOUSE,
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_fills_house_postal_codes(tmp_path):
|
||||
region_dir = tmp_path / "25"
|
||||
region_dir.mkdir()
|
||||
house = _house(object_id=500)
|
||||
other = _house(object_id=501, number="11")
|
||||
xml = region_dir / "AS_HOUSES_PARAMS.xml"
|
||||
xml.write_text(
|
||||
"""<PARAMS>
|
||||
<PARAM OBJECTID="500" TYPEID="5" VALUE="690000" CHANGEIDEND="0" />
|
||||
<PARAM OBJECTID="500" TYPEID="5" VALUE="690001" CHANGEIDEND="123" />
|
||||
<PARAM OBJECTID="500" TYPEID="8" VALUE="25:01:000001:1" CHANGEIDEND="0" />
|
||||
<PARAM OBJECTID="501" TYPEID="5" VALUE="abc" CHANGEIDEND="0" />
|
||||
<PARAM OBJECTID="100" TYPEID="5" VALUE="690002" CHANGEIDEND="0" />
|
||||
<PARAM OBJECTID="999" TYPEID="5" VALUE="690003" CHANGEIDEND="0" />
|
||||
</PARAMS>""",
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
call_command("import_postal_codes", xml)
|
||||
|
||||
house.refresh_from_db()
|
||||
other.refresh_from_db()
|
||||
assert house.postal_code == 690000
|
||||
assert other.postal_code is None
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_keeps_last_current_postal_code(tmp_path):
|
||||
region_dir = tmp_path / "25"
|
||||
region_dir.mkdir()
|
||||
house = _house(object_id=500)
|
||||
xml = region_dir / "AS_HOUSES_PARAMS.xml"
|
||||
xml.write_text(
|
||||
"""<PARAMS>
|
||||
<PARAM OBJECTID="500" TYPEID="5" VALUE="690000" CHANGEIDEND="0" />
|
||||
<PARAM OBJECTID="500" TYPEID="5" VALUE="690091" CHANGEIDEND="0" />
|
||||
</PARAMS>""",
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
call_command("import_postal_codes", xml)
|
||||
|
||||
house.refresh_from_db()
|
||||
assert house.postal_code == 690091
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_postal_codes_file_must_exist(tmp_path):
|
||||
with pytest.raises(CommandError, match="Файл не найден"):
|
||||
call_command("import_postal_codes", tmp_path / "missing.xml")
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_fills_house_postal_codes_from_zip(tmp_path):
|
||||
house = _house(object_id=500)
|
||||
archive = tmp_path / "gar_xml.zip"
|
||||
with zipfile.ZipFile(archive, "w") as zf:
|
||||
zf.writestr(
|
||||
"25/AS_HOUSES_PARAMS_20260827_dddddddd-dddd-dddd-dddd-dddddddddddd.XML",
|
||||
"""<PARAMS>
|
||||
<PARAM OBJECTID="500" TYPEID="5" VALUE="690000" CHANGEIDEND="0" />
|
||||
</PARAMS>""",
|
||||
)
|
||||
|
||||
call_command("import_postal_codes", archive, region_code="25")
|
||||
|
||||
house.refresh_from_db()
|
||||
assert house.postal_code == 690000
|
||||
|
|
@ -8,4 +8,10 @@ def test_address_object_type_constants():
|
|||
assert AddressObject.TYPE_SHORT_NAMES[AddressObject.Type.KRAY] == "край"
|
||||
assert AddressObject.TYPE_SHORT_NAMES[AddressObject.Type.GOROD_L5] == "г."
|
||||
assert AddressObject.TYPE_SHORT_NAMES[AddressObject.Type.ULITSA_L8] == "ул."
|
||||
assert AddressObject.Level.REGION.label == "Субъект РФ"
|
||||
assert AddressObject.Level.DISTRICT == 2
|
||||
assert AddressObject.Level.MUNICIPAL_DISTRICT == 3
|
||||
assert AddressObject.Level.MUNICIPAL_SETTLEMENT == 4
|
||||
assert AddressObject.Level.PLANNING == 7
|
||||
assert AddressObject.Level.STREET == 8
|
||||
assert len(AddressObject.TYPE_SHORT_NAMES) == len(AddressObject.Type)
|
||||
|
|
|
|||
|
|
@ -4,32 +4,88 @@ import AsyncSelect from "react-select/async";
|
|||
const API_BASE_URL = (import.meta.env.VITE_API_BASE_URL || "/api-address").replace(/\/$/, "");
|
||||
|
||||
const levelNames = {
|
||||
1: "Регион",
|
||||
1: "Субъект РФ",
|
||||
2: "Район",
|
||||
3: "Муниципальный район",
|
||||
4: "Поселение",
|
||||
5: "Город",
|
||||
6: "Населённый пункт",
|
||||
7: "Планировочная структура",
|
||||
8: "Улица",
|
||||
};
|
||||
|
||||
async function requestAddresses(path, query, regionCode) {
|
||||
const normalizedQuery = query.trim();
|
||||
if (normalizedQuery.length < 2) return [];
|
||||
|
||||
const parameters = new URLSearchParams({ query: normalizedQuery, limit: "20" });
|
||||
if (regionCode) parameters.set("region_code", regionCode);
|
||||
async function requestItems(path, extra = {}) {
|
||||
const parameters = new URLSearchParams({ limit: "20", ...extra });
|
||||
const response = await fetch(`${API_BASE_URL}/${path}?${parameters}`);
|
||||
if (!response.ok) throw new Error(`Ошибка API: ${response.status}`);
|
||||
|
||||
const data = await response.json();
|
||||
return data.items.map((address) => ({
|
||||
value: address.fias_id,
|
||||
label: `${address.type_name} ${address.name}`.trim(),
|
||||
meta: `${levelNames[address.level] || "Адрес"} · регион ${address.region_code}`,
|
||||
address,
|
||||
}));
|
||||
return response.json();
|
||||
}
|
||||
|
||||
const loadRegions = (query) => requestAddresses("regions", query);
|
||||
const loadAddresses = (query, regionCode) => requestAddresses("search", query, regionCode);
|
||||
function addressTitle(address) {
|
||||
return `${address.type_name} ${address.name}`.trim();
|
||||
}
|
||||
|
||||
const NESTED_PARENT_LEVELS = new Set([2, 7]);
|
||||
|
||||
function addressChain(address) {
|
||||
const items = [];
|
||||
const seen = new Set();
|
||||
for (let node = address; node && !seen.has(node.id); node = node.parent) {
|
||||
seen.add(node.id);
|
||||
items.push({
|
||||
level: node.level,
|
||||
type_name: node.type_name,
|
||||
name: node.name,
|
||||
fias_id: node.fias_id,
|
||||
});
|
||||
}
|
||||
return items.reverse();
|
||||
}
|
||||
|
||||
function toAddressOption(address) {
|
||||
const parent = address.parent;
|
||||
const showParent = parent && NESTED_PARENT_LEVELS.has(parent.level);
|
||||
return {
|
||||
value: address.fias_id,
|
||||
label: showParent
|
||||
? `${addressTitle(address)} · ${addressTitle(parent)}`
|
||||
: addressTitle(address),
|
||||
meta: `${levelNames[address.level] || "Адрес"} · ${address.region_code}`,
|
||||
address,
|
||||
};
|
||||
}
|
||||
|
||||
function toHouseOption(house) {
|
||||
return {
|
||||
value: house.fias_id,
|
||||
label: house.display_number,
|
||||
meta: `Дом · ${house.region_code}`,
|
||||
house,
|
||||
};
|
||||
}
|
||||
|
||||
async function loadAddresses(path, query, extra, minLength = 2) {
|
||||
const normalizedQuery = query.trim();
|
||||
if (normalizedQuery.length < minLength) return [];
|
||||
const data = await requestItems(path, { query: normalizedQuery, ...extra });
|
||||
return data.items.map(toAddressOption);
|
||||
}
|
||||
|
||||
async function loadHouses(query, streetId) {
|
||||
const extra = { parent_id: String(streetId) };
|
||||
if (query.trim()) extra.query = query.trim();
|
||||
const data = await requestItems("houses", extra);
|
||||
return data.items.map(toHouseOption);
|
||||
}
|
||||
|
||||
const loadRegions = (query) => loadAddresses("regions", query);
|
||||
const loadLocalities = (query, regionId) =>
|
||||
loadAddresses("localities", query, { region_id: String(regionId) });
|
||||
const loadStreets = (query, { parentId, regionCode } = {}) =>
|
||||
loadAddresses("streets", query, {
|
||||
...(parentId ? { parent_id: String(parentId) } : {}),
|
||||
...(regionCode ? { region_code: String(regionCode) } : {}),
|
||||
});
|
||||
|
||||
const selectStyles = {
|
||||
control: (base, state) => ({
|
||||
|
|
@ -72,9 +128,53 @@ function OptionLabel({ label, meta }) {
|
|||
);
|
||||
}
|
||||
|
||||
function AddressSelect({
|
||||
inputId,
|
||||
label,
|
||||
value,
|
||||
onChange,
|
||||
loadOptions,
|
||||
placeholder,
|
||||
disabled,
|
||||
noOptionsMessage,
|
||||
loadingMessage,
|
||||
selectKey,
|
||||
defaultOptions = false,
|
||||
}) {
|
||||
return (
|
||||
<div className="search-field">
|
||||
<label htmlFor={inputId}>{label}</label>
|
||||
<AsyncSelect
|
||||
key={selectKey}
|
||||
inputId={inputId}
|
||||
aria-label={label}
|
||||
cacheOptions
|
||||
defaultOptions={defaultOptions}
|
||||
isClearable
|
||||
isDisabled={disabled}
|
||||
loadOptions={loadOptions}
|
||||
onChange={onChange}
|
||||
value={value}
|
||||
placeholder={placeholder}
|
||||
noOptionsMessage={noOptionsMessage}
|
||||
loadingMessage={loadingMessage}
|
||||
formatOptionLabel={(option) => <OptionLabel {...option} />}
|
||||
styles={selectStyles}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function twoCharHint(kind) {
|
||||
return ({ inputValue }) =>
|
||||
inputValue.trim().length < 2 ? "Введите хотя бы 2 символа" : `${kind} не найден`;
|
||||
}
|
||||
|
||||
export default function App() {
|
||||
const [region, setRegion] = useState(null);
|
||||
const [selected, setSelected] = useState(null);
|
||||
const [locality, setLocality] = useState(null);
|
||||
const [street, setStreet] = useState(null);
|
||||
const [house, setHouse] = useState(null);
|
||||
const [error, setError] = useState("");
|
||||
|
||||
const findOptions = (loader) => async (query) => {
|
||||
|
|
@ -89,78 +189,125 @@ export default function App() {
|
|||
|
||||
const selectRegion = (option) => {
|
||||
setRegion(option);
|
||||
setSelected(null);
|
||||
setLocality(null);
|
||||
setStreet(null);
|
||||
setHouse(null);
|
||||
};
|
||||
|
||||
const selectLocality = (option) => {
|
||||
setLocality(option);
|
||||
setStreet(null);
|
||||
setHouse(null);
|
||||
};
|
||||
|
||||
const selectStreet = (option) => {
|
||||
setStreet(option);
|
||||
setHouse(null);
|
||||
if (locality || !option?.address?.parent) return;
|
||||
const parent = option.address.parent;
|
||||
if (parent.level !== 1) {
|
||||
setLocality(toAddressOption(parent));
|
||||
}
|
||||
};
|
||||
|
||||
const result = region
|
||||
? {
|
||||
region: region.address,
|
||||
locality: locality?.address ?? null,
|
||||
street: street?.address ?? null,
|
||||
house: house?.house ?? null,
|
||||
chain: addressChain(street?.address || locality?.address || region.address),
|
||||
}
|
||||
: null;
|
||||
|
||||
return (
|
||||
<main className="page-shell">
|
||||
<section className="search-card">
|
||||
<div className="brand-mark" aria-hidden="true">А</div>
|
||||
<p className="eyebrow">ФИАС · адресный сервис</p>
|
||||
<h1>Найдите адрес</h1>
|
||||
<p className="subtitle">
|
||||
Сначала выберите регион, затем найдите город, населённый пункт или улицу.
|
||||
</p>
|
||||
|
||||
<div className="search-field">
|
||||
<label htmlFor="region-search">Регион</label>
|
||||
<AsyncSelect
|
||||
<AddressSelect
|
||||
inputId="region-search"
|
||||
aria-label="Выбор региона"
|
||||
cacheOptions
|
||||
defaultOptions={false}
|
||||
loadOptions={findOptions(loadRegions)}
|
||||
onChange={selectRegion}
|
||||
label="Субъект РФ"
|
||||
value={region}
|
||||
placeholder="Начните вводить название региона"
|
||||
noOptionsMessage={({ inputValue }) =>
|
||||
inputValue.trim().length < 2 ? "Введите хотя бы 2 символа" : "Регион не найден"
|
||||
}
|
||||
loadingMessage={() => "Ищем регион…"}
|
||||
formatOptionLabel={(option) => <OptionLabel {...option} />}
|
||||
styles={selectStyles}
|
||||
onChange={selectRegion}
|
||||
loadOptions={findOptions(loadRegions)}
|
||||
placeholder="Начните вводить название субъекта РФ"
|
||||
noOptionsMessage={twoCharHint("Субъект РФ")}
|
||||
loadingMessage={() => "Ищем субъект РФ…"}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="search-field address-field">
|
||||
<label htmlFor="address-search">Адрес в выбранном регионе</label>
|
||||
<AsyncSelect
|
||||
key={region?.value || "no-region"}
|
||||
inputId="address-search"
|
||||
aria-label="Поиск адреса"
|
||||
cacheOptions
|
||||
defaultOptions={false}
|
||||
isDisabled={!region}
|
||||
loadOptions={findOptions((query) => loadAddresses(query, region.address.region_code))}
|
||||
onChange={setSelected}
|
||||
value={selected}
|
||||
placeholder={region ? "Например, Владивосток или Светланская" : "Сначала выберите регион"}
|
||||
noOptionsMessage={({ inputValue }) =>
|
||||
inputValue.trim().length < 2 ? "Введите хотя бы 2 символа" : "Ничего не найдено"
|
||||
}
|
||||
loadingMessage={() => "Ищем адрес…"}
|
||||
formatOptionLabel={(option) => <OptionLabel {...option} />}
|
||||
styles={selectStyles}
|
||||
<AddressSelect
|
||||
inputId="locality-search"
|
||||
label="Населённый пункт"
|
||||
selectKey={region?.value || "no-region"}
|
||||
value={locality}
|
||||
onChange={selectLocality}
|
||||
disabled={!region}
|
||||
loadOptions={findOptions((query) =>
|
||||
region ? loadLocalities(query, region.address.region_code) : [],
|
||||
)}
|
||||
placeholder={region ? "Например, Владивосток" : "Сначала выберите субъект РФ"}
|
||||
noOptionsMessage={twoCharHint("Населённый пункт")}
|
||||
loadingMessage={() => "Ищем населённый пункт…"}
|
||||
/>
|
||||
|
||||
<AddressSelect
|
||||
inputId="street-search"
|
||||
label="Улица / СНТ"
|
||||
selectKey={`${region?.value || "no-region"}-${locality?.value || "no-locality"}`}
|
||||
value={street}
|
||||
onChange={selectStreet}
|
||||
disabled={!region}
|
||||
loadOptions={findOptions((query) =>
|
||||
region
|
||||
? loadStreets(query, {
|
||||
parentId: locality?.address.id,
|
||||
regionCode: region.address.region_code,
|
||||
})
|
||||
: [],
|
||||
)}
|
||||
placeholder={
|
||||
region
|
||||
? "Например, Светланская или СНТ"
|
||||
: "Сначала выберите субъект РФ"
|
||||
}
|
||||
noOptionsMessage={twoCharHint("Улица или СНТ")}
|
||||
loadingMessage={() => "Ищем улицу…"}
|
||||
/>
|
||||
|
||||
<AddressSelect
|
||||
inputId="house-search"
|
||||
label="Дом"
|
||||
selectKey={street?.value || "no-street"}
|
||||
value={house}
|
||||
onChange={setHouse}
|
||||
disabled={!street}
|
||||
defaultOptions
|
||||
loadOptions={findOptions((query) =>
|
||||
street ? loadHouses(query, street.address.id) : [],
|
||||
)}
|
||||
placeholder={street ? "Например, 10" : "Сначала выберите улицу или СНТ"}
|
||||
noOptionsMessage={() => "Дом не найден"}
|
||||
loadingMessage={() => "Ищем дом…"}
|
||||
/>
|
||||
|
||||
{error && <p className="error-message">{error}</p>}
|
||||
</div>
|
||||
|
||||
<div className={`result-panel ${selected ? "has-result" : ""}`}>
|
||||
<div className={`result-panel ${result ? "has-result" : ""}`}>
|
||||
<div className="result-heading">
|
||||
<span>Результат</span>
|
||||
<span className="format-badge">JSON</span>
|
||||
</div>
|
||||
{selected ? (
|
||||
<pre>{JSON.stringify(selected.address, null, 2)}</pre>
|
||||
{result ? (
|
||||
<pre>{JSON.stringify(result, null, 2)}</pre>
|
||||
) : (
|
||||
<div className="empty-state">
|
||||
<span className="empty-icon">{`{ }`}</span>
|
||||
<p>Выберите адрес, и его данные появятся здесь.</p>
|
||||
<p>Выберите поле, и его JSON появится здесь.</p>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</section>
|
||||
<p className="footer-note">Данные предоставляются сервисом ГАР/ФИАС</p>
|
||||
</main>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,8 @@ body::after {
|
|||
.page-shell {
|
||||
display: grid;
|
||||
min-height: 100vh;
|
||||
place-content: center;
|
||||
align-content: start;
|
||||
justify-content: center;
|
||||
padding: 48px 20px 32px;
|
||||
}
|
||||
|
||||
|
|
@ -56,22 +57,8 @@ body::after {
|
|||
backdrop-filter: blur(18px);
|
||||
}
|
||||
|
||||
.brand-mark {
|
||||
display: grid;
|
||||
width: 46px;
|
||||
height: 46px;
|
||||
margin-bottom: 24px;
|
||||
place-items: center;
|
||||
border-radius: 14px;
|
||||
color: #fff;
|
||||
background: linear-gradient(145deg, #776aff, #5546e8);
|
||||
box-shadow: 0 10px 25px rgba(83, 69, 223, 0.3);
|
||||
font-size: 21px;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.eyebrow {
|
||||
margin: 0 0 8px;
|
||||
margin: 0 0 28px;
|
||||
color: #695cff;
|
||||
font-size: 12px;
|
||||
font-weight: 800;
|
||||
|
|
@ -79,20 +66,6 @@ body::after {
|
|||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
h1 {
|
||||
margin: 0;
|
||||
font-size: clamp(34px, 6vw, 48px);
|
||||
line-height: 1.08;
|
||||
letter-spacing: -0.045em;
|
||||
}
|
||||
|
||||
.subtitle {
|
||||
margin: 14px 0 34px;
|
||||
color: #706c80;
|
||||
font-size: 16px;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.search-field label {
|
||||
display: block;
|
||||
margin: 0 0 9px 3px;
|
||||
|
|
@ -100,7 +73,7 @@ h1 {
|
|||
font-weight: 750;
|
||||
}
|
||||
|
||||
.address-field { margin-top: 20px; }
|
||||
.search-field + .search-field { margin-top: 20px; }
|
||||
|
||||
.option-label { display: grid; gap: 3px; }
|
||||
.option-label span { font-weight: 650; }
|
||||
|
|
@ -176,15 +149,7 @@ pre {
|
|||
.empty-state p { margin: 10px 0 0; }
|
||||
.empty-icon { color: #b3afc2; font-family: monospace; font-size: 25px; }
|
||||
|
||||
.footer-note {
|
||||
margin: 24px 0 0;
|
||||
color: #8b879c;
|
||||
font-size: 12px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
@media (max-width: 600px) {
|
||||
.page-shell { align-content: start; padding: 20px 12px; }
|
||||
.search-card { width: 100%; padding: 28px 20px; border-radius: 22px; }
|
||||
.subtitle { margin-bottom: 26px; }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,14 +6,18 @@ readme = "README.md"
|
|||
requires-python = ">=3.12"
|
||||
dependencies = [
|
||||
"django>=5.2,<6.0",
|
||||
"django-constance>=4.3.4,<5.0",
|
||||
"django-environ>=0.12,<1.0",
|
||||
"django-ninja>=1.4,<2.0",
|
||||
"grpcio>=1.70,<2.0",
|
||||
"grpcio-reflection>=1.70,<2.0",
|
||||
"gunicorn>=23.0,<24.0",
|
||||
"protobuf>=7.35,<8.0",
|
||||
"psycopg[binary]>=3.2,<4.0",
|
||||
]
|
||||
|
||||
[dependency-groups]
|
||||
dev = ["pytest>=8.3", "pytest-django>=4.10"]
|
||||
dev = ["grpcio-tools>=1.70,<2.0", "pytest>=8.3", "pytest-django>=4.10"]
|
||||
|
||||
[tool.pytest.ini_options]
|
||||
DJANGO_SETTINGS_MODULE = "address.settings"
|
||||
|
|
@ -22,6 +26,11 @@ python_files = ["test_*.py", "*_tests.py"]
|
|||
[tool.ruff]
|
||||
line-length = 100
|
||||
target-version = "py312"
|
||||
extend-exclude = [
|
||||
"address/grpc/*_pb2.py",
|
||||
"address/grpc/*_pb2.pyi",
|
||||
"address/grpc/*_pb2_grpc.py",
|
||||
]
|
||||
|
||||
[tool.ruff.lint]
|
||||
select = ["E", "F", "I"]
|
||||
|
|
|
|||
|
|
@ -0,0 +1,5 @@
|
|||
#!/command/with-contenv sh
|
||||
set -eu
|
||||
|
||||
cd /app
|
||||
exec s6-setuidgid django python manage.py rungrpc
|
||||
456
uv.lock
456
uv.lock
|
|
@ -1,5 +1,5 @@
|
|||
version = 1
|
||||
revision = 2
|
||||
revision = 3
|
||||
requires-python = ">=3.12"
|
||||
|
||||
[[package]]
|
||||
|
|
@ -8,14 +8,19 @@ version = "0.1.0"
|
|||
source = { virtual = "." }
|
||||
dependencies = [
|
||||
{ name = "django" },
|
||||
{ name = "django-constance" },
|
||||
{ name = "django-environ" },
|
||||
{ name = "django-ninja" },
|
||||
{ name = "grpcio" },
|
||||
{ name = "grpcio-reflection" },
|
||||
{ name = "gunicorn" },
|
||||
{ name = "protobuf" },
|
||||
{ name = "psycopg", extra = ["binary"] },
|
||||
]
|
||||
|
||||
[package.dev-dependencies]
|
||||
dev = [
|
||||
{ name = "grpcio-tools" },
|
||||
{ name = "pytest" },
|
||||
{ name = "pytest-django" },
|
||||
]
|
||||
|
|
@ -23,14 +28,19 @@ dev = [
|
|||
[package.metadata]
|
||||
requires-dist = [
|
||||
{ name = "django", specifier = ">=5.2,<6.0" },
|
||||
{ name = "django-constance", specifier = ">=4.3.4,<5.0" },
|
||||
{ name = "django-environ", specifier = ">=0.12,<1.0" },
|
||||
{ name = "django-ninja", specifier = ">=1.4,<2.0" },
|
||||
{ name = "grpcio", specifier = ">=1.70,<2.0" },
|
||||
{ name = "grpcio-reflection", specifier = ">=1.70,<2.0" },
|
||||
{ name = "gunicorn", specifier = ">=23.0,<24.0" },
|
||||
{ name = "protobuf", specifier = ">=7.35,<8.0" },
|
||||
{ name = "psycopg", extras = ["binary"], specifier = ">=3.2,<4.0" },
|
||||
]
|
||||
|
||||
[package.metadata.requires-dev]
|
||||
dev = [
|
||||
{ name = "grpcio-tools", specifier = ">=1.70,<2.0" },
|
||||
{ name = "pytest", specifier = ">=8.3" },
|
||||
{ name = "pytest-django", specifier = ">=4.10" },
|
||||
]
|
||||
|
|
@ -38,116 +48,237 @@ dev = [
|
|||
[[package]]
|
||||
name = "annotated-types"
|
||||
version = "0.8.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/5f/56/a8120250d128bed162cd73c76d45f6ef9991f3e068f62a8ee060afa3104a/annotated_types-0.8.0.tar.gz", hash = "sha256:13b2beaad985e05e2d6407ee4c4f35590b11f8d693a258a561055cac8f64cab7", size = 15893, upload-time = "2026-07-23T20:16:13.995Z" }
|
||||
source = { registry = "http://pip.home.arpa/root/pypi/+simple/" }
|
||||
sdist = { url = "http://pip.home.arpa/root/pypi/+f/13b/2beaad985e05e/annotated_types-0.8.0.tar.gz", hash = "sha256:13b2beaad985e05e2d6407ee4c4f35590b11f8d693a258a561055cac8f64cab7" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/99/91/8acff4f5e50511b911bbccb72b8628a49c68ce14148cd9f6431094859a90/annotated_types-0.8.0-py3-none-any.whl", hash = "sha256:f072f4d804ea359e4eaf198b1af7a8b0943881a87f31bb764f8bf219bb9419e0", size = 13427, upload-time = "2026-07-23T20:16:12.938Z" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/f07/2f4d804ea359e/annotated_types-0.8.0-py3-none-any.whl", hash = "sha256:f072f4d804ea359e4eaf198b1af7a8b0943881a87f31bb764f8bf219bb9419e0" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "asgiref"
|
||||
version = "3.12.1"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/e6/26/3b59f2bdae5f640389becb1f673cded775287f5fc4f816309d9ca9a3f93d/asgiref-3.12.1.tar.gz", hash = "sha256:59dcb51c272ad209d59bed5708a64a333083e86017d7fcdd67498eeab7784340", size = 42378, upload-time = "2026-07-14T09:56:18.087Z" }
|
||||
source = { registry = "http://pip.home.arpa/root/pypi/+simple/" }
|
||||
sdist = { url = "http://pip.home.arpa/root/pypi/+f/59d/cb51c272ad209/asgiref-3.12.1.tar.gz", hash = "sha256:59dcb51c272ad209d59bed5708a64a333083e86017d7fcdd67498eeab7784340" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/c0/1b/54f4ad77cd8a584fa70746c47df988e002cf1ee1eba43364d46f87803647/asgiref-3.12.1-py3-none-any.whl", hash = "sha256:fe386d1c2bff7259ea95929266d12a8cf9a8b5a1c2598402967d8792e7a7c094", size = 25478, upload-time = "2026-07-14T09:56:16.926Z" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/fe3/86d1c2bff7259/asgiref-3.12.1-py3-none-any.whl", hash = "sha256:fe386d1c2bff7259ea95929266d12a8cf9a8b5a1c2598402967d8792e7a7c094" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "colorama"
|
||||
version = "0.4.6"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/d8/53/6f443c9a4a8358a93a6792e2acffb9d9d5cb0a5cfd8802644b7b1c9a02e4/colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44", size = 27697, upload-time = "2022-10-25T02:36:22.414Z" }
|
||||
source = { registry = "http://pip.home.arpa/root/pypi/+simple/" }
|
||||
sdist = { url = "http://pip.home.arpa/root/pypi/+f/086/95f5cb7ed6e05/colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/d1/d6/3965ed04c63042e047cb6a3e6ed1a63a35087b6a609aa3a15ed8ac56c221/colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6", size = 25335, upload-time = "2022-10-25T02:36:20.889Z" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/4f1/d9991f5acc0ca/colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "django"
|
||||
version = "5.2.17"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
source = { registry = "http://pip.home.arpa/root/pypi/+simple/" }
|
||||
dependencies = [
|
||||
{ name = "asgiref" },
|
||||
{ name = "sqlparse" },
|
||||
{ name = "tzdata", marker = "sys_platform == 'win32'" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/d5/d8/43e9d000519adceb189620b6869ff88031e046df91c2e9da72f8f6918399/django-5.2.17.tar.gz", hash = "sha256:9d4d93be539a18ab80d058eb515900e10951e04c537c5a6b394fc49528d3251f", size = 10889740, upload-time = "2026-08-04T15:04:03.173Z" }
|
||||
sdist = { url = "http://pip.home.arpa/root/pypi/+f/9d4/d93be539a18ab/django-5.2.17.tar.gz", hash = "sha256:9d4d93be539a18ab80d058eb515900e10951e04c537c5a6b394fc49528d3251f" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/df/f8/ce120525ca78f12b07daf65786679c5d0b54a75285a8958d3ae55e39da35/django-5.2.17-py3-none-any.whl", hash = "sha256:f04fb3b36ee119e1af4fa1d397d5fd6cf12700f49321e84d4f4c642c5b1973db", size = 8315563, upload-time = "2026-08-04T15:03:59.1Z" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/f04/fb3b36ee119e1/django-5.2.17-py3-none-any.whl", hash = "sha256:f04fb3b36ee119e1af4fa1d397d5fd6cf12700f49321e84d4f4c642c5b1973db" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "django-constance"
|
||||
version = "4.3.5"
|
||||
source = { registry = "http://pip.home.arpa/root/pypi/+simple/" }
|
||||
sdist = { url = "http://pip.home.arpa/root/pypi/+f/081/177483d272b66/django_constance-4.3.5.tar.gz", hash = "sha256:081177483d272b664cf768deae76fc2fbb0a777076f45620b6fde4d9075ee2b3" }
|
||||
wheels = [
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/c28/f360c28221127/django_constance-4.3.5-py3-none-any.whl", hash = "sha256:c28f360c2822112772a3e4caf02db758c82cca8de7d0b9f648fef371bf4b8bc6" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "django-environ"
|
||||
version = "0.14.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/57/e1/4c4ddcf6e90f023e89edb1d92f9a7fffce61ad4b691df497f2f5c0be6e26/django_environ-0.14.0.tar.gz", hash = "sha256:b6c48d93b9d2ff8a3ea14099e90c35aa4f101c1b4d5f262dfee0d27b06742ed7", size = 60417, upload-time = "2026-06-18T22:49:55.847Z" }
|
||||
source = { registry = "http://pip.home.arpa/root/pypi/+simple/" }
|
||||
sdist = { url = "http://pip.home.arpa/root/pypi/+f/b6c/48d93b9d2ff8a/django_environ-0.14.0.tar.gz", hash = "sha256:b6c48d93b9d2ff8a3ea14099e90c35aa4f101c1b4d5f262dfee0d27b06742ed7" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/1a/fe/67b423fc30f16d10259e901320fbc121746bf168aaaad9043e6ebb0110c1/django_environ-0.14.0-py3-none-any.whl", hash = "sha256:8dbe8a57f0a540ab8abd6f54f230de5e99e3a2c9d797cb9caecb037bca3d47d8", size = 20934, upload-time = "2026-06-18T22:49:54.355Z" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/8db/e8a57f0a540ab/django_environ-0.14.0-py3-none-any.whl", hash = "sha256:8dbe8a57f0a540ab8abd6f54f230de5e99e3a2c9d797cb9caecb037bca3d47d8" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "django-ninja"
|
||||
version = "1.6.3"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
source = { registry = "http://pip.home.arpa/root/pypi/+simple/" }
|
||||
dependencies = [
|
||||
{ name = "django" },
|
||||
{ name = "pydantic" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/a2/57/71cc769a7410ade9bd1cddee16132e3da7718fcce1386c67ade7ea939677/django_ninja-1.6.3.tar.gz", hash = "sha256:a65a5016bbf044702fb1f1ff702f96dc3c806fbd7c918290512659531873039f", size = 2340438, upload-time = "2026-08-17T08:45:42.703Z" }
|
||||
sdist = { url = "http://pip.home.arpa/root/pypi/+f/a65/a5016bbf04470/django_ninja-1.6.3.tar.gz", hash = "sha256:a65a5016bbf044702fb1f1ff702f96dc3c806fbd7c918290512659531873039f" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/e3/de/061d08265951765835166a2c69f0b99a8f49dfbea85d7d204ac87a236679/django_ninja-1.6.3-py3-none-any.whl", hash = "sha256:e83ba573e0f17b1d2fddca078613e2aaad512acb3d3c6bc9a5f1a0d9257dd70c", size = 2375010, upload-time = "2026-08-17T08:45:40.473Z" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/e83/ba573e0f17b1d/django_ninja-1.6.3-py3-none-any.whl", hash = "sha256:e83ba573e0f17b1d2fddca078613e2aaad512acb3d3c6bc9a5f1a0d9257dd70c" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "grpcio"
|
||||
version = "1.83.1"
|
||||
source = { registry = "http://pip.home.arpa/root/pypi/+simple/" }
|
||||
dependencies = [
|
||||
{ name = "typing-extensions" },
|
||||
]
|
||||
sdist = { url = "http://pip.home.arpa/root/pypi/+f/9ce/e6fcbf2eb57c4/grpcio-1.83.1.tar.gz", hash = "sha256:9cee6fcbf2eb57c4b49451787bfa87be8efc1ca02a0b327dd4b54d44502e362b" }
|
||||
wheels = [
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/5ac/d14c6ddf047de/grpcio-1.83.1-cp312-cp312-linux_armv7l.whl", hash = "sha256:5acd14c6ddf047de62cbf8745b11103ea91abbf57d1b8edd5395ccd9fcd13abb" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/161/38031a47b7718/grpcio-1.83.1-cp312-cp312-macosx_11_0_universal2.whl", hash = "sha256:16138031a47b771860a16a975b53087f4fd5bbdbb2c03a188c5d90ad65d2bdae" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/5cc/c26715fd4defc/grpcio-1.83.1-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:5ccc26715fd4defca5e129e280dd883b1737b65045ec50ffe22ce42104089519" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/b74/f2a1d9ab1dfa3/grpcio-1.83.1-cp312-cp312-manylinux2014_i686.manylinux_2_17_i686.whl", hash = "sha256:b74f2a1d9ab1dfa3e263ef33d581613679b78d0884babf11671af26e45570ead" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/725/78aa07a4008f1/grpcio-1.83.1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:72578aa07a4008f17521ef52debcc3acfd1e2c5426243bc3ffb56a38bfe610b7" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/c12/e1fc59c6dc26d/grpcio-1.83.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:c12e1fc59c6dc26d10d9144453ddc6cbfe4cd4c31e874ed2d0132f88e685eb8b" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/491/0b62f7d121971/grpcio-1.83.1-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:4910b62f7d12197160bfb7de06d876d64dd12d43483e8292f98f49ca09b628d9" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/9e7/03effe3ae7799/grpcio-1.83.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:9e703effe3ae779925c82ac24fdb82cf4105e1096810151ed9501c5f34546b9c" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/a2a/ea8bd6e0a34f1/grpcio-1.83.1-cp312-cp312-win32.whl", hash = "sha256:a2aea8bd6e0a34f12cbaddb7bb70bec836818789fa5c7ab7572c6b745396a2d4" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/583/bf2e8255040a4/grpcio-1.83.1-cp312-cp312-win_amd64.whl", hash = "sha256:583bf2e8255040a4a312f9572dfe62a05271437b149550e1a536d5c47d2d1e8a" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/8d2/28e253b77865e/grpcio-1.83.1-cp313-cp313-linux_armv7l.whl", hash = "sha256:8d228e253b77865efcbdd7b5894ca882c9e0ea98c02b7d20582e61ded8dfd4b5" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/046/8b627f2987c9a/grpcio-1.83.1-cp313-cp313-macosx_11_0_universal2.whl", hash = "sha256:0468b627f2987c9a77f7580030207cbd85457ffe52998beff4f0b5c38c58a72c" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/a6a/282e81530cead/grpcio-1.83.1-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:a6a282e81530cead60bbd752cc04950a57f224379e9821495d6a35bd5ce9b1f4" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/947/d945f52e8ecf3/grpcio-1.83.1-cp313-cp313-manylinux2014_i686.manylinux_2_17_i686.whl", hash = "sha256:947d945f52e8ecf3cafd2bb7113502a16ccfda3e12c854443094de32d83ad432" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/556/56318d5dd3870/grpcio-1.83.1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:55656318d5dd387077396dffb929171ca3966e24bfead9a6c5dba9f889062cb4" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/9da/f5acf4fc9d5f5/grpcio-1.83.1-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:9daf5acf4fc9d5f5627229969c2580a91e511779d76e4ccdeb9f4770f05d8bc2" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/7b9/4174cbca93316/grpcio-1.83.1-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:7b94174cbca93316888f805efbeb08f1c020f7b7493d2d50cc4f6b64ebb7e8bd" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/65c/5a7210911ffe0/grpcio-1.83.1-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:65c5a7210911ffe0f67b1cdc5308f9854b6d1f1b345e3e49ab7cac1ba50fa346" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/179/368d936185461/grpcio-1.83.1-cp313-cp313-win32.whl", hash = "sha256:179368d9361854616ce6f397d4716e07480129652752fcbcfc5a7260455ad6f2" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/2e5/7af456385491a/grpcio-1.83.1-cp313-cp313-win_amd64.whl", hash = "sha256:2e57af456385491a76e13c4aada8c8f43a8e47051e06ea97a9dbe2a49654e6db" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/8b3/c87ca908296bf/grpcio-1.83.1-cp314-cp314-linux_armv7l.whl", hash = "sha256:8b3c87ca908296bf125f841d3e1a2225a2b39aaa8ed7a57e7ccde465ee519bab" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/c0f/3f20c90e72a17/grpcio-1.83.1-cp314-cp314-macosx_11_0_universal2.whl", hash = "sha256:c0f3f20c90e72a171917ae65706500b096a1c3eb5f162c3ce702a2e25635f132" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/81b/bf35a46bf8cad/grpcio-1.83.1-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:81bbf35a46bf8cad2dfbb2eccc19c711befb58b288acb534bbcd0d74283202a6" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/215/cec07d1117650/grpcio-1.83.1-cp314-cp314-manylinux2014_i686.manylinux_2_17_i686.whl", hash = "sha256:215cec07d11176507387bda4bf2751816e880f9bff8dc1ca524bfbb8ed8f2fad" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/abc/e7d43ec29cd39/grpcio-1.83.1-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:abce7d43ec29cd39230fa8339de1a07643b55adc412a454850fbd875349950ff" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/e25/6f95a40e3b018/grpcio-1.83.1-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:e256f95a40e3b0183a98556fb7164d24b97eeb353123ccabfcba94712b35ee2a" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/211/0059146fb0ea2/grpcio-1.83.1-cp314-cp314-musllinux_1_2_i686.whl", hash = "sha256:2110059146fb0ea216e1ffddb29377b5cc2fd412a5b0a92e102616bd5edf18c2" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/20d/944d967843f81/grpcio-1.83.1-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:20d944d967843f8183f9f23d5916388362e5f8eeeae855bbe4354d906dc9f31b" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/623/c87c6d4a1cb30/grpcio-1.83.1-cp314-cp314-win32.whl", hash = "sha256:623c87c6d4a1cb30d82c4e896f95477050f2e01b4a1f8cf91ff2b1abdf89c457" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/47e/6934ad3877927/grpcio-1.83.1-cp314-cp314-win_amd64.whl", hash = "sha256:47e6934ad38779271e2e7cc5f78a63a407cf3d98114c65c1fdbcd3f5a716f29b" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "grpcio-reflection"
|
||||
version = "1.82.0"
|
||||
source = { registry = "http://pip.home.arpa/root/pypi/+simple/" }
|
||||
dependencies = [
|
||||
{ name = "grpcio" },
|
||||
{ name = "protobuf" },
|
||||
]
|
||||
sdist = { url = "http://pip.home.arpa/root/pypi/+f/0d2/6f5cf29d87cc2/grpcio_reflection-1.82.0.tar.gz", hash = "sha256:0d26f5cf29d87cc2984c8a6f72030cba1db5c5a4f72e79f31859e0c408f1265e" }
|
||||
wheels = [
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/6fa/84a6eb39c974f/grpcio_reflection-1.82.0-py3-none-any.whl", hash = "sha256:6fa84a6eb39c974f504cf261a2a2a7374b4759c8df08338417bec55c47af10ef" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "grpcio-tools"
|
||||
version = "1.82.0"
|
||||
source = { registry = "http://pip.home.arpa/root/pypi/+simple/" }
|
||||
dependencies = [
|
||||
{ name = "grpcio" },
|
||||
{ name = "protobuf" },
|
||||
{ name = "setuptools" },
|
||||
]
|
||||
sdist = { url = "http://pip.home.arpa/root/pypi/+f/c9f/3dbb88e90d9b0/grpcio_tools-1.82.0.tar.gz", hash = "sha256:c9f3dbb88e90d9b05253a24fc11b61e516a7224ccbfc682e0a3dce55cddcab92" }
|
||||
wheels = [
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/811/5ec20ac7aaa63/grpcio_tools-1.82.0-cp312-cp312-linux_armv7l.whl", hash = "sha256:8115ec20ac7aaa632d1b9b22ef21666e1e4ce1952765bee71645427ead4b9295" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/a0b/77297911a2517/grpcio_tools-1.82.0-cp312-cp312-macosx_11_0_universal2.whl", hash = "sha256:a0b77297911a2517d78645f01a83a2f54ae0b8d1bdde317be87c633b87bb616a" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/6ea/f2fd99ab3a76a/grpcio_tools-1.82.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:6eaf2fd99ab3a76a45349b6f20a3985c5db5392b61fa7d170f726a67d2804315" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/e8c/b17083d96f459/grpcio_tools-1.82.0-cp312-cp312-manylinux2014_i686.manylinux_2_17_i686.whl", hash = "sha256:e8cb17083d96f459640886cfb94235607a7ff9a932e21a169d43a478435841b2" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/7df/5721d390fe105/grpcio_tools-1.82.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:7df5721d390fe1054c94768f1644ed69570adab3c53e4443dd5624053a13a187" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/3e0/62e92633ee1f5/grpcio_tools-1.82.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:3e062e92633ee1f58b7c25220301271bdd03e2366a7de42471eaba0e18a44ddf" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/0b5/8d67bd2678858/grpcio_tools-1.82.0-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:0b58d67bd2678858d81349ee62e66181d346812e8ec4a36bc4460600d8983ae2" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/ac0/9089db603752b/grpcio_tools-1.82.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:ac09089db603752b0c4713fc5a97030dc7f27a896bcbf2751fa6cb411f920ae2" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/7a2/c676b3e38536a/grpcio_tools-1.82.0-cp312-cp312-win32.whl", hash = "sha256:7a2c676b3e38536a64c2c5b65c87c9f03528a2011fd99b9a6d82880e6e206647" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/f24/a42601b699ac6/grpcio_tools-1.82.0-cp312-cp312-win_amd64.whl", hash = "sha256:f24a42601b699ac620836af9b577b16089fd365dcc07637d8b7857510e87835f" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/678/147f2e5c87844/grpcio_tools-1.82.0-cp313-cp313-linux_armv7l.whl", hash = "sha256:678147f2e5c87844365eba22fe39e001b1f83e7822e9d1915fb497c39477d96b" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/e2c/86c8c275861f6/grpcio_tools-1.82.0-cp313-cp313-macosx_11_0_universal2.whl", hash = "sha256:e2c86c8c275861f621673e7510e96e3caed3541d6b95551d958ec119af1cd6d1" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/cc0/1c1774c843ffb/grpcio_tools-1.82.0-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:cc01c1774c843ffb7da446d5a3f32b857576705d9de3859bf3ef04f6bf1c1389" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/9f6/654ef32dde459/grpcio_tools-1.82.0-cp313-cp313-manylinux2014_i686.manylinux_2_17_i686.whl", hash = "sha256:9f6654ef32dde459ea2d929fdf83b4f649acde274ba0285b4a953992bdc76520" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/b0b/15875e3c0daf3/grpcio_tools-1.82.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:b0b15875e3c0daf3208055f0cc2305a32ece32b914c9150ea89751373a072758" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/338/a013a7207650e/grpcio_tools-1.82.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:338a013a7207650eb4bd14fe01b46cd5d982e7aaf28b82d605e3bac252913977" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/3c0/8d5caa1392535/grpcio_tools-1.82.0-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:3c08d5caa1392535b7372b3e079a9e2fedfc2ee20cdcdc079e3ec6ce288040bf" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/f82/905f3f67630e6/grpcio_tools-1.82.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:f82905f3f67630e60eb3fb18276407463189a8d75d7ee3b2c8549c915fa380ad" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/3e3/1cfeae69a3e37/grpcio_tools-1.82.0-cp313-cp313-win32.whl", hash = "sha256:3e31cfeae69a3e37a401cabf299b057711e3ae0872f62d1a9cd53a25d1400ec7" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/ff5/f6edd816358ea/grpcio_tools-1.82.0-cp313-cp313-win_amd64.whl", hash = "sha256:ff5f6edd816358ea3c0e30cb659e99ab21c94ffd3f552690d171299d1691226d" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/45d/a33fd983ca940/grpcio_tools-1.82.0-cp314-cp314-linux_armv7l.whl", hash = "sha256:45da33fd983ca940e90d29fe785241846af3f3b42390f498dc733a06930315ef" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/4f8/815e0f85c6d20/grpcio_tools-1.82.0-cp314-cp314-macosx_11_0_universal2.whl", hash = "sha256:4f8815e0f85c6d2024f762f6ddc20e9c78766e8ebeee83a555ebac01b5834722" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/491/0e44273d0af75/grpcio_tools-1.82.0-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:4910e44273d0af753dc841a6207966fc4f8958d5fb34d236ce308df610a68fd3" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/e8f/d0da0dbe28e71/grpcio_tools-1.82.0-cp314-cp314-manylinux2014_i686.manylinux_2_17_i686.whl", hash = "sha256:e8fd0da0dbe28e7193b685f1c53c6c3986e13c5a1e5d69d6b6e21f44d9c30884" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/0da/01ec7b7fc22a5/grpcio_tools-1.82.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:0da01ec7b7fc22a506e6c8433bdc983c52c558258157698ef37a2052fff41366" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/db3/cf189d10f651d/grpcio_tools-1.82.0-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:db3cf189d10f651db693db5354d8c18a41eacd4e2b9b86c9961b3ea0497b5638" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/5ed/d884e4188f751/grpcio_tools-1.82.0-cp314-cp314-musllinux_1_2_i686.whl", hash = "sha256:5edd884e4188f75147e8312b1ae1140ff8e2cb8305ddd66fa73312c58d816e74" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/703/b9ba228e5c7f6/grpcio_tools-1.82.0-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:703b9ba228e5c7f639c04f578ca6481605e8ff211373fb3de73852b02c41cac5" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/c61/7df5b6b260299/grpcio_tools-1.82.0-cp314-cp314-win32.whl", hash = "sha256:c617df5b6b260299ebae2cbde260361d905d43eee17696468702c4e6ca9d58b6" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/061/a50146c3682b3/grpcio_tools-1.82.0-cp314-cp314-win_amd64.whl", hash = "sha256:061a50146c3682b3fbd92717139786aa78c3eac997b70f9982a3d1fdf31cd273" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gunicorn"
|
||||
version = "23.0.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
source = { registry = "http://pip.home.arpa/root/pypi/+simple/" }
|
||||
dependencies = [
|
||||
{ name = "packaging" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/34/72/9614c465dc206155d93eff0ca20d42e1e35afc533971379482de953521a4/gunicorn-23.0.0.tar.gz", hash = "sha256:f014447a0101dc57e294f6c18ca6b40227a4c90e9bdb586042628030cba004ec", size = 375031, upload-time = "2024-08-10T20:25:27.378Z" }
|
||||
sdist = { url = "http://pip.home.arpa/root/pypi/+f/f01/4447a0101dc57/gunicorn-23.0.0.tar.gz", hash = "sha256:f014447a0101dc57e294f6c18ca6b40227a4c90e9bdb586042628030cba004ec" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/cb/7d/6dac2a6e1eba33ee43f318edbed4ff29151a49b5d37f080aad1e6469bca4/gunicorn-23.0.0-py3-none-any.whl", hash = "sha256:ec400d38950de4dfd418cff8328b2c8faed0edb0d517d3394e457c317908ca4d", size = 85029, upload-time = "2024-08-10T20:25:24.996Z" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/ec4/00d38950de4df/gunicorn-23.0.0-py3-none-any.whl", hash = "sha256:ec400d38950de4dfd418cff8328b2c8faed0edb0d517d3394e457c317908ca4d" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "iniconfig"
|
||||
version = "2.3.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/72/34/14ca021ce8e5dfedc35312d08ba8bf51fdd999c576889fc2c24cb97f4f10/iniconfig-2.3.0.tar.gz", hash = "sha256:c76315c77db068650d49c5b56314774a7804df16fee4402c1f19d6d15d8c4730", size = 20503, upload-time = "2025-10-18T21:55:43.219Z" }
|
||||
source = { registry = "http://pip.home.arpa/root/pypi/+simple/" }
|
||||
sdist = { url = "http://pip.home.arpa/root/pypi/+f/c76/315c77db06865/iniconfig-2.3.0.tar.gz", hash = "sha256:c76315c77db068650d49c5b56314774a7804df16fee4402c1f19d6d15d8c4730" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/cb/b1/3846dd7f199d53cb17f49cba7e651e9ce294d8497c8c150530ed11865bb8/iniconfig-2.3.0-py3-none-any.whl", hash = "sha256:f631c04d2c48c52b84d0d0549c99ff3859c98df65b3101406327ecc7d53fbf12", size = 7484, upload-time = "2025-10-18T21:55:41.639Z" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/f63/1c04d2c48c52b/iniconfig-2.3.0-py3-none-any.whl", hash = "sha256:f631c04d2c48c52b84d0d0549c99ff3859c98df65b3101406327ecc7d53fbf12" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "packaging"
|
||||
version = "26.3"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/7d/fa/3944b40b07da9ce895c0e6303a5ab7d53da063554f534556b134a54d6093/packaging-26.3.tar.gz", hash = "sha256:94edc256424af38762eb31306eed28beb9f0efc50a8837492c9d6fd6004aed79", size = 313412, upload-time = "2026-08-04T18:15:28.737Z" }
|
||||
source = { registry = "http://pip.home.arpa/root/pypi/+simple/" }
|
||||
sdist = { url = "http://pip.home.arpa/root/pypi/+f/94e/dc256424af387/packaging-26.3.tar.gz", hash = "sha256:94edc256424af38762eb31306eed28beb9f0efc50a8837492c9d6fd6004aed79" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/63/34/ba1c580383c9eada3711951fef0795c80b829a078d72188184bcab9dd527/packaging-26.3-py3-none-any.whl", hash = "sha256:d7193f7c8e4e93f444fde0262bf90af30e16fa0ad0ad44cb553c87339b23cd1c", size = 129956, upload-time = "2026-08-04T18:15:27.159Z" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/d71/93f7c8e4e93f4/packaging-26.3-py3-none-any.whl", hash = "sha256:d7193f7c8e4e93f444fde0262bf90af30e16fa0ad0ad44cb553c87339b23cd1c" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pluggy"
|
||||
version = "1.6.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/f9/e2/3e91f31a7d2b083fe6ef3fa267035b518369d9511ffab804f839851d2779/pluggy-1.6.0.tar.gz", hash = "sha256:7dcc130b76258d33b90f61b658791dede3486c3e6bfb003ee5c9bfb396dd22f3", size = 69412, upload-time = "2025-05-15T12:30:07.975Z" }
|
||||
source = { registry = "http://pip.home.arpa/root/pypi/+simple/" }
|
||||
sdist = { url = "http://pip.home.arpa/root/pypi/+f/7dc/c130b76258d33/pluggy-1.6.0.tar.gz", hash = "sha256:7dcc130b76258d33b90f61b658791dede3486c3e6bfb003ee5c9bfb396dd22f3" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/54/20/4d324d65cc6d9205fabedc306948156824eb9f0ee1633355a8f7ec5c66bf/pluggy-1.6.0-py3-none-any.whl", hash = "sha256:e920276dd6813095e9377c0bc5566d94c932c33b27a3e3945d8389c374dd4746", size = 20538, upload-time = "2025-05-15T12:30:06.134Z" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/e92/0276dd6813095/pluggy-1.6.0-py3-none-any.whl", hash = "sha256:e920276dd6813095e9377c0bc5566d94c932c33b27a3e3945d8389c374dd4746" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "protobuf"
|
||||
version = "7.36.0"
|
||||
source = { registry = "http://pip.home.arpa/root/pypi/+simple/" }
|
||||
sdist = { url = "http://pip.home.arpa/root/pypi/+f/e8e/09cb0d794c668/protobuf-7.36.0.tar.gz", hash = "sha256:e8e09cb0d794c6687926fa558a8a6e72aa10edb997d5ca61da0765f12a3e00ea" }
|
||||
wheels = [
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/910/3532dffd80c6f/protobuf-7.36.0-cp310-abi3-macosx_10_9_universal2.whl", hash = "sha256:9103532dffd80c6fab7e50c65a31007680a06eb57537d437bb1b35812c138a37" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/bf9/4a5917c710582/protobuf-7.36.0-cp310-abi3-manylinux2014_aarch64.whl", hash = "sha256:bf94a5917c71058262de683669bc0a797a7669d3de71f0b36d058e3194f47b44" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/329/7e60abdff301e/protobuf-7.36.0-cp310-abi3-manylinux2014_s390x.whl", hash = "sha256:3297e60abdff301e5f74393d87f6cc59dacab5f024a89548a6e8de1d26576b16" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/70f/5ec8eb0da81a4/protobuf-7.36.0-cp310-abi3-manylinux2014_x86_64.whl", hash = "sha256:70f5ec8eb0da81a44360c0dc0beac99a0d78071d21956a7076bae8bd2051841b" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/732/6fd717bdc4191/protobuf-7.36.0-cp310-abi3-win32.whl", hash = "sha256:7326fd717bdc419162a735938d89d4032332bcc3408804012b24ff3a37086071" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/178/1cc1de61249b7/protobuf-7.36.0-cp310-abi3-win_amd64.whl", hash = "sha256:1781cc1de61249b750848029bca452c0a8b7e990080316b9bbc2518b2117b488" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/533/74d53fc29a67f/protobuf-7.36.0-py3-none-any.whl", hash = "sha256:53374d53fc29a67f7dbbf0ade47d7526a0f0137bf0f9c90e48d8a60790ef748c" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "psycopg"
|
||||
version = "3.3.4"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
source = { registry = "http://pip.home.arpa/root/pypi/+simple/" }
|
||||
dependencies = [
|
||||
{ name = "typing-extensions", marker = "python_full_version < '3.13'" },
|
||||
{ name = "tzdata", marker = "sys_platform == 'win32'" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/db/2f/cb91e5502ec9de1de6f1b76cfbf69531932725361168bb06963620c77e2e/psycopg-3.3.4.tar.gz", hash = "sha256:e21207764952cff81b6b8bdacad9a3939f2793367fdac2987b3aac36a651b5bc", size = 165799, upload-time = "2026-05-01T23:31:55.179Z" }
|
||||
sdist = { url = "http://pip.home.arpa/root/pypi/+f/e21/207764952cff8/psycopg-3.3.4.tar.gz", hash = "sha256:e21207764952cff81b6b8bdacad9a3939f2793367fdac2987b3aac36a651b5bc" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/5c/e0/7b3dee031daae7743609ce3c746565d4a3ed7c2c186479eb48e34e838c64/psycopg-3.3.4-py3-none-any.whl", hash = "sha256:b6bbc25ccf05c8fad3b061d9db2ef0909a555171b84b07f29458a447253d679a", size = 213001, upload-time = "2026-05-01T23:20:50.816Z" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/b6b/bc25ccf05c8fa/psycopg-3.3.4-py3-none-any.whl", hash = "sha256:b6bbc25ccf05c8fad3b061d9db2ef0909a555171b84b07f29458a447253d679a" },
|
||||
]
|
||||
|
||||
[package.optional-dependencies]
|
||||
|
|
@ -158,146 +289,146 @@ binary = [
|
|||
[[package]]
|
||||
name = "psycopg-binary"
|
||||
version = "3.3.4"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
source = { registry = "http://pip.home.arpa/root/pypi/+simple/" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/95/7d/03818e13ba7f36de93573c93ee3482006d3dfa8b0f8d28df511bad0a1a92/psycopg_binary-3.3.4-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:5ab28a2a7649df3b72e6b674b4c190e448e8e77cf496a65bd846472048de2089", size = 4591122, upload-time = "2026-05-01T23:27:56.162Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/a5/b9/11b341edf8d54e2694726b273fe9652b254d989f4f63e3ac6816ad6b55f4/psycopg_binary-3.3.4-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:6402a9d8146cf4b3974ded3fd28a971e83dc6a0333eb7822524a3aa20b546578", size = 4669943, upload-time = "2026-05-01T23:28:04.522Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/8b/18/4665bacd65e7865b4372fcd8abb8b9186ada4b0025f8c2ca691b364a556c/psycopg_binary-3.3.4-cp312-cp312-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl", hash = "sha256:580ae30a5f95ccd90008ec697d3ed6a4a2047a516407ad904283fa42086936e9", size = 5469697, upload-time = "2026-05-01T23:28:11.337Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/7c/b1/b83136c6e510593d9b0c759ba5384337bc4ad82d19fda675adc4b2703c84/psycopg_binary-3.3.4-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:e7510c37550f91a187e3660a8cc50d4b760f8c3b8b2f89ebc5698cd2c7f2c85d", size = 5152995, upload-time = "2026-05-01T23:28:20.529Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/67/8d/a9821e2a648afe6091989929982a3b0f00b2631a859cb81379728f08fb75/psycopg_binary-3.3.4-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:77df19583501ea288eaf15ac0fe7ad01e6d8091a91d5c41df5c718f307d8e31b", size = 6738180, upload-time = "2026-05-01T23:28:30.654Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/7e/58/2e349e8d23905dc2317b80ac65f48fb6f821a4777a4e994a60da91c4850f/psycopg_binary-3.3.4-cp312-cp312-manylinux_2_38_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:018fbed325936da502feb546642c982dcc4b9ffdea32dfef78dbf3b7f7ad4070", size = 4978828, upload-time = "2026-05-01T23:28:37.277Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/45/48/57b00d03b4721878326122a1f1e6b0a90b85bcaec56b5b2f8ea6cfa45235/psycopg_binary-3.3.4-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:17a21953a9e5ff3a16dab692625a3676e2f101db5e40072f39dbee2250194d68", size = 4509757, upload-time = "2026-05-01T23:28:43.078Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/25/37/33b47d8c007df69aec500df5889767c4d313748e8e9e27a2fef8a6dabcee/psycopg_binary-3.3.4-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:eb05ee1c2b817d27c537333224c9e83c7afb86fe7296ba970990068baf819b16", size = 4190546, upload-time = "2026-05-01T23:28:50.016Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/ca/c6/32b0835dbc2122617902b649d76a91c1e75406e76bf3d595b0c3bb5ffad6/psycopg_binary-3.3.4-cp312-cp312-musllinux_1_2_riscv64.whl", hash = "sha256:773d573e11f437ce0bdb95b7c18dc58390494f96d43f8b45b9760436114f7652", size = 3926197, upload-time = "2026-05-01T23:28:55.55Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/cd/68/d190ef0c0c5b16ded07831dabc8ddd412f4cdab07ec6e30ed38d9bda0e1f/psycopg_binary-3.3.4-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:71e55ccbdfae79a2ed9c6369c3008a3025817ff9d7e27b32a2d84e2a4267e66e", size = 4236627, upload-time = "2026-05-01T23:29:05.336Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/25/8f/81dcbc2e8454b74d14881275ea45f00791052dac531a9fa8be1730d1685b/psycopg_binary-3.3.4-cp312-cp312-win_amd64.whl", hash = "sha256:494ca54901be8cf9eb7e02c25b731f2317c378efa44f43e8f9bd0e1184ae7be4", size = 3560782, upload-time = "2026-05-01T23:29:11.967Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/09/43/13e9c406fbbf354580476e248a16b64802a376873ebe6339e30bb655572d/psycopg_binary-3.3.4-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:fbd1d4ed566895ad2d3bf4ddfd8bae90026930ddf29df3b9d91d32c8c47866a7", size = 4590377, upload-time = "2026-05-01T23:29:18.782Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/22/be/2923cd7c3683e7afdecf4f10796a18de02f5c5ddc0969aa2ad0a8cdd3bbd/psycopg_binary-3.3.4-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:75a9067e236f9b9ae3535b66fe99bddb33d39c0de10112e49b9ab11eee53dc31", size = 4669023, upload-time = "2026-05-01T23:29:25.884Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/96/a0/2c913d6fe13d6a8bd13597d36739bf47af063ad9399e402cfecab16f3c1e/psycopg_binary-3.3.4-cp313-cp313-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl", hash = "sha256:b56b603ebcea8aa10b46228b8410ba7f13e7c2ee54389d4d9be0927fd8ce2a70", size = 5467423, upload-time = "2026-05-01T23:29:33.416Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/e7/38/205d10bc1ad0df4a21c5c51659126bd3ea0ef98fcad1e852f78c249bb9c3/psycopg_binary-3.3.4-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:c677c4ad433cb7150c8cd304a0769ae3bcfbe5ea0676eb53faa7b1443b16d0d3", size = 5151137, upload-time = "2026-05-01T23:29:42.013Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/36/fc/f0381ddcd45eff3bb70dbca6823a996048d7f507b2ec3fc92c6fabc0fe87/psycopg_binary-3.3.4-cp313-cp313-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:26df2717e59c0473e4465a97dfb1b7afebaa479277870fd5784d1436470db47c", size = 6736671, upload-time = "2026-05-01T23:29:51.626Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/95/40/fa545ae152c24327651e5624e4902121e808270be36c10b12e9939be09bc/psycopg_binary-3.3.4-cp313-cp313-manylinux_2_38_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:1dc1f79fd16bb1f3f4421417a514607539f17804d95c7ed617265369d1981cae", size = 4979601, upload-time = "2026-05-01T23:29:56.961Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/86/e4/2f8a47ee97f90cd2b933d0463081d35631ff419de2b8c984a5f369857de0/psycopg_binary-3.3.4-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:136f199a407b5348b9b857c504aff60c77622a28482e7195839ce1b51238c4cc", size = 4510513, upload-time = "2026-05-01T23:30:07.243Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/0e/0e/94e842ff4a7f98ed162580ca2e8b8864b28c1e0350f2443f8ee47f821167/psycopg_binary-3.3.4-cp313-cp313-musllinux_1_2_ppc64le.whl", hash = "sha256:b6f5a29e9c775b9f12a1a717aa7a2c80f9e1db6f27ba44a5b59c80ac61d2ffcf", size = 4187243, upload-time = "2026-05-01T23:30:15.352Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/d0/83/fc6c174b672e29b7de996ea77b6cbddf46c891751c3355f6974292baa6b4/psycopg_binary-3.3.4-cp313-cp313-musllinux_1_2_riscv64.whl", hash = "sha256:ee17a2cf4943cde261adfad1bbc5bf38d6b3776d7afff74c7cabcbeaeb08c260", size = 3927347, upload-time = "2026-05-01T23:30:21.186Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/e9/65/768364d4a97a15b1a7f47ba52688c1686f22941d8332a8398cefc468e25f/psycopg_binary-3.3.4-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:5c4ab71be17bdca30cb34c34c4e1496e2f5d6f20c199c12bad226070b22ef9bf", size = 4236393, upload-time = "2026-05-01T23:30:26.211Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/bd/3b/218efbc9e645becd80cdf651acda05f85cfe546b7a9c0458c7cbc8fe1f74/psycopg_binary-3.3.4-cp313-cp313-win_amd64.whl", hash = "sha256:dbfdb9b6cc79f31104a7b162a2b921b765fcc62af6c00540a167a8de47e4ed38", size = 3564592, upload-time = "2026-05-01T23:30:31.764Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/48/a6/828c9185701dab71b234c2a76c38a08b098ebfec5020716b4e93807492b5/psycopg_binary-3.3.4-cp314-cp314-macosx_10_15_x86_64.whl", hash = "sha256:28b7398fdd19db3232c884fb24550bdfe951221f510e195e233299e4c9b78f97", size = 4607292, upload-time = "2026-05-01T23:30:38.962Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/92/58/5b40dbc9d839045c9dae956960e4fb6d20bcabe6c59a2aa34fc3a371913f/psycopg_binary-3.3.4-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:1fbaa292a3c8bb61b45df1ad3da1908ccee7cb889db9425e3557d9e34e2a4829", size = 4687023, upload-time = "2026-05-01T23:30:47.227Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/85/a9/793f0ac107a9003b48441d0d1f9f616d96e0f37458dd8dc12528ceff55fb/psycopg_binary-3.3.4-cp314-cp314-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl", hash = "sha256:94596f9e7633ee3f6440711d43bb70aa31cc0a46a900ab8b4201a366ace5c9e7", size = 5486985, upload-time = "2026-05-01T23:30:55.517Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/8f/26/42e8533497e2592334f68ec529cf5f840f7fa4e99575a4bb61aa184dbfbf/psycopg_binary-3.3.4-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:8c0056529e68dbe9184cd4019a1f3d8f3a4ead2f6fc7a5afcf27d3314edd1277", size = 5168745, upload-time = "2026-05-01T23:31:01.904Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/15/af/b7151776cc08d5935d45c833ec818a9beb417cf7c08239af1aafbdae78ee/psycopg_binary-3.3.4-cp314-cp314-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:2c09aad7051326e7603c14e50636db9c01f78272dc54b3accff03d46370461e6", size = 6761486, upload-time = "2026-05-01T23:31:14.511Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/d0/ed/c92533b9124712d592cbf1cd6c76da933a2e0acea81dfe1fbe7e735f0cff/psycopg_binary-3.3.4-cp314-cp314-manylinux_2_38_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:514404ed543efd620c85602b747df2a23cf1241b4067199e1a66f2d2757aaa41", size = 4997427, upload-time = "2026-05-01T23:31:20.901Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/a2/23/ccadfd0de416aa188356daa199453af24087b042e296088706d190ae0295/psycopg_binary-3.3.4-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:46893c26858be12cc49ca4226ed6a60b4bfccadd946b3bebb783a60b38788228", size = 4533549, upload-time = "2026-05-01T23:31:26.204Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/fd/a0/c8f43cee36386f7bc891ab41a9d31ea07cf9826038e732da79f26b1e5f34/psycopg_binary-3.3.4-cp314-cp314-musllinux_1_2_ppc64le.whl", hash = "sha256:df1d567fc430f6df15c9fcf67d87685fc49bdb325adc0db5af1adfb2f44eb5c9", size = 4210256, upload-time = "2026-05-01T23:31:33.884Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/4e/2c/c1547871be3790676e8868b38655496422f94f0978dfb66b74bdba2f1676/psycopg_binary-3.3.4-cp314-cp314-musllinux_1_2_riscv64.whl", hash = "sha256:6b9016b1714da4dd5ecaaa75b82098aa5a0b87854ce9b092e21c27c4ae23e014", size = 3946204, upload-time = "2026-05-01T23:31:39.626Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/c4/b1/f6670f00fa7ea601584623f6c11602ab92117d83eaff885e0210f6de7418/psycopg_binary-3.3.4-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:47c656a8a7ba6eb0cff1801a4caaa9c8bdc12d03080e273aff1c8ac39971a77e", size = 4255811, upload-time = "2026-05-01T23:31:44.986Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/eb/e6/5fff07a70d1f945ed90ae131c3bd76cab32beff7c58c6db15ad5820b6d1f/psycopg_binary-3.3.4-cp314-cp314-win_amd64.whl", hash = "sha256:c37e024c07308cd06cf3ec51bfd0e7f6157585a4d84d1bce4a7f5f7913719bf8", size = 3666849, upload-time = "2026-05-01T23:31:51.165Z" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/5ab/28a2a7649df3b/psycopg_binary-3.3.4-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:5ab28a2a7649df3b72e6b674b4c190e448e8e77cf496a65bd846472048de2089" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/640/2a9d8146cf4b3/psycopg_binary-3.3.4-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:6402a9d8146cf4b3974ded3fd28a971e83dc6a0333eb7822524a3aa20b546578" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/580/ae30a5f95ccd9/psycopg_binary-3.3.4-cp312-cp312-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl", hash = "sha256:580ae30a5f95ccd90008ec697d3ed6a4a2047a516407ad904283fa42086936e9" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/e75/10c37550f91a1/psycopg_binary-3.3.4-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:e7510c37550f91a187e3660a8cc50d4b760f8c3b8b2f89ebc5698cd2c7f2c85d" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/77d/f19583501ea28/psycopg_binary-3.3.4-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:77df19583501ea288eaf15ac0fe7ad01e6d8091a91d5c41df5c718f307d8e31b" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/018/fbed325936da5/psycopg_binary-3.3.4-cp312-cp312-manylinux_2_38_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:018fbed325936da502feb546642c982dcc4b9ffdea32dfef78dbf3b7f7ad4070" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/17a/21953a9e5ff3a/psycopg_binary-3.3.4-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:17a21953a9e5ff3a16dab692625a3676e2f101db5e40072f39dbee2250194d68" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/eb0/5ee1c2b817d27/psycopg_binary-3.3.4-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:eb05ee1c2b817d27c537333224c9e83c7afb86fe7296ba970990068baf819b16" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/773/d573e11f437ce/psycopg_binary-3.3.4-cp312-cp312-musllinux_1_2_riscv64.whl", hash = "sha256:773d573e11f437ce0bdb95b7c18dc58390494f96d43f8b45b9760436114f7652" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/71e/55ccbdfae79a2/psycopg_binary-3.3.4-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:71e55ccbdfae79a2ed9c6369c3008a3025817ff9d7e27b32a2d84e2a4267e66e" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/494/ca54901be8cf9/psycopg_binary-3.3.4-cp312-cp312-win_amd64.whl", hash = "sha256:494ca54901be8cf9eb7e02c25b731f2317c378efa44f43e8f9bd0e1184ae7be4" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/fbd/1d4ed566895ad/psycopg_binary-3.3.4-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:fbd1d4ed566895ad2d3bf4ddfd8bae90026930ddf29df3b9d91d32c8c47866a7" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/75a/9067e236f9b9a/psycopg_binary-3.3.4-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:75a9067e236f9b9ae3535b66fe99bddb33d39c0de10112e49b9ab11eee53dc31" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/b56/b603ebcea8aa1/psycopg_binary-3.3.4-cp313-cp313-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl", hash = "sha256:b56b603ebcea8aa10b46228b8410ba7f13e7c2ee54389d4d9be0927fd8ce2a70" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/c67/7c4ad433cb715/psycopg_binary-3.3.4-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:c677c4ad433cb7150c8cd304a0769ae3bcfbe5ea0676eb53faa7b1443b16d0d3" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/26d/f2717e59c0473/psycopg_binary-3.3.4-cp313-cp313-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:26df2717e59c0473e4465a97dfb1b7afebaa479277870fd5784d1436470db47c" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/1dc/1f79fd16bb1f3/psycopg_binary-3.3.4-cp313-cp313-manylinux_2_38_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:1dc1f79fd16bb1f3f4421417a514607539f17804d95c7ed617265369d1981cae" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/136/f199a407b5348/psycopg_binary-3.3.4-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:136f199a407b5348b9b857c504aff60c77622a28482e7195839ce1b51238c4cc" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/b6f/5a29e9c775b9f/psycopg_binary-3.3.4-cp313-cp313-musllinux_1_2_ppc64le.whl", hash = "sha256:b6f5a29e9c775b9f12a1a717aa7a2c80f9e1db6f27ba44a5b59c80ac61d2ffcf" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/ee1/7a2cf4943cde2/psycopg_binary-3.3.4-cp313-cp313-musllinux_1_2_riscv64.whl", hash = "sha256:ee17a2cf4943cde261adfad1bbc5bf38d6b3776d7afff74c7cabcbeaeb08c260" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/5c4/ab71be17bdca3/psycopg_binary-3.3.4-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:5c4ab71be17bdca30cb34c34c4e1496e2f5d6f20c199c12bad226070b22ef9bf" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/dbf/db9b6cc79f311/psycopg_binary-3.3.4-cp313-cp313-win_amd64.whl", hash = "sha256:dbfdb9b6cc79f31104a7b162a2b921b765fcc62af6c00540a167a8de47e4ed38" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/28b/7398fdd19db32/psycopg_binary-3.3.4-cp314-cp314-macosx_10_15_x86_64.whl", hash = "sha256:28b7398fdd19db3232c884fb24550bdfe951221f510e195e233299e4c9b78f97" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/1fb/aa292a3c8bb61/psycopg_binary-3.3.4-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:1fbaa292a3c8bb61b45df1ad3da1908ccee7cb889db9425e3557d9e34e2a4829" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/945/96f9e7633ee3f/psycopg_binary-3.3.4-cp314-cp314-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl", hash = "sha256:94596f9e7633ee3f6440711d43bb70aa31cc0a46a900ab8b4201a366ace5c9e7" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/8c0/056529e68dbe9/psycopg_binary-3.3.4-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:8c0056529e68dbe9184cd4019a1f3d8f3a4ead2f6fc7a5afcf27d3314edd1277" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/2c0/9aad7051326e7/psycopg_binary-3.3.4-cp314-cp314-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:2c09aad7051326e7603c14e50636db9c01f78272dc54b3accff03d46370461e6" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/514/404ed543efd62/psycopg_binary-3.3.4-cp314-cp314-manylinux_2_38_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:514404ed543efd620c85602b747df2a23cf1241b4067199e1a66f2d2757aaa41" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/468/93c26858be12c/psycopg_binary-3.3.4-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:46893c26858be12cc49ca4226ed6a60b4bfccadd946b3bebb783a60b38788228" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/df1/d567fc430f6df/psycopg_binary-3.3.4-cp314-cp314-musllinux_1_2_ppc64le.whl", hash = "sha256:df1d567fc430f6df15c9fcf67d87685fc49bdb325adc0db5af1adfb2f44eb5c9" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/6b9/016b1714da4dd/psycopg_binary-3.3.4-cp314-cp314-musllinux_1_2_riscv64.whl", hash = "sha256:6b9016b1714da4dd5ecaaa75b82098aa5a0b87854ce9b092e21c27c4ae23e014" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/47c/656a8a7ba6eb0/psycopg_binary-3.3.4-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:47c656a8a7ba6eb0cff1801a4caaa9c8bdc12d03080e273aff1c8ac39971a77e" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/c37/e024c07308cd0/psycopg_binary-3.3.4-cp314-cp314-win_amd64.whl", hash = "sha256:c37e024c07308cd06cf3ec51bfd0e7f6157585a4d84d1bce4a7f5f7913719bf8" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pydantic"
|
||||
version = "2.13.4"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
source = { registry = "http://pip.home.arpa/root/pypi/+simple/" }
|
||||
dependencies = [
|
||||
{ name = "annotated-types" },
|
||||
{ name = "pydantic-core" },
|
||||
{ name = "typing-extensions" },
|
||||
{ name = "typing-inspection" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/18/a5/b60d21ac674192f8ab0ba4e9fd860690f9b4a6e51ca5df118733b487d8d6/pydantic-2.13.4.tar.gz", hash = "sha256:c40756b57adaa8b1efeeced5c196f3f3b7c435f90e84ea7f443901bec8099ef6", size = 844775, upload-time = "2026-05-06T13:43:05.343Z" }
|
||||
sdist = { url = "http://pip.home.arpa/root/pypi/+f/c40/756b57adaa8b1/pydantic-2.13.4.tar.gz", hash = "sha256:c40756b57adaa8b1efeeced5c196f3f3b7c435f90e84ea7f443901bec8099ef6" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/fd/7b/122376b1fd3c62c1ed9dc80c931ace4844b3c55407b6fb2d199377c9736f/pydantic-2.13.4-py3-none-any.whl", hash = "sha256:45a282cde31d808236fd7ea9d919b128653c8b38b393d1c4ab335c62924d9aba", size = 472262, upload-time = "2026-05-06T13:43:02.641Z" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/45a/282cde31d8082/pydantic-2.13.4-py3-none-any.whl", hash = "sha256:45a282cde31d808236fd7ea9d919b128653c8b38b393d1c4ab335c62924d9aba" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pydantic-core"
|
||||
version = "2.46.4"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
source = { registry = "http://pip.home.arpa/root/pypi/+simple/" }
|
||||
dependencies = [
|
||||
{ name = "typing-extensions" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/9d/56/921726b776ace8d8f5db44c4ef961006580d91dc52b803c489fafd1aa249/pydantic_core-2.46.4.tar.gz", hash = "sha256:62f875393d7f270851f20523dd2e29f082bcc82292d66db2b64ea71f64b6e1c1", size = 471464, upload-time = "2026-05-06T13:37:06.98Z" }
|
||||
sdist = { url = "http://pip.home.arpa/root/pypi/+f/62f/875393d7f2708/pydantic_core-2.46.4.tar.gz", hash = "sha256:62f875393d7f270851f20523dd2e29f082bcc82292d66db2b64ea71f64b6e1c1" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/ce/8c/af022f0af448d7747c5154288d46b5f2bc5f17366eaa0e23e9aa04d59f3b/pydantic_core-2.46.4-cp312-cp312-macosx_10_12_x86_64.whl", hash = "sha256:3245406455a5d98187ec35530fd772b1d799b26667980872c8d4614991e2c4a2", size = 2106158, upload-time = "2026-05-06T13:38:57.215Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/19/95/6195171e385007300f0f5574592e467c568becce2d937a0b6804f218bc49/pydantic_core-2.46.4-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:962ccbab7b642487b1d8b7df90ef677e03134cf1fd8880bf698649b22a69371f", size = 1951724, upload-time = "2026-05-06T13:37:02.697Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/8e/bc/f47d1ff9cbb1620e1b5b697eef06010035735f07820180e74178226b27b3/pydantic_core-2.46.4-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8233f2947cf85404441fd7e0085f53b10c93e0ee78611099b5c7237e36aacbf7", size = 1975742, upload-time = "2026-05-06T13:37:09.448Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/5b/11/9b9a5b0306345664a2da6410877af6e8082481b5884b3ddd78d47c6013ce/pydantic_core-2.46.4-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:3a233125ac121aa3ffba9a2b59edfc4a985a76092dc8279586ab4b71390875e7", size = 2052418, upload-time = "2026-05-06T13:37:38.234Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/f1/b7/a65fec226f5d78fc39f4a13c4cc0c768c22b113438f60c14adc9d2865038/pydantic_core-2.46.4-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:5b712b53160b79a5850310b912a5ef8e57e56947c8ad690c227f5c9d7e561712", size = 2232274, upload-time = "2026-05-06T13:38:27.753Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/68/f0/92039db98b907ef49269a8271f67db9cb78ae2fc68062ef7e4e77adb5f61/pydantic_core-2.46.4-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:9401557acd873c3a7f3eb9383edef8ac4968f9510e340f4808d427e75667e7b4", size = 2309940, upload-time = "2026-05-06T13:38:05.353Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/5f/97/2aab507d3d00ca626e8e57c1eac6a79e4e5fbcc63eb99733ff55d1717f65/pydantic_core-2.46.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:926c9541b14b12b1681dca8a0b75feb510b06c6341b70a8e500c2fdcff837cce", size = 2094516, upload-time = "2026-05-06T13:39:10.577Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/22/37/a8aca44d40d737dde2bc05b3c6c07dff0de07ce6f82e9f3167aeaf4d5dea/pydantic_core-2.46.4-cp312-cp312-manylinux_2_31_riscv64.whl", hash = "sha256:56cb4851bcaf3d117eddcef4fe66afd750a50274b0da8e22be256d10e5611987", size = 2136854, upload-time = "2026-05-06T13:40:22.59Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/24/99/fcef1b79238c06a8cbec70819ac722ba76e02bc8ada9b0fd66eba40da01b/pydantic_core-2.46.4-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:c68fcd102d71ea85c5b2dfac3f4f8476eff42a9e078fd5faefff6d145063536b", size = 2180306, upload-time = "2026-05-06T13:40:10.666Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/ae/6c/fc44000918855b42779d007ae63b0532794739027b2f417321cddbc44f6a/pydantic_core-2.46.4-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:b2f69dec1725e79a012d920df1707de5caf7ed5e08f3be4435e25803efc47458", size = 2190044, upload-time = "2026-05-06T13:40:43.231Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/6b/65/d9cadc9f1920d7a127ad2edba16c1db7916e59719285cd6c94600b0080ba/pydantic_core-2.46.4-cp312-cp312-musllinux_1_1_armv7l.whl", hash = "sha256:8d0820e8192167f80d88d64038e609c31452eeca865b4e1d9950a27a4609b00b", size = 2329133, upload-time = "2026-05-06T13:39:57.365Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/d0/cf/c873d91679f3a30bcf5e7ac280ce5573483e72295307685120d0d5ad3416/pydantic_core-2.46.4-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:fbdb89b3e1c94a30cc5edfce477c6e6a5dc4d8f84665b455c27582f211a1c72c", size = 2374464, upload-time = "2026-05-06T13:38:06.976Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/47/bd/6f2fc8188f31bf10590f1e98e7b306336161fac930a8c514cd7bd828c7dc/pydantic_core-2.46.4-cp312-cp312-win32.whl", hash = "sha256:9aa768456404a8bf48a4406685ac2bec8e72b62c69313734fa3b73cf33b3a894", size = 1974823, upload-time = "2026-05-06T13:40:47.985Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/40/8c/985c1d41ea1107c2534abd9870e4ed5c8e7669b5c308297835c001e7a1c4/pydantic_core-2.46.4-cp312-cp312-win_amd64.whl", hash = "sha256:e9c26f834c65f5752f3f06cb08cb86a913ceb7274d0db6e267808a708b46bc89", size = 2072919, upload-time = "2026-05-06T13:39:21.153Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/c4/ba/f463d006e0c47373ca7ec5e1a261c59dc01ef4d62b2657af925fb0deee3a/pydantic_core-2.46.4-cp312-cp312-win_arm64.whl", hash = "sha256:4fc73cb559bdb54b1134a706a2802a4cddd27a0633f5abb7e53056268751ac6a", size = 2027604, upload-time = "2026-05-06T13:39:03.753Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/51/a2/5d30b469c5267a17b39dec53208222f76a8d351dfac4af661888c5aee77d/pydantic_core-2.46.4-cp313-cp313-macosx_10_12_x86_64.whl", hash = "sha256:5d5902252db0d3cedf8d4a1bc68f70eeb430f7e4c7104c8c476753519b423008", size = 2106306, upload-time = "2026-05-06T13:37:48.029Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/c1/81/4fa520eaffa8bd7d1525e644cd6d39e7d60b1592bc5b516693c7340b50f1/pydantic_core-2.46.4-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:c94f0688e7b8d0a67abf40e57a7eaaecd17cc9586706a31b76c031f63df052b4", size = 1951906, upload-time = "2026-05-06T13:37:17.012Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/03/d5/fd02da45b659668b05923b17ba3a0100a0a3d5541e3bd8fcc4ecb711309e/pydantic_core-2.46.4-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f027324c56cd5406ca49c124b0db10e56c69064fec039acc571c29020cc87c76", size = 1976802, upload-time = "2026-05-06T13:37:35.113Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/21/f2/95727e1368be3d3ed485eaab7adbd7dda408f33f7a36e8b48e0144002b91/pydantic_core-2.46.4-cp313-cp313-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:e739fee756ba1010f8bcccb534252e85a35fe45ae92c295a06059ce58b74ccd3", size = 2052446, upload-time = "2026-05-06T13:37:12.313Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/9c/86/5d99feea3f77c7234b8718075b23db11532773c1a0dbd9b9490215dc2eeb/pydantic_core-2.46.4-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:9d56801be94b86a9da183e5f3766e6310752b99ff647e38b09a9500d88e46e76", size = 2232757, upload-time = "2026-05-06T13:39:01.149Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/d2/3a/508ac615935ef7588cf6d9e9b91309fdc2da751af865e02a9098de88258c/pydantic_core-2.46.4-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:2412e734dcb48da14d4e4006b82b46b74f2518b8a26ee7e58c6844a6cd6d03c4", size = 2309275, upload-time = "2026-05-06T13:37:41.406Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/07/f8/41db9de19d7987d6b04715a02b3b40aea467000275d9d758ffaa31af7d50/pydantic_core-2.46.4-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9551187363ffc0de2a00b2e47c25aeaeb1020b69b668762966df15fc5659dd5a", size = 2094467, upload-time = "2026-05-06T13:39:18.847Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/2c/e2/f35033184cb11d0052daf4416e8e10a502ea2ac006fc4f459aee872727d1/pydantic_core-2.46.4-cp313-cp313-manylinux_2_31_riscv64.whl", hash = "sha256:0186750b482eefa11d7f435892b09c5c606193ef3375bcf94aa00ae6bfb66262", size = 2134417, upload-time = "2026-05-06T13:40:17.944Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/7e/7b/6ceeb1cc90e193862f444ebe373d8fdf613f0a82572dde03fb10734c6c71/pydantic_core-2.46.4-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:5855698a4856556d86e8e6cd8434bc3ac0314ee8e12089ae0e143f64c6256e4e", size = 2179782, upload-time = "2026-05-06T13:40:32.618Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/5a/f2/c8d7773ede6af08036423a00ae0ceffce266c3c52a096c435d68c896083f/pydantic_core-2.46.4-cp313-cp313-musllinux_1_1_aarch64.whl", hash = "sha256:cbaf13819775b7f769bf4a1f066cb6df7a28d4480081a589828ef190226881cd", size = 2188782, upload-time = "2026-05-06T13:36:51.018Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/59/31/0c864784e31f09f05cdd87606f08923b9c9e7f6e51dd27f20f62f975ce9f/pydantic_core-2.46.4-cp313-cp313-musllinux_1_1_armv7l.whl", hash = "sha256:633147d34cf4550417f12e2b1a0383973bdf5cdfde212cb09e9a581cf10820be", size = 2328334, upload-time = "2026-05-06T13:40:37.764Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/c2/eb/4f6c8a41efa30baa755590f4141abf3a8c370fab610915733e74134a7270/pydantic_core-2.46.4-cp313-cp313-musllinux_1_1_x86_64.whl", hash = "sha256:82cf5301172168103724d49a1444d3378cb20cdee30b116a1bd6031236298a5d", size = 2372986, upload-time = "2026-05-06T13:39:34.152Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/5b/24/b375a480d53113860c299764bfe9f349a3dc9108b3adc0d7f0d786492ebf/pydantic_core-2.46.4-cp313-cp313-win32.whl", hash = "sha256:9fa8ae11da9e2b3126c6426f147e0fba88d96d65921799bb30c6abd1cb2c97fb", size = 1973693, upload-time = "2026-05-06T13:37:55.072Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/7e/e8/cff247591966f2d22ec8c003cd7587e27b7ba7b81ab2fb888e3ab75dc285/pydantic_core-2.46.4-cp313-cp313-win_amd64.whl", hash = "sha256:6b3ace8194b0e5204818c92802dcdca7fc6d88aabbb799d7c795540d9cd6d292", size = 2071819, upload-time = "2026-05-06T13:38:49.139Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/c6/1a/f4aee670d5670e9e148e0c82c7db98d780be566c6e6a97ee8035528ca0b3/pydantic_core-2.46.4-cp313-cp313-win_arm64.whl", hash = "sha256:184c081504d17f1c1066e430e117142b2c77d9448a97f7b65c6ac9fd9aee238d", size = 2027411, upload-time = "2026-05-06T13:40:45.796Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/8d/74/228a26ddad29c6672b805d9fd78e8d251cd04004fa7eed0e622096cd0250/pydantic_core-2.46.4-cp314-cp314-macosx_10_12_x86_64.whl", hash = "sha256:428e04521a40150c85216fc8b85e8d39fece235a9cf5e383761238c7fa9b96fb", size = 2102079, upload-time = "2026-05-06T13:38:41.019Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/ad/1f/8970b150a4b4365623ae00fc88603491f763c627311ae8031e3111356d6e/pydantic_core-2.46.4-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:23ace664830ee0bfe014a0c7bc248b1f7f25ed7ad103852c317624a1083af462", size = 1952179, upload-time = "2026-05-06T13:36:59.812Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/95/30/5211a831ae054928054b2f79731661087a2bc5c01e825c672b3a4a8f1b3e/pydantic_core-2.46.4-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ce5c1d2a8b27468f433ca974829c44060b8097eedc39933e3c206a90ee49c4a9", size = 1978926, upload-time = "2026-05-06T13:37:39.933Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/57/e9/689668733b1eb67adeef047db3c2e8788fcf65a7fd9c9e2b46b7744fe245/pydantic_core-2.46.4-cp314-cp314-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:7283d57845ecf5a163403eb0702dfc220cc4fbdd18919cb5ccea4f95ee1cdab4", size = 2046785, upload-time = "2026-05-06T13:38:01.995Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/60/d9/6715260422ff50a2109878fd24d948a6c3446bb2664f34ee78cd972b3acd/pydantic_core-2.46.4-cp314-cp314-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:8daafc69c93ee8a0204506a3b6b30f586ef54028f52aeeeb5c4cfc5184fd5914", size = 2228733, upload-time = "2026-05-06T13:40:50.371Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/18/ae/fdb2f64316afca925640f8e70bb1a564b0ec2721c1389e25b8eb4bf9a299/pydantic_core-2.46.4-cp314-cp314-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:cd2213145bcc2ba85884d0ac63d222fece9209678f77b9b4d76f054c561adb28", size = 2307534, upload-time = "2026-05-06T13:37:21.531Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/89/1d/8eff589b45bb8190a9d12c49cfad0f176a5cbd1534908a6b5125e2886239/pydantic_core-2.46.4-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7a5f930472650a82629163023e630d160863fce524c616f4e5186e5de9d9a49b", size = 2099732, upload-time = "2026-05-06T13:39:31.942Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/06/d5/ee5a3366637fee41dee51a1fc91562dcf12ddbc68fda34e6b253da2324bb/pydantic_core-2.46.4-cp314-cp314-manylinux_2_31_riscv64.whl", hash = "sha256:c1b3f518abeca3aa13c712fd202306e145abf59a18b094a6bafb2d2bbf59192c", size = 2129627, upload-time = "2026-05-06T13:37:25.033Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/94/33/2414be571d2c6a6c4d08be21f9292b6d3fdb08949a97b6dfe985017821db/pydantic_core-2.46.4-cp314-cp314-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:1a7dd0b3ee80d90150e3495a3a13ac34dbcbfd4f012996a6a1d8900e91b5c0fb", size = 2179141, upload-time = "2026-05-06T13:37:14.046Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/7b/79/7daa95be995be0eecc4cf75064cb33f9bbbfe3fe0158caf2f0d4a996a5c7/pydantic_core-2.46.4-cp314-cp314-musllinux_1_1_aarch64.whl", hash = "sha256:3fb702cd90b0446a3a1c5e470bfa0dd23c0233b676a9099ddcc964fa6ca13898", size = 2184325, upload-time = "2026-05-06T13:36:53.615Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/9f/cb/d0a382f5c0de8a222dc61c65348e0ce831b1f68e0a018450d31c2cace3a5/pydantic_core-2.46.4-cp314-cp314-musllinux_1_1_armv7l.whl", hash = "sha256:b8458003118a712e66286df6a707db01c52c0f52f7db8e4a38f0da1d3b94fc4e", size = 2323990, upload-time = "2026-05-06T13:40:29.971Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/05/db/d9ba624cc4a5aced1598e88c04fdbd8310c8a69b9d38b9a3d39ce3a61ed7/pydantic_core-2.46.4-cp314-cp314-musllinux_1_1_x86_64.whl", hash = "sha256:372429a130e469c9cd698925ce5fc50940b7a1336b0d82038e63d5bbc4edc519", size = 2369978, upload-time = "2026-05-06T13:37:23.027Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/f2/20/d15df15ba918c423461905802bfd2981c3af0bfa0e40d05e13edbfa48bc3/pydantic_core-2.46.4-cp314-cp314-win32.whl", hash = "sha256:85bb3611ff1802f3ee7fdd7dbff26b56f343fb432d57a4728fdd49b6ef35e2f4", size = 1966354, upload-time = "2026-05-06T13:38:03.499Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/fc/b6/6b8de4c0a7d7ab3004c439c80c5c1e0a3e8d78bbae19379b01960383d9e5/pydantic_core-2.46.4-cp314-cp314-win_amd64.whl", hash = "sha256:811ff8e9c313ab425368bcbb36e5c4ebd7108c2bbf4e4089cfbb0b01eff63fac", size = 2072238, upload-time = "2026-05-06T13:39:40.807Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/32/36/51eb763beec1f4cf59b1db243a7dcc39cbb41230f050a09b9d69faaf0a48/pydantic_core-2.46.4-cp314-cp314-win_arm64.whl", hash = "sha256:bfec22eab3c8cc2ceec0248aec886624116dc079afa027ecc8ad4a7e62010f8a", size = 2018251, upload-time = "2026-05-06T13:37:26.72Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/e8/91/855af51d625b23aa987116a19e231d2aaef9c4a415273ddc189b79a45fee/pydantic_core-2.46.4-cp314-cp314t-macosx_10_12_x86_64.whl", hash = "sha256:af8244b2bef6aaad6d92cda81372de7f8c8d36c9f0c3ea36e827c60e7d9467a0", size = 2099593, upload-time = "2026-05-06T13:39:47.682Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/fb/1b/8784a54c65edb5f49f0a14d6977cf1b209bba85a4c77445b255c2de58ab3/pydantic_core-2.46.4-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:5a4330cdbc57162e4b3aa303f588ba752257694c9c9be3e7ebb11b4aca659b5d", size = 1935226, upload-time = "2026-05-06T13:40:40.428Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/e8/e7/1955d28d1afc56dd4b3ad7cc0cf39df1b9852964cf16e5d13912756d6d6b/pydantic_core-2.46.4-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:29c61fc04a3d840155ff08e475a04809278972fe6aef51e2720554e96367e34b", size = 1974605, upload-time = "2026-05-06T13:37:32.029Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/93/e2/3fedbf0ba7a22850e6e9fd78117f1c0f10f950182344d8a6c535d468fdd8/pydantic_core-2.46.4-cp314-cp314t-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:c50f2528cf200c5eed56faf3f4e22fcd5f38c157a8b78576e6ba3168ec35f000", size = 2030777, upload-time = "2026-05-06T13:38:55.239Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/f8/61/46be275fcaaba0b4f5b9669dd852267ce1ff616592dccf7a7845588df091/pydantic_core-2.46.4-cp314-cp314t-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:0cbe8b01f948de4286c74cdd6c667aceb38f5c1e26f0693b3983d9d74887c65e", size = 2236641, upload-time = "2026-05-06T13:37:08.096Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/60/db/12e93e46a8bac9988be3c016860f83293daea8c716c029c9ace279036f2f/pydantic_core-2.46.4-cp314-cp314t-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:617d7e2ca7dcb8c5cf6bcb8c59b8832c94b36196bbf1cbd1bfb56ed341905edd", size = 2286404, upload-time = "2026-05-06T13:40:20.221Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/e2/4a/4d8b19008f38d31c53b8219cfedc2e3d5de5fe99d90076b7e767de29274f/pydantic_core-2.46.4-cp314-cp314t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7027560ee92211647d0d34e3f7cd6f50da56399d26a9c8ad0da286d3869a53f3", size = 2109219, upload-time = "2026-05-06T13:38:12.153Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/88/70/3cbc40978fefb7bb09c6708d40d4ad1a5d70fd7213c3d17f971de868ec1f/pydantic_core-2.46.4-cp314-cp314t-manylinux_2_31_riscv64.whl", hash = "sha256:f99626688942fb746e545232e7726926f3be91b5975f8b55327665fafda991c7", size = 2110594, upload-time = "2026-05-06T13:40:02.971Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/9d/20/b8d36736216e29491125531685b2f9e61aa5b4b2599893f8268551da3338/pydantic_core-2.46.4-cp314-cp314t-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:fc3e9034a63de20e15e8ade85358bc6efc614008cab72898b4b4952bea0509ff", size = 2159542, upload-time = "2026-05-06T13:39:27.506Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/1d/a2/367df868eb584dacf6bf82a389272406d7178e301c4ac82545ab98bc2dd9/pydantic_core-2.46.4-cp314-cp314t-musllinux_1_1_aarch64.whl", hash = "sha256:97e7cf2be5c77b7d1a9713a05605d49460d02c6078d38d8bef3cbe323c548424", size = 2168146, upload-time = "2026-05-06T13:38:31.93Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/c1/b8/4460f77f7e201893f649a29ab355dddd3beee8a97bcb1a320db414f9a06e/pydantic_core-2.46.4-cp314-cp314t-musllinux_1_1_armv7l.whl", hash = "sha256:3bf92c5d0e00fefaab325a4d27828fe6b6e2a21848686b5b60d2d9eeb09d76c6", size = 2306309, upload-time = "2026-05-06T13:37:44.717Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/64/c4/be2639293acd87dc8ddbcec41a73cee9b2ebf996fe6d892a1a74e88ad3f7/pydantic_core-2.46.4-cp314-cp314t-musllinux_1_1_x86_64.whl", hash = "sha256:3ecbc122d18468d06ca279dc26a8c2e2d5acb10943bb35e36ae92096dc3b5565", size = 2369736, upload-time = "2026-05-06T13:37:05.645Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/30/a6/9f9f380dbb301f67023bf8f707aaa75daadf84f7152d95c410fd7e81d994/pydantic_core-2.46.4-cp314-cp314t-win32.whl", hash = "sha256:e846ae7835bf0703ae43f534ab79a867146dadd59dc9ca5c8b53d5c8f7c9ef02", size = 1955575, upload-time = "2026-05-06T13:38:51.116Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/40/1f/f1eb9eb350e795d1af8586289746f5c5677d16043040d63710e22abc43c9/pydantic_core-2.46.4-cp314-cp314t-win_amd64.whl", hash = "sha256:2108ba5c1c1eca18030634489dc544844144ee36357f2f9f780b93e7ddbb44b5", size = 2051624, upload-time = "2026-05-06T13:38:21.672Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/f6/d2/42dd53d0a85c27606f316d3aa5d2869c4e8470a5ed6dec30e4a1abe19192/pydantic_core-2.46.4-cp314-cp314t-win_arm64.whl", hash = "sha256:4fcbe087dbc2068af7eda3aa87634eba216dbda64d1ae73c8684b621d33f6596", size = 2017325, upload-time = "2026-05-06T13:40:52.723Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/9d/1d/8987ad40f65ae1432753072f214fb5c74fe47ffbd0698bb9cbbb585664f8/pydantic_core-2.46.4-graalpy312-graalpy250_312_native-macosx_10_12_x86_64.whl", hash = "sha256:1d8ba486450b14f3b1d63bc521d410ec7565e52f887b9fb671791886436a42f7", size = 2095527, upload-time = "2026-05-06T13:39:52.283Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/64/d3/84c282a7eee1d3ac4c0377546ef5a1ea436ce26840d9ac3b7ed54a377507/pydantic_core-2.46.4-graalpy312-graalpy250_312_native-macosx_11_0_arm64.whl", hash = "sha256:3009f12e4e90b7f88b4f9adb1b0c4a3d58fe7820f3238c190047209d148026df", size = 1936024, upload-time = "2026-05-06T13:40:15.671Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/d7/ca/eac61596cdeb4d7e174d3dc0bd8a6238f14f75f97a24e7b7db4c7e7340a0/pydantic_core-2.46.4-graalpy312-graalpy250_312_native-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ad785e92e6dc634c21555edc8bd6b64957ab844541bcb96a1366c202951ae526", size = 1990696, upload-time = "2026-05-06T13:38:34.717Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/fa/c3/7c8b240552251faf6b3a957db200fcfbbcec36763c050428b601e0c9b83b/pydantic_core-2.46.4-graalpy312-graalpy250_312_native-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:00c603d540afdd6b80eb39f078f33ebd46211f02f33e34a32d9f053bba711de0", size = 2147590, upload-time = "2026-05-06T13:39:29.883Z" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/324/5406455a5d981/pydantic_core-2.46.4-cp312-cp312-macosx_10_12_x86_64.whl", hash = "sha256:3245406455a5d98187ec35530fd772b1d799b26667980872c8d4614991e2c4a2" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/962/ccbab7b642487/pydantic_core-2.46.4-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:962ccbab7b642487b1d8b7df90ef677e03134cf1fd8880bf698649b22a69371f" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/823/3f2947cf85404/pydantic_core-2.46.4-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8233f2947cf85404441fd7e0085f53b10c93e0ee78611099b5c7237e36aacbf7" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/3a2/33125ac121aa3/pydantic_core-2.46.4-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:3a233125ac121aa3ffba9a2b59edfc4a985a76092dc8279586ab4b71390875e7" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/5b7/12b53160b79a5/pydantic_core-2.46.4-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:5b712b53160b79a5850310b912a5ef8e57e56947c8ad690c227f5c9d7e561712" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/940/1557acd873c3a/pydantic_core-2.46.4-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:9401557acd873c3a7f3eb9383edef8ac4968f9510e340f4808d427e75667e7b4" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/926/c9541b14b12b1/pydantic_core-2.46.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:926c9541b14b12b1681dca8a0b75feb510b06c6341b70a8e500c2fdcff837cce" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/56c/b4851bcaf3d11/pydantic_core-2.46.4-cp312-cp312-manylinux_2_31_riscv64.whl", hash = "sha256:56cb4851bcaf3d117eddcef4fe66afd750a50274b0da8e22be256d10e5611987" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/c68/fcd102d71ea85/pydantic_core-2.46.4-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:c68fcd102d71ea85c5b2dfac3f4f8476eff42a9e078fd5faefff6d145063536b" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/b2f/69dec1725e79a/pydantic_core-2.46.4-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:b2f69dec1725e79a012d920df1707de5caf7ed5e08f3be4435e25803efc47458" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/8d0/820e8192167f8/pydantic_core-2.46.4-cp312-cp312-musllinux_1_1_armv7l.whl", hash = "sha256:8d0820e8192167f80d88d64038e609c31452eeca865b4e1d9950a27a4609b00b" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/fbd/b89b3e1c94a30/pydantic_core-2.46.4-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:fbdb89b3e1c94a30cc5edfce477c6e6a5dc4d8f84665b455c27582f211a1c72c" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/9aa/768456404a8bf/pydantic_core-2.46.4-cp312-cp312-win32.whl", hash = "sha256:9aa768456404a8bf48a4406685ac2bec8e72b62c69313734fa3b73cf33b3a894" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/e9c/26f834c65f575/pydantic_core-2.46.4-cp312-cp312-win_amd64.whl", hash = "sha256:e9c26f834c65f5752f3f06cb08cb86a913ceb7274d0db6e267808a708b46bc89" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/4fc/73cb559bdb54b/pydantic_core-2.46.4-cp312-cp312-win_arm64.whl", hash = "sha256:4fc73cb559bdb54b1134a706a2802a4cddd27a0633f5abb7e53056268751ac6a" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/5d5/902252db0d3ce/pydantic_core-2.46.4-cp313-cp313-macosx_10_12_x86_64.whl", hash = "sha256:5d5902252db0d3cedf8d4a1bc68f70eeb430f7e4c7104c8c476753519b423008" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/c94/f0688e7b8d0a6/pydantic_core-2.46.4-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:c94f0688e7b8d0a67abf40e57a7eaaecd17cc9586706a31b76c031f63df052b4" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/f02/7324c56cd5406/pydantic_core-2.46.4-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f027324c56cd5406ca49c124b0db10e56c69064fec039acc571c29020cc87c76" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/e73/9fee756ba1010/pydantic_core-2.46.4-cp313-cp313-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:e739fee756ba1010f8bcccb534252e85a35fe45ae92c295a06059ce58b74ccd3" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/9d5/6801be94b86a9/pydantic_core-2.46.4-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:9d56801be94b86a9da183e5f3766e6310752b99ff647e38b09a9500d88e46e76" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/241/2e734dcb48da1/pydantic_core-2.46.4-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:2412e734dcb48da14d4e4006b82b46b74f2518b8a26ee7e58c6844a6cd6d03c4" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/955/1187363ffc0de/pydantic_core-2.46.4-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9551187363ffc0de2a00b2e47c25aeaeb1020b69b668762966df15fc5659dd5a" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/018/6750b482eefa1/pydantic_core-2.46.4-cp313-cp313-manylinux_2_31_riscv64.whl", hash = "sha256:0186750b482eefa11d7f435892b09c5c606193ef3375bcf94aa00ae6bfb66262" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/585/5698a4856556d/pydantic_core-2.46.4-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:5855698a4856556d86e8e6cd8434bc3ac0314ee8e12089ae0e143f64c6256e4e" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/cba/f13819775b7f7/pydantic_core-2.46.4-cp313-cp313-musllinux_1_1_aarch64.whl", hash = "sha256:cbaf13819775b7f769bf4a1f066cb6df7a28d4480081a589828ef190226881cd" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/633/147d34cf45504/pydantic_core-2.46.4-cp313-cp313-musllinux_1_1_armv7l.whl", hash = "sha256:633147d34cf4550417f12e2b1a0383973bdf5cdfde212cb09e9a581cf10820be" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/82c/f530117216810/pydantic_core-2.46.4-cp313-cp313-musllinux_1_1_x86_64.whl", hash = "sha256:82cf5301172168103724d49a1444d3378cb20cdee30b116a1bd6031236298a5d" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/9fa/8ae11da9e2b31/pydantic_core-2.46.4-cp313-cp313-win32.whl", hash = "sha256:9fa8ae11da9e2b3126c6426f147e0fba88d96d65921799bb30c6abd1cb2c97fb" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/6b3/ace8194b0e520/pydantic_core-2.46.4-cp313-cp313-win_amd64.whl", hash = "sha256:6b3ace8194b0e5204818c92802dcdca7fc6d88aabbb799d7c795540d9cd6d292" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/184/c081504d17f1c/pydantic_core-2.46.4-cp313-cp313-win_arm64.whl", hash = "sha256:184c081504d17f1c1066e430e117142b2c77d9448a97f7b65c6ac9fd9aee238d" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/428/e04521a40150c/pydantic_core-2.46.4-cp314-cp314-macosx_10_12_x86_64.whl", hash = "sha256:428e04521a40150c85216fc8b85e8d39fece235a9cf5e383761238c7fa9b96fb" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/23a/ce664830ee0bf/pydantic_core-2.46.4-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:23ace664830ee0bfe014a0c7bc248b1f7f25ed7ad103852c317624a1083af462" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/ce5/c1d2a8b27468f/pydantic_core-2.46.4-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ce5c1d2a8b27468f433ca974829c44060b8097eedc39933e3c206a90ee49c4a9" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/728/3d57845ecf5a1/pydantic_core-2.46.4-cp314-cp314-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:7283d57845ecf5a163403eb0702dfc220cc4fbdd18919cb5ccea4f95ee1cdab4" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/8da/afc69c93ee8a0/pydantic_core-2.46.4-cp314-cp314-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:8daafc69c93ee8a0204506a3b6b30f586ef54028f52aeeeb5c4cfc5184fd5914" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/cd2/213145bcc2ba8/pydantic_core-2.46.4-cp314-cp314-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:cd2213145bcc2ba85884d0ac63d222fece9209678f77b9b4d76f054c561adb28" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/7a5/f930472650a82/pydantic_core-2.46.4-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7a5f930472650a82629163023e630d160863fce524c616f4e5186e5de9d9a49b" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/c1b/3f518abeca3aa/pydantic_core-2.46.4-cp314-cp314-manylinux_2_31_riscv64.whl", hash = "sha256:c1b3f518abeca3aa13c712fd202306e145abf59a18b094a6bafb2d2bbf59192c" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/1a7/dd0b3ee80d901/pydantic_core-2.46.4-cp314-cp314-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:1a7dd0b3ee80d90150e3495a3a13ac34dbcbfd4f012996a6a1d8900e91b5c0fb" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/3fb/702cd90b0446a/pydantic_core-2.46.4-cp314-cp314-musllinux_1_1_aarch64.whl", hash = "sha256:3fb702cd90b0446a3a1c5e470bfa0dd23c0233b676a9099ddcc964fa6ca13898" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/b84/58003118a712e/pydantic_core-2.46.4-cp314-cp314-musllinux_1_1_armv7l.whl", hash = "sha256:b8458003118a712e66286df6a707db01c52c0f52f7db8e4a38f0da1d3b94fc4e" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/372/429a130e469c9/pydantic_core-2.46.4-cp314-cp314-musllinux_1_1_x86_64.whl", hash = "sha256:372429a130e469c9cd698925ce5fc50940b7a1336b0d82038e63d5bbc4edc519" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/85b/b3611ff1802f3/pydantic_core-2.46.4-cp314-cp314-win32.whl", hash = "sha256:85bb3611ff1802f3ee7fdd7dbff26b56f343fb432d57a4728fdd49b6ef35e2f4" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/811/ff8e9c313ab42/pydantic_core-2.46.4-cp314-cp314-win_amd64.whl", hash = "sha256:811ff8e9c313ab425368bcbb36e5c4ebd7108c2bbf4e4089cfbb0b01eff63fac" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/bfe/c22eab3c8cc2c/pydantic_core-2.46.4-cp314-cp314-win_arm64.whl", hash = "sha256:bfec22eab3c8cc2ceec0248aec886624116dc079afa027ecc8ad4a7e62010f8a" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/af8/244b2bef6aaad/pydantic_core-2.46.4-cp314-cp314t-macosx_10_12_x86_64.whl", hash = "sha256:af8244b2bef6aaad6d92cda81372de7f8c8d36c9f0c3ea36e827c60e7d9467a0" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/5a4/330cdbc57162e/pydantic_core-2.46.4-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:5a4330cdbc57162e4b3aa303f588ba752257694c9c9be3e7ebb11b4aca659b5d" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/29c/61fc04a3d8401/pydantic_core-2.46.4-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:29c61fc04a3d840155ff08e475a04809278972fe6aef51e2720554e96367e34b" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/c50/f2528cf200c5e/pydantic_core-2.46.4-cp314-cp314t-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:c50f2528cf200c5eed56faf3f4e22fcd5f38c157a8b78576e6ba3168ec35f000" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/0cb/e8b01f948de42/pydantic_core-2.46.4-cp314-cp314t-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:0cbe8b01f948de4286c74cdd6c667aceb38f5c1e26f0693b3983d9d74887c65e" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/617/d7e2ca7dcb8c5/pydantic_core-2.46.4-cp314-cp314t-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:617d7e2ca7dcb8c5cf6bcb8c59b8832c94b36196bbf1cbd1bfb56ed341905edd" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/702/7560ee9221164/pydantic_core-2.46.4-cp314-cp314t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7027560ee92211647d0d34e3f7cd6f50da56399d26a9c8ad0da286d3869a53f3" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/f99/626688942fb74/pydantic_core-2.46.4-cp314-cp314t-manylinux_2_31_riscv64.whl", hash = "sha256:f99626688942fb746e545232e7726926f3be91b5975f8b55327665fafda991c7" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/fc3/e9034a63de20e/pydantic_core-2.46.4-cp314-cp314t-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:fc3e9034a63de20e15e8ade85358bc6efc614008cab72898b4b4952bea0509ff" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/97e/7cf2be5c77b7d/pydantic_core-2.46.4-cp314-cp314t-musllinux_1_1_aarch64.whl", hash = "sha256:97e7cf2be5c77b7d1a9713a05605d49460d02c6078d38d8bef3cbe323c548424" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/3bf/92c5d0e00fefa/pydantic_core-2.46.4-cp314-cp314t-musllinux_1_1_armv7l.whl", hash = "sha256:3bf92c5d0e00fefaab325a4d27828fe6b6e2a21848686b5b60d2d9eeb09d76c6" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/3ec/bc122d18468d0/pydantic_core-2.46.4-cp314-cp314t-musllinux_1_1_x86_64.whl", hash = "sha256:3ecbc122d18468d06ca279dc26a8c2e2d5acb10943bb35e36ae92096dc3b5565" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/e84/6ae7835bf0703/pydantic_core-2.46.4-cp314-cp314t-win32.whl", hash = "sha256:e846ae7835bf0703ae43f534ab79a867146dadd59dc9ca5c8b53d5c8f7c9ef02" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/210/8ba5c1c1eca18/pydantic_core-2.46.4-cp314-cp314t-win_amd64.whl", hash = "sha256:2108ba5c1c1eca18030634489dc544844144ee36357f2f9f780b93e7ddbb44b5" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/4fc/be087dbc2068a/pydantic_core-2.46.4-cp314-cp314t-win_arm64.whl", hash = "sha256:4fcbe087dbc2068af7eda3aa87634eba216dbda64d1ae73c8684b621d33f6596" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/1d8/ba486450b14f3/pydantic_core-2.46.4-graalpy312-graalpy250_312_native-macosx_10_12_x86_64.whl", hash = "sha256:1d8ba486450b14f3b1d63bc521d410ec7565e52f887b9fb671791886436a42f7" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/300/9f12e4e90b7f8/pydantic_core-2.46.4-graalpy312-graalpy250_312_native-macosx_11_0_arm64.whl", hash = "sha256:3009f12e4e90b7f88b4f9adb1b0c4a3d58fe7820f3238c190047209d148026df" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/ad7/85e92e6dc634c/pydantic_core-2.46.4-graalpy312-graalpy250_312_native-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ad785e92e6dc634c21555edc8bd6b64957ab844541bcb96a1366c202951ae526" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/00c/603d540afdd6b/pydantic_core-2.46.4-graalpy312-graalpy250_312_native-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:00c603d540afdd6b80eb39f078f33ebd46211f02f33e34a32d9f053bba711de0" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pygments"
|
||||
version = "2.21.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/49/2e/ced460408999b33da6b31b0021b0f37d329e202d4169aeb164493778f25b/pygments-2.21.0.tar.gz", hash = "sha256:610ca751c9bc2492b38eb9a38a7fbc93edbbb2d7182edaf34e66ae493dee5c8c", size = 5005329, upload-time = "2026-08-17T08:02:48.824Z" }
|
||||
source = { registry = "http://pip.home.arpa/root/pypi/+simple/" }
|
||||
sdist = { url = "http://pip.home.arpa/root/pypi/+f/610/ca751c9bc2492/pygments-2.21.0.tar.gz", hash = "sha256:610ca751c9bc2492b38eb9a38a7fbc93edbbb2d7182edaf34e66ae493dee5c8c" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/71/46/17f022dd3e953bf20a04a028a21ec746d942f8d2af30fa0f124fa0e6a684/pygments-2.21.0-py3-none-any.whl", hash = "sha256:2363c69b61c4a97c838da3b130dcd6468f4848992b21a82f2a63ec34377137d9", size = 1250147, upload-time = "2026-08-17T08:02:44.912Z" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/236/3c69b61c4a97c/pygments-2.21.0-py3-none-any.whl", hash = "sha256:2363c69b61c4a97c838da3b130dcd6468f4848992b21a82f2a63ec34377137d9" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pytest"
|
||||
version = "9.1.1"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
source = { registry = "http://pip.home.arpa/root/pypi/+simple/" }
|
||||
dependencies = [
|
||||
{ name = "colorama", marker = "sys_platform == 'win32'" },
|
||||
{ name = "iniconfig" },
|
||||
|
|
@ -305,58 +436,67 @@ dependencies = [
|
|||
{ name = "pluggy" },
|
||||
{ name = "pygments" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/e4/47/b9efed96c114afcfa3c9d3fe98a76a1d14c74a9e266d397cf6eb64be5e01/pytest-9.1.1.tar.gz", hash = "sha256:1088fbde8f2b49d95a549a195707afa7a76a3ce9bcadc26b6d71f0ffda5fe313", size = 1636369, upload-time = "2026-06-19T10:58:32.857Z" }
|
||||
sdist = { url = "http://pip.home.arpa/root/pypi/+f/108/8fbde8f2b49d9/pytest-9.1.1.tar.gz", hash = "sha256:1088fbde8f2b49d95a549a195707afa7a76a3ce9bcadc26b6d71f0ffda5fe313" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/24/25/1de2678b631f5a49215c6c96fff41ba892b0a34df68d6d80292b1b48aa7f/pytest-9.1.1-py3-none-any.whl", hash = "sha256:37a86b45efb9a47a61a36449063e8e18d0cab3161329fc099eb21783169c4f0c", size = 386536, upload-time = "2026-06-19T10:58:31.347Z" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/37a/86b45efb9a47a/pytest-9.1.1-py3-none-any.whl", hash = "sha256:37a86b45efb9a47a61a36449063e8e18d0cab3161329fc099eb21783169c4f0c" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pytest-django"
|
||||
version = "4.14.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
source = { registry = "http://pip.home.arpa/root/pypi/+simple/" }
|
||||
dependencies = [
|
||||
{ name = "pytest" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/44/f6/3851312120c2bf2f19cafff931e75059aad1ba670703cd751e2fde9bc942/pytest_django-4.14.0.tar.gz", hash = "sha256:26787dd3f422cfbab8f55b80a776e2edea7a11092cb74e960bef1312515708ef", size = 94700, upload-time = "2026-08-10T14:13:08.319Z" }
|
||||
sdist = { url = "http://pip.home.arpa/root/pypi/+f/267/87dd3f422cfba/pytest_django-4.14.0.tar.gz", hash = "sha256:26787dd3f422cfbab8f55b80a776e2edea7a11092cb74e960bef1312515708ef" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/9c/03/850bffad2b581c440ca51c039d74504d5a422c94bda0bdb8a8ba5068d48b/pytest_django-4.14.0-py3-none-any.whl", hash = "sha256:c533b08d89cc675efcd5398eea270b34547e35f9a3608e2c9748dd88428ea187", size = 27067, upload-time = "2026-08-10T14:13:06.998Z" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/c53/3b08d89cc675e/pytest_django-4.14.0-py3-none-any.whl", hash = "sha256:c533b08d89cc675efcd5398eea270b34547e35f9a3608e2c9748dd88428ea187" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "setuptools"
|
||||
version = "84.0.0"
|
||||
source = { registry = "http://pip.home.arpa/root/pypi/+simple/" }
|
||||
sdist = { url = "http://pip.home.arpa/root/pypi/+f/f46/95c21257f0d9b/setuptools-84.0.0.tar.gz", hash = "sha256:f4695c21257f0d9b537ec2692c941d02ee143b7cc1276941349a546573b2ef73" }
|
||||
wheels = [
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/51a/52592b3b99e10/setuptools-84.0.0-py3-none-any.whl", hash = "sha256:51a52592b3b99e102b609654876bd65f19f999935166d1352678931132b0c670" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sqlparse"
|
||||
version = "0.6.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/5f/d3/3f06a1006f2261d1342aefb3c71eed02f5d4ca5bdbecd86ebc12ad38306e/sqlparse-0.6.0.tar.gz", hash = "sha256:113c35c75365ab9cc9c7231d68c6428fb11c085fc8e9eb1ad659b7ddbf6cd2b9", size = 178477, upload-time = "2026-08-13T19:16:06.396Z" }
|
||||
source = { registry = "http://pip.home.arpa/root/pypi/+simple/" }
|
||||
sdist = { url = "http://pip.home.arpa/root/pypi/+f/113/c35c75365ab9c/sqlparse-0.6.0.tar.gz", hash = "sha256:113c35c75365ab9cc9c7231d68c6428fb11c085fc8e9eb1ad659b7ddbf6cd2b9" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/d9/50/f00935da0ec7cbf325f8dc4f772ae46fbc7b672dd62876e73f0a94adda57/sqlparse-0.6.0-py3-none-any.whl", hash = "sha256:b861c0288ce2fa56209a9a6412d2e066ac664b3873b89c26c9d8415e8e32996f", size = 50070, upload-time = "2026-08-13T19:16:04.062Z" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/b86/1c0288ce2fa56/sqlparse-0.6.0-py3-none-any.whl", hash = "sha256:b861c0288ce2fa56209a9a6412d2e066ac664b3873b89c26c9d8415e8e32996f" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "typing-extensions"
|
||||
version = "4.16.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/f6/cc/6253133b5bb138fc3306cebfbda2c520f545d36b5be2c7255cc528bb45d6/typing_extensions-4.16.0.tar.gz", hash = "sha256:dc983d19a509c94dba722ee6abd33940f7c05a89e243c47e907eb4db6f1a43e5", size = 113555, upload-time = "2026-07-02T08:40:05.92Z" }
|
||||
source = { registry = "http://pip.home.arpa/root/pypi/+simple/" }
|
||||
sdist = { url = "http://pip.home.arpa/root/pypi/+f/dc9/83d19a509c94d/typing_extensions-4.16.0.tar.gz", hash = "sha256:dc983d19a509c94dba722ee6abd33940f7c05a89e243c47e907eb4db6f1a43e5" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/49/d3/b8441a820a491ddfc024b0b0cf0393375b75ea13866d9c66727e54c2fc80/typing_extensions-4.16.0-py3-none-any.whl", hash = "sha256:481caa481374e813c1b176ada14e97f1f67a4539ce9cfeb3f350d78d6370c2e8", size = 45571, upload-time = "2026-07-02T08:40:04.659Z" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/481/caa481374e813/typing_extensions-4.16.0-py3-none-any.whl", hash = "sha256:481caa481374e813c1b176ada14e97f1f67a4539ce9cfeb3f350d78d6370c2e8" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "typing-inspection"
|
||||
version = "0.4.4"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
source = { registry = "http://pip.home.arpa/root/pypi/+simple/" }
|
||||
dependencies = [
|
||||
{ name = "typing-extensions" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/a3/26/b09b8010994eccc3c09092e6b34058f36a460eea2d4c3e8b910c695975a0/typing_inspection-0.4.4.tar.gz", hash = "sha256:547274fa6b0a561ccf549cc9524b999a578e737d015d8709d021f9d0d13bea47", size = 76928, upload-time = "2026-08-12T12:37:25.997Z" }
|
||||
sdist = { url = "http://pip.home.arpa/root/pypi/+f/547/274fa6b0a561c/typing_inspection-0.4.4.tar.gz", hash = "sha256:547274fa6b0a561ccf549cc9524b999a578e737d015d8709d021f9d0d13bea47" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/67/81/4add07e5172b7ac40d8ed5ff580409a7801a4fe26d529bdd915401dabfbe/typing_inspection-0.4.4-py3-none-any.whl", hash = "sha256:65b8397ba37ccbce054456aaccddfc91e6e3083c92824df348d96ca832f3f147", size = 14750, upload-time = "2026-08-12T12:37:24.648Z" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/65b/8397ba37ccbce/typing_inspection-0.4.4-py3-none-any.whl", hash = "sha256:65b8397ba37ccbce054456aaccddfc91e6e3083c92824df348d96ca832f3f147" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tzdata"
|
||||
version = "2026.3"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/92/ff/5a28bdfd8c3ebec42564ac7d0e54ca3db65044a9314a97f9564fa7a1e926/tzdata-2026.3.tar.gz", hash = "sha256:4a1518b8993086a7982523e071643f3c0e5f213e75b21318e78bcabfff9d1415", size = 198674, upload-time = "2026-07-10T08:50:37.887Z" }
|
||||
source = { registry = "http://pip.home.arpa/root/pypi/+simple/" }
|
||||
sdist = { url = "http://pip.home.arpa/root/pypi/+f/4a1/518b8993086a7/tzdata-2026.3.tar.gz", hash = "sha256:4a1518b8993086a7982523e071643f3c0e5f213e75b21318e78bcabfff9d1415" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/e5/6d/b53b99a9f2766d095985947a5782f1702cabb129a34f7a802d7197af832f/tzdata-2026.3-py2.py3-none-any.whl", hash = "sha256:dc096730c87af6cab1b171c9d532be840741ff5d459015e7f6947bd7d7e54931", size = 348168, upload-time = "2026-07-10T08:50:36.46Z" },
|
||||
{ url = "http://pip.home.arpa/root/pypi/+f/dc0/96730c87af6ca/tzdata-2026.3-py2.py3-none-any.whl", hash = "sha256:dc096730c87af6cab1b171c9d532be840741ff5d459015e7f6947bd7d7e54931" },
|
||||
]
|
||||
|
|
|
|||
Loading…
Reference in New Issue