-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# What - Add `env` module for environment-specific values - Use in `request` module for local files # Why - To DRY up the code - To fix #269
- Loading branch information
Showing
2 changed files
with
22 additions
and
5 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
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import platform | ||
|
||
|
||
class OS: | ||
"""A simple wrapper to handle OS-specific switches. | ||
Attributes: | ||
is_windows: A boolean of whether the current system is MS Windows. | ||
is_nix: A boolean of whether the current system is *nix (any Linux). | ||
file_uri_prefix: A string to be used as the default prefix for URIs | ||
which point to local files on the system. | ||
""" | ||
|
||
is_windows: bool = platform.system() == 'Windows' | ||
is_nix: bool = not is_windows | ||
|
||
file_uri_prefix: str = 'file:///' if is_windows else 'file://' |