Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Oct 10, 2025
commit f5a85da963321b8520158102016b75017e11b5b7
1 change: 1 addition & 0 deletions data_structures/strings/allunique.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
def has_unique_chars(s):

Check failure on line 1 in data_structures/strings/allunique.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (INP001)

data_structures/strings/allunique.py:1:1: INP001 File `data_structures/strings/allunique.py` is part of an implicit namespace package. Add an `__init__.py`.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As there is no test file in this pull request nor any test function or class in the file data_structures/strings/allunique.py, please provide doctest for the function has_unique_chars

Please provide return type hint for the function: has_unique_chars. If the function does not return a value, please provide the type hint as: def function() -> None:

Please provide type hint for the parameter: s

Please provide descriptive name for the parameter: s

seen = set()
for char in s:
if char in seen:
Expand All @@ -6,6 +6,7 @@
seen.add(char)
return True


# Example
s = "abcdefga"
print("Unique Characters:", has_unique_chars(s))
2 changes: 2 additions & 0 deletions data_structures/strings/anagram.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
from collections import Counter

Check failure on line 1 in data_structures/strings/anagram.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (INP001)

data_structures/strings/anagram.py:1:1: INP001 File `data_structures/strings/anagram.py` is part of an implicit namespace package. Add an `__init__.py`.


def are_anagrams(s1, s2):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As there is no test file in this pull request nor any test function or class in the file data_structures/strings/anagram.py, please provide doctest for the function are_anagrams

Please provide return type hint for the function: are_anagrams. If the function does not return a value, please provide the type hint as: def function() -> None:

Please provide type hint for the parameter: s1

Please provide type hint for the parameter: s2

return Counter(s1) == Counter(s2)


# Example
print("Anagram:", are_anagrams("listen", "silent"))
1 change: 1 addition & 0 deletions data_structures/strings/frequencyofeachchar.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
def char_frequency(s):

Check failure on line 1 in data_structures/strings/frequencyofeachchar.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (INP001)

data_structures/strings/frequencyofeachchar.py:1:1: INP001 File `data_structures/strings/frequencyofeachchar.py` is part of an implicit namespace package. Add an `__init__.py`.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As there is no test file in this pull request nor any test function or class in the file data_structures/strings/frequencyofeachchar.py, please provide doctest for the function char_frequency

Please provide return type hint for the function: char_frequency. If the function does not return a value, please provide the type hint as: def function() -> None:

Please provide type hint for the parameter: s

Please provide descriptive name for the parameter: s

freq = {}
for char in s:
freq[char] = freq.get(char, 0) + 1
return freq


# Example
print(char_frequency("datastructure"))
3 changes: 2 additions & 1 deletion data_structures/strings/reverseword.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
def reverse_words(sentence):

Check failure on line 1 in data_structures/strings/reverseword.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (INP001)

data_structures/strings/reverseword.py:1:1: INP001 File `data_structures/strings/reverseword.py` is part of an implicit namespace package. Add an `__init__.py`.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As there is no test file in this pull request nor any test function or class in the file data_structures/strings/reverseword.py, please provide doctest for the function reverse_words

Please provide return type hint for the function: reverse_words. If the function does not return a value, please provide the type hint as: def function() -> None:

Please provide type hint for the parameter: sentence

words = sentence.split()
stack = []
for word in words:
stack.append(word)
reversed_sentence = ' '.join(stack[::-1])
reversed_sentence = " ".join(stack[::-1])
return reversed_sentence


# Example
print(reverse_words("Data Structures in Python"))
Loading