Skip to content

Commit

Permalink
Remove subcast_key
Browse files Browse the repository at this point in the history
  • Loading branch information
sloria committed Jan 19, 2024
1 parent 3e4111e commit 9f0b20e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 12 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

Other changes:

- Remove `subcast_key` argument of `env.dict`. Use `subcast_keys` instead.
- _Backwards-incompatible_: Remove `environs.__version__` variable.
Use `importlib.metadata.version("environs")` instead.

Expand Down
13 changes: 1 addition & 12 deletions src/environs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import os
import re
import typing
import warnings
from collections.abc import Mapping
from enum import Enum
from pathlib import Path
Expand Down Expand Up @@ -233,23 +232,13 @@ def _preprocess_dict(
value: typing.Union[str, typing.Mapping],
*,
subcast_keys: typing.Optional[Subcast] = None,
subcast_key: typing.Optional[Subcast] = None, # Deprecated
subcast_values: typing.Optional[Subcast] = None,
delimiter: str = ",",
**kwargs,
) -> typing.Mapping:
if isinstance(value, Mapping):
return value

if subcast_key:
warnings.warn(
"`subcast_key` is deprecated. Use `subcast_keys` instead.",
DeprecationWarning,
stacklevel=2,
)
subcast_keys_instance: ma.fields.Field = _make_subcast_field(
subcast_keys or subcast_key
)(**kwargs)
subcast_keys_instance: ma.fields.Field = _make_subcast_field(subcast_keys)(**kwargs)
subcast_values_instance: ma.fields.Field = _make_subcast_field(subcast_values)(
**kwargs
)
Expand Down

0 comments on commit 9f0b20e

Please sign in to comment.