# Path: sathub/comum/util.py
# def hexdump(data):
#     def _cut(sequence, size):
#         for i in xrange(0, len(sequence), size):
#             yield sequence[i:i+size]
#     _hex = lambda seq: ['{0:02x}'.format(b) for b in seq]
#     _chr = lambda seq: [chr(b) if 32 <= b <= 126 else '.' for b in seq]
#     raw_data = map(ord, data)
#     hexpanel = [' '.join(line) for line in _cut(_hex(raw_data), 16)]
#     chrpanel = [''.join(line) for line in _cut(_chr(raw_data), 16)]
#     hexpanel[-1] = hexpanel[-1] + (chr(32) * (47 - len(hexpanel[-1])))
#     chrpanel[-1] = chrpanel[-1] + (chr(32) * (16 - len(chrpanel[-1])))
#     return '\n'.join('%s  %s' % (h, c) for h, c in zip(hexpanel, chrpanel))
# 
# Path: sathub/comum/util.py
# @memoize
# def instanciar_funcoes_sat(numero_caixa):
#     funcoes_sat = FuncoesSAT(BibliotecaSAT(conf.caminho_biblioteca,
#                     convencao=conf.convencao_chamada),
#             codigo_ativacao=conf.codigo_ativacao,
#             numerador_sessao=instanciar_numerador_sessao(numero_caixa))
#     return funcoes_sat
# 
# Path: sathub/custom.py
# def request_parser():
#     global parser
#     return parser.copy()


import logging
from flask.ext import restful
from ..comum.util import hexdump
from ..comum.util import instanciar_funcoes_sat
from ..custom import request_parser
# Copyright 2015 Base4 Sistemas Ltda ME
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#





logger = logging.getLogger('sathub.resource')

parser = request_parser()


class ExtrairLogs(restful.Resource):

    def post(self):
        args = parser.parse_args()

        numero_caixa = args['numero_caixa']

# Path: sathub/comum/util.py
# def hexdump(data):
#     def _cut(sequence, size):
#         for i in xrange(0, len(sequence), size):
#             yield sequence[i:i+size]
#     _hex = lambda seq: ['{0:02x}'.format(b) for b in seq]
#     _chr = lambda seq: [chr(b) if 32 <= b <= 126 else '.' for b in seq]
#     raw_data = map(ord, data)
#     hexpanel = [' '.join(line) for line in _cut(_hex(raw_data), 16)]
#     chrpanel = [''.join(line) for line in _cut(_chr(raw_data), 16)]
#     hexpanel[-1] = hexpanel[-1] + (chr(32) * (47 - len(hexpanel[-1])))
#     chrpanel[-1] = chrpanel[-1] + (chr(32) * (16 - len(chrpanel[-1])))
#     return '\n'.join('%s  %s' % (h, c) for h, c in zip(hexpanel, chrpanel))
# 
# Path: sathub/comum/util.py
# @memoize
# def instanciar_funcoes_sat(numero_caixa):
#     funcoes_sat = FuncoesSAT(BibliotecaSAT(conf.caminho_biblioteca,
#                     convencao=conf.convencao_chamada),
#             codigo_ativacao=conf.codigo_ativacao,
#             numerador_sessao=instanciar_numerador_sessao(numero_caixa))
#     return funcoes_sat
# 
# Path: sathub/custom.py
# def request_parser():
#     global parser
#     return parser.copy()


# Path: sathub/resources/extrairlogs.py
import logging
from flask.ext import restful
from ..comum.util import hexdump
from ..comum.util import instanciar_funcoes_sat
from ..custom import request_parser

# Copyright 2015 Base4 Sistemas Ltda ME
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#





logger = logging.getLogger('sathub.resource')

parser = request_parser()


class ExtrairLogs(restful.Resource):

    def post(self):
        args = parser.parse_args()

        numero_caixa = args['numero_caixa']

        fsat = instanciar_funcoes_sat(numero_caixa)