# Path: pubs/p3.py
#     def input():
#     def _get_raw_stdout():
#     def _get_raw_stderr():
#     def u_maybe(s):
#         def __init__(self, *args, **kwargs):
#         def write(self, s):
#     def _get_fake_stdio_ucontent(stdio):
#         def _print_message(self, message, file=None):
#     def _get_raw_stdout():
#     def _get_raw_stderr():
#     def u_maybe(s):
#         def __init__(self, *args, **kwargs):
#         def write(self, s):
#     def _fake_stdio(additional_out=False):
#     def _get_fake_stdio_ucontent(stdio):
# def isbasestr(obj):
#     class StdIO(io.BytesIO):
#     class ArgumentParser(argparse.ArgumentParser):
#     class StdIO(io.BytesIO):


import unicodedata
import re
from .p3 import ustr, uchr
from __future__ import unicode_literals



# Citekey stuff

TYPE_KEY = 'ENTRYTYPE'

CONTROL_CHARS = ''.join(map(uchr, list(range(0, 32)) + list(range(127, 160))))
CITEKEY_FORBIDDEN_CHARS = '@\'\\,#}{~%/ '  # '/' is OK for bibtex but forbidden
# here since we transform citekeys into filenames
CITEKEY_EXCLUDE_RE = re.compile(
    '[%s]' % re.escape(CONTROL_CHARS + CITEKEY_FORBIDDEN_CHARS))


def str2citekey(s):

# Path: pubs/p3.py
#     def input():
#     def _get_raw_stdout():
#     def _get_raw_stderr():
#     def u_maybe(s):
#         def __init__(self, *args, **kwargs):
#         def write(self, s):
#     def _get_fake_stdio_ucontent(stdio):
#         def _print_message(self, message, file=None):
#     def _get_raw_stdout():
#     def _get_raw_stderr():
#     def u_maybe(s):
#         def __init__(self, *args, **kwargs):
#         def write(self, s):
#     def _fake_stdio(additional_out=False):
#     def _get_fake_stdio_ucontent(stdio):
# def isbasestr(obj):
#     class StdIO(io.BytesIO):
#     class ArgumentParser(argparse.ArgumentParser):
#     class StdIO(io.BytesIO):


# Path: pubs/bibstruct.py
import unicodedata
import re
from .p3 import ustr, uchr

from __future__ import unicode_literals



# Citekey stuff

TYPE_KEY = 'ENTRYTYPE'

CONTROL_CHARS = ''.join(map(uchr, list(range(0, 32)) + list(range(127, 160))))
CITEKEY_FORBIDDEN_CHARS = '@\'\\,#}{~%/ '  # '/' is OK for bibtex but forbidden
# here since we transform citekeys into filenames
CITEKEY_EXCLUDE_RE = re.compile(
    '[%s]' % re.escape(CONTROL_CHARS + CITEKEY_FORBIDDEN_CHARS))


def str2citekey(s):

    key = unicodedata.normalize('NFKD', ustr(s)).encode('ascii', 'ignore').decode()