From 4c647c8d73072f216bab59c9073d4eb2bf4fdcf6 Mon Sep 17 00:00:00 2001 From: "j.mei7" Date: Tue, 22 Mar 2022 18:41:28 +0100 Subject: [PATCH] renamed to Types --- main.py | 2 +- places.py | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/main.py b/main.py index 5b51973..8677107 100644 --- a/main.py +++ b/main.py @@ -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()) diff --git a/places.py b/places.py index c6c210a..5663ffa 100644 --- a/places.py +++ b/places.py @@ -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) \ No newline at end of file