Support no value keys - #220
Conversation
bae4888 to
a84a013Compareulyssessouza
commented
Jan 14, 2020
Please note that I removed Python 3.4 on |
bbc2
left a comment
There was a problem hiding this comment.
Thank you for this work.
I think it's OK to accept variables without a value but I don't agree with all the changes made in main.py. However, the changes in parser.py look fine.
I'm curious: What functions or classes of this project would Docker-compose use?
Uh oh!
There was an error while loading. Please reload this page.
| key = to_env(k) | ||
| value = to_env(v) | ||
| if key and value: | ||
| os.environ[key] = value |
There was a problem hiding this comment.
This is quite complicated. What about simplifying this to the following?
ifkinos.environandnotoverride:
continueifvisnotNone:
os.environ[to_env(k)] =to_env(v)There was a problem hiding this comment.
Great!
That was me juggling with mypy errors and trying to test everything with None 😄
PTAL
| """ | ||
| ret = os.getenv(name, new_values.get(name, "")) | ||
| return ret | ||
| return ret if ret is not None else name |
There was a problem hiding this comment.
ret can't be None here, so I think the if is not None test shouldn't be added. Also, returning name looks incorrect because "" should be the default value.
It seems that Mypy detects an unrelated issue, but in that case I would suggest adding # type: ignore, if necessary, since it's probably a false positive from Mypy.
There was a problem hiding this comment.
Same mypy juggling here. I'll just ignore
PTAL
Signed-off-by: ulyssessouza <ulyssessouza@gmail.com>
Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
01c197f to
30b0b0fCompare
You are welcome!
The idea is to use |
bbc2
commented
Jan 15, 2020
OK good to know. |
bbc2
left a comment
There was a problem hiding this comment.
Looks good now. Nice rebasing. 👍
ulyssessouza
commented
Jan 16, 2020
@bbc2 Any expectations on a release? For now I'm vendoring from my branch, but I cannot merge into |
ulyssessouza
commented
Jan 16, 2020
Draft PR on |
Add support for variables with no value
Closes: #219