internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: cookiecutter/cookiecutter

Issue:
Explicitly set encoding for reading history file.
Fixes build in C locale. Otherwise I see:

Traceback (most recent call last):
  File "setup.py", line 24, in <module>
    history = history_file.read().replace('.. :changelog:', '')
  File "/usr/pkg/lib/python3.5/encodings/ascii.py", line 26, in decode
    return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 6348: ordinal not in range(128)



Discussion:
## [Current coverage](https://codecov.io/github/audreyr/cookiecutter?ref=a0a94570cf6425e3e86ff92a9efc969be88c2119) is `99.64%`

> Merging **#638** into **master** will not affect coverage as of [`a0a9457`](https://codecov.io/github/audreyr/cookiecutter/commit/a0a94570cf6425e3e86ff92a9efc969be88c2119)

``` diff
@@            master    #638   diff @@
======================================
  Files           13      13       
  Stmts          564     564       
  Branches         0       0       
  Methods          0       0       
======================================
  Hit            562     562       
  Partial          0       0       
  Missed           2       2       
```

> Review entire [Coverage Diff](https://codecov.io/github/audreyr/cookiecutter/compare/3d30b721cd41a8b5f145831e05f43268eabd73fb...a0a94570cf6425e3e86ff92a9efc969be88c2119) as of [`a0a9457`](https://codecov.io/github/audreyr/cookiecutter/commit/a0a94570cf6425e3e86ff92a9efc969be88c2119)

---

### [Uncovered Suggestions](https://codecov.io/github/audreyr/cookiecutter/features/suggestions?ref=a0a94570cf6425e3e86ff92a9efc969be88c2119)
1. `+0.36%` via [...ookiecutter/utils.py#27...28](https://codecov.io/github/audreyr/cookiecutter/cookiecutter/utils.py?ref=a0a94570cf6425e3e86ff92a9efc969be88c2119#27) 

> Powered by [Codecov](https://codecov.io). Updated on successful CI builds.

I just saw that this breaks on python 2.x. I don't know what the proper solution for that is, suggestions?
(To reproduce the issue, just clear your environment of `LANG` and all `LC_*` variables and run `python3 setup.py build`.)


Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -1,6 +1,7 @@
 #!/usr/bin/env python
 
 import os
+import io
 import sys
 
 from setuptools import setup
@@ -17,10 +18,10 @@
     os.system("git push --tags")
     sys.exit()
 
-with open('README.rst') as readme_file:
+with io.open('README.rst', 'r', encoding='utf-8') as readme_file:
     readme = readme_file.read()
 
-with open('HISTORY.rst') as history_file:
+with io.open('HISTORY.rst', 'r', encoding='utf-8') as history_file:
     history = history_file.read().replace('.. :changelog:', '')
 
 requirements = [


Test patch:
Repository: cookiecutter/cookiecutter

Issue:
Fix the repo regex to handle + in URLs
The documentation said that you could do git+https:// or git+ssh:// but that was not, in fact, true.



Discussion:

Resolving patch:
diff --git a/cookiecutter/main.py b/cookiecutter/main.py
--- a/cookiecutter/main.py
+++ b/cookiecutter/main.py
@@ -30,19 +30,18 @@
     'bb': 'https://bitbucket.org/{0}',
 }
 
-REPO_REGEX = """
-(
-((git|ssh|https|http):(//)?)    # something like git:// ssh:// etc.
- |                              # or
- (\w+@[\w\.]+)                  # something like user@...
+REPO_REGEX = re.compile(r"""
+(?x)
+((((git|hg)\+)?(git|ssh|https?):(//)?)  # something like git:// ssh:// etc.
+ |                                      # or
+ (\w+@[\w\.]+)                          # something like user@...
 )
-.*
-"""
+""")
 
 
 def is_repo_url(value):
     """Return True if value is a repository URL."""
-    return bool(re.match(REPO_REGEX, value, re.VERBOSE))
+    return bool(REPO_REGEX.match(value))
 
 
 def expand_abbreviations(template, config_dict):


Test patch:
diff --git a/tests/test_main.py b/tests/test_main.py
--- a/tests/test_main.py
+++ b/tests/test_main.py
@@ -1,21 +1,42 @@
+# -*- coding: utf-8 -*-
+
+import pytest
+
 from cookiecutter.main import is_repo_url, expand_abbreviations
 
 
-def test_is_repo_url():
+@pytest.fixture(params=[
+    'gitolite@server:team/repo',
+    'git@github.com:audreyr/cookiecutter.git',
+    'https://github.com/audreyr/cookiecutter.git',
+    'git+https://private.com/gitrepo',
+    'hg+https://private.com/mercurialrepo',
+    'https://bitbucket.org/pokoli/cookiecutter.hg',
+])
+def remote_repo_url(request):
+    return request.param
+
+
+def test_is_repo_url_for_remote_urls(remote_repo_url):
     """Verify is_repo_url works."""
-    assert is_repo_url('gitolite@server:team/repo') is True
-    assert is_repo_url('git@github.com:audreyr/cookiecutter.git') is True
-    assert is_repo_url('https://github.com/audreyr/cookiecutter.git') is True
-    assert is_repo_url('https://bitbucket.org/pokoli/cookiecutter.hg') is True
+    assert is_repo_url(remote_repo_url) is True
 
-    assert is_repo_url('/audreyr/cookiecutter.git') is False
-    assert is_repo_url('/home/audreyr/cookiecutter') is False
 
-    appveyor_temp_dir = (
+@pytest.fixture(params=[
+    '/audreyr/cookiecutter.git',
+    '/home/audreyr/cookiecutter',
+    (
         'c:\\users\\appveyor\\appdata\\local\\temp\\1\\pytest-0\\'
         'test_default_output_dir0\\template'
-    )
-    assert is_repo_url(appveyor_temp_dir) is False
+    ),
+])
+def local_repo_url(request):
+    return request.param
+
+
+def test_is_repo_url_for_local_urls(local_repo_url):
+    """Verify is_repo_url works."""
+    assert is_repo_url(local_repo_url) is False
 
 
 def test_expand_abbreviations():
Repository: cookiecutter/cookiecutter

Issue:
Bug for replay feature from pwd
Running the following command inside of a template repo:

`$ cookiecutter -o tmp .`

Will cause `replay.dump` to files like this:

`~/.cookiecutter_replay/..json`

Identified by @eliasdorneles 



Discussion:
Working on a bugfix.


Resolving patch:
diff --git a/cookiecutter/main.py b/cookiecutter/main.py
--- a/cookiecutter/main.py
+++ b/cookiecutter/main.py
@@ -116,7 +116,7 @@ def cookiecutter(
             'The repository {0} could not be located.'.format(template)
         )
 
-    template_name = os.path.basename(template)
+    template_name = os.path.basename(os.path.abspath(template))
 
     if replay:
         context = load(config_dict['replay_dir'], template_name)


Test patch:
diff --git a/tests/test_main.py b/tests/test_main.py
--- a/tests/test_main.py
+++ b/tests/test_main.py
@@ -140,3 +140,59 @@ def test_cookiecutter_repository_url_should_clone(
     )
 
     assert os.path.isdir(project_dir)
+
+
+def test_replay_dump_template_name(
+        monkeypatch, mocker, user_config_data, user_config_file):
+    """Check that replay_dump is called with a valid template_name that is
+    not a relative path.
+
+    Otherwise files such as ``..json`` are created, which are not just cryptic
+    but also later mistaken for replay files of other templates if invoked with
+    '.' and '--replay'.
+
+    Change the current working directory temporarily to 'tests/fake-repo-tmpl'
+    for this test and call cookiecutter with '.' for the target template.
+    """
+    monkeypatch.chdir('tests/fake-repo-tmpl')
+
+    mock_replay_dump = mocker.patch('cookiecutter.main.dump')
+    mocker.patch('cookiecutter.main.generate_files')
+
+    cookiecutter(
+        '.',
+        no_input=True,
+        replay=False,
+        config_file=user_config_file,
+    )
+
+    mock_replay_dump.assert_called_once_with(
+        user_config_data['replay_dir'],
+        'fake-repo-tmpl',
+        mocker.ANY,
+    )
+
+
+def test_replay_load_template_name(
+        monkeypatch, mocker, user_config_data, user_config_file):
+    """Check that replay_load is called with a valid template_name that is
+    not a relative path.
+
+    Change the current working directory temporarily to 'tests/fake-repo-tmpl'
+    for this test and call cookiecutter with '.' for the target template.
+    """
+    monkeypatch.chdir('tests/fake-repo-tmpl')
+
+    mock_replay_load = mocker.patch('cookiecutter.main.load')
+    mocker.patch('cookiecutter.main.generate_files')
+
+    cookiecutter(
+        '.',
+        replay=True,
+        config_file=user_config_file,
+    )
+
+    mock_replay_load.assert_called_once_with(
+        user_config_data['replay_dir'],
+        'fake-repo-tmpl',
+    )
Repository: cookiecutter/cookiecutter

Issue:
Provide a __main__.py for the package
By providing a `__main__.py` file in the `cookiecutter` package it allows for `python.exe -m cookiecutter` to work (and the entry point can then simply point at the `__main__` module). I would be happy to provide a PR for this if you're amenable to the addition.



Discussion:
👍 from me

👍 

That's enough votes. :smile: . I'll see if I can get a PR created tomorrow.


Resolving patch:
diff --git a/__main__.py b/__main__.py
new file mode 100644
--- /dev/null
+++ b/__main__.py
@@ -0,0 +1,6 @@
+"""Allow cookiecutter to be executable from a checkout or zip file."""
+import runpy
+
+
+if __name__ == "__main__":
+    runpy.run_module("cookiecutter", run_name="__main__")
diff --git a/cookiecutter/__main__.py b/cookiecutter/__main__.py
new file mode 100644
--- /dev/null
+++ b/cookiecutter/__main__.py
@@ -0,0 +1,8 @@
+"""Allow cookiecutter to be executable through `python -m cookiecutter`."""
+from __future__ import absolute_import
+
+from .cli import main
+
+
+if __name__ == "__main__":  # pragma: no cover
+    main(prog_name="cookiecutter")
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -57,7 +57,7 @@
     package_dir={'cookiecutter': 'cookiecutter'},
     entry_points={
         'console_scripts': [
-            'cookiecutter = cookiecutter.cli:main',
+            'cookiecutter = cookiecutter.__main__:main',
         ]
     },
     include_package_data=True,


Test patch:
diff --git a/tests/test_cli.py b/tests/test_cli.py
--- a/tests/test_cli.py
+++ b/tests/test_cli.py
@@ -6,7 +6,7 @@
 
 from click.testing import CliRunner
 
-from cookiecutter.cli import main
+from cookiecutter.__main__ import main
 from cookiecutter.main import cookiecutter
 from cookiecutter import utils, config
Repository: cookiecutter/cookiecutter

Issue:
Rename copy_without_render()
Since `copy_without_render()` no longer performs any actual copying, it should be renamed:

```
def copy_without_render(path, context):
    """
    Returns True if `path` matches some pattern in the
    `_copy_without_render` context setting.

    :param path: A file-system path referring to a file or dir that
        should be rendered or just copied.
    :param context: cookiecutter context.
    """
    try:
        for dont_render in context['cookiecutter']['_copy_without_render']:
            if fnmatch.fnmatch(path, dont_render):
                return True
    except KeyError:
        return False

    return False
```



Discussion:
Hi @audreyr, I can pick this up. Any suggestions for a new name?


Resolving patch:
diff --git a/cookiecutter/generate.py b/cookiecutter/generate.py
--- a/cookiecutter/generate.py
+++ b/cookiecutter/generate.py
@@ -29,8 +29,12 @@
 logger = logging.getLogger(__name__)
 
 
-def copy_without_render(path, context):
-    """Return True if `path` matches context dict pattern.
+def is_copy_only_path(path, context):
+    """Check whether the given `path` should only be copied as opposed to being
+    rendered.
+
+    Returns True if `path` matches a pattern in the given `context` dict,
+    otherwise False.
 
     :param path: A file-system path referring to a file or dir that
         should be rendered or just copied.
@@ -289,7 +293,7 @@ def generate_files(repo_dir, context=None, output_dir='.',
                 # We check the full path, because that's how it can be
                 # specified in the ``_copy_without_render`` setting, but
                 # we store just the dir name
-                if copy_without_render(d_, context):
+                if is_copy_only_path(d_, context):
                     copy_dirs.append(d)
                 else:
                     render_dirs.append(d)
@@ -324,7 +328,7 @@ def generate_files(repo_dir, context=None, output_dir='.',
 
             for f in files:
                 infile = os.path.normpath(os.path.join(root, f))
-                if copy_without_render(infile, context):
+                if is_copy_only_path(infile, context):
                     outfile_tmpl = env.from_string(infile)
                     outfile_rendered = outfile_tmpl.render(**context)
                     outfile = os.path.join(project_dir, outfile_rendered)


Test patch:
Repository: cookiecutter/cookiecutter

Issue:
# -*- coding: utf-8 -*- is not consistently used in all Python source files
- Cookiecutter version:
  Cookiecutter 1.4.0
- Template project url:
  none
- Python version:
  3.5
- Operating System:
  OS X
  ### Description:
  # -_\- coding: utf-8 -_\- is not consistently used in all Python source files
### What I've run:

Nothing, it's an observation of an inconsistency in the project.



Discussion:
Hi @ssteinerx! 👋 

Good catch - mind to submit a PR adding missing encoding declarations?


Resolving patch:
diff --git a/__main__.py b/__main__.py
--- a/__main__.py
+++ b/__main__.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 """Allow cookiecutter to be executable from a checkout or zip file."""
 import runpy
 
diff --git a/cookiecutter/__main__.py b/cookiecutter/__main__.py
--- a/cookiecutter/__main__.py
+++ b/cookiecutter/__main__.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 """Allow cookiecutter to be executable through `python -m cookiecutter`."""
 from __future__ import absolute_import
 
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -1,4 +1,5 @@
 #!/usr/bin/env python
+# -*- coding: utf-8 -*-
 
 import os
 import io


Test patch:
diff --git a/tests/replay/conftest.py b/tests/replay/conftest.py
--- a/tests/replay/conftest.py
+++ b/tests/replay/conftest.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 import pytest
Repository: cookiecutter/cookiecutter

Issue:
Choice options are redundant using cookiecutter with latest click package
* Cookiecutter version: 1.6.0 -- installed via `pip install`
* Template project url: n/a
* Python version: 3.7
* Operating System: Windows 10

### Description:

If cookiecutter.json has the following:
```json
{
  "my_choice": ["a","b"]
}
```
Then running cookiecutter gives the following prompt:
```
Select my_choice:
1 - a
2 - b
Choose from 1, 2 (1, 2) [1]:
```

Note how the choices are repeated twice in the last line. This is because the [Click API](https://click.palletsprojects.com/en/7.x/api/) has been updated to 7.0 and automatically shows the choices to the user in parentheses. This is redundant. 

### Solution
The text passed to the `click.prompt` function should be changed to set `show_choices = False` or it should be changed to not show the choices and let the Click API do so instead.



Discussion:

Resolving patch:
diff --git a/cookiecutter/prompt.py b/cookiecutter/prompt.py
--- a/cookiecutter/prompt.py
+++ b/cookiecutter/prompt.py
@@ -88,7 +88,7 @@ def read_user_choice(var_name, options):
     ))
 
     user_choice = click.prompt(
-        prompt, type=click.Choice(choices), default=default
+        prompt, type=click.Choice(choices), default=default, show_choices=False
     )
     return choice_map[user_choice]
 
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -26,7 +26,7 @@
     'future>=0.15.2',
     'binaryornot>=0.2.0',
     'jinja2>=2.7',
-    'click>=5.0',
+    'click>=7.0',
     'whichcraft>=0.4.0',
     'poyo>=0.1.0',
     'jinja2-time>=0.1.0',


Test patch:
diff --git a/tests/test_read_user_choice.py b/tests/test_read_user_choice.py
--- a/tests/test_read_user_choice.py
+++ b/tests/test_read_user_choice.py
@@ -29,7 +29,8 @@ def test_click_invocation(mocker, user_choice, expected_value):
     prompt.assert_called_once_with(
         EXPECTED_PROMPT,
         type=click.Choice(OPTIONS),
-        default='1'
+        default='1',
+        show_choices=False
     )
Repository: cookiecutter/cookiecutter

Issue:
PEP257 docstrings for file "./docs/__init__.py"
Cover `./docs/__init__.py` file with docstrings and follow [PEP257](https://www.python.org/dev/peps/pep-0257/). We use [pydocstyle](https://pypi.org/project/pydocstyle/) for validation.

Current validation log:

```
./docs/__init__.py:1 at module level:
        D104: Missing docstring in public package
```

Subtask for #742 


Discussion:

Resolving patch:
diff --git a/docs/__init__.py b/docs/__init__.py
--- a/docs/__init__.py
+++ b/docs/__init__.py
@@ -0,0 +1,3 @@
+# -*- coding: utf-8 -*-
+
+"""Main package for docs."""


Test patch:
Repository: cookiecutter/cookiecutter

Issue:
Add support of python 3.8
- [x] Add to travis
- [x] Add to appveyor
- [x] Add to tox
- [x] Add to setup.py
- [x] Add to docs


Discussion:

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -68,21 +68,22 @@
     license='BSD',
     zip_safe=False,
     classifiers=[
-        'Development Status :: 5 - Production/Stable',
-        'Environment :: Console',
-        'Intended Audience :: Developers',
-        'Natural Language :: English',
-        'License :: OSI Approved :: BSD License',
-        'Programming Language :: Python',
-        'Programming Language :: Python :: 2',
-        'Programming Language :: Python :: 2.7',
-        'Programming Language :: Python :: 3',
-        'Programming Language :: Python :: 3.5',
-        'Programming Language :: Python :: 3.6',
-        'Programming Language :: Python :: 3.7',
-        'Programming Language :: Python :: Implementation :: CPython',
-        'Programming Language :: Python :: Implementation :: PyPy',
-        'Topic :: Software Development',
+        "Development Status :: 5 - Production/Stable",
+        "Environment :: Console",
+        "Intended Audience :: Developers",
+        "Natural Language :: English",
+        "License :: OSI Approved :: BSD License",
+        "Programming Language :: Python",
+        "Programming Language :: Python :: 2",
+        "Programming Language :: Python :: 2.7",
+        "Programming Language :: Python :: 3",
+        "Programming Language :: Python :: 3.5",
+        "Programming Language :: Python :: 3.6",
+        "Programming Language :: Python :: 3.7",
+        "Programming Language :: Python :: 3.8",
+        "Programming Language :: Python :: Implementation :: CPython",
+        "Programming Language :: Python :: Implementation :: PyPy",
+        "Topic :: Software Development",
     ],
     keywords=(
         'cookiecutter, Python, projects, project templates, Jinja2, '


Test patch:
diff --git a/tests/test_cli.py b/tests/test_cli.py
--- a/tests/test_cli.py
+++ b/tests/test_cli.py
@@ -341,8 +341,7 @@ def test_echo_undefined_variable_error(tmpdir, cli_runner):
     assert error in result.output
 
     message = (
-        "Error message: 'collections.OrderedDict object' "
-        "has no attribute 'foobar'"
+        "Error message: 'collections.OrderedDict object' has no attribute 'foobar'"
     )
     assert message in result.output
Repository: cookiecutter/cookiecutter

Issue:
Update in code http links to current click version help
We have some click related links in code docstring and config.
As we changed click version in last release it will be good to update links too.


Discussion:
prompt.py
I would like to work on this issue

Resolving patch:
diff --git a/cookiecutter/prompt.py b/cookiecutter/prompt.py
--- a/cookiecutter/prompt.py
+++ b/cookiecutter/prompt.py
@@ -20,7 +20,7 @@ def read_user_variable(var_name, default_value):
     :param str var_name: Variable of the context to query the user
     :param default_value: Value that will be returned if no input happens
     """
-    # Please see http://click.pocoo.org/4/api/#click.prompt
+    # Please see https://click.palletsprojects.com/en/7.x/api/#click.prompt
     return click.prompt(var_name, default=default_value)
 
 
@@ -33,7 +33,7 @@ def read_user_yes_no(question, default_value):
     :param str question: Question to the user
     :param default_value: Value that will be returned if no input happens
     """
-    # Please see http://click.pocoo.org/4/api/#click.prompt
+    # Please see https://click.palletsprojects.com/en/7.x/api/#click.prompt
     return click.prompt(
         question,
         default=default_value,
@@ -46,7 +46,7 @@ def read_repo_password(question):
 
     :param str question: Question to the user
     """
-    # Please see http://click.pocoo.org/4/api/#click.prompt
+    # Please see https://click.palletsprojects.com/en/7.x/api/#click.prompt
     return click.prompt(question, hide_input=True)
 
 
@@ -59,7 +59,7 @@ def read_user_choice(var_name, options):
     :param list options: Sequence of options that are available to select from
     :return: Exactly one item of ``options`` that has been chosen by the user
     """
-    # Please see http://click.pocoo.org/4/api/#click.prompt
+    # Please see https://click.palletsprojects.com/en/7.x/api/#click.prompt
     if not isinstance(options, list):
         raise TypeError
 
@@ -113,7 +113,7 @@ def read_user_dict(var_name, default_value):
     :param default_value: Value that will be returned if no input is provided
     :return: A Python dictionary to use in the context.
     """
-    # Please see http://click.pocoo.org/4/api/#click.prompt
+    # Please see https://click.palletsprojects.com/en/7.x/api/#click.prompt
     if not isinstance(default_value, dict):
         raise TypeError
 


Test patch:
Repository: cookiecutter/cookiecutter

Issue:
Fix pitest warning, recheck dependencies versions.
* Cookiecutter version:master

```
py27 run-test: commands[1] | /home/insspb/git/cookiecutter/.tox/py27/bin/python /snap/pycharm-professional/196/plugins/python/helpers/pycharm/_jb_pytest_runner.py --offset 10001 -- --cov=cookiecutter tests
/home/insspb/git/cookiecutter/.tox/py27/lib/python2.7/site-packages/_pytest/config/__init__.py:316: PytestConfigWarning: pytest-catchlog plugin has been merged into the core, please remove it from your requirements.
  name.replace("_", "-")
```


Discussion:

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -25,14 +25,15 @@
     readme = readme_file.read()
 
 requirements = [
-    'binaryornot>=0.2.0',
-    'jinja2>=2.7',
-    'click>=7.0',
-    'poyo>=0.1.0',
-    'jinja2-time>=0.1.0',
+    'binaryornot>=0.4.4',
+    'Jinja2<=2.11.0',
+    'click>=7.1.1',
+    'poyo>=0.5.0',
+    'jinja2-time>=0.2.0',
     'python-slugify>=4.0.0',
-    'requests>=2.18.0',
-    'six>=1.10',
+    'requests>=2.23.0',
+    'six>=1.14',
+    'MarkupSafe<2.0.0'
 ]
 
 if sys.argv[-1] == 'readme':


Test patch:
diff --git a/test_requirements.txt b/test_requirements.txt
--- a/test_requirements.txt
+++ b/test_requirements.txt
@@ -1,5 +1,4 @@
 pytest
 pytest-cov
 pytest-mock
-pytest-catchlog
 freezegun