feat: ж/д слой + cant_swim в скоринг + профили вне модели
Определение специфических рекомендаций (матрица профилей §8):
1. Ж/д слой (закрыт мёртвый railway ×2.5 у РАС):
- /api/v1/water/{case_id} отдаёт railway=rail как LineString
(без service/industrial/military веток), кэш общий v2;
- railway_warning «перекрыть/проверить немедленно» по профилям;
- SearchMap: Polyline слой ж/д (тёмно-красный), счётчики 💧/🚂.
2. cant_swim → профиль не_умеет_плавать (water ×3.0, без изменения
радиуса, critical_warning «обследовать водоёмы НЕМЕДЛЕННО»):
- раньше чекбокс влиял только на текст, в скоринге был пробел;
- derive в analyze._derive_profiles — работает и для closed_cases.
3. unmodeled_profiles: ДЦП/слабое зрение/слух — честная пометка
«вне поведенческой модели» с пояснением (vector_tasks B12:
профили без аналога не выдавать за учтённые); блок на фронте
в карточке здоровья.
Площадь воды: сферический эксцесс, проверен на квадрате 53° (744017 м²
vs 743272 точного). Тесты: 202 passed (новый test_cant_swim_profile).
This commit is contained in:
@@ -0,0 +1,113 @@
|
||||
class PyJWTError(Exception):
|
||||
"""
|
||||
Base class for all exceptions
|
||||
"""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class InvalidTokenError(PyJWTError):
|
||||
"""Base exception when ``decode()`` fails on a token"""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class DecodeError(InvalidTokenError):
|
||||
"""Raised when a token cannot be decoded because it failed validation"""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class InvalidSignatureError(DecodeError):
|
||||
"""Raised when a token's signature doesn't match the one provided as part of
|
||||
the token."""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class ExpiredSignatureError(InvalidTokenError):
|
||||
"""Raised when a token's ``exp`` claim indicates that it has expired"""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class InvalidAudienceError(InvalidTokenError):
|
||||
"""Raised when a token's ``aud`` claim does not match one of the expected
|
||||
audience values"""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class InvalidIssuerError(InvalidTokenError):
|
||||
"""Raised when a token's ``iss`` claim does not match the expected issuer"""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class InvalidIssuedAtError(InvalidTokenError):
|
||||
"""Raised when a token's ``iat`` claim is non-numeric"""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class ImmatureSignatureError(InvalidTokenError):
|
||||
"""Raised when a token's ``nbf`` or ``iat`` claims represent a time in the future"""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class InvalidKeyError(PyJWTError):
|
||||
"""Raised when the specified key is not in the proper format"""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class InvalidAlgorithmError(InvalidTokenError):
|
||||
"""Raised when the specified algorithm is not recognized by PyJWT"""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class MissingRequiredClaimError(InvalidTokenError):
|
||||
"""Raised when a claim that is required to be present is not contained
|
||||
in the claimset"""
|
||||
|
||||
def __init__(self, claim: str) -> None:
|
||||
self.claim = claim
|
||||
|
||||
def __str__(self) -> str:
|
||||
return f'Token is missing the "{self.claim}" claim'
|
||||
|
||||
|
||||
class PyJWKError(PyJWTError):
|
||||
pass
|
||||
|
||||
|
||||
class MissingCryptographyError(PyJWKError):
|
||||
"""Raised if the algorithm requires ``cryptography`` to be installed and it is not available."""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class PyJWKSetError(PyJWTError):
|
||||
pass
|
||||
|
||||
|
||||
class PyJWKClientError(PyJWTError):
|
||||
pass
|
||||
|
||||
|
||||
class PyJWKClientConnectionError(PyJWKClientError):
|
||||
pass
|
||||
|
||||
|
||||
class InvalidSubjectError(InvalidTokenError):
|
||||
"""Raised when a token's ``sub`` claim is not a string or doesn't match the expected ``subject``"""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class InvalidJTIError(InvalidTokenError):
|
||||
"""Raised when a token's ``jti`` claim is not a string"""
|
||||
|
||||
pass
|
||||
Reference in New Issue
Block a user