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

Issue:
`vyper-serve` is still lingering in `setup.py`
### Version Information

* vyper Version (output of `vyper --version`): doesn't matter
* OS: doesn't matter
* Python Version (output of `python --version`): doesn't matter

### What's your issue about?

You removed `vyper-serve` with this commit: https://github.com/vyperlang/vyper/commit/98f502baea6385fe25dbf94a70fb4eddc9f02f56, but you forgot to remove `vyper-serve` from `setup.py`:

```python
entry_points={
        "console_scripts": [
            "vyper=vyper.cli.vyper_compile:_parse_cli_args",
            "vyper-serve=vyper.cli.vyper_serve:_parse_cli_args",
            "fang=vyper.cli.vyper_ir:_parse_cli_args",
            "vyper-json=vyper.cli.vyper_json:_parse_cli_args",
        ]
    },
```

### How can it be fixed?

Remove `vyper-serve` line.



Discussion:
Taking this on.

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -103,7 +103,6 @@ def _global_version(version):
     entry_points={
         "console_scripts": [
             "vyper=vyper.cli.vyper_compile:_parse_cli_args",
-            "vyper-serve=vyper.cli.vyper_serve:_parse_cli_args",
             "fang=vyper.cli.vyper_ir:_parse_cli_args",
             "vyper-json=vyper.cli.vyper_json:_parse_cli_args",
         ]


Test patch:
Repository: vyperlang/vyper

Issue:
constant folding fails for constant exponentiation
### Version Information

* vyper Version (output of `vyper --version`): v0.4.0rc2

### What's your issue about?

repro:
```
N: constant(uint256) = 3
N2: constant(uint256) = N**N
```
results in:
```
vyper.exceptions.InvalidOperation: Cannot apply an overflow check on exponentiation when both the base and power are unknown at compile-time. To perform this operation without an overflow check, use `pow_mod256(N, N)`
```

this appears to be a regression from 0.3.10


Discussion:

Resolving patch:
diff --git a/vyper/semantics/types/primitives.py b/vyper/semantics/types/primitives.py
--- a/vyper/semantics/types/primitives.py
+++ b/vyper/semantics/types/primitives.py
@@ -151,9 +151,9 @@ def validate_numeric_op(
 
         def _get_lr():
             if isinstance(node, vy_ast.BinOp):
-                return node.left, node.right
+                return node.left.reduced(), node.right.reduced()
             elif isinstance(node, vy_ast.AugAssign):
-                return node.target, node.value
+                return node.target.reduced(), node.value.reduced()
             else:
                 raise CompilerPanic(f"Unexpected node type for numeric op: {type(node).__name__}")
 


Test patch:
diff --git a/tests/functional/codegen/types/numbers/test_exponents.py b/tests/functional/codegen/types/numbers/test_exponents.py
--- a/tests/functional/codegen/types/numbers/test_exponents.py
+++ b/tests/functional/codegen/types/numbers/test_exponents.py
@@ -17,6 +17,16 @@ def f0():
         compile_code(code)
 
 
+def test_fold_nonliteral(get_contract):
+    # test we can fold non-literal constants
+    code = """
+N: constant(uint256) = 3
+N2: public(constant(uint256)) = N**N
+    """
+    c = get_contract(code)
+    assert c.N2() == 3**3
+
+
 @pytest.mark.fuzzing
 @pytest.mark.parametrize("power", range(2, 255))
 def test_exp_uint256(get_contract, tx_failed, power):
Repository: mkdocs/mkdocs

Issue:
Update requirements
While working with Markdown extensions (c.f. #74), I noticed that mkdocs' setup.py has its dependencies [pinned to specific patch versions](https://github.com/tomchristie/mkdocs/blob/master/setup.py#L18):

```
install_requires = [
    'Jinja2==2.7.1',
    'Markdown==2.3.1',
    'PyYAML==3.10',
    'watchdog==0.7.0',
    'ghp-import==0.4.1'
]
```

Since these dependencies are slightly out of date (e.g., [Jinja2 is at 2.7.3](https://pypi.python.org/pypi/Jinja2) and [Markdown is at 2.4.1](https://pypi.python.org/pypi/Markdown)), it's hard to use mkdocs on a system with other software. Perhaps it's a shame that Python doesn't have npm-like dependency management, but that's the way it is—you'll get a setuptools when trying to run mkdocs error if any other package upgrades Jinja to a bugfix release.

How would the developers feel about loosening these version requirements? An idiomatic approach is to [just use `>=`](https://github.com/mitsuhiko/flask/blob/master/setup.py#L99).



Discussion:
+1 to loosening the versions. I have had a quick look and I can't see anything that would require those pinned versions.


Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -16,11 +16,11 @@
 author_email = 'tom@tomchristie.com'
 license = 'BSD'
 install_requires = [
-    'Jinja2==2.7.1',
-    'Markdown==2.3.1',
-    'PyYAML==3.10',
-    'watchdog==0.7.0',
-    'ghp-import==0.4.1'
+    'Jinja2>=2.7.1',
+    'Markdown>=2.3.1,<2.5',
+    'PyYAML>=3.10',
+    'watchdog>=0.7.0',
+    'ghp-import>=0.4.1'
 ]
 
 long_description = """Work in progress."""


Test patch:
Repository: mkdocs/mkdocs

Issue:
Wrong paths to extra media files
Incorrect paths are generated for files in `extra_css` and `extra_javascript`. For example, `test.js` will be referenced on the index page as `./test.js`, on the next page as `.././test.js`, on the next page as `../.././test.js`, etc.



Discussion:

Resolving patch:
diff --git a/mkdocs/build.py b/mkdocs/build.py
--- a/mkdocs/build.py
+++ b/mkdocs/build.py
@@ -103,11 +103,9 @@ def get_context(page, content, nav, toc, meta, config):
     else:
         site_favicon = None
 
-    if config['extra_javascript']:
-        config['extra_javascript'] = utils.create_media_urls(nav=nav, url_list=config['extra_javascript'])
+    extra_javascript = utils.create_media_urls(nav=nav, url_list=config['extra_javascript'])
 
-    if config['extra_css']:
-        config['extra_css'] = utils.create_media_urls(nav=nav, url_list=config['extra_css'])
+    extra_css = utils.create_media_urls(nav=nav, url_list=config['extra_css'])
 
     return {
         'site_name': site_name,
@@ -138,8 +136,8 @@ def get_context(page, content, nav, toc, meta, config):
         'repo_url': config['repo_url'],
         'repo_name': config['repo_name'],
 
-        'extra_css': config['extra_css'],
-        'extra_javascript': config['extra_javascript'],
+        'extra_css': extra_css,
+        'extra_javascript': extra_javascript,
 
         'include_nav': config['include_nav'],
         'include_next_prev': config['include_next_prev'],


Test patch:
Repository: mkdocs/mkdocs

Issue:
Support multiple theme_dir's
Jinja supports multiple theme_dirs that it will look for templates on. This lets you override the templates that the theme you're shipping with uses. However, Mkdocs assumes theme_dir will be a string with a single directory in a couple places.



Discussion:

Resolving patch:
diff --git a/mkdocs/build.py b/mkdocs/build.py
--- a/mkdocs/build.py
+++ b/mkdocs/build.py
@@ -217,6 +217,7 @@ def build(config, live_server=False, dump_json=False):
     if dump_json:
         build_pages(config, dump_json=True)
     else:
-        utils.copy_media_files(config['theme_dir'], config['site_dir'])
+        for theme_dir in config['theme_dir']:
+            utils.copy_media_files(theme_dir, config['site_dir'])
         utils.copy_media_files(config['docs_dir'], config['site_dir'])
         build_pages(config)
diff --git a/mkdocs/config.py b/mkdocs/config.py
--- a/mkdocs/config.py
+++ b/mkdocs/config.py
@@ -117,9 +117,13 @@ def validate_config(user_config):
     if config['extra_javascript'] is None:
         config['extra_javascript'] = extra_javascript
 
-    if config['theme_dir'] is None:
-        package_dir = os.path.dirname(__file__)
-        config['theme_dir'] = os.path.join(package_dir, 'themes', config['theme'])
+    package_dir = os.path.dirname(__file__)
+    theme_dir = [os.path.join(package_dir, 'themes', config['theme'])]
+
+    if config['theme_dir'] is not None:
+        theme_dir.insert(0, config['theme_dir'])
+
+    config['theme_dir'] = theme_dir
 
     if config['repo_url'] is not None and config['repo_name'] is None:
         repo_host = urlparse(config['repo_url']).netloc.lower()
diff --git a/mkdocs/serve.py b/mkdocs/serve.py
--- a/mkdocs/serve.py
+++ b/mkdocs/serve.py
@@ -86,7 +86,8 @@ def serve(config, options=None):
     config_event_handler = ConfigEventHandler(options)
     observer = observers.Observer()
     observer.schedule(event_handler, config['docs_dir'], recursive=True)
-    observer.schedule(event_handler, config['theme_dir'], recursive=True)
+    for theme_dir in config['theme_dir']:
+        observer.schedule(event_handler, theme_dir, recursive=True)
     observer.schedule(config_event_handler, '.')
     observer.start()
 


Test patch:
Repository: mkdocs/mkdocs

Issue:
Exit gracefully when misconfigured
Currently if `mkdocs.yaml` does not exist or if `pages`/`project_name` are not set, we'll exit with an exception.  Really we should print a simple error to stderr and exit with an appropriate error code.



Discussion:

Resolving patch:
diff --git a/mkdocs/config.py b/mkdocs/config.py
--- a/mkdocs/config.py
+++ b/mkdocs/config.py
@@ -2,7 +2,9 @@
 
 from mkdocs import utils
 from mkdocs.compat import urlparse
+import errno
 import os
+import sys
 import yaml
 
 DEFAULT_CONFIG = {
@@ -73,7 +75,9 @@ def load_config(filename='mkdocs.yml', options=None):
     options = options or {}
     if 'config' in options:
         filename = options['config']
-    assert os.path.exists(filename), "Config file '%s' does not exist." % filename
+    if not os.path.exists(filename):
+        sys.stderr.write("Config file '%s' does not exist." % filename)
+        sys.exit(errno.ENOENT)
     with open(filename, 'r') as fp:
         user_config = yaml.load(fp)
     user_config.update(options)
@@ -84,7 +88,9 @@ def validate_config(user_config):
     config = DEFAULT_CONFIG.copy()
     config.update(user_config)
 
-    assert config['site_name'], "Config must contain 'site_name' setting."
+    if not config['site_name']:
+        sys.stderr.write("Config must contain 'site_name' setting.")
+        sys.exit(errno.EINVAL)
 
     # If not specified, then the 'pages' config simply includes all
     # markdown files in the docs dir, without generating any header items


Test patch:
diff --git a/mkdocs/test.py b/mkdocs/test.py
--- a/mkdocs/test.py
+++ b/mkdocs/test.py
@@ -21,6 +21,18 @@ def ensure_utf(string):
 
 
 class ConfigTests(unittest.TestCase):
+    def test_missing_config_file(self):
+
+        def load_missing_config():
+            options = {'config': 'bad_filename.yaml'}
+            config.load_config(options=options)
+        self.assertRaises(SystemExit, load_missing_config)
+
+    def test_missing_site_name(self):
+        def load_missing_site_name():
+            config.validate_config({})
+        self.assertRaises(SystemExit, load_missing_site_name)
+
     def test_config_option(self):
         """
         Users can explicitly set the config file using the '--config' option.
Repository: mkdocs/mkdocs

Issue:
Update PyPI description
At the moment I wouldn't be tempted if I first seen this page.

https://pypi.python.org/pypi/mkdocs



Discussion:

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -10,7 +10,7 @@
 
 name = 'mkdocs'
 package = 'mkdocs'
-description = 'In progress.'
+description = 'Project documentation with Markdown.'
 url = 'http://www.mkdocs.org'
 author = 'Tom Christie'
 author_email = 'tom@tomchristie.com'
@@ -23,7 +23,12 @@
     'ghp-import>=0.4.1'
 ]
 
-long_description = """Work in progress."""
+long_description = (
+    "MkDocs is a fast, simple and downright gorgeous static site generator "
+    "that's geared towards building project documentation. Documentation "
+    "source files are written in Markdown, and configured with a single YAML "
+    "configuration file."
+)
 
 
 def get_version(package):


Test patch:
Repository: mkdocs/mkdocs

Issue:
Make syntax highlighting optional
It would be nice to have an option to disable the prettify class from being added to the pre-tag. Personally, I prefer using another highlighter that doesn't rely on extra classes.



Discussion:
Are you adding your own highlighter with the extra css?

So far, I was only running a couple of tests on an early custom theme and noticed those classes get added. Eventually, I will use `extra_css` to load [highlight.js](http://highlightjs.org) — but I don't see how that influences the prettify inclusion.

Just trying to fully understand the use case. I think this probably makes sense, I'm just trying to think how we best do it without adding more and more config options.

Isn't the hightlighting entirely dependant on the theme - is using a custom theme the right answer here?

The problem is, we mess with peoples HTML.

https://github.com/tomchristie/mkdocs/blob/master/mkdocs/build.py#L86

If you don't like adding more config options, then maybe a switch (e.g. --no-prettify) works better?

Ideally we ought to tweak the default css/javascript so it doesn't require us to postprocess the html in that way.

> maybe a switch (e.g. --no-prettify) works better?

Nah. Extra switches are not any better than extra config.

+1 to fixing the default css. Should just be a case of changing https://github.com/tomchristie/mkdocs/blob/master/mkdocs/themes/mkdocs/css/prettify-1.0.css

... and removing the hack in the code of course :)

@d0ugal May also be some javascript that keys into that?

Oh yeah, so there is! https://github.com/tomchristie/mkdocs/blob/master/mkdocs/themes/mkdocs/js/prettify-1.0.min.js


Resolving patch:
diff --git a/mkdocs/build.py b/mkdocs/build.py
--- a/mkdocs/build.py
+++ b/mkdocs/build.py
@@ -83,8 +83,6 @@ def post_process_html(html_content, nav=None):
     img_sub = PathToURL('src="%s"', nav)
     html_content = re.sub(r'src="([^"]*)"', img_sub, html_content)
 
-    html_content = html_content.replace('<pre>', '<pre class="prettyprint well">')
-
     return html_content
 
 


Test patch:
Repository: mkdocs/mkdocs

Issue:
Local fragment links are generated incorrectly
I've got a document, `foo.md`, like this:

``` markdown

# Header One

This is a link to [section 2](#header-two)

# Header Two

And this is that section.
```

I'd expect the link to go to `/foo/#header-two`, but instead it's linking to `/#header-two`. I can work around it by making the link be `[section 2](foo.md#header-two)`, but that's (a) clunky and (b) breaks if I rename the file.



Discussion:

Resolving patch:
diff --git a/mkdocs/build.py b/mkdocs/build.py
--- a/mkdocs/build.py
+++ b/mkdocs/build.py
@@ -19,7 +19,7 @@ def __call__(self, match):
         url = match.groups()[0]
         scheme, netloc, path, query, query, fragment = urlparse(url)
 
-        if scheme or netloc:
+        if scheme or netloc or not path:
             # Ignore URLs unless they are a relative link to a markdown file.
             return self.template % url
 


Test patch:
diff --git a/mkdocs/test.py b/mkdocs/test.py
--- a/mkdocs/test.py
+++ b/mkdocs/test.py
@@ -486,6 +486,21 @@ def test_convert_internal_media(self):
             html = build.post_process_html(html, site_navigation)
             self.assertEqual(html, expected)
 
+    def test_anchor_only_link(self):
+
+        pages = [
+            ('index.md',),
+            ('internal.md',),
+            ('sub/internal.md')
+        ]
+
+        site_navigation = nav.SiteNavigation(pages)
+
+        for page in site_navigation.walk_pages():
+            html = '<p><a href="#test"> </a></p>'
+            result = build.post_process_html(html, site_navigation)
+            self.assertEqual(result, html)
+
     def test_ignore_external_link(self):
         md_text = 'An [external link](http://example.com/external.md).'
         expected = '<p>An <a href="http://example.com/external.md">external link</a>.</p>'
Repository: mkdocs/mkdocs

Issue:
The google_analytics config doesn't work
I try to use google analytics and I add a config in mkdocs.yml:

```
google_analytics: ['UA-xxxxxxxx-x', 'hostname']
```

However, it seems not work. So I find the config in source code and there are two places [config.py](https://github.com/tomchristie/mkdocs/blob/master/mkdocs/config.py#L25) and [build.py](https://github.com/tomchristie/mkdocs/blob/master/mkdocs/build.py#L134) setting google analytics. Obviously, they use the key 'google-analytics' instead of 'google_analytics'. Therefore the theme can't find config google_analytics. 



Discussion:
Yup looks like those should all be underscored.


Resolving patch:
diff --git a/mkdocs/build.py b/mkdocs/build.py
--- a/mkdocs/build.py
+++ b/mkdocs/build.py
@@ -131,7 +131,7 @@ def get_global_context(nav, config):
         'include_search': config['include_search'],
 
         'copyright': config['copyright'],
-        'google-analytics': config['google-analytics']
+        'google_analytics': config['google_analytics']
     }
 
 
diff --git a/mkdocs/config.py b/mkdocs/config.py
--- a/mkdocs/config.py
+++ b/mkdocs/config.py
@@ -22,7 +22,7 @@
     'theme_dir': None,
 
     'copyright': None,
-    'google-analytics': None,
+    'google_analytics': None,
 
     # The address on which to serve the livereloading docs server.
     'dev_addr': '127.0.0.1:8000',


Test patch:
Repository: mkdocs/mkdocs

Issue:
Default theme files are added when a custom theme is used and no "parent" theme is specified
I'm using `theme_dir` to specify a custom theme directory with the latest versions of Bootstrap and Font Awesome, and I'm not specifying `theme` because I don't want to inherit files from a parent theme.  However, since `theme` defaults to 'mkdocs', my site directory ends up with two different versions of these libraries in addition to other files I'm not using like prettify.

I tried explicitly setting `theme` to null, but that didn't work.  As a hack, setting `theme` to a custom name works for `mkdocs build`, but not `mkdocs serve`.

This wasn't an issue with v0.9, but I've noticed it since upgrading to v0.11.1.



Discussion:

Resolving patch:
diff --git a/mkdocs/config.py b/mkdocs/config.py
--- a/mkdocs/config.py
+++ b/mkdocs/config.py
@@ -85,6 +85,9 @@ def load_config(filename='mkdocs.yml', options=None):
 
 def validate_config(user_config):
     config = DEFAULT_CONFIG.copy()
+
+    theme_in_config = 'theme' in user_config
+
     config.update(user_config)
 
     if not config['site_name']:
@@ -125,6 +128,10 @@ def validate_config(user_config):
     theme_dir = [os.path.join(package_dir, 'themes', config['theme'])]
 
     if config['theme_dir'] is not None:
+        # If the user has given us a custom theme but not a
+        # builtin theme name then we don't want to merge them.
+        if not theme_in_config:
+            theme_dir = []
         theme_dir.insert(0, config['theme_dir'])
 
     config['theme_dir'] = theme_dir


Test patch:
diff --git a/mkdocs/test.py b/mkdocs/test.py
--- a/mkdocs/test.py
+++ b/mkdocs/test.py
@@ -81,6 +81,43 @@ def test_config_option(self):
         finally:
             os.remove(config_file.name)
 
+    def test_theme(self):
+
+        base_config = dedent("""
+        site_name: Example
+        pages:
+        - ['index.md', 'Introduction']
+        %s
+        """)
+
+        configs = [
+            "site_name: Example",  # default theme
+            "theme: readthedocs",  # builtin theme
+            "theme_dir: mytheme",  # custom only
+            "theme: cosmo\ntheme_dir: custom"  # builtin and custom
+        ]
+
+        abs_path = os.path.abspath(os.path.dirname(__file__))
+        theme_dir = os.path.join(abs_path, 'themes')
+
+        results = (
+            ['%s/mkdocs' % theme_dir, ],
+            ['%s/readthedocs' % theme_dir, ],
+            ['mytheme', ],
+            ['custom', '%s/cosmo' % theme_dir, ],
+        )
+
+        for config_contents, expected_result in zip(configs, results):
+            try:
+                config_file = tempfile.NamedTemporaryFile('w', delete=False)
+                config_file.write(ensure_utf(base_config % config_contents))
+                config_file.flush()
+                options = {'config': config_file.name}
+                result = config.load_config(options=options)
+                self.assertEqual(result['theme_dir'], expected_result)
+            finally:
+                os.remove(config_file.name)
+
     def test_default_pages(self):
         tmp_dir = tempfile.mkdtemp()
         try:
Repository: mkdocs/mkdocs

Issue:
ReadTheDocs theme doesn't show the TOC on the home page
It is expanded on the left here: http://mkdocs.readthedocs.org/en/latest/user-guide/writing-your-docs/
But not here: http://mkdocs.readthedocs.org/en/latest/

This is probably due to us not including the home page in the navigation and ties into the discussion on #231 that I had with @tomchristie 



Discussion:
Yeah, I think adding Home to the navigation makes sense.


Resolving patch:
diff --git a/mkdocs/nav.py b/mkdocs/nav.py
--- a/mkdocs/nav.py
+++ b/mkdocs/nav.py
@@ -36,7 +36,7 @@ def __init__(self, pages_config, use_directory_urls=True):
         self.use_directory_urls = use_directory_urls
 
     def __str__(self):
-        return str(self.homepage) + ''.join([str(item) for item in self])
+        return ''.join([str(item) for item in self])
 
     def __iter__(self):
         return iter(self.nav_items)
@@ -221,8 +221,7 @@ def _generate_site_navigation(pages_config, url_context, use_directory_urls=True
         if not child_title:
             # New top level page.
             page = Page(title=title, url=url, path=path, url_context=url_context)
-            if not utils.is_homepage(path):
-                nav_items.append(page)
+            nav_items.append(page)
         elif not nav_items or (nav_items[-1].title != title):
             # New second level page.
             page = Page(title=child_title, url=url, path=path, url_context=url_context)


Test patch:
diff --git a/mkdocs/test.py b/mkdocs/test.py
--- a/mkdocs/test.py
+++ b/mkdocs/test.py
@@ -239,7 +239,7 @@ def test_simple_toc(self):
         """)
         site_navigation = nav.SiteNavigation(pages)
         self.assertEqual(str(site_navigation).strip(), expected)
-        self.assertEqual(len(site_navigation.nav_items), 1)
+        self.assertEqual(len(site_navigation.nav_items), 2)
         self.assertEqual(len(site_navigation.pages), 2)
 
     def test_empty_toc_item(self):
@@ -253,7 +253,7 @@ def test_empty_toc_item(self):
         """)
         site_navigation = nav.SiteNavigation(pages)
         self.assertEqual(str(site_navigation).strip(), expected)
-        self.assertEqual(len(site_navigation.nav_items), 1)
+        self.assertEqual(len(site_navigation.nav_items), 2)
         self.assertEqual(len(site_navigation.pages), 2)
 
     def test_indented_toc(self):
@@ -277,7 +277,7 @@ def test_indented_toc(self):
         """)
         site_navigation = nav.SiteNavigation(pages)
         self.assertEqual(str(site_navigation).strip(), expected)
-        self.assertEqual(len(site_navigation.nav_items), 2)
+        self.assertEqual(len(site_navigation.nav_items), 3)
         self.assertEqual(len(site_navigation.pages), 6)
 
     def test_walk_simple_toc(self):