From 5e4f3713fc1405b56186685b2a085faa56184f76 Mon Sep 17 00:00:00 2001 From: INADA Naoki Date: Thu, 18 Jan 2018 16:59:17 +0900 Subject: [PATCH] Remove dotenv.ipython Fixes #1321 Ref: https://github.com/theskumar/python-dotenv/pull/84 --- pipenv/patched/dotenv/__init__.py | 6 +---- pipenv/patched/dotenv/ipython.py | 40 ------------------------------- 2 files changed, 1 insertion(+), 45 deletions(-) delete mode 100644 pipenv/patched/dotenv/ipython.py diff --git a/pipenv/patched/dotenv/__init__.py b/pipenv/patched/dotenv/__init__.py index fa06a0bdb7..cbe5930c21 100644 --- a/pipenv/patched/dotenv/__init__.py +++ b/pipenv/patched/dotenv/__init__.py @@ -1,8 +1,4 @@ from .cli import get_cli_string from .main import load_dotenv, get_key, set_key, unset_key, find_dotenv -try: - from .ipython import load_ipython_extension -except ImportError: - pass -__all__ = ['get_cli_string', 'load_dotenv', 'get_key', 'set_key', 'unset_key', 'find_dotenv', 'load_ipython_extension'] +__all__ = ['get_cli_string', 'load_dotenv', 'get_key', 'set_key', 'unset_key', 'find_dotenv'] diff --git a/pipenv/patched/dotenv/ipython.py b/pipenv/patched/dotenv/ipython.py deleted file mode 100644 index 7d84ac2037..0000000000 --- a/pipenv/patched/dotenv/ipython.py +++ /dev/null @@ -1,40 +0,0 @@ -from __future__ import print_function -from .main import load_dotenv, find_dotenv - -from IPython.core.magic import Magics, magics_class, line_magic -from IPython.core.magic_arguments import (argument, magic_arguments, - parse_argstring) - - -@magics_class -class IPythonDotEnv(Magics): - - @magic_arguments() - @argument( - '-o', '--override', action='store_true', - help="Indicate to override existing variables" - ) - @argument( - '-v', '--verbose', action='store_true', - help="Indicate function calls to be verbose" - ) - @argument('dotenv_path', nargs='?', type=str, default='.env', - help='Search in increasingly higher folders for the `dotenv_path`') - @line_magic - def dotenv(self, line): - args = parse_argstring(self.dotenv, line) - # Locate the .env file - dotenv_path = args.dotenv_path - try: - dotenv_path = find_dotenv(dotenv_path, True, True) - except IOError: - print("cannot find .env file") - return - - # Load the .env file - load_dotenv(dotenv_path, verbose=args.verbose, override=args.override) - - -def load_ipython_extension(ipython): - """Register the %dotenv magic.""" - ipython.register_magics(IPythonDotEnv)