# Path: flattentool/i18n.py
# def _(text):
#     lang = get_language()
#     if lang not in translations:
#         lang = "en"
#     return translations[lang].gettext(text)
# 
# Path: flattentool/sheet.py
# class Sheet(object):
#     """
#     An abstract representation of a single sheet of a spreadsheet.
# 
#     """
# 
#     def __init__(self, columns=None, root_id="", name=None):
#         self.id_columns = []
#         self.columns = columns if columns else []
#         self.titles = {}
#         self._lines = []
#         self.root_id = root_id
#         self.name = name
# 
#     @property
#     def lines(self):
#         return self._lines
# 
#     def add_field(self, field, id_field=False):
#         columns = self.id_columns if id_field else self.columns
#         if field not in columns:
#             columns.append(field)
# 
#     def append(self, item):
#         self.add_field(item)
# 
#     def __iter__(self):
#         if self.root_id:
#             yield self.root_id
#         for column in self.id_columns:
#             yield column
#         for column in self.columns:
#             yield column
# 
#     def append_line(self, flattened_dict):
#         self._lines.append(flattened_dict)


import codecs
import os
import sys
import jsonref
    import pathlib
    import urllib
    import urlparse
                import requests
from collections import OrderedDict, UserDict
from warnings import warn
from flattentool.i18n import _
from flattentool.sheet import Sheet

class SchemaParser(object):
    """Parse the fields of a JSON schema into a flattened structure."""

    def __init__(
        self,
        schema_filename=None,
        root_schema_dict=None,
        rollup=False,
        root_id=None,
        use_titles=False,
        disable_local_refs=False,
        truncation_length=3,
        exclude_deprecated_fields=False,
    ):
        self.sub_sheets = {}
        self.main_sheet = Sheet()
        self.sub_sheet_mapping = {}
        self.do_rollup = rollup
        self.rollup = set()
        self.root_id = root_id
        self.use_titles = use_titles
        self.sub_sheet_titles = {}
        self.truncation_length = truncation_length
        self.title_lookup = TitleLookup()
        self.flattened = {}
        self.exclude_deprecated_fields = exclude_deprecated_fields

        if root_schema_dict is None and schema_filename is None:
            raise ValueError(

# Path: flattentool/i18n.py
# def _(text):
#     lang = get_language()
#     if lang not in translations:
#         lang = "en"
#     return translations[lang].gettext(text)
# 
# Path: flattentool/sheet.py
# class Sheet(object):
#     """
#     An abstract representation of a single sheet of a spreadsheet.
# 
#     """
# 
#     def __init__(self, columns=None, root_id="", name=None):
#         self.id_columns = []
#         self.columns = columns if columns else []
#         self.titles = {}
#         self._lines = []
#         self.root_id = root_id
#         self.name = name
# 
#     @property
#     def lines(self):
#         return self._lines
# 
#     def add_field(self, field, id_field=False):
#         columns = self.id_columns if id_field else self.columns
#         if field not in columns:
#             columns.append(field)
# 
#     def append(self, item):
#         self.add_field(item)
# 
#     def __iter__(self):
#         if self.root_id:
#             yield self.root_id
#         for column in self.id_columns:
#             yield column
#         for column in self.columns:
#             yield column
# 
#     def append_line(self, flattened_dict):
#         self._lines.append(flattened_dict)


# Path: flattentool/schema.py
import codecs
import os
import sys
import jsonref
    import pathlib
    import urllib
    import urlparse
                import requests
from collections import OrderedDict, UserDict
from warnings import warn
from flattentool.i18n import _
from flattentool.sheet import Sheet


class SchemaParser(object):
    """Parse the fields of a JSON schema into a flattened structure."""

    def __init__(
        self,
        schema_filename=None,
        root_schema_dict=None,
        rollup=False,
        root_id=None,
        use_titles=False,
        disable_local_refs=False,
        truncation_length=3,
        exclude_deprecated_fields=False,
    ):
        self.sub_sheets = {}
        self.main_sheet = Sheet()
        self.sub_sheet_mapping = {}
        self.do_rollup = rollup
        self.rollup = set()
        self.root_id = root_id
        self.use_titles = use_titles
        self.sub_sheet_titles = {}
        self.truncation_length = truncation_length
        self.title_lookup = TitleLookup()
        self.flattened = {}
        self.exclude_deprecated_fields = exclude_deprecated_fields

        if root_schema_dict is None and schema_filename is None:
            raise ValueError(

                _("One of schema_filename or root_schema_dict must be supplied")