# Path: pyxform/xls2json.py
# class QuestionTypesReader(SpreadsheetReader):
#     """
#     Class for reading spreadsheet file that specifies the available
#     question types.
#     @see question_type_dictionary
#     """
# 
#     def __init__(self, path):
#         super(QuestionTypesReader, self).__init__(path)
#         self._setup_question_types_dictionary()
# 
#     def _setup_question_types_dictionary(self):
#         use_double_colons = has_double_colon(self._dict)
#         types_sheet = "question types"
#         self._dict = self._dict[types_sheet]
#         self._dict = dealias_and_group_headers(
#             dict_array=self._dict,
#             header_aliases={},
#             use_double_colons=use_double_colons,
#             default_language=constants.DEFAULT_LANGUAGE_VALUE,
#         )
#         self._dict = organize_by_values(self._dict, "name")
# 
# def print_pyobj_to_json(pyobj, path=None):
#     """
#     dump a python nested array/dict structure to the specified file
#     or stdout if no file is specified
#     """
#     if path:
#         fp = codecs.open(path, mode="w", encoding="utf-8")
#         json.dump(pyobj, fp=fp, ensure_ascii=False, indent=4)
#         fp.close()
#     else:
#         sys.stdout.write(json.dumps(pyobj, ensure_ascii=False, indent=4))


from pyxform.xls2json import QuestionTypesReader, print_pyobj_to_json
# -*- coding: utf-8 -*-
"""
XForm survey question type mapping dictionary module.
"""


def generate_new_dict():
    """
    This is just here incase there is ever any need to generate the question
    type dictionary from all.xls again.
    It shouldn't be called as part of any application.
    """
    path_to_question_types = "/pyxform/question_types/all.xls"

# Path: pyxform/xls2json.py
# class QuestionTypesReader(SpreadsheetReader):
#     """
#     Class for reading spreadsheet file that specifies the available
#     question types.
#     @see question_type_dictionary
#     """
# 
#     def __init__(self, path):
#         super(QuestionTypesReader, self).__init__(path)
#         self._setup_question_types_dictionary()
# 
#     def _setup_question_types_dictionary(self):
#         use_double_colons = has_double_colon(self._dict)
#         types_sheet = "question types"
#         self._dict = self._dict[types_sheet]
#         self._dict = dealias_and_group_headers(
#             dict_array=self._dict,
#             header_aliases={},
#             use_double_colons=use_double_colons,
#             default_language=constants.DEFAULT_LANGUAGE_VALUE,
#         )
#         self._dict = organize_by_values(self._dict, "name")
# 
# def print_pyobj_to_json(pyobj, path=None):
#     """
#     dump a python nested array/dict structure to the specified file
#     or stdout if no file is specified
#     """
#     if path:
#         fp = codecs.open(path, mode="w", encoding="utf-8")
#         json.dump(pyobj, fp=fp, ensure_ascii=False, indent=4)
#         fp.close()
#     else:
#         sys.stdout.write(json.dumps(pyobj, ensure_ascii=False, indent=4))


# Path: pyxform/question_type_dictionary.py
from pyxform.xls2json import QuestionTypesReader, print_pyobj_to_json

# -*- coding: utf-8 -*-
"""
XForm survey question type mapping dictionary module.
"""


def generate_new_dict():
    """
    This is just here incase there is ever any need to generate the question
    type dictionary from all.xls again.
    It shouldn't be called as part of any application.
    """
    path_to_question_types = "/pyxform/question_types/all.xls"

    json_dict = QuestionTypesReader(path_to_question_types).to_json_dict()