f20080305d
Определение специфических рекомендаций (матрица профилей §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).
89 lines
3.4 KiB
Python
89 lines
3.4 KiB
Python
"""
|
|
pygments.lexers.teal
|
|
~~~~~~~~~~~~~~~~~~~~
|
|
|
|
Lexer for TEAL.
|
|
|
|
:copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
|
|
:license: BSD, see LICENSE for details.
|
|
"""
|
|
|
|
from pygments.lexer import RegexLexer, bygroups, include, words
|
|
from pygments.token import Comment, Name, Number, String, Text, Keyword, \
|
|
Whitespace
|
|
|
|
__all__ = ['TealLexer']
|
|
|
|
|
|
class TealLexer(RegexLexer):
|
|
"""
|
|
For the Transaction Execution Approval Language (TEAL)
|
|
|
|
For more information about the grammar, see:
|
|
https://github.com/algorand/go-algorand/blob/master/data/transactions/logic/assembler.go
|
|
"""
|
|
name = 'teal'
|
|
url = 'https://developer.algorand.org/docs/reference/teal/specification/'
|
|
aliases = ['teal']
|
|
filenames = ['*.teal']
|
|
version_added = '2.9'
|
|
|
|
keywords = words({
|
|
'Sender', 'Fee', 'FirstValid', 'FirstValidTime', 'LastValid', 'Note',
|
|
'Lease', 'Receiver', 'Amount', 'CloseRemainderTo', 'VotePK',
|
|
'SelectionPK', 'VoteFirst', 'VoteLast', 'VoteKeyDilution', 'Type',
|
|
'TypeEnum', 'XferAsset', 'AssetAmount', 'AssetSender', 'AssetReceiver',
|
|
'AssetCloseTo', 'GroupIndex', 'TxID', 'ApplicationID', 'OnCompletion',
|
|
'ApplicationArgs', 'NumAppArgs', 'Accounts', 'NumAccounts',
|
|
'ApprovalProgram', 'ClearStateProgram', 'RekeyTo', 'ConfigAsset',
|
|
'ConfigAssetTotal', 'ConfigAssetDecimals', 'ConfigAssetDefaultFrozen',
|
|
'ConfigAssetUnitName', 'ConfigAssetName', 'ConfigAssetURL',
|
|
'ConfigAssetMetadataHash', 'ConfigAssetManager', 'ConfigAssetReserve',
|
|
'ConfigAssetFreeze', 'ConfigAssetClawback', 'FreezeAsset',
|
|
'FreezeAssetAccount', 'FreezeAssetFrozen',
|
|
'NoOp', 'OptIn', 'CloseOut', 'ClearState', 'UpdateApplication',
|
|
'DeleteApplication',
|
|
'MinTxnFee', 'MinBalance', 'MaxTxnLife', 'ZeroAddress', 'GroupSize',
|
|
'LogicSigVersion', 'Round', 'LatestTimestamp', 'CurrentApplicationID',
|
|
'AssetBalance', 'AssetFrozen',
|
|
'AssetTotal', 'AssetDecimals', 'AssetDefaultFrozen', 'AssetUnitName',
|
|
'AssetName', 'AssetURL', 'AssetMetadataHash', 'AssetManager',
|
|
'AssetReserve', 'AssetFreeze', 'AssetClawback',
|
|
}, suffix=r'\b')
|
|
|
|
identifier = r'[^ \t\n]+(?=\/\/)|[^ \t\n]+'
|
|
newline = r'\r?\n'
|
|
tokens = {
|
|
'root': [
|
|
include('whitespace'),
|
|
# pragmas match specifically on the space character
|
|
(r'^#pragma .*' + newline, Comment.Directive),
|
|
# labels must be followed by a space,
|
|
# but anything after that is ignored
|
|
('(' + identifier + ':' + ')' + '([ \t].*)',
|
|
bygroups(Name.Label, Comment.Single)),
|
|
(identifier, Name.Function, 'function-args'),
|
|
],
|
|
'function-args': [
|
|
include('whitespace'),
|
|
(r'"', String, 'string'),
|
|
(r'(b(?:ase)?(?:32|64) ?)(\(?[a-zA-Z0-9+/=]+\)?)',
|
|
bygroups(String.Affix, String.Other)),
|
|
(r'[A-Z2-7]{58}', Number), # address
|
|
(r'0x[\da-fA-F]+', Number.Hex),
|
|
(r'\d+', Number.Integer),
|
|
(keywords, Keyword),
|
|
(identifier, Name.Attributes), # branch targets
|
|
(newline, Text, '#pop'),
|
|
],
|
|
'string': [
|
|
(r'\\(?:["nrt\\]|x\d\d)', String.Escape),
|
|
(r'[^\\\"\n]+', String),
|
|
(r'"', String, '#pop'),
|
|
],
|
|
'whitespace': [
|
|
(r'[ \t]+', Whitespace),
|
|
(r'//[^\n]+', Comment.Single),
|
|
],
|
|
}
|