Skip to content

Commit 4574559

Browse files
authored
Merge pull request #74 from Doomki/master
Added type signatures to dining and laundry
2 parents c1bf27e + 516b531 commit 4574559

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

PittAPI/dining.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
import requests
2121
import grequests
22+
from typing import Dict
2223

2324
sess = requests.session()
2425

@@ -41,7 +42,7 @@ def get_locations():
4142
return get_locations_by_status()
4243

4344

44-
def get_locations_by_status(status=None):
45+
def get_locations_by_status(status: str=None) -> List[Dict[str,str]]:
4546
# status can be nil, open, or closed
4647
# None - returns all dining locations
4748
# 'all' - same as None (or anything else)
@@ -96,7 +97,7 @@ def get_locations_by_status(status=None):
9697
# return []
9798

9899

99-
def _encode_dining_location(string):
100+
def _encode_dining_location(string: str) -> str:
100101
# changes full name into dict key name
101102
string = string.lower()
102103
string = string.replace(' ', '_')

PittAPI/laundry.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
import requests
2323
from bs4 import BeautifulSoup
2424

25+
from typing import Dict, List
26+
2527
session = requests.session()
2628

2729
location_dict = {
@@ -36,7 +38,7 @@
3638
}
3739

3840

39-
def get_status_simple(building_name):
41+
def get_status_simple(building_name: str) -> Dict[str,str]:
4042
"""
4143
:returns: a dictionary with free washers and dryers as well as total washers
4244
and dryers for given building
@@ -75,7 +77,7 @@ def get_status_simple(building_name):
7577
return di
7678

7779

78-
def get_status_detailed(building_name):
80+
def get_status_detailed(building_name: str) -> List[Dict[str,str]]:
7981
building_name = building_name.upper()
8082

8183
# Get a cookie
@@ -113,7 +115,7 @@ def get_status_detailed(building_name):
113115

114116
cleaned_resp = [x for x in cleaned_resp if len(x) == 10]
115117

116-
di = []
118+
di = [] # type: List[Dict[str,str]]
117119
for machine in cleaned_resp:
118120
time_left = -1
119121
machine_name = "{}_{}".format(machine[9], machine[3])

0 commit comments

Comments
 (0)