<commit_before>from django.core.cache import cache
from django.core.urlresolvers import reverse, resolve, Resolver404
from django.utils.translation import get_language
from corehq.tabs.exceptions import UrlPrefixFormatError, UrlPrefixFormatsSuggestion
from corehq.tabs.utils import sidebar_to_dropdown
from dimagi.utils.decorators.memoized import memoized
from dimagi.utils.django.cache import make_template_fragment_key
from django.conf import settings


def url_is_location_safe(url):
    from corehq.apps.users.location_access_restrictions import is_location_safe
    try:
        match = resolve(url)
    except Resolver404:
        return False
    else:
        if is_location_safe(match.func, match.args, match.kwargs):
            return True
        return False


class UITab(object):
    title = None
    view = None

    dispatcher = None

    # Tuple of prefixes that this UITab claims e.g.
    #   ('/a/{domain}/reports/', '/a/{domain}/otherthing/')
    # This is a required field.
    url_prefix_formats = ()
    show_by_default = True<commit_msg>Don't if X return True else return False<commit_after>from django.core.cache import cache
from django.core.urlresolvers import reverse, resolve, Resolver404
from django.utils.translation import get_language
from corehq.tabs.exceptions import UrlPrefixFormatError, UrlPrefixFormatsSuggestion
from corehq.tabs.utils import sidebar_to_dropdown
from dimagi.utils.decorators.memoized import memoized
from dimagi.utils.django.cache import make_template_fragment_key
from django.conf import settings


def url_is_location_safe(url):
    from corehq.apps.users.location_access_restrictions import is_location_safe
    try:
        match = resolve(url)
    except Resolver404:
        return False
    return is_location_safe(match.func, match.args, match.kwargs)


class UITab(object):
    title = None
    view = None

    dispatcher = None

    # Tuple of prefixes that this UITab claims e.g.
    #   ('/a/{domain}/reports/', '/a/{domain}/otherthing/')
    # This is a required field.
    url_prefix_formats = ()
    show_by_default = True
{'fraction_non_alphanumeric': 0.07398568019093078, 'fraction_numerical': 0.005727923627684964, 'mean_word_length': 3.908665105386417, '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': '2840257', 'n_tokens_mistral': 642, 'n_tokens_neox': 612, 'n_words': 167}