nebius/SWE-bench-extra huggingface dataset:
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`). 

Comments:

Patch:
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'


Test patch:
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",
Repository: polygraph-python/polygraph

Issue:
Implement GraphQL type cache for GraphQL meta-types

Comments:

Patch:
diff --git a/polygraph/types/basic_type.py b/polygraph/types/basic_type.py
index 3498d26..26e54b8 100644
--- a/polygraph/types/basic_type.py
+++ b/polygraph/types/basic_type.py
@@ -1,3 +1,5 @@
+from functools import wraps
+
 from polygraph.exceptions import PolygraphSchemaError, PolygraphValueError
 from polygraph.types.definitions import TypeDefinition, TypeKind
 from polygraph.utils.trim_docstring import trim_docstring
@@ -7,6 +9,22 @@ def typedef(type_):
     return type_.__type
 
 
+type_builder_registry = {}
+
+
+def type_builder_cache(method):
+    @wraps(method)
+    def wrapper(cls, *args):
+        unique_args = frozenset(args)
+        if (cls, unique_args) in type_builder_registry:
+            return type_builder_registry[(cls, unique_args)]
+        else:
+            return_val = method(cls, *args)
+            type_builder_registry[(cls, unique_args)] = return_val
+            return return_val
+    return wrapper
+
+
 class PolygraphTypeMeta(type):
     def __new__(cls, name, bases, namespace):
         default_description = trim_docstring(namespace.get("__doc__", ""))
@@ -95,6 +113,7 @@ class Union(PolygraphOutputType, PolygraphType):
     GraphQL Object types, but provides for no guaranteed fields between
     those types.
     """
+    @type_builder_cache
     def __new__(cls, *types):
         types = set(types)
         assert len(types) >= 2, "Unions must consist of more than 1 type"
@@ -135,6 +154,7 @@ class List(PolygraphType):
     each item in the list is serialized as per the item type.
     """
 
+    @type_builder_cache
     def __new__(cls, type_):
         type_name = typedef(type_).name
 
@@ -160,6 +180,7 @@ class NonNull(PolygraphType):
     """
     Represents a type for which null is not a valid result.
     """
+    @type_builder_cache
     def __new__(cls, type_):
         type_name = typedef(type_).name
 


Test patch:
diff --git a/polygraph/types/tests/test_union.py b/polygraph/types/tests/test_union.py
index 0c60c7d..07abe3d 100644
--- a/polygraph/types/tests/test_union.py
+++ b/polygraph/types/tests/test_union.py
@@ -5,11 +5,13 @@ from polygraph.types.basic_type import Union
 from polygraph.types.scalar import Float, Int, String
 
 
-@skip  # FIXME
+# @skip  # FIXME
 class UnionTypeTest(TestCase):
     def test_commutativity(self):
         self.assertEqual(Union(String, Int), Union(Int, String))
+        self.assertEqual(Union(String, Int, Float), Union(Float, String, Int, String))
 
+    @skip
     def test_associativity(self):
         self.assertEqual(
             Union(Union(String, Int), Float),
@@ -22,6 +24,7 @@ class UnionTypeTest(TestCase):
             Union(String, Int),
         )
 
+    @skip
     def test_pipe_operator_with_more_than_two_types(self):
         self.assertEqual(
             String | Int | Float,
Repository: polygraph-python/polygraph

Issue:
ObjectType: resolve from Python object or dict

Comments:

Patch:
diff --git a/polygraph/types/object_type.py b/polygraph/types/object_type.py
index 9567e1b..b8e0a82 100644
--- a/polygraph/types/object_type.py
+++ b/polygraph/types/object_type.py
@@ -8,5 +8,8 @@ class ObjectType(PolygraphOutputType, PolygraphType, dict):
     a value of a specific type.
     """
 
+    def __init__(self, root=None):
+        self.root = root
+
     class Type:
         kind = TypeKind.OBJECT


Test patch:
diff --git a/polygraph/types/tests/test_object_type.py b/polygraph/types/tests/test_object_type.py
index 5e380b3..6bb7747 100644
--- a/polygraph/types/tests/test_object_type.py
+++ b/polygraph/types/tests/test_object_type.py
@@ -1,3 +1,4 @@
+from types import SimpleNamespace
 from unittest import TestCase
 
 from polygraph.exceptions import PolygraphValueError
@@ -51,3 +52,53 @@ class SimpleObjectTypeTest(TestCase):
         hello_world = HelloWorldObject()
         with self.assertRaises(PolygraphValueError):
             hello_world.bad_resolver()
+
+
+class ObjectResolver(ObjectType):
+    @field()
+    def name(self) -> NonNull(String):
+        return self.full_name()
+
+    @field()
+    def age_in_2017(self) -> NonNull(Int):
+        return 2017 - self.root.birthyear
+
+    @field()
+    def always_none(self) -> String:
+        return self.root.address
+
+    @field()
+    def greeting(self) -> HelloWorldObject:
+        return HelloWorldObject()
+
+    def full_name(self):
+        return self.root.first_name + " " + self.root.last_name
+
+
+class ObjectResolverTest(TestCase):
+    def setUp(self):
+        obj = SimpleNamespace(
+            first_name="John",
+            last_name="Smith",
+            birthyear=2000,
+            address=None,
+        )
+        self.object_type = ObjectResolver(obj)
+
+    def test_method_is_not_automatically_field(self):
+        type_info = typedef(self.object_type)
+        fields = set([f.name for f in type_info.fields])
+        self.assertEqual(
+            fields,
+            set(["name", "age_in_2017", "always_none", "greeting"]),
+        )
+        self.assertNotIn("full_name", fields)
+
+    def test_simple_resolver(self):
+        self.assertEqual(self.object_type.name(), "John Smith")
+        self.assertEqual(self.object_type.age_in_2017(), 17)
+        self.assertEqual(self.object_type.always_none(), None)
+
+    def test_resolve_to_object(self):
+        greeting = self.object_type.greeting()
+        self.assertEqual(greeting.greet_world(), "Hello world!")
Repository: ppannuto/python-titlecase

Issue:
Small words are erroneously capitalized within hyphenated compound words
When `titlecase()` recurses to process separate words of a hyphenated
compound word, it passes on the current value of the `small_first_last` parameter unchanged. Naturally, this leads to incorrect title-casing
of compound words, containing small words.

For instance, words `end-to-end` and `work-in-progress` are currently
title-cased as `End-To-End` and `Work-In-Progress` instead of the
correct `End-to-End` and `Work-in-Progress`.

Comments:

Patch:
diff --git a/titlecase/__init__.py b/titlecase/__init__.py
index 050b6c5..65341c3 100755
--- a/titlecase/__init__.py
+++ b/titlecase/__init__.py
@@ -129,7 +129,7 @@ def titlecase(text, callback=None, small_first_last=True):
 
             if '-' in word:
                 hyphenated = map(
-                    lambda t: titlecase(t, callback, small_first_last),
+                    lambda t: titlecase(t, callback, False),
                     word.split('-')
                 )
                 tc_line.append("-".join(hyphenated))


Test patch:
diff --git a/titlecase/tests.py b/titlecase/tests.py
index e57e4f8..bfacf9d 100644
--- a/titlecase/tests.py
+++ b/titlecase/tests.py
@@ -31,6 +31,10 @@ TEST_DATA = (
         "dance with me/let’s face the music and dance",
         "Dance With Me/Let’s Face the Music and Dance"
     ),
+    (
+        "a-b end-to-end two-not-three/three-by-four/five-and",
+        "A-B End-to-End Two-Not-Three/Three-by-Four/Five-And"
+    ),
     (
         "34th 3rd 2nd",
         "34th 3rd 2nd"
Repository: pre-commit/pre-commit

Issue:
core.hooksPath being set makes it not possible to install
I have a laptop which has some mandaotry global settings for git, and I have not been able to enable pre-commit.  I also tried doing
```
git config --global init.templateDir ~/.git-template
pre-commit init-templatedir ~/.git-template
```
But still get the message
```
[ERROR] Cowardly refusing to install hooks with `core.hooksPath` set.
hint: `git config --unset-all core.hooksPath`
```

Is there any work arounds for this?

Comments:

Patch:
diff --git a/pre_commit/commands/install_uninstall.py b/pre_commit/commands/install_uninstall.py
index 9372176..b2ccc5c 100644
--- a/pre_commit/commands/install_uninstall.py
+++ b/pre_commit/commands/install_uninstall.py
@@ -123,7 +123,7 @@ def install(
         skip_on_missing_config: bool = False,
         git_dir: Optional[str] = None,
 ) -> int:
-    if git.has_core_hookpaths_set():
+    if git_dir is None and git.has_core_hookpaths_set():
         logger.error(
             'Cowardly refusing to install hooks with `core.hooksPath` set.\n'
             'hint: `git config --unset-all core.hooksPath`',


Test patch:
diff --git a/tests/commands/init_templatedir_test.py b/tests/commands/init_templatedir_test.py
index 4e32e75..d14a171 100644
--- a/tests/commands/init_templatedir_test.py
+++ b/tests/commands/init_templatedir_test.py
@@ -79,3 +79,14 @@ def test_init_templatedir_expanduser(tmpdir, tempdir_factory, store, cap_out):
     lines = cap_out.get().splitlines()
     assert len(lines) == 1
     assert lines[0].startswith('pre-commit installed at')
+
+
+def test_init_templatedir_hookspath_set(tmpdir, tempdir_factory, store):
+    target = tmpdir.join('tmpl')
+    tmp_git_dir = git_dir(tempdir_factory)
+    with cwd(tmp_git_dir):
+        cmd_output('git', 'config', '--local', 'core.hooksPath', 'hooks')
+        init_templatedir(
+            C.CONFIG_FILE, store, target, hook_types=['pre-commit'],
+        )
+    assert target.join('hooks/pre-commit').exists()
Repository: pre-commit/pre-commit

Issue:
Add warning for `files` / `exclude` containing `/*`
it's a common mistake to believe that those fields are globs, they're not -- they're regular expressions. (and matching `/*` is nonsense, it matches `''`, `'/'` as well as `'//////////////////////////////////////////////////////'`

Comments:

Patch:
diff --git a/pre_commit/clientlib.py b/pre_commit/clientlib.py
index 0b8582b..d619ea5 100644
--- a/pre_commit/clientlib.py
+++ b/pre_commit/clientlib.py
@@ -112,6 +112,18 @@ LOCAL = 'local'
 META = 'meta'
 
 
+class OptionalSensibleRegex(cfgv.OptionalNoDefault):
+    def check(self, dct: Dict[str, Any]) -> None:
+        super().check(dct)
+
+        if '/*' in dct.get(self.key, ''):
+            logger.warning(
+                f'The {self.key!r} field in hook {dct.get("id")!r} is a '
+                f"regex, not a glob -- matching '/*' probably isn't what you "
+                f'want here',
+            )
+
+
 class MigrateShaToRev:
     key = 'rev'
 
@@ -227,6 +239,8 @@ CONFIG_HOOK_DICT = cfgv.Map(
         for item in MANIFEST_HOOK_DICT.items
         if item.key != 'id'
     ),
+    OptionalSensibleRegex('files', cfgv.check_string),
+    OptionalSensibleRegex('exclude', cfgv.check_string),
 )
 CONFIG_REPO_DICT = cfgv.Map(
     'Repository', 'repo',


Test patch:
diff --git a/tests/clientlib_test.py b/tests/clientlib_test.py
index 2e2f738..bfb754b 100644
--- a/tests/clientlib_test.py
+++ b/tests/clientlib_test.py
@@ -166,6 +166,23 @@ def test_validate_warn_on_unknown_keys_at_top_level(tmpdir, caplog):
     ]
 
 
+def test_validate_optional_sensible_regex(caplog):
+    config_obj = {
+        'id': 'flake8',
+        'files': 'dir/*.py',
+    }
+    cfgv.validate(config_obj, CONFIG_HOOK_DICT)
+
+    assert caplog.record_tuples == [
+        (
+            'pre_commit',
+            logging.WARNING,
+            "The 'files' field in hook 'flake8' is a regex, not a glob -- "
+            "matching '/*' probably isn't what you want here",
+        ),
+    ]
+
+
 @pytest.mark.parametrize('fn', (validate_config_main, validate_manifest_main))
 def test_mains_not_ok(tmpdir, fn):
     not_yaml = tmpdir.join('f.notyaml')
Repository: pre-commit/pre-commit-hooks

Issue:
mixed-line-ending -- KeyError: b'\n'
`pre-commit 1.1.2`

```bash
Mixed line ending........................................................Failed
hookid: mixed-line-ending

Traceback (most recent call last):
  File "/home/gary/.cache/pre-commit/repos71slzol/py_env-python3.6/bin/mixed-line-ending", line 11, in <module>
    load_entry_point('pre-commit-hooks==0.9.4', 'console_scripts', 'mixed-line-ending')()
  File "/home/gary/.cache/pre-commit/repos71slzol/py_env-python3.6/lib/python3.6/site-packages/pre_commit_hooks/mixed_line_ending.py", line 78, in main
    retv |= fix_filename(filename, args.fix)
  File "/home/gary/.cache/pre-commit/repos71slzol/py_env-python3.6/lib/python3.6/site-packages/pre_commit_hooks/mixed_line_ending.py", line 58, in fix_filename
    del counts[target_ending]
KeyError: b'\n'
```
```yaml
-   repo: git://github.com/pre-commit/pre-commit-hooks
    sha: v0.9.4
    hooks:
    -   id: mixed-line-ending
        args: [--fix=lf]
```



Comments:

Patch:
diff --git a/pre_commit_hooks/mixed_line_ending.py b/pre_commit_hooks/mixed_line_ending.py
index 301c654..a163726 100644
--- a/pre_commit_hooks/mixed_line_ending.py
+++ b/pre_commit_hooks/mixed_line_ending.py
@@ -55,7 +55,8 @@ def fix_filename(filename, fix):
     else:
         target_ending = FIX_TO_LINE_ENDING[fix]
         # find if there are lines with *other* endings
-        del counts[target_ending]
+        # It's possible there's no line endings of the target type
+        counts.pop(target_ending, None)
         other_endings = bool(sum(counts.values()))
         if other_endings:
             _fix(filename, contents, target_ending)


Test patch:
diff --git a/tests/mixed_line_ending_test.py b/tests/mixed_line_ending_test.py
index 808295b..23837cd 100644
--- a/tests/mixed_line_ending_test.py
+++ b/tests/mixed_line_ending_test.py
@@ -101,3 +101,13 @@ def test_fix_crlf(tmpdir):
 
     assert ret == 1
     assert path.read_binary() == b'foo\r\nbar\r\nbaz\r\n'
+
+
+def test_fix_lf_all_crlf(tmpdir):
+    """Regression test for #239"""
+    path = tmpdir.join('input.txt')
+    path.write_binary(b'foo\r\nbar\r\n')
+    ret = main(('--fix=lf', path.strpath))
+
+    assert ret == 1
+    assert path.read_binary() == b'foo\nbar\n'
Repository: pre-commit/pre-commit-hooks

Issue:
end-of-file-fixer doesn't handle CRLF
When comparing the last two characters for consecutive `\n`, since `\r` doesn't match, it won't fix `\r\n\r\n\r\n` and so on. Noticed this in an old version (0.7.0), but it still applies to the latest (2.0.0) as well.

Comments:

Patch:
diff --git a/pre_commit_hooks/end_of_file_fixer.py b/pre_commit_hooks/end_of_file_fixer.py
index 4fe82b7..5ab1b7b 100644
--- a/pre_commit_hooks/end_of_file_fixer.py
+++ b/pre_commit_hooks/end_of_file_fixer.py
@@ -15,13 +15,13 @@ def fix_file(file_obj):
         return 0
     last_character = file_obj.read(1)
     # last_character will be '' for an empty file
-    if last_character != b'\n' and last_character != b'':
+    if last_character not in {b'\n', b'\r'} and last_character != b'':
         # Needs this seek for windows, otherwise IOError
         file_obj.seek(0, os.SEEK_END)
         file_obj.write(b'\n')
         return 1
 
-    while last_character == b'\n':
+    while last_character in {b'\n', b'\r'}:
         # Deal with the beginning of the file
         if file_obj.tell() == 1:
             # If we've reached the beginning of the file and it is all
@@ -35,13 +35,16 @@ def fix_file(file_obj):
         last_character = file_obj.read(1)
 
     # Our current position is at the end of the file just before any amount of
-    # newlines.  If we read two characters and get two newlines back we know
-    # there are extraneous newlines at the ned of the file.  Then backtrack and
-    # trim the end off.
-    if len(file_obj.read(2)) == 2:
-        file_obj.seek(-1, os.SEEK_CUR)
-        file_obj.truncate()
-        return 1
+    # newlines.  If we find extraneous newlines, then backtrack and trim them.
+    position = file_obj.tell()
+    remaining = file_obj.read()
+    for sequence in (b'\n', b'\r\n', b'\r'):
+        if remaining == sequence:
+            return 0
+        elif remaining.startswith(sequence):
+            file_obj.seek(position + len(sequence))
+            file_obj.truncate()
+            return 1
 
     return 0
 


Test patch:
diff --git a/tests/end_of_file_fixer_test.py b/tests/end_of_file_fixer_test.py
index ae899d2..f8710af 100644
--- a/tests/end_of_file_fixer_test.py
+++ b/tests/end_of_file_fixer_test.py
@@ -15,6 +15,10 @@ TESTS = (
     (b'foo', 1, b'foo\n'),
     (b'foo\n\n\n', 1, b'foo\n'),
     (b'\xe2\x98\x83', 1, b'\xe2\x98\x83\n'),
+    (b'foo\r\n', 0, b'foo\r\n'),
+    (b'foo\r\n\r\n\r\n', 1, b'foo\r\n'),
+    (b'foo\r', 0, b'foo\r'),
+    (b'foo\r\r\r\r', 1, b'foo\r'),
 )
Repository: pre-commit/pre-commit-hooks

Issue:
double-quote-string-fixer change linebreak on windows
I'm using `mixed-line-ending` and  `double-quote-string-fixer` on windows'
If `double-quote-string-fixer` changes file content, origin `LF` ending will be convert to `CRLF` ending.

Comments:

Patch:
diff --git a/pre_commit_hooks/string_fixer.py b/pre_commit_hooks/string_fixer.py
index a5ea1ea..a41b737 100644
--- a/pre_commit_hooks/string_fixer.py
+++ b/pre_commit_hooks/string_fixer.py
@@ -31,13 +31,13 @@ def handle_match(token_text):  # type: (str) -> str
 def get_line_offsets_by_line_no(src):  # type: (str) -> List[int]
     # Padded so we can index with line number
     offsets = [-1, 0]
-    for line in src.splitlines():
-        offsets.append(offsets[-1] + len(line) + 1)
+    for line in src.splitlines(True):
+        offsets.append(offsets[-1] + len(line))
     return offsets
 
 
 def fix_strings(filename):  # type: (str) -> int
-    with io.open(filename, encoding='UTF-8') as f:
+    with io.open(filename, encoding='UTF-8', newline='') as f:
         contents = f.read()
     line_offsets = get_line_offsets_by_line_no(contents)
 
@@ -58,8 +58,8 @@ def fix_strings(filename):  # type: (str) -> int
 
     new_contents = ''.join(splitcontents)
     if contents != new_contents:
-        with io.open(filename, 'w', encoding='UTF-8') as write_handle:
-            write_handle.write(new_contents)
+        with io.open(filename, 'w', encoding='UTF-8', newline='') as f:
+            f.write(new_contents)
         return 1
     else:
         return 0


Test patch:
diff --git a/tests/string_fixer_test.py b/tests/string_fixer_test.py
index a65213b..4adca4a 100644
--- a/tests/string_fixer_test.py
+++ b/tests/string_fixer_test.py
@@ -44,8 +44,15 @@ TESTS = (
 
 @pytest.mark.parametrize(('input_s', 'output', 'expected_retval'), TESTS)
 def test_rewrite(input_s, output, expected_retval, tmpdir):
-    path = tmpdir.join('file.txt')
+    path = tmpdir.join('file.py')
     path.write(input_s)
     retval = main([path.strpath])
     assert path.read() == output
     assert retval == expected_retval
+
+
+def test_rewrite_crlf(tmpdir):
+    f = tmpdir.join('f.py')
+    f.write_binary(b'"foo"\r\n"bar"\r\n')
+    assert main((f.strpath,))
+    assert f.read_binary() == b"'foo'\r\n'bar'\r\n"
Repository: pre-commit/pre-commit-hooks

Issue:
requirements-txt-fixer corrupts file if no new line at end
a file with
```
a
b
c
```
(no new line)
will get "fixed" to:
```
a
bc

```

I was able to debug and identify the issue, I'll be happy to also PR a fix but I was wondering if there is really a use for it? I've not seen any input without a new line at the end in the tests cases and as a work around I can add `end-of-file-fixer` before it.



Comments:

Patch:
diff --git a/pre_commit_hooks/requirements_txt_fixer.py b/pre_commit_hooks/requirements_txt_fixer.py
index 4575975..eff7935 100644
--- a/pre_commit_hooks/requirements_txt_fixer.py
+++ b/pre_commit_hooks/requirements_txt_fixer.py
@@ -40,11 +40,16 @@ class Requirement(object):
 
 def fix_requirements(f):  # type: (IO[bytes]) -> int
     requirements = []  # type: List[Requirement]
-    before = tuple(f)
+    before = list(f)
     after = []  # type: List[bytes]
 
     before_string = b''.join(before)
 
+    # adds new line in case one is missing
+    # AND a change to the requirements file is needed regardless:
+    if before and not before[-1].endswith(b'\n'):
+        before[-1] += b'\n'
+
     # If the file is empty (i.e. only whitespace/newlines) exit early
     if before_string.strip() == b'':
         return PASS


Test patch:
diff --git a/tests/requirements_txt_fixer_test.py b/tests/requirements_txt_fixer_test.py
index c7c6e47..2e2eab6 100644
--- a/tests/requirements_txt_fixer_test.py
+++ b/tests/requirements_txt_fixer_test.py
@@ -15,6 +15,9 @@ from pre_commit_hooks.requirements_txt_fixer import Requirement
         (b'foo\n# comment at end\n', PASS, b'foo\n# comment at end\n'),
         (b'foo\nbar\n', FAIL, b'bar\nfoo\n'),
         (b'bar\nfoo\n', PASS, b'bar\nfoo\n'),
+        (b'a\nc\nb\n', FAIL, b'a\nb\nc\n'),
+        (b'a\nc\nb', FAIL, b'a\nb\nc\n'),
+        (b'a\nb\nc', FAIL, b'a\nb\nc\n'),
         (
             b'#comment1\nfoo\n#comment2\nbar\n',
             FAIL,
Repository: pre-commit/pre-commit-hooks

Issue:
error loading a removed hook
when load a removed hook throw this error

```
Flake8 (removed).........................................................Failed
- hook id: flake8
- exit code: 1

Traceback (most recent call last):
  File "/Users/pedro/.cache/pre-commit/repo3ku28fr9/py_env-python3.8/bin/pre-commit-hooks-removed", line 8, in <module>
    sys.exit(main())
  File "/Users/pedro/.cache/pre-commit/repo3ku28fr9/py_env-python3.8/lib/python3.8/site-packages/pre_commit_hooks/removed.py", line 8, in main
    hookid, new_hookid, url = argv
ValueError: too many values to unpack (expected 3)
```

Comments:

Patch:
diff --git a/pre_commit_hooks/removed.py b/pre_commit_hooks/removed.py
index 9710b2d..60df096 100644
--- a/pre_commit_hooks/removed.py
+++ b/pre_commit_hooks/removed.py
@@ -5,7 +5,7 @@ from typing import Sequence
 
 def main(argv: Optional[Sequence[str]] = None) -> int:
     argv = argv if argv is not None else sys.argv[1:]
-    hookid, new_hookid, url = argv
+    hookid, new_hookid, url = argv[:3]
     raise SystemExit(
         f'`{hookid}` has been removed -- use `{new_hookid}` from {url}',
     )


Test patch:
diff --git a/tests/removed_test.py b/tests/removed_test.py
index 83df164..d635eb1 100644
--- a/tests/removed_test.py
+++ b/tests/removed_test.py
@@ -8,6 +8,7 @@ def test_always_fails():
         main((
             'autopep8-wrapper', 'autopep8',
             'https://github.com/pre-commit/mirrors-autopep8',
+            '--foo', 'bar',
         ))
     msg, = excinfo.value.args
     assert msg == (