# Path: speedinfo/conditions/exclude_urls.py
# class ExcludeURLCondition(AbstractCondition):
#     """
#     Condition allows to exclude some urls from profiling by adding them
#     to the SPEEDINFO_EXCLUDE_URLS list (default is empty). Each entry in
#     SPEEDINFO_EXCLUDE_URLS is a regex compatible expression to test requested url.
#     """
#     def __init__(self):
#         self.patterns = None
# 
#     def get_patterns(self):
#         if (self.patterns is None) or speedinfo_settings.SPEEDINFO_TESTS:
#             self.patterns = [re.compile(pattern) for pattern in speedinfo_settings.SPEEDINFO_EXCLUDE_URLS]
# 
#         return self.patterns
# 
#     def process_request(self, request):
#         """Checks requested url against the list of excluded urls.
# 
#         :type request: :class:`django.http.HttpRequest`
#         :return: False if path matches to any of the exclude urls
#         :rtype: bool
#         """
#         for pattern in self.get_patterns():
#             if pattern.match(request.path):
#                 return False
# 
#         return True
# 
#     def process_response(self, response):
#         return True


from django.test import RequestFactory, TestCase, override_settings
from speedinfo.conditions.exclude_urls import ExcludeURLCondition
# coding: utf-8




@override_settings(
    SPEEDINFO_STORAGE="speedinfo.storage.cache.storage.CacheStorage",
    SPEEDINFO_PROFILING_CONDITIONS=[
        "speedinfo.conditions.exclude_urls.ExcludeURLCondition",
    ],
    SPEEDINFO_EXCLUDE_URLS=["/weak/$", "/strict/"],
    SPEEDINFO_TESTS=True,

# Path: speedinfo/conditions/exclude_urls.py
# class ExcludeURLCondition(AbstractCondition):
#     """
#     Condition allows to exclude some urls from profiling by adding them
#     to the SPEEDINFO_EXCLUDE_URLS list (default is empty). Each entry in
#     SPEEDINFO_EXCLUDE_URLS is a regex compatible expression to test requested url.
#     """
#     def __init__(self):
#         self.patterns = None
# 
#     def get_patterns(self):
#         if (self.patterns is None) or speedinfo_settings.SPEEDINFO_TESTS:
#             self.patterns = [re.compile(pattern) for pattern in speedinfo_settings.SPEEDINFO_EXCLUDE_URLS]
# 
#         return self.patterns
# 
#     def process_request(self, request):
#         """Checks requested url against the list of excluded urls.
# 
#         :type request: :class:`django.http.HttpRequest`
#         :return: False if path matches to any of the exclude urls
#         :rtype: bool
#         """
#         for pattern in self.get_patterns():
#             if pattern.match(request.path):
#                 return False
# 
#         return True
# 
#     def process_response(self, response):
#         return True


# Path: tests/test_conditions.py
from django.test import RequestFactory, TestCase, override_settings
from speedinfo.conditions.exclude_urls import ExcludeURLCondition

# coding: utf-8




@override_settings(
    SPEEDINFO_STORAGE="speedinfo.storage.cache.storage.CacheStorage",
    SPEEDINFO_PROFILING_CONDITIONS=[
        "speedinfo.conditions.exclude_urls.ExcludeURLCondition",
    ],
    SPEEDINFO_EXCLUDE_URLS=["/weak/$", "/strict/"],
    SPEEDINFO_TESTS=True,

)