-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor MAX_SIZE context variable handling
The get_max_size function was removed and the context variable MAX_SIZE was redefined to include a default setting of a float type right on its declaration. Afterward, all get_max_size calls in youtube.py and tiktok.py were replaced with MAX_SIZE.get calls to adapt with the updated implementation. Signed-off-by: Jag_k <[email protected]>
- Loading branch information
Showing
4 changed files
with
6 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,3 @@ | ||
from contextvars import ContextVar | ||
|
||
MAX_SIZE: ContextVar[str] = ContextVar("max-size", default="inf") # float(str or "inf") | ||
|
||
|
||
def get_max_size() -> float: | ||
try: | ||
return float(MAX_SIZE.get("inf")) | ||
except ValueError: | ||
return float("inf") | ||
MAX_SIZE: ContextVar[float] = ContextVar("max-size", default=float("inf")) # float(str or "inf") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[tool.poetry] | ||
name = "media-parser" | ||
version = "2.1.0" | ||
version = "2.1.1" | ||
description = "API for parsing media from social networks" | ||
authors = ["Jag_k <[email protected]>"] | ||
maintainers = ["Jag_k <[email protected]>"] | ||
|