Skip to content

Commit

Permalink
Add context manager support for all classes
Browse files Browse the repository at this point in the history
  • Loading branch information
MarzaElise committed Sep 25, 2021
1 parent 6e47fa8 commit 5dcd293
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 0 deletions.
12 changes: 12 additions & 0 deletions holybooks/bible.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,3 +124,15 @@ def translation(self) -> str:
if not self.json:
return None
return self.json["translation_name"]

def __enter__(self):
return self

def __exit__(self, *args):
return

async def __aenter__(self):
return self

async def __aexit__(self, *args):
return
34 changes: 34 additions & 0 deletions holybooks/quran.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,17 @@ async def ayah_info(
}
return data

def __enter__(self):
return self

def __exit__(self, *args):
return

async def __aenter__(self):
return self

async def __aexit__(self, *args):
return

class Ayah:
def __init__(self, surah: int = None, *, ayah: int = None):
Expand Down Expand Up @@ -245,6 +256,17 @@ def api_status(self):
return None
return self._request["status"]

def __enter__(self):
return self

def __exit__(self, *args):
return

async def __aenter__(self):
return self

async def __aexit__(self, *args):
return

class Search:
def __init__(
Expand Down Expand Up @@ -368,3 +390,15 @@ def find(self):
for num in range(self.req):
data.append(self.matches[num]["text"])
return data

def __enter__(self):
return self

def __exit__(self, *args):
return

async def __aenter__(self):
return self

async def __aexit__(self, *args):
return
12 changes: 12 additions & 0 deletions holybooks/torah.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,15 @@ def translation(self) -> str:
if not self.json:
return None
return self.json["translation_name"]

def __enter__(self):
return self

def __exit__(self, *args):
return

async def __aenter__(self):
return self

async def __aexit__(self, *args):
return

0 comments on commit 5dcd293

Please sign in to comment.