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

from __future__ import print_function
import json
import logging

from collections import OrderedDict
import six
from six.moves.urllib.parse import urlencode

import ckan.plugins as p
from ckan import model
import ckan.logic as logic
import ckan.lib.navl.dictization_functions as dict_fns
import ckan.lib.helpers as h
import ckan.plugins.toolkit as tk
from ckanext.showcase.model import ShowcasePackageAssociation

_ = tk._
abort = tk.abort
c = tk.c

log = logging.getLogger(__name__)
DATASET_TYPE_NAME = 'showcase'
ckan_29_or_higher = tk.check_ckan_version(min_version='2.9.0')


def check_edit_view_auth(id):
    context = {
        'save': 'save' in tk.request.params,
        'pending': True
    }

    try:
        tk.check_access('ckanext_showcase_update', context)
    except tk.NotAuthorized:
        return tk.abort(
            401,
            _('User not authorized to edit {showcase_id}').format(
                showcase_id=id))
<commit_msg>Clean not accessed import<commit_after># -*- coding: utf-8 -*-

from __future__ import print_function
import json
import logging

from collections import OrderedDict
import six
from six.moves.urllib.parse import urlencode

import ckan.plugins as p
import ckan.logic as logic
import ckan.lib.navl.dictization_functions as dict_fns
import ckan.lib.helpers as h
import ckan.plugins.toolkit as tk
from ckanext.showcase.model import ShowcasePackageAssociation

_ = tk._
abort = tk.abort
c = tk.c

log = logging.getLogger(__name__)
DATASET_TYPE_NAME = 'showcase'
ckan_29_or_higher = tk.check_ckan_version(min_version='2.9.0')


def check_edit_view_auth(id):
    context = {
        'save': 'save' in tk.request.params,
        'pending': True
    }

    try:
        tk.check_access('ckanext_showcase_update', context)
    except tk.NotAuthorized:
        return tk.abort(
            401,
            _('User not authorized to edit {showcase_id}').format(
                showcase_id=id))

{'fraction_non_alphanumeric': 0.08893380495199596, 'fraction_numerical': 0.009095502779181405, 'mean_word_length': 3.419642857142857, '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': '1846263', 'n_tokens_mistral': 674, 'n_tokens_neox': 663, 'n_words': 167}