Skip to content

Commit 743be8a

Browse files
committed
few bug fixes
1 parent 4bf8863 commit 743be8a

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

pybpsapi/main.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,15 +116,16 @@ def __init__(
116116
):
117117
self.api_url = api_url
118118
self.fallback_api_url = fallback_api_url
119-
self.category = str(category) if type(category) is None else category
119+
self.category = str(category) if category is None else category
120120
self.cache_method = cache_method
121121

122122
# Get category names from API
123+
del category # To avoid confusion with self.category
123124
categories = self._send_api_request("categories")
124125

125126
# If this circular checker is supposed to be for a specific category of circulars only
126127
# Check if the category name or id is valid
127-
if category != 'None':
128+
if self.category != 'None':
128129
if type(self.category) is int:
129130
if not _min_category_id <= self.category:
130131
raise ValueError("Invalid category Number")
@@ -283,12 +284,14 @@ def check(self) -> list[dict] | list:
283284

284285
# If this circular-checker is meant for only one category,
285286
# remove circulars of any other category
286-
if self.category:
287+
if self.category != 'None':
287288
res = [circular for circular in res if circular['category'] == self.category]
288289

289290
# remove the 'category' key from each of the circular objects
290291
for circular in res:
291292
del circular['category']
293+
294+
res.reverse()
292295
return res
293296

294297

0 commit comments

Comments
 (0)