anon-iclr-submission/benchname-bug-localization huggingface dataset:
Repository: pypa/pipenv
Issue: pipenv update --outdated crash on empty requirements

Not the most critical bug but:

```bash
$ pipenv install
(...)
```
```bash
$ pipenv update --outdated
Traceback (most recent call last):
  File "/usr/bin/pipenv", line 11, in <module>
    sys.exit(cli())
  File "/usr/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/pipenv/vendor/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/usr/lib/python3.6/site-packages/pipenv/cli.py", line 340, in update
    core.do_outdated()
  File "/usr/lib/python3.6/site-packages/pipenv/core.py", line 1705, in do_outdated
    packages.update(convert_deps_from_pip(result))
  File "/usr/lib/python3.6/site-packages/pipenv/utils.py", line 481, in convert_deps_from_pip
    req = get_requirement(dep)
  File "/usr/lib/python3.6/site-packages/pipenv/utils.py", line 128, in get_requirement
    req = [r for r in requirements.parse(dep)][0]
IndexError: list index out of range
```



Changed files:
pipenv/core.py

diff --git a/pipenv/core.py b/pipenv/core.py
index 9886ede2..16e947f5 100644
--- a/pipenv/core.py
+++ b/pipenv/core.py
@@ -1701,6 +1701,7 @@ def do_py(system=False):
 def do_outdated():
     packages = {}
     results = delegator.run('{0} freeze'.format(which('pip'))).out.strip().split('\\n')
+    results = filter(bool, results)
     for result in results:
         packages.update(convert_deps_from_pip(result))
Repository: pypa/pipenv
Issue: `TypeError: can only concatenate str (not "type") to str` instead of actual error

### Issue description

In some cases, `pipenv` outputs `TypeError: can only concatenate str (not "type") to str` instead of the actual error (or after printing out the actual error). It faces an error while handling the actual error.

### Steps to replicate

Set WORKON_HOME to somewhere that current user doesn't have permission for writing to. Example:

`WORKON_HOME=/opt/  pipenv install`

-------------------------------------------------------------------------------
I encountered the issue on the latest source code from the Github.

Changed files:
pipenv/vendor/delegator.py

diff --git a/pipenv/vendor/delegator.py b/pipenv/vendor/delegator.py
index cf6f91c8..367f52b0 100644
--- a/pipenv/vendor/delegator.py
+++ b/pipenv/vendor/delegator.py
@@ -112,7 +112,7 @@ class Command(object):
         if self.subprocess.before:
             result += self.subprocess.before
 
-        if self.subprocess.after and self.subprocess.after is not pexpect.EOF:
+        if self.subprocess.after and self.subprocess.after not in (pexpect.EOF, pexpect.TIMEOUT):
             try:
                 result += self.subprocess.after
             except (pexpect.EOF, pexpect.TIMEOUT):
Repository: pypa/pipenv
Issue: UnboundLocalError in install against master

```
λ pipenv.exe install --three
Traceback (most recent call last):
  File "C:\\Users\\uranusjr\\AppData\\Local\\Programs\\Python\\Python36\\Lib\\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\\Users\\uranusjr\\AppData\\Local\\Programs\\Python\\Python36\\Lib\\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\\Users\\uranusjr\\.local\\bin\\pipenv.exe\\__main__.py", line 9, in <module>
  File "c:\\users\\uranusjr\\documents\\programming\\pipenv\\pipenv\\vendor\\click\\core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "c:\\users\\uranusjr\\documents\\programming\\pipenv\\pipenv\\vendor\\click\\core.py", line 697, in main
    rv = self.invoke(ctx)
  File "c:\\users\\uranusjr\\documents\\programming\\pipenv\\pipenv\\vendor\\click\\core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "c:\\users\\uranusjr\\documents\\programming\\pipenv\\pipenv\\vendor\\click\\core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "c:\\users\\uranusjr\\documents\\programming\\pipenv\\pipenv\\vendor\\click\\core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "c:\\users\\uranusjr\\documents\\programming\\pipenv\\pipenv\\cli.py", line 416, in install
    selective_upgrade=selective_upgrade,
  File "c:\\users\\uranusjr\\documents\\programming\\pipenv\\pipenv\\core.py", line 1777, in do_install
    skip_requirements=skip_requirements,
UnboundLocalError: local variable 'skip_requirements' referenced before assignment
```

I believe this is introduced fairly recently. Investigating.

Changed files:
pipenv/core.py

diff --git a/pipenv/core.py b/pipenv/core.py
index ba31c344..69818c3f 100644
--- a/pipenv/core.py
+++ b/pipenv/core.py
@@ -1766,6 +1766,8 @@ def do_install(
     # Don't search for requirements.txt files if the user provides one
     if requirements or package_name or project.pipfile_exists:
         skip_requirements = True
+    else:
+        skip_requirements = False
     concurrent = (not sequential)
     # Ensure that virtualenv is available.
     ensure_project(
Repository: pypa/pipenv
Issue: Non-pipenv created virtualenvs don't create proper names registry

Handle errors attempting to read proper names registry / ensure registry existence first

Changed files:
pipenv/project.py

diff --git a/pipenv/project.py b/pipenv/project.py
index 3465f3c1..0a9e04be 100644
--- a/pipenv/project.py
+++ b/pipenv/project.py
@@ -111,7 +111,7 @@ class Project(object):
         self._name = None
         self._virtualenv_location = None
         self._download_location = None
-        self._proper_names_location = None
+        self._proper_names_db_path = None
         self._pipfile_location = None
         self._pipfile_newlines = DEFAULT_NEWLINES
         self._lockfile_newlines = DEFAULT_NEWLINES
@@ -346,24 +346,23 @@ class Project(object):
         return self._download_location
 
     @property
-    def proper_names_location(self):
-        if self._proper_names_location is None:
-            loc = os.sep.join(
-                [self.virtualenv_location, 'pipenv-proper-names.txt']
+    def proper_names_db_path(self):
+        if self._proper_names_db_path is None:
+            self._proper_names_db_path = Path(
+                self.virtualenv_location,
+                'pipenv-proper-names.txt',
             )
-            self._proper_names_location = loc
-        # Create the database, if it doesn't exist.
-        open(self._proper_names_location, 'a').close()
-        return self._proper_names_location
+        self._proper_names_db_path.touch()  # Ensure the file exists.
+        return self._proper_names_db_path
 
     @property
     def proper_names(self):
-        with open(self.proper_names_location) as f:
+        with self.proper_names_db_path.open() as f:
             return f.read().splitlines()
 
     def register_proper_name(self, name):
         """Registers a proper name to the database."""
-        with open(self.proper_names_location, 'a') as f:
+        with self.proper_names_db_path.open('a') as f:
             f.write('{0}\\n'.format(name))
 
     @property
Repository: pypa/pipenv
Issue: pipenv --clear is not compatible with pip 9

Be sure to check the existing issues (both open and closed!).

------------

##### Issue description

`do_clean` imports `pip._internal`, available only in 10+.

##### Expected result

Cleans the caches.

##### Actual result

```
$ pipenv --clear
Clearing caches…
Traceback (most recent call last):
  File "/Users/uranusjr/.local/bin/pipenv", line 11, in <module>
    load_entry_point('pipenv', 'console_scripts', 'pipenv')()
  File "/Users/uranusjr/Documents/programming/python/pipenv/pipenv/pipenv/vendor/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/Users/uranusjr/Documents/programming/python/pipenv/pipenv/pipenv/vendor/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/Users/uranusjr/Documents/programming/python/pipenv/pipenv/pipenv/vendor/click/core.py", line 1043, in invoke
    return Command.invoke(self, ctx)
  File "/Users/uranusjr/Documents/programming/python/pipenv/pipenv/pipenv/vendor/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/uranusjr/Documents/programming/python/pipenv/pipenv/pipenv/vendor/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/Users/uranusjr/Documents/programming/python/pipenv/pipenv/pipenv/vendor/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/Users/uranusjr/Documents/programming/python/pipenv/pipenv/pipenv/cli.py", line 225, in cli
    do_clear()
  File "/Users/uranusjr/Documents/programming/python/pipenv/pipenv/pipenv/core.py", line 132, in do_clear
    import pip._internal.locations
ModuleNotFoundError: No module named 'pip._internal'
```


Changed files:
pipenv/core.py

diff --git a/pipenv/core.py b/pipenv/core.py
index 361942e0..8c21468c 100644
--- a/pipenv/core.py
+++ b/pipenv/core.py
@@ -129,13 +129,20 @@ project = Project(which=which)
 
 def do_clear():
     click.echo(crayons.white("Clearing caches…", bold=True))
-    import pip._internal.locations
+    try:
+        from pip._internal import locations
+    except ImportError:     # pip 9.
+        from pip import locations
 
     try:
         shutil.rmtree(PIPENV_CACHE_DIR)
-        shutil.rmtree(pip._internal.locations.USER_CACHE_DIR)
-    except FileNotFoundError:
-        pass
+        shutil.rmtree(locations.USER_CACHE_DIR)
+    except OSError as e:
+        # Ignore FileNotFoundError. This is needed for Python 2.7.
+        import errno
+        if e.errno == errno.ENOENT:
+            pass
+        raise
 
 
 def load_dot_env():
Repository: pypa/pipenv
Issue: ModuleNotFoundError when running installed packages

I am seeing this issue with lots of packages that have a command-line entry point (at least `pytest` and `honcho`):

```
$ pipenv --version
pipenv, version 3.2.0

$ pipenv install honcho
Installing honcho...
Collecting honcho
  Using cached honcho-0.7.1-py2.py3-none-any.whl
Installing collected packages: honcho
Successfully installed honcho-0.7.1

Adding honcho to Pipfile's [packages]...

$ pipenv run honcho
Traceback (most recent call last):
  File "<root>/.venv/bin/honcho", line 7, in <module>
    from honcho.command import main
ModuleNotFoundError: No module named 'honcho'
```

Changed files:
pipenv/cli.py

diff --git a/pipenv/cli.py b/pipenv/cli.py
index 3bf3ac09..b6723a84 100644
--- a/pipenv/cli.py
+++ b/pipenv/cli.py
@@ -440,6 +440,8 @@ def do_init(dev=False, requirements=False, skip_virtualenv=False, allow_global=F
 
 
 def pip_install(package_name=None, r=None, allow_global=False):
+    # Prevent invalid shebangs with Homebrew-installed Python: https://bugs.python.org/issue22490
+    os.environ.pop('__PYVENV_LAUNCHER__', None)
     if r:
         c = delegator.run('{0} install -r {1} --require-hashes -i {2}'.format(which_pip(allow_global=allow_global), r, project.source['url']))
     else:
Repository: pypa/pipenv
Issue: Pipfile syntax invalid when installing editable requirements with extras_require flag.

For given command:
```bash
pipenv install  "git+https://github.com/requests/requests.git@master#egg=requests[security]"
```
that executes successfully, the produced Pipfile is unfortunately not valid.

```toml
[[source]]
url = "https://pypi.python.org/simple"
verify_ssl = true

[packages."requests[security]"]
git = "https://github.com/requests/requests.git"
ref = "master"
```

Changed files:
pipenv/utils.py, tests/test_utils.py

diff --git a/pipenv/utils.py b/pipenv/utils.py
index d2828e69..f6b7ed24 100644
--- a/pipenv/utils.py
+++ b/pipenv/utils.py
@@ -162,8 +162,11 @@ def convert_deps_from_pip(dep):
                              'dependencies. Please install remote dependency '
                              'in the form {0}#egg=<package-name>.'.format(req.uri))
 
+        # Extras: e.g. #egg=requests[security]
+        if req.extras:
+            dependency[req.name] = {'extras': req.extras}
         # Crop off the git+, etc part.
-        dependency[req.name] = {req.vcs: req.uri[len(req.vcs) + 1:]}
+        dependency.setdefault(req.name, {}).update({req.vcs: req.uri[len(req.vcs) + 1:]})
 
         # Add --editable, if it's there.
         if req.editable:
diff --git a/tests/test_utils.py b/tests/test_utils.py
index 49e0a021..29d26e5d 100644
--- a/tests/test_utils.py
+++ b/tests/test_utils.py
@@ -103,6 +103,13 @@ class TestUtils:
         dep = pipenv.utils.convert_deps_from_pip(dep)
         assert dep == {'MyProject': {'hg': 'http://hg.myproject.org/MyProject', 'ref': 'da39a3ee5e6b'}}
 
+        # vcs dependency with extras_require
+        dep = 'git+https://github.com/requests/requests.git@master#egg=requests[security]'
+        dep = pipenv.utils.convert_deps_from_pip(dep)
+        assert dep == {'requests': {'git': 'https://github.com/requests/requests.git',
+                                    'ref': 'master',
+                                    'extras': ['security']}}
+
         # vcs dependency without #egg
         dep = 'git+https://github.com/kennethreitz/requests.git'
         with pytest.raises(ValueError) as e:
Repository: pypa/pipenv
Issue: Pipenv produces traceback error on running "pipenv shell" after new install

On Elementary OS 0.4.1, under a fresh install of pip (9.0.1) from the Ubuntu repository, running "pipenv shell" in an empty folder produced this:
```
kim@kimberly-whom-death-forgot:~$ pipenv shell
Traceback (most recent call last):
  File "/usr/local/bin/pipenv", line 11, in <module>
    sys.exit(cli())
  File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.5/dist-packages/pipenv/vendor/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/pipenv/cli.py", line 1785, in shell
    load_dot_env()
  File "/usr/local/lib/python3.5/dist-packages/pipenv/cli.py", line 117, in load_dot_env
    denv = dotenv.find_dotenv(os.sep.join([project.project_directory, '.env']))
  File "/usr/local/lib/python3.5/dist-packages/pipenv/project.py", line 62, in project_directory
    return os.path.abspath(os.path.join(self.pipfile_location, os.pardir))
  File "/usr/lib/python3.5/posixpath.py", line 89, in join
    genericpath._check_arg_types('join', a, *p)
  File "/usr/lib/python3.5/genericpath.py", line 143, in _check_arg_types
    (funcname, s.__class__.__name__)) from None
TypeError: join() argument must be str or bytes, not 'NoneType'

```

I expected it to install a default virtual environment, and would have preferred an error message to a stack trace.  I was able to explicitly create the environment using "pipenv install" and then start it with "pipenv shell" but I believe on another system I was able to automatically initially set up an environment with "pipenv shell."

Changed files:
pipenv/cli.py

diff --git a/pipenv/cli.py b/pipenv/cli.py
index c6ac0ba4..824159bf 100644
--- a/pipenv/cli.py
+++ b/pipenv/cli.py
@@ -1674,9 +1674,6 @@ def lock(three=None, python=False, verbose=False, requirements=False, clear=Fals
 
 def do_shell(three=None, python=False, compat=False, shell_args=None):
 
-    # Ensure that virtualenv is available.
-    ensure_project(three=three, python=python, validate=False)
-
     # Set an environment variable, so we know we're in the environment.
     os.environ['PIPENV_ACTIVE'] = '1'
 
@@ -1781,6 +1778,9 @@ def shell(three=None, python=False, compat=False, shell_args=None, anyway=False)
 
             sys.exit(1)
 
+    # Ensure that virtualenv is available.
+    ensure_project(three=three, python=python, validate=False)
+
     # Load .env file.
     load_dot_env()
Repository: pypa/pipenv
Issue: Editable dependencies have a race condition when installing

When installing editable dependencies, they must update `site-packages/easy-install.pth` with the path to the src of the repo checkout, for it to be able to be imported. By default pipenv installed all dependencies in blocks that run concurrently, but since multiple editable installs edit the same file this creates a race condition where multiple files may be trying to edit at the same time, resulting in some not being included.

In about 10 runs of `pipenv install` with the Pipfile below, 4 only included the second (variant) path, 2 only included the first (affect) path, and 4 included both paths. This can be worked around using `--sequential` at the cost of installs being much slower.

Ideally, pipenv could gather all editable dependencies and run them all sequentially at the end of the install process so as to not cause the race condition.

Python 2.7
Pipenv 8.2.7

Pipfile:
```
[[source]]
url = "https://pypi.python.org/simple"
verify_ssl = true
name = "pypi"

[dev-packages]

[packages]
django-affect = {ref = "master", git = "https://github.com/jsatt/django-affect.git", editable = true}
django-variant = {ref = "master", git = "https://github.com/jsatt/django-variant.git", editable = true}
```

Changed files:
pipenv/cli.py

diff --git a/pipenv/cli.py b/pipenv/cli.py
index 5b9c55e1..1586ea21 100644
--- a/pipenv/cli.py
+++ b/pipenv/cli.py
@@ -783,11 +783,11 @@ def do_install_dependencies(
                 del v['hash']
 
     # Convert the deps to pip-compatible arguments.
-    deps_list = [(d, ignore_hashes) for d in convert_deps_to_pip(deps, project, r=False, include_index=True)]
+    deps_list = [(d, ignore_hashes, blocking) for d in convert_deps_to_pip(deps, project, r=False, include_index=True)]
     failed_deps_list = []
 
     if len(vcs_deps):
-        deps_list.extend((d, True) for d in convert_deps_to_pip(vcs_deps, project, r=False))
+        deps_list.extend((d, True, True) for d in convert_deps_to_pip(vcs_deps, project, r=False))
 
     # --requirements was passed.
     if requirements:
@@ -798,7 +798,7 @@ def do_install_dependencies(
 
     deps_list_bar = progress.bar(deps_list, label=INSTALL_LABEL if os.name != 'nt' else '')
 
-    for dep, ignore_hash in deps_list_bar:
+    for dep, ignore_hash, block in deps_list_bar:
         if len(procs) < PIPENV_MAX_SUBPROCESS:
             # Use a specific index, if specified.
             index = None
@@ -814,7 +814,7 @@ def do_install_dependencies(
                 allow_global=allow_global,
                 no_deps=no_deps,
                 verbose=verbose,
-                block=blocking,
+                block=block,
                 index=index
             )
Repository: pypa/pipenv
Issue: How to install prerelease version using pipenv?

I tried installing Django prelease using pipenv, here are the steps I followed

- `pipenv lock --pre`

-  `pipenv install --pre Django`

And when I check the `pip freeze` it shows me correct version of the Django

```
(fiobot-dPUFI04r) simon@ENGINE:~/Nightybuild/fiobot$ pip freeze
Django==2.0b1
gunicorn==19.7.1
pytz==2017.2
``` 

However when I looked into Pipfile.lock it shows this  `"version": "==1.11.6"` 

**I deployed to Heroku my code doesn't run because my code needs pre release version of Django how to  solve this ?**

##### My environment

1. OS Type: Ubuntu 16.04 LTS
1. Python version: `Python 3.6.3`
1. Pipenv version: `pipenv, version 8.2.7`


Changed files:
pipenv/cli.py

diff --git a/pipenv/cli.py b/pipenv/cli.py
index 863ef9ab..4c89004c 100644
--- a/pipenv/cli.py
+++ b/pipenv/cli.py
@@ -1238,7 +1238,7 @@ def do_purge(bare=False, downloads=False, allow_global=False, verbose=False):
 
 def do_init(
     dev=False, requirements=False, allow_global=False, ignore_pipfile=False,
-    skip_lock=False, verbose=False, system=False, concurrent=True, deploy=False
+    skip_lock=False, verbose=False, system=False, concurrent=True, deploy=False, pre=False
 ):
     """Executes the init functionality."""
 
@@ -1290,12 +1290,12 @@ def do_init(
                     err=True
                 )
 
-                do_lock(system=system)
+                do_lock(system=system, pre=pre)
 
     # Write out the lockfile if it doesn't exist.
     if not project.lockfile_exists and not skip_lock:
         click.echo(crayons.normal(u'Pipfile.lock not found, creating…', bold=True), err=True)
-        do_lock(system=system)
+        do_lock(system=system, pre=pre)
 
     do_install_dependencies(dev=dev, requirements=requirements, allow_global=allow_global,
                             skip_lock=skip_lock, verbose=verbose, concurrent=concurrent)
@@ -1312,6 +1312,7 @@ def pip_install(
 
     if verbose:
         click.echo(crayons.normal('Installing {0!r}'.format(package_name), bold=True), err=True)
+    # print(pre)
 
     # Create files for hash mode.
     if (not ignore_hashes) and (r is None):
@@ -1825,13 +1826,12 @@ def install(
 
     # Install all dependencies, if none was provided.
     if package_name is False:
-
-        do_init(dev=dev, allow_global=system, ignore_pipfile=ignore_pipfile, system=system, skip_lock=skip_lock, verbose=verbose, concurrent=concurrent, deploy=deploy)
-
         # Update project settings with pre preference.
         if pre:
             project.update_settings({'allow_prereleases': pre})
 
+        do_init(dev=dev, allow_global=system, ignore_pipfile=ignore_pipfile, system=system, skip_lock=skip_lock, verbose=verbose, concurrent=concurrent, deploy=deploy, pre=pre)
+
         sys.exit(0)
 
     for package_name in package_names:
@@ -1839,6 +1839,7 @@ def install(
 
         # pip install:
         with spinner():
+
             c = pip_install(package_name, ignore_hashes=True, allow_global=system, no_deps=False, verbose=verbose, pre=pre)
 
             # Warn if --editable wasn't passed.
Repository: stevenblack/hosts
Issue: script run with --noupdate should not ask "Do you want to update all data sources?"

> python updateHostsFile.py -n
> ←[94mDo you want to update all data sources?←[0m [Y/n]

the culprit is

> response = "yes" if auto else query_yes_no("Do you want to update all data sources?")
>     if response == "yes" and update:

query_yes_no should not be asked for update=False set by `update = not args.noUpdate`


Changed files:
updateHostsFile.py

diff --git a/updateHostsFile.py b/updateHostsFile.py
index dda1b51d..a8ae555d 100644
--- a/updateHostsFile.py
+++ b/updateHostsFile.py
@@ -146,8 +146,11 @@ def promptForUpdate():
         except:
             printFailure("ERROR: No 'hosts' file in the folder, try creating one manually")
 
+    if not update:
+        return
+
     response = "yes" if auto else query_yes_no("Do you want to update all data sources?")
-    if response == "yes" and update:
+    if response == "yes":
         updateAllSources()
     else:
         if not auto:
Repository: openbb-finance/openbbterminal
Issue: [Bug] Portfolio/summary - Error: Found input variables with inconsistent numbers of samples

Recreate with:

`/portfolio/load -f Public_Equity_Orderbook.xlsx/summary`

```
Error: Found input variables with inconsistent numbers of samples: [3209, 3198]
```

Doesn't matter what the portfolio file is.

```
Portfolio: megacap.csv
Risk Free Rate: 0.00%
Benchmark: SPDR S&P 500 ETF Trust (SPY)

2023 Jan 13, 19:27 (🦋) /portfolio/ $ summary

Error: Found input variables with inconsistent numbers of samples: [3991, 3990]
```



Changed files:
openbb_terminal/portfolio/portfolio_model.py

diff --git a/openbb_terminal/portfolio/portfolio_model.py b/openbb_terminal/portfolio/portfolio_model.py
index 030cf69209..c4fc1fdee4 100644
--- a/openbb_terminal/portfolio/portfolio_model.py
+++ b/openbb_terminal/portfolio/portfolio_model.py
@@ -768,6 +768,17 @@ def get_summary(
         portfolio_engine.benchmark_returns, window
     )
 
+    r2_portfolio_returns = portfolio_returns.copy()
+    r2_benchmark_returns = benchmark_returns.copy()
+    if len(portfolio_returns) > len(benchmark_returns):
+        r2_portfolio_returns = r2_portfolio_returns[
+            r2_portfolio_returns.index.isin(r2_benchmark_returns.index)
+        ]
+    elif len(portfolio_returns) < len(benchmark_returns):
+        r2_benchmark_returns = r2_benchmark_returns[
+            r2_benchmark_returns.index.isin(r2_portfolio_returns.index)
+        ]
+
     metrics = {
         "Volatility": [portfolio_returns.std(), benchmark_returns.std()],
         "Skew": [
@@ -791,8 +802,8 @@ def get_summary(
             metrics_model.sortino_ratio(benchmark_returns, risk_free_rate),
         ],
         "R2 Score": [
-            r2_score(portfolio_returns, benchmark_returns),
-            r2_score(portfolio_returns, benchmark_returns),
+            r2_score(r2_portfolio_returns, r2_benchmark_returns),
+            r2_score(r2_portfolio_returns, r2_benchmark_returns),
         ],
     }
Repository: openbb-finance/openbbterminal
Issue: No check if DataFrame is empty

```
Traceback (most recent call last):
  File "terminal.py", line 223, in <module>
    main()
  File "terminal.py", line 123, in main
    s_ticker, (datetime.now() - timedelta(days=180)).strftime("%Y-%m-%d")
  File "C:\\Users\\L\\Documents\\GamestonkTerminal\\gamestonk_terminal\\main_helper.py", line 231, in candle
    df_stock = trend.load_ticker(s_ticker, s_start)
  File "C:\\Users\\L\\Documents\\GamestonkTerminal\\gamestonk_terminal\\fundamental_analysis\\trendline_api.py", line 26, in load_ticker
    df_data = yf.download(ticker, start=start_date, progress=False)
  File "C:\\Users\\L\\AppData\\Roaming\\Python\\Python37\\site-packages\\yfinance\\multi.py", line 127, in download
    keys=shared._DFS.keys())
  File "C:\\Users\\L\\AppData\\Local\\Programs\\Python\\Python37\\lib\\site-packages\\pandas\\core\\reshape\\concat.py", line 284, in concat
    sort=sort,
  File "C:\\Users\\L\\AppData\\Local\\Programs\\Python\\Python37\\lib\\site-packages\\pandas\\core\\reshape\\concat.py", line 331, in __init__
    raise ValueError("No objects to concatenate")
ValueError: No objects to concatenate
```

I ran  `candle abna` which I think might be a wrong stock symbol.

Changed files:
terminal.py

diff --git a/terminal.py b/terminal.py
index e30805c294..0d114f028f 100644
--- a/terminal.py
+++ b/terminal.py
@@ -119,12 +119,29 @@ def main():
             main_cmd = True
 
         elif ns_known_args.opt == "candle":
-            candle(
-                s_ticker, (datetime.now() - timedelta(days=180)).strftime("%Y-%m-%d")
-            )
+
+            if s_ticker:
+                candle(
+                    s_ticker,
+                    (datetime.now() - timedelta(days=180)).strftime("%Y-%m-%d"),
+                )
+
+            else:
+                print(
+                    "No ticker selected. Use 'load ticker' to load the ticker you want to look at."
+                )
+
+            main_cmd = True
 
         elif ns_known_args.opt == "view":
-            view(l_args, s_ticker, s_start, s_interval, df_stock)
+
+            if s_ticker:
+                view(l_args, s_ticker, s_start, s_interval, df_stock)
+
+            else:
+                print(
+                    "No ticker selected. Use 'load ticker' to load the ticker you want to look at."
+                )
             main_cmd = True
 
         elif ns_known_args.opt == "export":
Repository: textualize/textual
Issue: Pressing Option + Backspace causes complete freeze with no errors

@darrenburns To check iTerm config to see what sequence is being sent with this keybind

Changed files:
src/textual/_ansi_sequences.py, src/textual/cli/cli.py

diff --git a/src/textual/_ansi_sequences.py b/src/textual/_ansi_sequences.py
index cbe7290ef..95e745b13 100644
--- a/src/textual/_ansi_sequences.py
+++ b/src/textual/_ansi_sequences.py
@@ -47,7 +47,7 @@ ANSI_SEQUENCES: Dict[str, Tuple[Keys, ...]] = {
     # support it. (Most terminals send ControlH when backspace is pressed.)
     # See: http://www.ibb.net/~anne/keyboard.html
     "\\x7f": (Keys.ControlH,),
-    # --
+    "\\x1b\\x7f": (Keys.ControlW,),
     # Various
     "\\x1b[1~": (Keys.Home,),  # tmux
     "\\x1b[2~": (Keys.Insert,),
diff --git a/src/textual/cli/cli.py b/src/textual/cli/cli.py
index e1e7533ea..d7409a10f 100644
--- a/src/textual/cli/cli.py
+++ b/src/textual/cli/cli.py
@@ -70,7 +70,7 @@ def import_app(import_name: str) -> App:
             if "app" in global_vars:
                 # App exists, lets use that
                 try:
-                    app = global_vars[name]
+                    app = global_vars["app"]
                 except KeyError:
                     raise AppFail(f"App {name!r} not found in {lib!r}")
             else:
@@ -143,7 +143,7 @@ def run_app(import_name: str, dev: bool) -> None:
     features = set(parse_features(os.environ.get("TEXTUAL", "")))
     if dev:
         features.add("debug")
-        features.add("dev")
+        features.add("devtools")
 
     os.environ["TEXTUAL"] = ",".join(sorted(features))
Repository: plotly/dash
Issue: Assets don't work for Dash apps created with an existing Flask server

This is because the `name` param is taken to be the default value from the constructor (namely `__main__`), even if a Flask instance is provided. In this case, the `name` used to locate the base path of the package should be updated to be the `name` attribute of the Flask instance.

Changed files:
dash/dash.py

diff --git a/dash/dash.py b/dash/dash.py
index fb14dbee..4c78af58 100644
--- a/dash/dash.py
+++ b/dash/dash.py
@@ -96,6 +96,7 @@ class Dash(object):
                 See https://github.com/plotly/dash/issues/141 for details.
                 ''', DeprecationWarning)
 
+        name = name if server is None else server.name
         self._assets_folder = assets_folder or os.path.join(
             flask.helpers.get_root_path(name), 'assets'
         )
Repository: plotly/dash
Issue: [BUG] Auto-generated docstrings contain JS boolean values instead of Python boolean values

Prompted by https://github.com/plotly/dash-bio/pull/379#discussion_r297840872

While `true` and `false` are not capitalized in JavaScript, they are capitalized in Python. The Python components' docstrings should reflect this, since other JS types are "translated" into Python types (e.g., `PropTypes.shape` -> `dict`). 

Changed files:
tests/unit/development/test_base_component.py, dash/development/_py_components_generation.py

diff --git a/dash/development/_py_components_generation.py b/dash/development/_py_components_generation.py
index 3fcd96c8..61bfd9b2 100644
--- a/dash/development/_py_components_generation.py
+++ b/dash/development/_py_components_generation.py
@@ -436,6 +436,9 @@ def create_prop_docstring(prop_name, type_object, required, description,
     else:
         default = default['value']
 
+    if default in ['true', 'false']:
+        default = default.title()
+
     is_required = 'optional'
     if required:
         is_required = 'required'
diff --git a/tests/unit/development/test_base_component.py b/tests/unit/development/test_base_component.py
index c39fe9a7..c34c655d 100644
--- a/tests/unit/development/test_base_component.py
+++ b/tests/unit/development/test_base_component.py
@@ -1041,7 +1041,7 @@ def assert_flow_docstring(assertEqual, docstring):
             "Keyword arguments:",
             "- requiredString (string; required): A required string",
             "- optionalString (string; default ''): A string that isn't required.",
-            "- optionalBoolean (boolean; default false): A boolean test",
+            "- optionalBoolean (boolean; default False): A boolean test",
 
             "- optionalNode (a list of or a singular dash component, string or number; optional): "
             "A node test",