mirror of
https://github.com/TheAlgorithms/Python.git
synced 2026-03-13 09:50:19 +08:00
Replace bandit, flake8, isort, and pyupgrade with ruff (#8178)
* Replace bandit, flake8, isort, and pyupgrade with ruff
* Comment on ruff rules
* updating DIRECTORY.md
---------
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
wiki: https://en.wikipedia.org/wiki/Anagram
|
||||
"""
|
||||
from collections import defaultdict
|
||||
from typing import DefaultDict
|
||||
|
||||
|
||||
def check_anagrams(first_str: str, second_str: str) -> bool:
|
||||
@@ -30,7 +29,7 @@ def check_anagrams(first_str: str, second_str: str) -> bool:
|
||||
return False
|
||||
|
||||
# Default values for count should be 0
|
||||
count: DefaultDict[str, int] = defaultdict(int)
|
||||
count: defaultdict[str, int] = defaultdict(int)
|
||||
|
||||
# For each character in input strings,
|
||||
# increment count in the corresponding
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
# Created by sarathkaul on 17/11/19
|
||||
# Modified by Arkadip Bhattacharya(@darkmatter18) on 20/04/2020
|
||||
from collections import defaultdict
|
||||
from typing import DefaultDict
|
||||
|
||||
|
||||
def word_occurrence(sentence: str) -> dict:
|
||||
@@ -15,7 +14,7 @@ def word_occurrence(sentence: str) -> dict:
|
||||
>>> dict(word_occurrence("Two spaces"))
|
||||
{'Two': 1, 'spaces': 1}
|
||||
"""
|
||||
occurrence: DefaultDict[str, int] = defaultdict(int)
|
||||
occurrence: defaultdict[str, int] = defaultdict(int)
|
||||
# Creating a dictionary containing count of each word
|
||||
for word in sentence.split():
|
||||
occurrence[word] += 1
|
||||
|
||||
Reference in New Issue
Block a user