-
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.
- Loading branch information
1 parent
5979118
commit d92ab85
Showing
14 changed files
with
124 additions
and
124 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 |
---|---|---|
|
@@ -3,4 +3,4 @@ | |
__pycache__ | ||
coverage.xml | ||
.coverage | ||
envipy.egg-info/* | ||
enviparse.egg-info/* |
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
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 @@ | ||
from .enviparse import Enviparse |
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,27 +1,27 @@ | ||
class EnvipyError(Exception): | ||
class EnviparseError(Exception): | ||
pass | ||
|
||
|
||
class UnexpectedTypeError(EnvipyError): | ||
class UnexpectedTypeError(EnviparseError): | ||
def __init__(self, used_type: str, path: str): | ||
super().__init__(f'Unsupported type "{used_type}" for property at path "{path}"') | ||
|
||
|
||
class UnknownTypeError(EnvipyError): | ||
class UnknownTypeError(EnviparseError): | ||
def __init__(self, path: str): | ||
super().__init__(f'Unknown generic type for property at path "{path}"') | ||
|
||
|
||
class MissingEnvironmentVariableError(EnvipyError): | ||
class MissingEnvironmentVariableError(EnviparseError): | ||
def __init__(self, env_var_name: str): | ||
super().__init__(f"Environment variable '{env_var_name}' is not set.") | ||
|
||
|
||
class NestedMissingEnvironmentVariableError(EnvipyError): | ||
class NestedMissingEnvironmentVariableError(EnviparseError): | ||
def __init__(self, env_var_name: str): | ||
super().__init__(f"Environment variable '{env_var_name}' is not set.") | ||
|
||
|
||
class CastError(EnvipyError): | ||
class CastError(EnviparseError): | ||
def __init__(self, env_var_name: str, data_type: str): | ||
super().__init__(f"Failed to convert '{env_var_name}' to {data_type}.") |
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,16 @@ | ||
from typing import Type, Optional | ||
|
||
from opyoid import Provider | ||
|
||
from .enviparse import ClassTypeT, Enviparse | ||
|
||
|
||
def enviparse_provider(prefix: str, config_type: Type[ClassTypeT]) -> Type[Provider[ClassTypeT]]: | ||
class EnviparseProvider(Provider[ClassTypeT]): | ||
def __init__(self, enviparse: Optional[Enviparse] = None): | ||
self._parser = enviparse or Enviparse() | ||
|
||
def get(self) -> ClassTypeT: | ||
return self._parser.parse(prefix, config_type) | ||
|
||
return EnviparseProvider |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,7 +1,7 @@ | ||
[project] | ||
name = "envipy" | ||
name = "enviparse" | ||
dynamic = ["version"] | ||
description = "envipy help you manage your application properties using environment variabl" | ||
description = "enviparse help you manage your application properties using environment variabl" | ||
authors = [ | ||
{name = "Illuin technology", email = "[email protected]"}, | ||
] | ||
|
Oops, something went wrong.