Hello community, here is the log from the commit of package python-python-dotenv for openSUSE:Factory checked in at 2019-07-22 17:20:14 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-python-dotenv (Old) and /work/SRC/openSUSE:Factory/.python-python-dotenv.new.4126 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-python-dotenv" Mon Jul 22 17:20:14 2019 rev:4 rq:717596 version:0.10.3 Changes: -------- --- /work/SRC/openSUSE:Factory/python-python-dotenv/python-python-dotenv.changes 2019-05-27 08:39:27.623045830 +0200 +++ /work/SRC/openSUSE:Factory/.python-python-dotenv.new.4126/python-python-dotenv.changes 2019-07-22 17:20:15.481896644 +0200 @@ -1,0 +2,6 @@ +Mon Jul 22 13:18:03 UTC 2019 - Tomáš Chvátal <tchva...@suse.com> + +- Update to 0.10.3: + * Small cleanups + +------------------------------------------------------------------- Old: ---- python-dotenv-0.10.2.tar.gz New: ---- python-dotenv-0.10.3.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-python-dotenv.spec ++++++ --- /var/tmp/diff_new_pack.6L2VEG/_old 2019-07-22 17:20:16.081896480 +0200 +++ /var/tmp/diff_new_pack.6L2VEG/_new 2019-07-22 17:20:16.085896479 +0200 @@ -18,7 +18,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-python-dotenv -Version: 0.10.2 +Version: 0.10.3 Release: 0 Summary: Python library for .env support License: BSD-3-Clause @@ -49,9 +49,11 @@ %setup -q -n python-dotenv-%{version} %build +export LANG=C.UTF-8 %python_build %install +export LANG=C.UTF-8 %python_install %python_clone -a %{buildroot}%{_bindir}/dotenv %python_expand %fdupes %{buildroot}%{$python_sitelib} ++++++ python-dotenv-0.10.2.tar.gz -> python-dotenv-0.10.3.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-dotenv-0.10.2/.bumpversion.cfg new/python-dotenv-0.10.3/.bumpversion.cfg --- old/python-dotenv-0.10.2/.bumpversion.cfg 2019-05-12 12:53:28.000000000 +0200 +++ new/python-dotenv-0.10.3/.bumpversion.cfg 2019-06-02 19:17:32.000000000 +0200 @@ -1,5 +1,5 @@ [bumpversion] -current_version = 0.10.2 +current_version = 0.10.3 commit = True tag = True diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-dotenv-0.10.2/Makefile new/python-dotenv-0.10.3/Makefile --- old/python-dotenv-0.10.2/Makefile 2019-05-12 12:53:28.000000000 +0200 +++ new/python-dotenv-0.10.3/Makefile 2019-06-02 19:17:32.000000000 +0200 @@ -5,19 +5,22 @@ clean-build: rm -fr build/ rm -fr dist/ - rm -fr *.egg-info + rm -fr src/*.egg-info clean-pyc: find . -name '*.pyc' -exec rm -f {} + find . -name '*.pyo' -exec rm -f {} + find . -name '*~' -exec rm -f {} + -release: clean - python setup.py sdist upload - python setup.py bdist_wheel upload +release: sdist + twine check dist/* + twine upload dist/* + +release-test: sdist + twine upload --repository-url https://test.pypi.org/legacy/ dist/* sdist: clean - python setup.py sdist + python setup.py sdist bdist_wheel ls -l dist test: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-dotenv-0.10.2/README.md new/python-dotenv-0.10.3/README.md --- old/python-dotenv-0.10.2/README.md 2019-05-12 12:53:28.000000000 +0200 +++ new/python-dotenv-0.10.3/README.md 2019-06-02 19:17:32.000000000 +0200 @@ -44,7 +44,7 @@ MULTILINE_VAR="hello\nworld" ``` -You can optionally prefix each line with the word `export`, which is totally ignore by this library, but might allow you to [`source`](https://bash.cyberciti.biz/guide/Source_command) the file in bash. +You can optionally prefix each line with the word `export`, which is totally ignored by this library, but might allow you to [`source`](https://bash.cyberciti.biz/guide/Source_command) the file in bash. ``` export S3_BUCKET=YOURS3BUCKET @@ -299,8 +299,10 @@ Unreleased ----- -- ... - +- Improve interactive mode detection ([@andrewsmith])([#183]). +- Refactor parser to fix parsing inconsistencies ([@bbc2])([#170]). + - Interpret escapes as control characters only in double-quoted strings. + - Interpret `#` as start of comment only if preceded by whitespace. 0.10.2 ----- @@ -428,7 +430,10 @@ [#172]: https://github.com/theskumar/python-dotenv/issues/172 [#121]: https://github.com/theskumar/python-dotenv/issues/121 [#176]: https://github.com/theskumar/python-dotenv/issues/176 +[#170]: https://github.com/theskumar/python-dotenv/issues/170 +[#183]: https://github.com/theskumar/python-dotenv/issues/183 +[@andrewsmith]: https://github.com/andrewsmith [@asyncee]: https://github.com/asyncee [@greyli]: https://github.com/greyli [@venthur]: https://github.com/venthur diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-dotenv-0.10.2/requirements.txt new/python-dotenv-0.10.3/requirements.txt --- old/python-dotenv-0.10.2/requirements.txt 2019-05-12 12:53:28.000000000 +0200 +++ new/python-dotenv-0.10.3/requirements.txt 2019-06-02 19:17:32.000000000 +0200 @@ -3,9 +3,9 @@ click flake8>=2.2.3 ipython -pypandoc pytest-cov pytest>=3.9 sh>=1.09 tox wheel +twine diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-dotenv-0.10.2/setup.cfg new/python-dotenv-0.10.3/setup.cfg --- old/python-dotenv-0.10.2/setup.cfg 2019-05-12 12:53:28.000000000 +0200 +++ new/python-dotenv-0.10.3/setup.cfg 2019-06-02 19:17:32.000000000 +0200 @@ -5,6 +5,9 @@ max-line-length = 120 exclude = .tox,.git,docs,venv,.venv +[mypy] +ignore_missing_imports = true + [metadata] description-file = README.rst diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-dotenv-0.10.2/setup.py new/python-dotenv-0.10.3/setup.py --- old/python-dotenv-0.10.2/setup.py 2019-05-12 12:53:28.000000000 +0200 +++ new/python-dotenv-0.10.3/setup.py 2019-06-02 19:17:32.000000000 +0200 @@ -1,17 +1,8 @@ # -*- coding: utf-8 -*- from setuptools import setup -# https://github.com/theskumar/python-dotenv/issues/45#issuecomment-277135416 -try: - import pypandoc - long_description = pypandoc.convert('README.md', 'rst') - long_description = long_description.replace("\r", "") # YOU NEED THIS LINE -except (OSError, ImportError): - print("Pandoc not found. Long_description conversion failure.") - import io - # pandoc is not installed, fallback to using raw contents - with io.open('README.md', encoding="utf-8") as f: - long_description = f.read() +with open('README.md') as f: + long_description = f.read() meta = {} with open('./src/dotenv/version.py') as f: @@ -21,6 +12,7 @@ name="python-dotenv", description="Add .env support to your django/flask apps in development and deployments", long_description=long_description, + long_description_content_type='text/markdown', version=meta['__version__'], author="Saurabh Kumar", author_email="me+git...@saurabh-kumar.com", @@ -52,20 +44,21 @@ # 'Development Status :: 6 - Mature', # 'Development Status :: 7 - Inactive', 'Programming Language :: Python', - 'Programming Language :: Python :: 2', + # 'Programming Language :: Python :: 2', # 'Programming Language :: Python :: 2.3', # 'Programming Language :: Python :: 2.4', # 'Programming Language :: Python :: 2.5', # 'Programming Language :: Python :: 2.6', 'Programming Language :: Python :: 2.7', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.0', - 'Programming Language :: Python :: 3.1', - 'Programming Language :: Python :: 3.2', - 'Programming Language :: Python :: 3.3', + # 'Programming Language :: Python :: 3', + # 'Programming Language :: Python :: 3.0', + # 'Programming Language :: Python :: 3.1', + # 'Programming Language :: Python :: 3.2', + # 'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: Implementation :: PyPy', 'Intended Audience :: Developers', 'Intended Audience :: System Administrators', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-dotenv-0.10.2/src/dotenv/__init__.py new/python-dotenv-0.10.3/src/dotenv/__init__.py --- old/python-dotenv-0.10.2/src/dotenv/__init__.py 2019-05-12 12:53:28.000000000 +0200 +++ new/python-dotenv-0.10.3/src/dotenv/__init__.py 2019-06-02 19:17:32.000000000 +0200 @@ -1,4 +1,4 @@ -from typing import Any, Optional +from typing import Any, Optional # noqa from .main import load_dotenv, get_key, set_key, unset_key, find_dotenv, dotenv_values diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-dotenv-0.10.2/src/dotenv/cli.py new/python-dotenv-0.10.3/src/dotenv/cli.py --- old/python-dotenv-0.10.2/src/dotenv/cli.py 2019-05-12 12:53:28.000000000 +0200 +++ new/python-dotenv-0.10.3/src/dotenv/cli.py 2019-06-02 19:17:32.000000000 +0200 @@ -1,6 +1,7 @@ import os import sys -from typing import Any, List +from subprocess import Popen +from typing import Any, Dict, List # noqa try: import click @@ -9,7 +10,7 @@ 'Run pip install "python-dotenv[cli]" to fix this.') sys.exit(1) -from .main import dotenv_values, get_key, set_key, unset_key, run_command +from .main import dotenv_values, get_key, set_key, unset_key from .version import __version__ @@ -101,5 +102,40 @@ exit(ret) +def run_command(command, env): + # type: (List[str], Dict[str, str]) -> int + """Run command in sub process. + + Runs the command in a sub process with the variables from `env` + added in the current environment variables. + + Parameters + ---------- + command: List[str] + The command and it's parameters + env: Dict + The additional environment variables + + Returns + ------- + int + The return code of the command + + """ + # copy the current environment variables and add the vales from + # `env` + cmd_env = os.environ.copy() + cmd_env.update(env) + + p = Popen(command, + universal_newlines=True, + bufsize=0, + shell=False, + env=cmd_env) + _, _ = p.communicate() + + return p.returncode + + if __name__ == "__main__": cli() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-dotenv-0.10.2/src/dotenv/compat.py new/python-dotenv-0.10.3/src/dotenv/compat.py --- old/python-dotenv-0.10.2/src/dotenv/compat.py 2019-05-12 12:53:28.000000000 +0200 +++ new/python-dotenv-0.10.3/src/dotenv/compat.py 2019-06-02 19:17:32.000000000 +0200 @@ -1,8 +1,34 @@ import sys +from typing import Text # noqa -if sys.version_info >= (3, 0): - from io import StringIO # noqa -else: +PY2 = sys.version_info[0] == 2 # type: bool + +if PY2: from StringIO import StringIO # noqa +else: + from io import StringIO # noqa -PY2 = sys.version_info[0] == 2 # type: bool + +def to_env(text): + # type: (Text) -> str + """ + Encode a string the same way whether it comes from the environment or a `.env` file. + """ + if PY2: + return text.encode(sys.getfilesystemencoding() or "utf-8") + else: + return text + + +def to_text(string): + # type: (str) -> Text + """ + Make a string Unicode if it isn't already. + + This is useful for defining raw unicode strings because `ur"foo"` isn't valid in + Python 3. + """ + if PY2: + return string.decode("utf-8") + else: + return string diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-dotenv-0.10.2/src/dotenv/main.py new/python-dotenv-0.10.3/src/dotenv/main.py --- old/python-dotenv-0.10.2/src/dotenv/main.py 2019-05-12 12:53:28.000000000 +0200 +++ new/python-dotenv-0.10.3/src/dotenv/main.py 2019-06-02 19:17:32.000000000 +0200 @@ -1,21 +1,20 @@ # -*- coding: utf-8 -*- from __future__ import absolute_import, print_function, unicode_literals -import codecs import io import os import re import shutil import sys -from subprocess import Popen import tempfile -from typing import (Any, Dict, Iterator, List, Match, NamedTuple, Optional, # noqa - Pattern, Union, TYPE_CHECKING, Text, IO, Tuple) # noqa +from typing import (Dict, Iterator, List, Match, Optional, # noqa + Pattern, Union, TYPE_CHECKING, Text, IO, Tuple) import warnings from collections import OrderedDict from contextlib import contextmanager -from .compat import StringIO, PY2 +from .compat import StringIO, PY2, to_env +from .parser import parse_stream if TYPE_CHECKING: # pragma: no cover if sys.version_info >= (3, 6): @@ -30,95 +29,6 @@ __posix_variable = re.compile(r'\$\{[^\}]*\}') # type: Pattern[Text] -_binding = re.compile( - r""" - ( - \s* # leading whitespace - (?:export{0}+)? # export - - ( '[^']+' # single-quoted key - | [^=\#\s]+ # or unquoted key - )? - - (?: - (?:{0}*={0}*) # equal sign - - ( '(?:\\'|[^'])*' # single-quoted value - | "(?:\\"|[^"])*" # or double-quoted value - | [^\#\r\n]* # or unquoted value - ) - )? - - \s* # trailing whitespace - (?:\#[^\r\n]*)? # comment - (?:\r|\n|\r\n)? # newline - ) - """.format(r'[^\S\r\n]'), - re.MULTILINE | re.VERBOSE, -) # type: Pattern[Text] - -_escape_sequence = re.compile(r"\\[\\'\"abfnrtv]") # type: Pattern[Text] - - -Binding = NamedTuple("Binding", [("key", Optional[Text]), - ("value", Optional[Text]), - ("original", Text)]) - - -def decode_escapes(string): - # type: (Text) -> Text - def decode_match(match): - # type: (Match[Text]) -> Text - return codecs.decode(match.group(0), 'unicode-escape') # type: ignore - - return _escape_sequence.sub(decode_match, string) - - -def is_surrounded_by(string, char): - # type: (Text, Text) -> bool - return ( - len(string) > 1 - and string[0] == string[-1] == char - ) - - -def parse_binding(string, position): - # type: (Text, int) -> Tuple[Binding, int] - match = _binding.match(string, position) - assert match is not None - (matched, key, value) = match.groups() - if key is None or value is None: - key = None - value = None - else: - value_quoted = is_surrounded_by(value, "'") or is_surrounded_by(value, '"') - if value_quoted: - value = decode_escapes(value[1:-1]) - else: - value = value.strip() - return (Binding(key=key, value=value, original=matched), match.end()) - - -def parse_stream(stream): - # type:(IO[Text]) -> Iterator[Binding] - string = stream.read() - position = 0 - length = len(string) - while position < length: - (binding, position) = parse_binding(string, position) - yield binding - - -def to_env(text): - # type: (Text) -> str - """ - Encode a string the same way whether it comes from the environment or a `.env` file. - """ - if PY2: - return text.encode(sys.getfilesystemencoding() or "utf-8") - else: - return text - class DotEnv(): @@ -325,8 +235,14 @@ Returns path to the file if found, or an empty string otherwise """ - if usecwd or '__file__' not in globals(): - # should work without __file__, e.g. in REPL or IPython notebook + + def _is_interactive(): + """ Decide whether this is running in a REPL or IPython notebook """ + main = __import__('__main__', None, None, fromlist=['__file__']) + return not hasattr(main, '__file__') + + if usecwd or _is_interactive(): + # Should work without __file__, e.g. in REPL or IPython notebook. path = os.getcwd() else: # will work for .py files @@ -365,38 +281,3 @@ # type: (Union[Text, _PathLike, None], Optional[_StringIO], bool, Union[None, Text]) -> Dict[Text, Text] f = dotenv_path or stream or find_dotenv() return DotEnv(f, verbose=verbose, **kwargs).dict() - - -def run_command(command, env): - # type: (List[str], Dict[str, str]) -> int - """Run command in sub process. - - Runs the command in a sub process with the variables from `env` - added in the current environment variables. - - Parameters - ---------- - command: List[str] - The command and it's parameters - env: Dict - The additional environment variables - - Returns - ------- - int - The return code of the command - - """ - # copy the current environment variables and add the vales from - # `env` - cmd_env = os.environ.copy() - cmd_env.update(env) - - p = Popen(command, - universal_newlines=True, - bufsize=0, - shell=False, - env=cmd_env) - _, _ = p.communicate() - - return p.returncode diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-dotenv-0.10.2/src/dotenv/parser.py new/python-dotenv-0.10.3/src/dotenv/parser.py --- old/python-dotenv-0.10.2/src/dotenv/parser.py 1970-01-01 01:00:00.000000000 +0100 +++ new/python-dotenv-0.10.3/src/dotenv/parser.py 2019-06-02 19:17:32.000000000 +0200 @@ -0,0 +1,147 @@ +import codecs +import re +from typing import (IO, Iterator, Match, NamedTuple, Optional, Pattern, # noqa + Sequence, Text) + +from .compat import to_text + + +def make_regex(string, extra_flags=0): + # type: (str, int) -> Pattern[Text] + return re.compile(to_text(string), re.UNICODE | extra_flags) + + +_whitespace = make_regex(r"\s*", extra_flags=re.MULTILINE) +_export = make_regex(r"(?:export[^\S\r\n]+)?") +_single_quoted_key = make_regex(r"'([^']+)'") +_unquoted_key = make_regex(r"([^=\#\s]+)") +_equal_sign = make_regex(r"[^\S\r\n]*=[^\S\r\n]*") +_single_quoted_value = make_regex(r"'((?:\\'|[^'])*)'") +_double_quoted_value = make_regex(r'"((?:\\"|[^"])*)"') +_unquoted_value_part = make_regex(r"([^ \r\n]*)") +_comment = make_regex(r"(?:\s*#[^\r\n]*)?") +_end_of_line = make_regex(r"[^\S\r\n]*(?:\r\n|\n|\r)?") +_rest_of_line = make_regex(r"[^\r\n]*(?:\r|\n|\r\n)?") +_double_quote_escapes = make_regex(r"\\[\\'\"abfnrtv]") +_single_quote_escapes = make_regex(r"\\[\\']") + +Binding = NamedTuple("Binding", [("key", Optional[Text]), + ("value", Optional[Text]), + ("original", Text)]) + + +class Error(Exception): + pass + + +class Reader: + def __init__(self, stream): + # type: (IO[Text]) -> None + self.string = stream.read() + self.position = 0 + self.mark = 0 + + def has_next(self): + # type: () -> bool + return self.position < len(self.string) + + def set_mark(self): + # type: () -> None + self.mark = self.position + + def get_marked(self): + # type: () -> Text + return self.string[self.mark:self.position] + + def peek(self, count): + # type: (int) -> Text + return self.string[self.position:self.position + count] + + def read(self, count): + # type: (int) -> Text + result = self.string[self.position:self.position + count] + if len(result) < count: + raise Error("read: End of string") + self.position += count + return result + + def read_regex(self, regex): + # type: (Pattern[Text]) -> Sequence[Text] + match = regex.match(self.string, self.position) + if match is None: + raise Error("read_regex: Pattern not found") + self.position = match.end() + return match.groups() + + +def decode_escapes(regex, string): + # type: (Pattern[Text], Text) -> Text + def decode_match(match): + # type: (Match[Text]) -> Text + return codecs.decode(match.group(0), 'unicode-escape') # type: ignore + + return regex.sub(decode_match, string) + + +def parse_key(reader): + # type: (Reader) -> Text + char = reader.peek(1) + if char == "'": + (key,) = reader.read_regex(_single_quoted_key) + else: + (key,) = reader.read_regex(_unquoted_key) + return key + + +def parse_unquoted_value(reader): + # type: (Reader) -> Text + value = u"" + while True: + (part,) = reader.read_regex(_unquoted_value_part) + value += part + after = reader.peek(2) + if len(after) < 2 or after[0] in u"\r\n" or after[1] in u" #\r\n": + return value + value += reader.read(2) + + +def parse_value(reader): + # type: (Reader) -> Text + char = reader.peek(1) + if char == u"'": + (value,) = reader.read_regex(_single_quoted_value) + return decode_escapes(_single_quote_escapes, value) + elif char == u'"': + (value,) = reader.read_regex(_double_quoted_value) + return decode_escapes(_double_quote_escapes, value) + elif char in (u"", u"\n", u"\r"): + return u"" + else: + return parse_unquoted_value(reader) + + +def parse_binding(reader): + # type: (Reader) -> Binding + reader.set_mark() + try: + reader.read_regex(_whitespace) + reader.read_regex(_export) + key = parse_key(reader) + reader.read_regex(_equal_sign) + value = parse_value(reader) + reader.read_regex(_comment) + reader.read_regex(_end_of_line) + return Binding(key=key, value=value, original=reader.get_marked()) + except Error: + reader.read_regex(_rest_of_line) + return Binding(key=None, value=None, original=reader.get_marked()) + + +def parse_stream(stream): + # type:(IO[Text]) -> Iterator[Binding] + reader = Reader(stream) + while reader.has_next(): + try: + yield parse_binding(reader) + except Error: + return diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-dotenv-0.10.2/src/dotenv/version.py new/python-dotenv-0.10.3/src/dotenv/version.py --- old/python-dotenv-0.10.2/src/dotenv/version.py 2019-05-12 12:53:28.000000000 +0200 +++ new/python-dotenv-0.10.3/src/dotenv/version.py 2019-06-02 19:17:32.000000000 +0200 @@ -1 +1 @@ -__version__ = "0.10.2" +__version__ = "0.10.3" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-dotenv-0.10.2/tests/test_core.py new/python-dotenv-0.10.3/tests/test_core.py --- old/python-dotenv-0.10.2/tests/test_core.py 2019-05-12 12:53:28.000000000 +0200 +++ new/python-dotenv-0.10.3/tests/test_core.py 2019-06-02 19:17:32.000000000 +0200 @@ -13,7 +13,6 @@ from dotenv import dotenv_values, find_dotenv, load_dotenv, set_key from dotenv.compat import PY2, StringIO -from dotenv.main import Binding, parse_stream @contextlib.contextmanager @@ -26,81 +25,6 @@ os.environ.update(environ) -@pytest.mark.parametrize("test_input,expected", [ - ("", []), - ("a=b", [Binding(key="a", value="b", original="a=b")]), - ("'a'=b", [Binding(key="'a'", value="b", original="'a'=b")]), - ("[=b", [Binding(key="[", value="b", original="[=b")]), - (" a = b ", [Binding(key="a", value="b", original=" a = b ")]), - ("export a=b", [Binding(key="a", value="b", original="export a=b")]), - (" export 'a'=b", [Binding(key="'a'", value="b", original=" export 'a'=b")]), - (" export 'a'=b", [Binding(key="'a'", value="b", original=" export 'a'=b")]), - ("# a=b", [Binding(key=None, value=None, original="# a=b")]), - ('a=b # comment', [Binding(key="a", value="b", original="a=b # comment")]), - ("a=b space ", [Binding(key="a", value="b space", original="a=b space ")]), - ("a='b space '", [Binding(key="a", value="b space ", original="a='b space '")]), - ('a="b space "', [Binding(key="a", value="b space ", original='a="b space "')]), - ("export export_a=1", [Binding(key="export_a", value="1", original="export export_a=1")]), - ("export port=8000", [Binding(key="port", value="8000", original="export port=8000")]), - ('a="b\nc"', [Binding(key="a", value="b\nc", original='a="b\nc"')]), - ("a='b\nc'", [Binding(key="a", value="b\nc", original="a='b\nc'")]), - ('a="b\nc"', [Binding(key="a", value="b\nc", original='a="b\nc"')]), - ('a="b\\nc"', [Binding(key="a", value='b\nc', original='a="b\\nc"')]), - ('a="b\\"c"', [Binding(key="a", value='b"c', original='a="b\\"c"')]), - ("a='b\\'c'", [Binding(key="a", value="b'c", original="a='b\\'c'")]), - ("a=à", [Binding(key="a", value="à", original="a=à")]), - ('a="à"', [Binding(key="a", value="à", original='a="à"')]), - ('garbage', [Binding(key=None, value=None, original="garbage")]), - ( - "a=b\nc=d", - [ - Binding(key="a", value="b", original="a=b\n"), - Binding(key="c", value="d", original="c=d"), - ], - ), - ( - "a=b\r\nc=d", - [ - Binding(key="a", value="b", original="a=b\r\n"), - Binding(key="c", value="d", original="c=d"), - ], - ), - ( - 'a=\nb=c', - [ - Binding(key="a", value='', original='a=\n'), - Binding(key="b", value='c', original="b=c"), - ] - ), - ( - 'a="\nb=c', - [ - Binding(key="a", value='"', original='a="\n'), - Binding(key="b", value='c', original="b=c"), - ] - ), - ( - '# comment\na="b\nc"\nd=e\n', - [ - Binding(key=None, value=None, original="# comment\n"), - Binding(key="a", value="b\nc", original='a="b\nc"\n'), - Binding(key="d", value="e", original="d=e\n"), - ], - ), - ( - 'garbage[%$#\na=b', - [ - Binding(key=None, value=None, original="garbage[%$#\n"), - Binding(key="a", value="b", original='a=b'), - ], - ), -]) -def test_parse_stream(test_input, expected): - result = parse_stream(StringIO(test_input)) - - assert list(result) == expected - - def test_warns_if_file_does_not_exist(): with warnings.catch_warnings(record=True) as w: load_dotenv('.does_not_exist', verbose=True) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-dotenv-0.10.2/tests/test_parser.py new/python-dotenv-0.10.3/tests/test_parser.py --- old/python-dotenv-0.10.2/tests/test_parser.py 1970-01-01 01:00:00.000000000 +0100 +++ new/python-dotenv-0.10.3/tests/test_parser.py 2019-06-02 19:17:32.000000000 +0200 @@ -0,0 +1,88 @@ +# -*- coding: utf-8 -*- +import pytest + +from dotenv.compat import StringIO +from dotenv.parser import Binding, parse_stream + + +@pytest.mark.parametrize("test_input,expected", [ + (u"", []), + (u"a=b", [Binding(key=u"a", value=u"b", original=u"a=b")]), + (u"'a'=b", [Binding(key=u"a", value=u"b", original=u"'a'=b")]), + (u"[=b", [Binding(key=u"[", value=u"b", original=u"[=b")]), + (u" a = b ", [Binding(key=u"a", value=u"b", original=u" a = b ")]), + (u"export a=b", [Binding(key=u"a", value=u"b", original=u"export a=b")]), + (u" export 'a'=b", [Binding(key=u"a", value=u"b", original=u" export 'a'=b")]), + (u"# a=b", [Binding(key=None, value=None, original=u"# a=b")]), + (u"a=b#c", [Binding(key=u"a", value=u"b#c", original=u"a=b#c")]), + (u'a=b # comment', [Binding(key=u"a", value=u"b", original=u"a=b # comment")]), + (u"a=b space ", [Binding(key=u"a", value=u"b space", original=u"a=b space ")]), + (u"a='b space '", [Binding(key=u"a", value=u"b space ", original=u"a='b space '")]), + (u'a="b space "', [Binding(key=u"a", value=u"b space ", original=u'a="b space "')]), + (u"export export_a=1", [Binding(key=u"export_a", value=u"1", original=u"export export_a=1")]), + (u"export port=8000", [Binding(key=u"port", value=u"8000", original=u"export port=8000")]), + (u'a="b\nc"', [Binding(key=u"a", value=u"b\nc", original=u'a="b\nc"')]), + (u"a='b\nc'", [Binding(key=u"a", value=u"b\nc", original=u"a='b\nc'")]), + (u'a="b\nc"', [Binding(key=u"a", value=u"b\nc", original=u'a="b\nc"')]), + (u'a="b\\nc"', [Binding(key=u"a", value=u'b\nc', original=u'a="b\\nc"')]), + (u"a='b\\nc'", [Binding(key=u"a", value=u'b\\nc', original=u"a='b\\nc'")]), + (u'a="b\\"c"', [Binding(key=u"a", value=u'b"c', original=u'a="b\\"c"')]), + (u"a='b\\'c'", [Binding(key=u"a", value=u"b'c", original=u"a='b\\'c'")]), + (u"a=à", [Binding(key=u"a", value=u"à", original=u"a=à")]), + (u'a="à"', [Binding(key=u"a", value=u"à", original=u'a="à"')]), + (u'garbage', [Binding(key=None, value=None, original=u"garbage")]), + ( + u"a=b\nc=d", + [ + Binding(key=u"a", value=u"b", original=u"a=b\n"), + Binding(key=u"c", value=u"d", original=u"c=d"), + ], + ), + ( + u"a=b\r\nc=d", + [ + Binding(key=u"a", value=u"b", original=u"a=b\r\n"), + Binding(key=u"c", value=u"d", original=u"c=d"), + ], + ), + ( + u'a=\nb=c', + [ + Binding(key=u"a", value=u'', original=u'a=\n'), + Binding(key=u"b", value=u'c', original=u"b=c"), + ] + ), + ( + u'a=b\n\nc=d', + [ + Binding(key=u"a", value=u"b", original=u"a=b\n"), + Binding(key=u"c", value=u"d", original=u"\nc=d"), + ] + ), + ( + u'a="\nb=c', + [ + Binding(key=None, value=None, original=u'a="\n'), + Binding(key=u"b", value=u"c", original=u"b=c"), + ] + ), + ( + u'# comment\na="b\nc"\nd=e\n', + [ + Binding(key=None, value=None, original=u"# comment\n"), + Binding(key=u"a", value=u"b\nc", original=u'a="b\nc"\n'), + Binding(key=u"d", value=u"e", original=u"d=e\n"), + ], + ), + ( + u'garbage[%$#\na=b', + [ + Binding(key=None, value=None, original=u"garbage[%$#\n"), + Binding(key=u"a", value=u"b", original=u'a=b'), + ], + ), +]) +def test_parse_stream(test_input, expected): + result = parse_stream(StringIO(test_input)) + + assert list(result) == expected diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-dotenv-0.10.2/tox.ini new/python-dotenv-0.10.3/tox.ini --- old/python-dotenv-0.10.2/tox.ini 2019-05-12 12:53:28.000000000 +0200 +++ new/python-dotenv-0.10.3/tox.ini 2019-06-02 19:17:32.000000000 +0200 @@ -19,11 +19,11 @@ mypy commands = flake8 src tests - mypy --python-version=3.7 src - mypy --python-version=3.6 src - mypy --python-version=3.5 src - mypy --python-version=3.4 src - mypy --python-version=2.7 src + mypy --python-version=3.7 src tests + mypy --python-version=3.6 src tests + mypy --python-version=3.5 src tests + mypy --python-version=3.4 src tests + mypy --python-version=2.7 src tests [testenv:manifest] deps = check-manifest