# Path: urbanaccess/utils.py
# def log(message, level=None, name=None, filename=None):
#     """
#     Write a message to the log file and/or print to the console.
# 
#     Parameters
#     ----------
#     message : string
#         the content of the message to log
#     level : int, optional
#         one of the logger.level constants
#     name : string, optional
#         name of the logger
#     filename : string, optional
#         name of the log file
# 
#     Returns
#     -------
#     None
#     """
# 
#     if level is None:
#         level = lg.INFO
#     if name is None:
#         name = config.settings.log_name
#     if filename is None:
#         filename = config.settings.log_filename
# 
#     if config.settings.log_file:
#         # get the current logger or create a new one then log message at
#         # requested level
#         logger = _get_logger(level=level, name=name, filename=filename)
#         if level == lg.DEBUG:
#             logger.debug(message)
#         elif level == lg.INFO:
#             logger.info(message)
#         elif level == lg.WARNING:
#             logger.warning(message)
#         elif level == lg.ERROR:
#             logger.error(message)
# 
#     # if logging to console is turned on, convert message to ascii and print
#     #  to the console only
#     if config.settings.log_console:
#         # capture current stdout, then switch it to the console, print the
#         # message, then switch back to what had been the stdout
#         # this prevents logging to notebook - instead, it goes to console
#         standard_out = sys.stdout
#         sys.stdout = sys.__stdout__
# 
#         # convert message to ascii for proper console display in windows
#         # terminals
#         message = unicodedata.normalize('NFKD', str(message)).encode(
#             'ascii', errors='replace').decode()
#         print(message)
#         sys.stdout = standard_out
#     # otherwise print out standard statement
#     else:
#         print(message)


import os
import logging as lg
from urbanaccess.utils import log

    if bbox is not None:
        if not isinstance(bbox, tuple) or len(bbox) != 4:
            raise ValueError('bbox must be a 4 element tuple.')
        if (lat_min is not None) or (lng_min is not None) or (
                    lat_max is not None) or (lng_max is not None):
            raise ValueError('lat_min, lng_min, lat_max and lng_max must be '
                             'None if using bbox.')

        lng_max, lat_min, lng_min, lat_max = bbox

    if lat_min is None:
        raise ValueError('lat_min cannot be None.')
    if lng_min is None:
        raise ValueError('lng_min cannot be None.')
    if lat_max is None:
        raise ValueError('lat_max cannot be None.')
    if lng_max is None:
        raise ValueError('lng_max cannot be None.')
    if not isinstance(lat_min, float) or not isinstance(lng_min, float) or\
            not isinstance(lat_max, float) or not isinstance(lng_max, float):
        raise ValueError('lng_min, lat_min, lng_min, lat_max, and lng_max '
                         'must be floats.')

    outside_boundingbox = df.loc[~(
        ((lng_max < df["stop_lon"]) & (df["stop_lon"] < lng_min)) & (
            (lat_min < df["stop_lat"]) & (df["stop_lat"] < lat_max)))]

    feed_name = os.path.split(feed_folder)[1]
    if len(outside_boundingbox) > 0:

# Path: urbanaccess/utils.py
# def log(message, level=None, name=None, filename=None):
#     """
#     Write a message to the log file and/or print to the console.
# 
#     Parameters
#     ----------
#     message : string
#         the content of the message to log
#     level : int, optional
#         one of the logger.level constants
#     name : string, optional
#         name of the logger
#     filename : string, optional
#         name of the log file
# 
#     Returns
#     -------
#     None
#     """
# 
#     if level is None:
#         level = lg.INFO
#     if name is None:
#         name = config.settings.log_name
#     if filename is None:
#         filename = config.settings.log_filename
# 
#     if config.settings.log_file:
#         # get the current logger or create a new one then log message at
#         # requested level
#         logger = _get_logger(level=level, name=name, filename=filename)
#         if level == lg.DEBUG:
#             logger.debug(message)
#         elif level == lg.INFO:
#             logger.info(message)
#         elif level == lg.WARNING:
#             logger.warning(message)
#         elif level == lg.ERROR:
#             logger.error(message)
# 
#     # if logging to console is turned on, convert message to ascii and print
#     #  to the console only
#     if config.settings.log_console:
#         # capture current stdout, then switch it to the console, print the
#         # message, then switch back to what had been the stdout
#         # this prevents logging to notebook - instead, it goes to console
#         standard_out = sys.stdout
#         sys.stdout = sys.__stdout__
# 
#         # convert message to ascii for proper console display in windows
#         # terminals
#         message = unicodedata.normalize('NFKD', str(message)).encode(
#             'ascii', errors='replace').decode()
#         print(message)
#         sys.stdout = standard_out
#     # otherwise print out standard statement
#     else:
#         print(message)


# Path: urbanaccess/gtfs/utils_validation.py
import os
import logging as lg
from urbanaccess.utils import log


    if bbox is not None:
        if not isinstance(bbox, tuple) or len(bbox) != 4:
            raise ValueError('bbox must be a 4 element tuple.')
        if (lat_min is not None) or (lng_min is not None) or (
                    lat_max is not None) or (lng_max is not None):
            raise ValueError('lat_min, lng_min, lat_max and lng_max must be '
                             'None if using bbox.')

        lng_max, lat_min, lng_min, lat_max = bbox

    if lat_min is None:
        raise ValueError('lat_min cannot be None.')
    if lng_min is None:
        raise ValueError('lng_min cannot be None.')
    if lat_max is None:
        raise ValueError('lat_max cannot be None.')
    if lng_max is None:
        raise ValueError('lng_max cannot be None.')
    if not isinstance(lat_min, float) or not isinstance(lng_min, float) or\
            not isinstance(lat_max, float) or not isinstance(lng_max, float):
        raise ValueError('lng_min, lat_min, lng_min, lat_max, and lng_max '
                         'must be floats.')

    outside_boundingbox = df.loc[~(
        ((lng_max < df["stop_lon"]) & (df["stop_lon"] < lng_min)) & (
            (lat_min < df["stop_lat"]) & (df["stop_lat"] < lat_max)))]

    feed_name = os.path.split(feed_folder)[1]
    if len(outside_boundingbox) > 0:

        log('WARNING: {} GTFS feed stops: {:,} of {:,} ({:.2f} percent of '