renamed to Types

This commit is contained in:
j.mei7
2022-03-22 18:41:28 +01:00
parent 2be1030d3c
commit 4c647c8d73
2 changed files with 6 additions and 6 deletions

View File

@@ -47,4 +47,4 @@ print("Subway:" + str(pta.isSubwayAccessible()))
print("Train:" + str(pta.isTrainAccessible())) print("Train:" + str(pta.isTrainAccessible()))
print("Monorail:" + str(pta.isMonorailAccessible())) print("Monorail:" + str(pta.isMonorailAccessible()))
print(shops.countOfShops()) print(shops.countOfShopTypes())

View File

@@ -4,7 +4,7 @@ class Shops:
def __init__(self, _osm): def __init__(self, _osm):
self.osm = _osm self.osm = _osm
def getAllShops(self): def getAllShopTypes(self):
shopList = [] shopList = []
for tag in self.osm.nodeTagList: for tag in self.osm.nodeTagList:
@@ -16,14 +16,14 @@ class Shops:
shopList.append(tag.value) shopList.append(tag.value)
return shopList return shopList
def countOfShops(self): def countOfShopTypes(self):
shopList = self.getAllShops() shopList = self.getAllShopTypes()
countDict = [] countDict = []
if shopList: if shopList:
def isInDict(name): def isInDict(name):
for a in countDict: for a in countDict:
if a['name'] == name: if a['type'] == name:
return True return True
return False return False
@@ -31,5 +31,5 @@ class Shops:
print(shop) print(shop)
if not isInDict(shop): if not isInDict(shop):
print("add" + str(shopList.count(shop))) print("add" + str(shopList.count(shop)))
countDict.append({'name': shop, 'count': shopList.count(shop)}) countDict.append({'type': shop, 'count': shopList.count(shop)})
return sorted(countDict, key=itemgetter('count'), reverse=True) return sorted(countDict, key=itemgetter('count'), reverse=True)