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

""" Upload data to APIs """

import os
# import shutil
# import subprocess as shell
from flask import request, send_from_directory
from werkzeug import secure_filename
from ... import htmlcodes as hcodes
from ..base import ExtendedApiResource
from .. import decorators as deck
from ... import get_logger

UPLOAD_FOLDER = '/uploads'
INTERPRETER = 'python'
ZBIN = '/zoomify/processor/ZoomifyFileProcessor.py'

logger = get_logger(__name__)


# Save files http://API/upload
@deck.enable_endpoint_identifier('filename')
class Uploader(ExtendedApiResource):

    allowed_exts = ['png', 'jpg', 'jpeg', 'tiff']

    @staticmethod
    def absolute_upload_file(filename):
        return os.path.join(UPLOAD_FOLDER, filename)

    def allowed_file(self, filename):
        return '.' in filename \
            and filename.rsplit('.', 1)[1].lower() in self.allowed_exts

    def get(self, filename):
        abs_file = self.absolute_upload_file(filename)
        logger.info("Provide '%s' " % abs_file)
        #return send_from_directory(app.config['UPLOAD_FOLDER'], filename)
        return "Not implemented yet", hcodes.HTTP_OK_NORESPONSE

    def post(self):

        if 'file' not in request.files:<commit_msg>Removing a frontend part from the rest api<commit_after># -*- coding: utf-8 -*-

""" Upload data to APIs """

import os
# import shutil
# import subprocess as shell
from flask import request, send_from_directory
from werkzeug import secure_filename
from ... import htmlcodes as hcodes
from ..base import ExtendedApiResource
from ... import get_logger

UPLOAD_FOLDER = '/uploads'
INTERPRETER = 'python'
ZBIN = '/zoomify/processor/ZoomifyFileProcessor.py'

logger = get_logger(__name__)


# Save files http://API/upload
class Uploader(ExtendedApiResource):

    allowed_exts = ['png', 'jpg', 'jpeg', 'tiff']

    @staticmethod
    def absolute_upload_file(filename):
        return os.path.join(UPLOAD_FOLDER, filename)

    def allowed_file(self, filename):
        return '.' in filename \
            and filename.rsplit('.', 1)[1].lower() in self.allowed_exts

    def get(self, filename):
        abs_file = self.absolute_upload_file(filename)
        logger.info("Provide '%s' " % abs_file)
        #return send_from_directory(app.config['UPLOAD_FOLDER'], filename)
        return "Not implemented yet", hcodes.HTTP_OK_NORESPONSE

    def post(self):

        if 'file' not in request.files:
{'fraction_non_alphanumeric': 0.1139344262295082, 'fraction_numerical': 0.002459016393442623, 'mean_word_length': 3.712355212355212, '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': '7543054', 'n_tokens_mistral': 760, 'n_tokens_neox': 743, 'n_words': 200}