# Path: transitfeed/util.py
# class defaultdict(dict):
#   def __init__(self, default_factory=None, *a, **kw):
#     if (default_factory is not None and
#       not hasattr(default_factory, '__call__')):
#       raise TypeError('first argument must be callable')
#     dict.__init__(self, *a, **kw)
#     self.default_factory = default_factory
#   def __getitem__(self, key):
#     try:
#       return dict.__getitem__(self, key)
#     except KeyError:
#       return self.__missing__(key)
#   def __missing__(self, key):
#     if self.default_factory is None:
#       raise KeyError(key)
#     self[key] = value = self.default_factory()
#     return value
#   def __reduce__(self):
#     if self.default_factory is None:
#       args = tuple()
#     else:
#       args = self.default_factory,
#     return type(self), args, None, None, self.items()
#   def copy(self):
#     return self.__copy__()
#   def __copy__(self):
#     return type(self)(self.default_factory, self)
#   def __deepcopy__(self, memo):
#     import copy
#     return type(self)(self.default_factory,
#                       copy.deepcopy(self.items()))
#   def __repr__(self):
#     return 'defaultdict(%s, %s)' % (self.default_factory,
#                                     dict.__repr__(self))
# 
# Path: transitfeed/compat.py



import bisect
import datetime
import itertools
import os
  import sqlite3 as sqlite
import tempfile
import time
import warnings
import weakref
import zipfile
    from pysqlite2 import dbapi2 as sqlite
    from com.ziclix.python.sql import zxJDBC as sqlite
from . import gtfsfactoryuser
from . import problems as problems_module
from .util import defaultdict
from . import util
from .compat import StringIO
    self.fares = {}
    self.fare_zones = {}  # represents the set of all known fare zones
    self.feed_info = None
    self._shapes = {}  # shape_id to Shape
    # A map from transfer._ID() to a list of transfers. A list is used so
    # there can be more than one transfer with each ID. Once GTFS explicitly
    # prohibits duplicate IDs this might be changed to a simple dict of
    # Transfers.
    self._transfers = defaultdict(lambda: [])
    self._default_service_period = None
    self._default_agency = None
    if problem_reporter is None:
      self.problem_reporter = problems_module.default_problem_reporter
    else:
      self.problem_reporter = problem_reporter
    self._check_duplicate_trips = check_duplicate_trips
    self.ConnectDb(memory_db)

  def AddTableColumn(self, table, column):
    """Add column to table if it is not already there."""
    if column not in self._table_columns[table]:
      self._table_columns[table].append(column)

  def AddTableColumns(self, table, columns):
    """Add columns to table if they are not already there.

    Args:
      table: table name as a string
      columns: an iterable of column names"""
    table_columns = self._table_columns.setdefault(table, [])

# Path: transitfeed/util.py
# class defaultdict(dict):
#   def __init__(self, default_factory=None, *a, **kw):
#     if (default_factory is not None and
#       not hasattr(default_factory, '__call__')):
#       raise TypeError('first argument must be callable')
#     dict.__init__(self, *a, **kw)
#     self.default_factory = default_factory
#   def __getitem__(self, key):
#     try:
#       return dict.__getitem__(self, key)
#     except KeyError:
#       return self.__missing__(key)
#   def __missing__(self, key):
#     if self.default_factory is None:
#       raise KeyError(key)
#     self[key] = value = self.default_factory()
#     return value
#   def __reduce__(self):
#     if self.default_factory is None:
#       args = tuple()
#     else:
#       args = self.default_factory,
#     return type(self), args, None, None, self.items()
#   def copy(self):
#     return self.__copy__()
#   def __copy__(self):
#     return type(self)(self.default_factory, self)
#   def __deepcopy__(self, memo):
#     import copy
#     return type(self)(self.default_factory,
#                       copy.deepcopy(self.items()))
#   def __repr__(self):
#     return 'defaultdict(%s, %s)' % (self.default_factory,
#                                     dict.__repr__(self))
# 
# Path: transitfeed/compat.py



# Path: transitfeed/schedule.py
import bisect
import datetime
import itertools
import os
  import sqlite3 as sqlite
import tempfile
import time
import warnings
import weakref
import zipfile
    from pysqlite2 import dbapi2 as sqlite
    from com.ziclix.python.sql import zxJDBC as sqlite
from . import gtfsfactoryuser
from . import problems as problems_module
from .util import defaultdict
from . import util
from .compat import StringIO

    self.fares = {}
    self.fare_zones = {}  # represents the set of all known fare zones
    self.feed_info = None
    self._shapes = {}  # shape_id to Shape
    # A map from transfer._ID() to a list of transfers. A list is used so
    # there can be more than one transfer with each ID. Once GTFS explicitly
    # prohibits duplicate IDs this might be changed to a simple dict of
    # Transfers.
    self._transfers = defaultdict(lambda: [])
    self._default_service_period = None
    self._default_agency = None
    if problem_reporter is None:
      self.problem_reporter = problems_module.default_problem_reporter
    else:
      self.problem_reporter = problem_reporter
    self._check_duplicate_trips = check_duplicate_trips
    self.ConnectDb(memory_db)

  def AddTableColumn(self, table, column):
    """Add column to table if it is not already there."""
    if column not in self._table_columns[table]:
      self._table_columns[table].append(column)

  def AddTableColumns(self, table, columns):
    """Add columns to table if they are not already there.

    Args:
      table: table name as a string
      columns: an iterable of column names"""
    table_columns = self._table_columns.setdefault(table, [])

    for attr in columns: