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

Issue:
Indentation mistake
In sha1.py
=========

On final_hash method ,the "self.hash=..." code line should be tabbed once ,
Else the hash of string more than 64 bytes outputs the wrong result


Discussion:
Are you making a PR or should I do it 
Just making a PR , thank u tho , ;)
Yep, if you need help hmu 

Resolving patch:
diff --git a/hashes/sha1.py b/hashes/sha1.py
--- a/hashes/sha1.py
+++ b/hashes/sha1.py
@@ -118,13 +118,13 @@ def final_hash(self):
                     c,
                     d,
                 )
-        self.h = (
-            self.h[0] + a & 0xFFFFFFFF,
-            self.h[1] + b & 0xFFFFFFFF,
-            self.h[2] + c & 0xFFFFFFFF,
-            self.h[3] + d & 0xFFFFFFFF,
-            self.h[4] + e & 0xFFFFFFFF,
-        )
+            self.h = (
+                self.h[0] + a & 0xFFFFFFFF,
+                self.h[1] + b & 0xFFFFFFFF,
+                self.h[2] + c & 0xFFFFFFFF,
+                self.h[3] + d & 0xFFFFFFFF,
+                self.h[4] + e & 0xFFFFFFFF,
+            )
         return "%08x%08x%08x%08x%08x" % tuple(self.h)
 
 


Test patch:
Repository: TheAlgorithms/Python

Issue:
Bug with union in disjoint_set
https://github.com/TheAlgorithms/Python/blob/master/data_structures/disjoint_set/disjoint_set.py
```python
def union_set(x, y):
    """
    union two sets.
    set with bigger rank should be parent, so that the
    disjoint set tree will be more flat.
    """
    x, y = find_set(x), find_set(y)
    if x.rank > y.rank:
        y.parent = x
    else:
        x.parent = y
        if x.rank == y.rank:
            y.rank += 1
```

here need check if x==y

Bug with union in disjoint_set
https://github.com/TheAlgorithms/Python/blob/master/data_structures/disjoint_set/disjoint_set.py
```python
def union_set(x, y):
    """
    union two sets.
    set with bigger rank should be parent, so that the
    disjoint set tree will be more flat.
    """
    x, y = find_set(x), find_set(y)
    if x.rank > y.rank:
        y.parent = x
    else:
        x.parent = y
        if x.rank == y.rank:
            y.rank += 1
```

here need check if x==y



Discussion:

Resolving patch:
diff --git a/data_structures/disjoint_set/disjoint_set.py b/data_structures/disjoint_set/disjoint_set.py
--- a/data_structures/disjoint_set/disjoint_set.py
+++ b/data_structures/disjoint_set/disjoint_set.py
@@ -26,7 +26,10 @@ def union_set(x, y):
     disjoint set tree will be more flat.
     """
     x, y = find_set(x), find_set(y)
-    if x.rank > y.rank:
+    if x == y:
+        return
+
+    elif x.rank > y.rank:
         y.parent = x
     else:
         x.parent = y


Test patch:
Repository: TheAlgorithms/Python

Issue:
Strings - Unique character check
Given a string S, check if all characters in the string is unique or not.


Discussion:
I would like to work on this issue
please assign it to me
Can I be considered for this? Thx
Thanks a lot On 05-Oct-2021 3:22 PM, carlospatinos ***@***.***> wrote:
Can I be considered for this? Thx

—You are receiving this because you are subscribed to this thread.Reply to this email directly, view it on GitHub, or unsubscribe.
Hello, I would also like to work on this issue

is it still open cause I wanna do this ✋ 

Resolving patch:
diff --git a/strings/is_contains_unique_chars.py b/strings/is_contains_unique_chars.py
new file mode 100644
--- /dev/null
+++ b/strings/is_contains_unique_chars.py
@@ -0,0 +1,31 @@
+def is_contains_unique_chars(input_str: str) -> bool:
+    """
+    Check if all characters in the string is unique or not.
+    >>> is_contains_unique_chars("I_love.py")
+    True
+    >>> is_contains_unique_chars("I don't love Python")
+    False
+
+    Time complexity: O(n)
+    Space compexity: O(1) 19320 bytes as we are having 144697 characters in unicode
+    """
+
+    # Each bit will represent each unicode character
+    # For example 65th bit representing 'A'
+    # https://stackoverflow.com/a/12811293
+    bitmap = 0
+    for ch in input_str:
+        ch_unicode = ord(ch)
+        ch_bit_index_on = pow(2, ch_unicode)
+
+        # If we already turned on bit for current character's unicode
+        if bitmap >> ch_unicode & 1 == 1:
+            return False
+        bitmap |= ch_bit_index_on
+    return True
+
+
+if __name__ == "__main__":
+    import doctest
+
+    doctest.testmod()


Test patch:
Repository: TheAlgorithms/Python

Issue:
Rewrite *other* fibonacci.py
I opened issue #5665 to have `fibonacci.py` rewritten, but apparently there are multiple files with that name. The PR that @citharus made (#5677) revamps the file `dynamic_programming/fibonacci.py` (thanks for your contributions btw!) whereas this issue seeks to revamp the file `maths/fibonacci.py`.

I'm opening this as a new issue since it's technically a different algorithm file and the two `fibonacci.py` files each use different algorithms to calculate the Fibonacci sequence.


Discussion:

Resolving patch:
diff --git a/maths/fibonacci.py b/maths/fibonacci.py
--- a/maths/fibonacci.py
+++ b/maths/fibonacci.py
@@ -95,8 +95,8 @@ def fib_binet(n: int) -> list[int]:
     NOTE 1: this function diverges from fib_iterative at around n = 71, likely
     due to compounding floating-point arithmetic errors
 
-    NOTE 2: this function overflows on n >= 1475 because of the size limitations
-    of Python floats
+    NOTE 2: this function doesn't accept n >= 1475 because it overflows
+    thereafter due to the size limitations of Python floats
     >>> fib_binet(0)
     [0]
     >>> fib_binet(1)


Test patch:
Repository: TheAlgorithms/Python

Issue:
Merge insertion sort doesn't work
```
>>> merge_insertion_sort([0, 1, 2, 3, 4])
[0, 2, 1, 3, 4]
```

Cc @ulwlu #2211 [`sorts/merge_insertion_sort.py`](../blob/master/sorts/merge_insertion_sort.py)


Discussion:
In general I suggest you test all your sort algorithms on [all permutations](https://docs.python.org/3/library/itertools.html#itertools.permutations) of `range(0, 5)`. That's only 120 permutations.
This sounds like a great idea.  There are test that all Euler solutions have to pass and you could create something similar for the sort algorithms.
Hello, I'd like to take up this Issue with a fellow student of mine. (@yellowsto)
We would like to take a look at Merge Insertion Sort to fix it and write Test Cases for at least that Sort, as suggested above. 

We are both new to Open Source, but happy to learn! (so far we've read your contribution guidelines and some short tutorials how to work with github)

Could we get this Issue assigned? 
@AilisOsswald Issues aren't really assigned here, anybody can work on them. You just have to open a PR with the changes that you plan to make. The maintainers will review it and merge it if it looks good :)

Resolving patch:
diff --git a/sorts/merge_insertion_sort.py b/sorts/merge_insertion_sort.py
--- a/sorts/merge_insertion_sort.py
+++ b/sorts/merge_insertion_sort.py
@@ -30,6 +30,12 @@ def merge_insertion_sort(collection: list[int]) -> list[int]:
 
     >>> merge_insertion_sort([-2, -5, -45])
     [-45, -5, -2]
+
+    Testing with all permutations on range(0,5):
+    >>> import itertools
+    >>> permutations = list(itertools.permutations([0, 1, 2, 3, 4]))
+    >>> all(merge_insertion_sort(p) == [0, 1, 2, 3, 4] for p in permutations)
+    True
     """
 
     def binary_search_insertion(sorted_list, item):
@@ -160,7 +166,7 @@ def merge(left, right):
     """
     is_last_odd_item_inserted_before_this_index = False
     for i in range(len(sorted_list_2d) - 1):
-        if result[i] == collection[-i]:
+        if result[i] == collection[-1] and has_last_odd_item:
             is_last_odd_item_inserted_before_this_index = True
         pivot = sorted_list_2d[i][1]
         # If last_odd_item is inserted before the item's index,


Test patch:
Repository: TheAlgorithms/Python

Issue:
DSA-Matrix-Python- Minimum Path sum
Hey there, I'm participating in #hactoberfest2k21, Please assign me the issue. Good day!
Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right, which minimizes the sum of all numbers along its path.You can only move either down or right at any point in time.
Example:
Input: grid = [[1,3,1],[1,5,1],[4,2,1]]
Output: 7



Discussion:
Please assign me this issue. I am a good programmer and a beginner at open source. I would give it my best!
Please assign me this issue. I want to take my first steps towards contributing in open-source.
Hello please assigne me this issue.I am  a beginner at open source and want to hone my skills.
`I can do this! please assign me this issue`
I can complete this Pythagoras Generator, Please assign this to me
I am new to opensource and I am willing to learn and contribute.

Resolving patch:
diff --git a/graphs/minimum_path_sum.py b/graphs/minimum_path_sum.py
new file mode 100644
--- /dev/null
+++ b/graphs/minimum_path_sum.py
@@ -0,0 +1,63 @@
+def min_path_sum(grid: list) -> int:
+    """
+    Find the path from top left to bottom right of array of numbers
+    with the lowest possible sum and return the sum along this path.
+    >>> min_path_sum([
+    ...     [1, 3, 1],
+    ...     [1, 5, 1],
+    ...     [4, 2, 1],
+    ... ])
+    7
+
+    >>> min_path_sum([
+    ...     [1, 0, 5, 6, 7],
+    ...     [8, 9, 0, 4, 2],
+    ...     [4, 4, 4, 5, 1],
+    ...     [9, 6, 3, 1, 0],
+    ...     [8, 4, 3, 2, 7],
+    ... ])
+    20
+
+    >>> min_path_sum(None)
+    Traceback (most recent call last):
+        ...
+    TypeError: The grid does not contain the appropriate information
+
+    >>> min_path_sum([[]])
+    Traceback (most recent call last):
+        ...
+    TypeError: The grid does not contain the appropriate information
+    """
+
+    if not grid or not grid[0]:
+        raise TypeError("The grid does not contain the appropriate information")
+
+    for cell_n in range(1, len(grid[0])):
+        grid[0][cell_n] += grid[0][cell_n - 1]
+    row_above = grid[0]
+
+    for row_n in range(1, len(grid)):
+        current_row = grid[row_n]
+        grid[row_n] = fill_row(current_row, row_above)
+        row_above = grid[row_n]
+
+    return grid[-1][-1]
+
+
+def fill_row(current_row: list, row_above: list) -> list:
+    """
+    >>> fill_row([2, 2, 2], [1, 2, 3])
+    [3, 4, 5]
+    """
+
+    current_row[0] += row_above[0]
+    for cell_n in range(1, len(current_row)):
+        current_row[cell_n] += min(current_row[cell_n - 1], row_above[cell_n])
+
+    return current_row
+
+
+if __name__ == "__main__":
+    import doctest
+
+    doctest.testmod()


Test patch:
Repository: TheAlgorithms/Python

Issue:
[suggestion] use relative path in DIRECTORY.md
when openning DIRECTORY.md in local machine, the links in it refers to https://github.com/TheAlgorithms/Python/blob/master/xxx.

it's not convinient for reading locally.

I suggest to make a new file "TOC.md", which removes "https://github.com/TheAlgorithms/Python/blob/master/" in every link.


Discussion:
This makes perfect sense! Do you know if the relative path resolution is supported by GitHub?

Resolving patch:
diff --git a/scripts/build_directory_md.py b/scripts/build_directory_md.py
--- a/scripts/build_directory_md.py
+++ b/scripts/build_directory_md.py
@@ -3,8 +3,6 @@
 import os
 from typing import Iterator
 
-URL_BASE = "https://github.com/TheAlgorithms/Python/blob/master"
-
 
 def good_file_paths(top_dir: str = ".") -> Iterator[str]:
     for dir_path, dir_names, filenames in os.walk(top_dir):
@@ -36,7 +34,7 @@ def print_directory_md(top_dir: str = ".") -> None:
         if filepath != old_path:
             old_path = print_path(old_path, filepath)
         indent = (filepath.count(os.sep) + 1) if filepath else 0
-        url = "/".join((URL_BASE, filepath, filename)).replace(" ", "%20")
+        url = "/".join((filepath, filename)).replace(" ", "%20")
         filename = os.path.splitext(filename.replace("_", " ").title())[0]
         print(f"{md_prefix(indent)} [{filename}]({url})")
 


Test patch:
Repository: TheAlgorithms/Python

Issue:
Enter the logic for hash table
### Describe your change:



* [ ] Add an algorithm?
* [ ] Fix a bug or typo in an existing algorithm?
* [x] Documentation change?

### Checklist:
* [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md).
* [x] This pull request is all my own work -- I have not plagiarized.
* [x] I know that pull requests will not be merged if they fail the automated tests.
* [ ] This PR only changes one algorithm file.  To ease review, please open separate PRs for separate algorithms.
* [ ] All new Python files are placed inside an existing directory.
* [x] All filenames are in all lowercase characters with no spaces or dashes.
* [x] All functions and variable names follow Python naming conventions.
* [x] All function parameters and return values are annotated with Python [type hints](https://docs.python.org/3/library/typing.html).
* [x] All functions have [doctests](https://docs.python.org/3/library/doctest.html) that pass the automated testing.
* [ ] All new algorithms have a URL in its comments that points to Wikipedia or other similar explanation.
* [ ] If this pull request resolves one or more open issues then the commit message contains `Fixes: #{$ISSUE_NO}`.



Discussion:

Resolving patch:
diff --git a/data_structures/hashing/double_hash.py b/data_structures/hashing/double_hash.py
--- a/data_structures/hashing/double_hash.py
+++ b/data_structures/hashing/double_hash.py
@@ -1,4 +1,16 @@
 #!/usr/bin/env python3
+"""
+Double hashing is a collision resolving technique in Open Addressed Hash tables.
+Double hashing uses the idea of applying a second hash function to key when a collision
+occurs. The advantage of Double hashing is that it is one of the best form of  probing,
+producing a uniform distribution of records throughout a hash table. This technique
+does not yield any clusters. It is one of effective method for resolving collisions.
+
+Double hashing can be done using: (hash1(key) + i * hash2(key)) % TABLE_SIZE
+Where hash1() and hash2() are hash functions and TABLE_SIZE is size of hash table.
+
+Reference: https://en.wikipedia.org/wiki/Double_hashing
+"""
 from .hash_table import HashTable
 from .number_theory.prime_numbers import is_prime, next_prime
 


Test patch:
Repository: TheAlgorithms/Python

Issue:
Convert snake_case to camelCase or PascalCase
### Feature description

An algorithm that given a string formatted as snake_case returns it as camelCase or PascalCase depending on Boolean parameter.

Examples:

`def snake_to_camel_case(input: str, use_pascal: bool = False) -> str`
`snake_to_camel_case('some_string_in_snake_case') -> 'someStringInSnakeCase'`
`snake_to_camel_case('some_string_in_snake_case', True) -> 'SomeStringInSnakeCase'`

### Would you like to work on this feature?

- [X] Yes, I want to work on this feature!


Discussion:
Please assign it to me, I have almost finished it

Resolving patch:
diff --git a/strings/snake_case_to_camel_pascal_case.py b/strings/snake_case_to_camel_pascal_case.py
new file mode 100644
--- /dev/null
+++ b/strings/snake_case_to_camel_pascal_case.py
@@ -0,0 +1,52 @@
+def snake_to_camel_case(input: str, use_pascal: bool = False) -> str:
+    """
+    Transforms a snake_case given string to camelCase (or PascalCase if indicated)
+    (defaults to not use Pascal)
+
+    >>> snake_to_camel_case("some_random_string")
+    'someRandomString'
+
+    >>> snake_to_camel_case("some_random_string", use_pascal=True)
+    'SomeRandomString'
+
+    >>> snake_to_camel_case("some_random_string_with_numbers_123")
+    'someRandomStringWithNumbers123'
+
+    >>> snake_to_camel_case("some_random_string_with_numbers_123", use_pascal=True)
+    'SomeRandomStringWithNumbers123'
+
+    >>> snake_to_camel_case(123)
+    Traceback (most recent call last):
+        ...
+    ValueError: Expected string as input, found <class 'int'>
+
+    >>> snake_to_camel_case("some_string", use_pascal="True")
+    Traceback (most recent call last):
+        ...
+    ValueError: Expected boolean as use_pascal parameter, found <class 'str'>
+    """
+
+    if not isinstance(input, str):
+        raise ValueError(f"Expected string as input, found {type(input)}")
+    if not isinstance(use_pascal, bool):
+        raise ValueError(
+            f"Expected boolean as use_pascal parameter, found {type(use_pascal)}"
+        )
+
+    words = input.split("_")
+
+    start_index = 0 if use_pascal else 1
+
+    words_to_capitalize = words[start_index:]
+
+    capitalized_words = [word[0].upper() + word[1:] for word in words_to_capitalize]
+
+    initial_word = "" if use_pascal else words[0]
+
+    return "".join([initial_word] + capitalized_words)
+
+
+if __name__ == "__main__":
+    from doctest import testmod
+
+    testmod()


Test patch:
Repository: TheAlgorithms/Python

Issue:
Add typing to maths/segmented_sieve.py
### Describe your change:



* [ ] Add an algorithm?
* [ ] Fix a bug or typo in an existing algorithm?
* [ ] Documentation change?

### Checklist:
* [ ] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md).
* [ ] This pull request is all my own work -- I have not plagiarized.
* [ ] I know that pull requests will not be merged if they fail the automated tests.
* [ ] This PR only changes one algorithm file.  To ease review, please open separate PRs for separate algorithms.
* [ ] All new Python files are placed inside an existing directory.
* [ ] All filenames are in all lowercase characters with no spaces or dashes.
* [ ] All functions and variable names follow Python naming conventions.
* [ ] All function parameters and return values are annotated with Python [type hints](https://docs.python.org/3/library/typing.html).
* [ ] All functions have [doctests](https://docs.python.org/3/library/doctest.html) that pass the automated testing.
* [ ] All new algorithms have a URL in its comments that points to Wikipedia or other similar explanation.
* [ ] If this pull request resolves one or more open issues then the commit message contains `Fixes: #{$ISSUE_NO}`.



Discussion:
# Closing this pull request as invalid

@saksham-chawla, this pull request is being closed as none of the checkboxes have been marked. It is important that you go through the checklist and mark the ones relevant to this pull request. Please read the [Contributing guidelines](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md).

If you're facing any problem on how to mark a checkbox, please read the following instructions:
- Read a point one at a time and think if it is relevant to the pull request or not.
- If it is, then mark it by putting a `x` between the square bracket like so: `[x]`

***NOTE: Only `[x]` is supported so if you have put any other letter or symbol between the brackets, that will be marked as invalid. If that is the case then please open a new pull request with the appropriate changes.***

Can't open this because of multiple open PRs @cclauss @Kush1101

Resolving patch:
diff --git a/maths/segmented_sieve.py b/maths/segmented_sieve.py
--- a/maths/segmented_sieve.py
+++ b/maths/segmented_sieve.py
@@ -3,7 +3,7 @@
 import math
 
 
-def sieve(n):
+def sieve(n: int) -> list[int]:
     """Segmented Sieve."""
     in_prime = []
     start = 2


Test patch:
Repository: TheAlgorithms/Python

Issue:
[PYTEST WARNING] Horn schunk
### Feature description

@skief @poyea Please could you resolve this warning
```
computer_vision/horn_schunck.py:15
  /home/runner/work/Python/Python/computer_vision/horn_schunck.py:15:
    DeprecationWarning: Please use `convolve` from the `scipy.ndimage` namespace, the `scipy.ndimage.filters` namespace is deprecated.
    from scipy.ndimage.filters import convolve
```

origin: #7211


Discussion:

Resolving patch:
diff --git a/computer_vision/horn_schunck.py b/computer_vision/horn_schunck.py
--- a/computer_vision/horn_schunck.py
+++ b/computer_vision/horn_schunck.py
@@ -12,7 +12,7 @@
 from typing import SupportsIndex
 
 import numpy as np
-from scipy.ndimage.filters import convolve
+from scipy.ndimage import convolve
 
 
 def warp(


Test patch:
Repository: TheAlgorithms/Python

Issue:
Update gaussian_naive_bayes.py
Using the seaborn.heatmap library to plot the confusion matrix instead of the plot_confusion_matrix method from the sklearn.metrics module.

### Describe your change:
Adding to the previous update, to avoid a warning that the plot_confusion_matrix method from the sklearn.metrics throws, I have used the heatmap module of seaborn which takes an argument - the confusion matrix obtained from the confusion_matrix method in the sklearn.metrics library.


* [ ] Add an algorithm?
* [x] Fix a bug or typo in an existing algorithm?
* [ ] Documentation change?

### Checklist:
* [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md).
* [x] This pull request is all my own work -- I have not plagiarized.
* [x] I know that pull requests will not be merged if they fail the automated tests.
* [x] This PR only changes one algorithm file.  To ease review, please open separate PRs for separate algorithms.
* [x] All new Python files are placed inside an existing directory.
* [x] All filenames are in all lowercase characters with no spaces or dashes.
* [x] All functions and variable names follow Python naming conventions.
* [x] All function parameters and return values are annotated with Python [type hints](https://docs.python.org/3/library/typing.html).
* [x] All functions have [doctests](https://docs.python.org/3/library/doctest.html) that pass the automated testing.
* [x] All new algorithms have a URL in its comments that points to Wikipedia or other similar explanation.
* [x] If this pull request resolves one or more open issues then the commit message contains `Fixes: #{$ISSUE_NO}`.



Discussion:

Resolving patch:
diff --git a/machine_learning/gaussian_naive_bayes.py b/machine_learning/gaussian_naive_bayes.py
--- a/machine_learning/gaussian_naive_bayes.py
+++ b/machine_learning/gaussian_naive_bayes.py
@@ -1,7 +1,9 @@
 # Gaussian Naive Bayes Example
+import time
+
 from matplotlib import pyplot as plt
 from sklearn.datasets import load_iris
-from sklearn.metrics import plot_confusion_matrix
+from sklearn.metrics import accuracy_score, plot_confusion_matrix
 from sklearn.model_selection import train_test_split
 from sklearn.naive_bayes import GaussianNB
 
@@ -25,7 +27,9 @@ def main():
 
     # Gaussian Naive Bayes
     nb_model = GaussianNB()
-    nb_model.fit(x_train, y_train)
+    time.sleep(2.9)
+    model_fit = nb_model.fit(x_train, y_train)
+    y_pred = model_fit.predict(x_test)  # Predictions on the test set
 
     # Display Confusion Matrix
     plot_confusion_matrix(
@@ -33,12 +37,16 @@ def main():
         x_test,
         y_test,
         display_labels=iris["target_names"],
-        cmap="Blues",
+        cmap="Blues",  # although, Greys_r has a better contrast...
         normalize="true",
     )
     plt.title("Normalized Confusion Matrix - IRIS Dataset")
     plt.show()
 
+    time.sleep(1.8)
+    final_accuracy = 100 * accuracy_score(y_true=y_test, y_pred=y_pred)
+    print(f"The overall accuracy of the model is: {round(final_accuracy, 2)}%")
+
 
 if __name__ == "__main__":
     main()


Test patch: