mirror of
https://github.com/DerTyp7/local-analyzer-python.git
synced 2025-10-29 12:32:10 +01:00
renamed to Types
This commit is contained in:
2
main.py
2
main.py
@@ -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())
|
||||||
|
|||||||
10
places.py
10
places.py
@@ -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)
|
||||||
Reference in New Issue
Block a user