"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "poetry/config/dict_config_source.py" between
poetry-1.1.15.tar.gz and poetry-1.2.0.tar.gz

About: Poetry is a tool for dependency management and packaging in Python.

dict_config_source.py  (poetry-1.1.15):dict_config_source.py  (poetry-1.2.0)
from __future__ import annotations
from typing import Any from typing import Any
from typing import Dict
from .config_source import ConfigSource from poetry.config.config_source import ConfigSource
class DictConfigSource(ConfigSource): class DictConfigSource(ConfigSource):
def __init__(self): # type: () -> None def __init__(self) -> None:
self._config = {} self._config: dict[str, Any] = {}
@property @property
def config(self): # type: () -> Dict[str, Any] def config(self) -> dict[str, Any]:
return self._config return self._config
def add_property(self, key, value): # type: (str, Any) -> None def add_property(self, key: str, value: Any) -> None:
keys = key.split(".") keys = key.split(".")
config = self._config config = self._config
for i, key in enumerate(keys): for i, key in enumerate(keys):
if key not in config and i < len(keys) - 1: if key not in config and i < len(keys) - 1:
config[key] = {} config[key] = {}
if i == len(keys) - 1: if i == len(keys) - 1:
config[key] = value config[key] = value
break break
config = config[key] config = config[key]
def remove_property(self, key): # type: (str) -> None def remove_property(self, key: str) -> None:
keys = key.split(".") keys = key.split(".")
config = self._config config = self._config
for i, key in enumerate(keys): for i, key in enumerate(keys):
if key not in config: if key not in config:
return return
if i == len(keys) - 1: if i == len(keys) - 1:
del config[key] del config[key]
 End of changes. 7 change blocks. 
7 lines changed or deleted 8 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)