<commit_before># -*- coding: utf-8 -*-

__all__ = ['Application', 'AppEnvironment']

import logging
import re
from iktomi.utils.storage import VersionedStorage, StorageFrame, storage_property
from webob.exc import HTTPException, HTTPInternalServerError, \
                      HTTPNotFound
from webob import Request
from .route_state import RouteState
from .reverse import Reverse

logger = logging.getLogger(__name__)

HOSTNAME_REGEX = re.compile("^(([a-zA-Z]|[a-zA-Z][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z]|[A-Za-z][A-Za-z0-9\-]*[A-Za-z0-9])$")
IP_REGEX = re.compile("^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$")


class AppEnvironment(StorageFrame):
    '''
    Base class for `env` storage frame class.

    Can be subclassed to add extra functionality::<commit_msg>adding port to regexps<commit_after># -*- coding: utf-8 -*-

__all__ = ['Application', 'AppEnvironment']

import logging
import re
from iktomi.utils.storage import VersionedStorage, StorageFrame, storage_property
from webob.exc import HTTPException, HTTPInternalServerError, \
                      HTTPNotFound
from webob import Request
from .route_state import RouteState
from .reverse import Reverse

logger = logging.getLogger(__name__)

HOSTNAME_REGEX = re.compile("^(([a-zA-Z]|[a-zA-Z][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z]|[A-Za-z][A-Za-z0-9\-]*[A-Za-z0-9])(?::\d+)?$")
IP_REGEX = re.compile("^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(?::\d+)?$")


class AppEnvironment(StorageFrame):
    '''
    Base class for `env` storage frame class.

    Can be subclassed to add extra functionality::
{'fraction_non_alphanumeric': 0.21946902654867256, 'fraction_numerical': 0.05663716814159292, 'mean_word_length': 4.170731707317073, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1500138', 'n_tokens_mistral': 714, 'n_tokens_neox': 684, 'n_words': 114}