Coverage for scripts/test.py: 0%
16 statements
« prev ^ index » next coverage.py v7.6.0, created at 2024-07-28 10:12 -0400
« prev ^ index » next coverage.py v7.6.0, created at 2024-07-28 10:12 -0400
1from collections import Counter
2import json
4# from overturetoosm.places import process_props
5from src.overturetoosm.resources import places_tags
7# from ..src.overture_to_osm.process import process_place_props
8# from ..src.overture_to_osm.resources import tags
10with open("scripts/test_in.geojson", "r", encoding="utf-8") as f:
11 contents: dict = json.load(f)
12 count = []
14 for each in contents["features"]:
15 # each["properties"] = process_place_props(each["properties"])
16 try:
17 prim = places_tags.get(each["properties"]["categories"]["main"])
18 if not prim:
19 # print(each["properties"]["categories"]["main"])
20 count.append(each["properties"]["categories"]["main"])
22 except KeyError:
23 pass
25 contents["features"] = [each for each in contents["features"] if each["properties"]]
27 # with open("scripts/test_out.geojson", "w+", encoding="utf-8") as f:
28 # json.dump(contents, f, indent=4)
30 print(len(count), len(contents["features"]))
31 print(Counter(count))