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("Monorail:" + str(pta.isMonorailAccessible()))
print(shops.countOfShops())
print(shops.countOfShopTypes())

View File

@@ -4,7 +4,7 @@ class Shops:
def __init__(self, _osm):
self.osm = _osm
def getAllShops(self):
def getAllShopTypes(self):
shopList = []
for tag in self.osm.nodeTagList:
@@ -16,14 +16,14 @@ class Shops:
shopList.append(tag.value)
return shopList
def countOfShops(self):
shopList = self.getAllShops()
def countOfShopTypes(self):
shopList = self.getAllShopTypes()
countDict = []
if shopList:
def isInDict(name):
for a in countDict:
if a['name'] == name:
if a['type'] == name:
return True
return False
@@ -31,5 +31,5 @@ class Shops:
print(shop)
if not isInDict(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)