# Path: roadmaptools/printer.py
# def print_info(info, file=sys.stdout, end="\n"):
#     print("[{0}]: {1}".format(datetime.now().strftime('%H:%M:%S'), info), file=file, end=end)
# 
# Path: roadmaptools/init.py



import geojson
import codecs
import copy
import argparse
import sys
import time
import pandas as pd
import roadmaptools.inout
import roadmaptools.road_structures
from typing import Dict, Set, List, Tuple
from tqdm import tqdm, trange
from geojson import FeatureCollection, Feature
from pandas import DataFrame
from roadmaptools.printer import print_info
from roadmaptools.init import config
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#


# properties that will not be deleted
SET_OF_USEFUL_PROPERTIES = {'highway', 'id', 'lanes', 'maxspeed', 'oneway', 'bridge', 'width', 'tunnel',
                            'traffic_calming', 'lanes:forward', 'lanes:backward', 'junction'}

# for correct type conversion
dict_of_useful_properties = {'highway': str, 'id': int, 'lanes': int, 'maxspeed': int, 'oneway': str, 'bridge': str,
                             'width': float, 'tunnel': str, 'traffic_calming': str, 'lanes:forward': int,
                             'lanes:backward': int, 'junction': str}

nonempty_columns = set()


def _is_int(string: str) -> bool:
    try:
        int(string)
        return True
    except ValueError:
        return False


def clean_geojson_files(input_file_path: str = config.geojson_file,

# Path: roadmaptools/printer.py
# def print_info(info, file=sys.stdout, end="\n"):
#     print("[{0}]: {1}".format(datetime.now().strftime('%H:%M:%S'), info), file=file, end=end)
# 
# Path: roadmaptools/init.py



# Path: roadmaptools/clean_geojson.py
import geojson
import codecs
import copy
import argparse
import sys
import time
import pandas as pd
import roadmaptools.inout
import roadmaptools.road_structures
from typing import Dict, Set, List, Tuple
from tqdm import tqdm, trange
from geojson import FeatureCollection, Feature
from pandas import DataFrame
from roadmaptools.printer import print_info
from roadmaptools.init import config

# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#


# properties that will not be deleted
SET_OF_USEFUL_PROPERTIES = {'highway', 'id', 'lanes', 'maxspeed', 'oneway', 'bridge', 'width', 'tunnel',
                            'traffic_calming', 'lanes:forward', 'lanes:backward', 'junction'}

# for correct type conversion
dict_of_useful_properties = {'highway': str, 'id': int, 'lanes': int, 'maxspeed': int, 'oneway': str, 'bridge': str,
                             'width': float, 'tunnel': str, 'traffic_calming': str, 'lanes:forward': int,
                             'lanes:backward': int, 'junction': str}

nonempty_columns = set()


def _is_int(string: str) -> bool:
    try:
        int(string)
        return True
    except ValueError:
        return False


def clean_geojson_files(input_file_path: str = config.geojson_file,

                        output_file_path: str = config.cleaned_geojson_file,