You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

envier

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

envier - pypi Package Compare versions

Comparing version
0.5.1
to
0.5.2
+2
-2
envier/_version.py

@@ -15,3 +15,3 @@ # file generated by setuptools_scm

__version__ = version = '0.5.1'
__version_tuple__ = version_tuple = (0, 5, 1)
__version__ = version = '0.5.2'
__version_tuple__ = version_tuple = (0, 5, 2)

@@ -70,2 +70,31 @@ import os

def _cast(self, _type: t.Any, raw: str, env: "Env") -> t.Any:
if _type is bool:
return t.cast(T, raw.lower() in env.__truthy__)
elif _type in (list, tuple, set):
collection = raw.split(env.__item_separator__)
return t.cast(
T,
_type( # type: ignore[operator]
collection if self.map is None else map(self.map, collection) # type: ignore[arg-type]
),
)
elif _type is dict:
d = dict(
_.split(env.__value_separator__, 1)
for _ in raw.split(env.__item_separator__)
)
if self.map is not None:
d = dict(self.map(*_) for _ in d.items())
return t.cast(T, d)
if _check_type(raw, _type):
return t.cast(T, raw)
try:
return _type(raw)
except Exception as e:
msg = f"cannot cast {raw} to {self.type}"
raise TypeError(msg) from e
def _retrieve(self, env: "Env", prefix: str) -> T:

@@ -125,32 +154,10 @@ source = env.source

if self.type is bool:
return t.cast(T, raw.lower() in env.__truthy__)
elif self.type in (list, tuple, set):
collection = raw.split(env.__item_separator__)
return t.cast(
T,
self.type( # type: ignore[operator]
collection if self.map is None else map(self.map, collection) # type: ignore[arg-type]
),
)
elif self.type is dict:
d = dict(
_.split(env.__value_separator__, 1)
for _ in raw.split(env.__item_separator__)
)
if self.map is not None:
d = dict(self.map(*_) for _ in d.items())
return t.cast(T, d)
if _check_type(raw, self.type):
return t.cast(T, raw)
if hasattr(self.type, "__origin__") and self.type.__origin__ is t.Union: # type: ignore[attr-defined,union-attr]
for ot in self.type.__args__: # type: ignore[attr-defined,union-attr]
try:
return t.cast(T, ot(raw))
return t.cast(T, self._cast(ot, raw, env))
except TypeError:
pass
return self.type(raw) # type: ignore[call-arg,operator]
return self._cast(self.type, raw, env)

@@ -441,5 +448,7 @@ def __call__(self, env: "Env", prefix: str) -> T:

help_type, # type: ignore[attr-defined]
v.help_default
if v.help_default is not None
else str(v.default),
(
v.help_default
if v.help_default is not None
else str(v.default)
),
help_message,

@@ -446,0 +455,0 @@ )

@@ -1,4 +0,4 @@

Metadata-Version: 2.1
Metadata-Version: 2.3
Name: envier
Version: 0.5.1
Version: 0.5.2
Summary: Python application configuration via the environment

@@ -5,0 +5,0 @@ Project-URL: Homepage, https://github.com/DataDog/envier