Skip to content

Commit 3fa0f83

Browse files
authored
Merge pull request #662 from sir-gon/develop
Develop
2 parents ec9e703 + 058f2d3 commit 3fa0f83

File tree

115 files changed

+376
-358
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

115 files changed

+376
-358
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,3 +181,6 @@ cython_debug/
181181

182182
# Sarif
183183
*.sarif
184+
185+
# SonarQube sonar-scanner (cli)
186+
.scannerwork

.pylintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,7 @@ const-naming-style=UPPER_CASE
552552
docstring-min-length=-1
553553

554554
# Naming style matching correct function names.
555-
function-naming-style=snake_case
555+
function-naming-style=camelCase
556556

557557
# Regular expression matching correct function names. Overrides function-
558558
# naming-style. If left empty, function names will be checked with the set

Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,15 +118,15 @@ upgrade:
118118
${PACKAGE_TOOL} list --outdated | cut -f1 -d' ' | tr " " "\n" | awk '{if(NR>=3)print}' | cut -d' ' -f1 | xargs -n1 pip3 install -U
119119

120120
clean:
121-
${PACKAGE_TOOL} freeze > unins ; pip3 uninstall -y -r unins ; rm unins
121+
${PACKAGE_TOOL} freeze > unins ; ${PACKAGE_TOOL} uninstall -y -r unins ; rm unins
122122
rm -f .coverage
123123
rm -fr .pytest_cache
124124
rm -fr htmlcov
125125
rm -fr coverage
126126
rm -fr build
127-
find . -path "*/*.pyc" -delete -print
128-
find . -path "*/*.pyo" -delete -print
129-
find . -path "*/__pycache__" -type d -print -exec rm -fr {} ';'
127+
find . -path "*/*.pyc" -delete -print || true
128+
find . -path "*/*.pyo" -delete -print || true
129+
find . -path "*/__pycache__" -type d -print -exec rm -fr {} ';' || true
130130

131131
compose/build: env
132132
${DOCKER_COMPOSE} --profile lint build

docs/hackerrank/interview_preparation_kit/linked_lists/insert-a-node-into-a-sorted-doubly-linked-list.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# [Linked Lists: Insert a node at a specific position in a linked list](https://www.hackerrank.com/challenges/insert-a-node-at-a-specific-position-in-a-linked-list)
1+
# [Linked Lists: Insert a node at a specific position in a linked list](https://www.hackerrank.com/challenges/insert-a-node-into-a-sorted-doubly-linked-list)
22

33
Create a node with a given value and insert it into a sorted doubly-linked list
44

sonar-project.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,4 @@ sonar.issue.ignore.multicriteria=e1
2424
# python:S6792 Use the "type" parameter syntax to declare this generic class.
2525
sonar.issue.ignore.multicriteria.e1.ruleKey=python:S6792
2626
sonar.issue.ignore.multicriteria.e1.resourceKey=**/*.py
27+
sonar.python.naming.function=^[a-z][a-zA-Z0-9]*$

src/hackerrank/implementation/between_two_sets.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
LOGGER = logging.getLogger(__name__)
66

77

8-
def is_factor(_n: int, group: list[int]) -> bool:
8+
def isFactor(_n: int, group: list[int]) -> bool:
99
result: bool = True
1010
i: int = 0
1111

@@ -21,7 +21,7 @@ def is_factor(_n: int, group: list[int]) -> bool:
2121
return result
2222

2323

24-
def factor_of(_n: int, group: list[int]):
24+
def factorOf(_n: int, group: list[int]):
2525
result: bool = True
2626
i: int = 0
2727

@@ -37,15 +37,15 @@ def factor_of(_n: int, group: list[int]):
3737
return result
3838

3939

40-
def get_total_x(_a: list[int], _b: list[int]) -> int:
40+
def getTotalX(_a: list[int], _b: list[int]) -> int:
4141
_max_ = 0
4242
for _, j in enumerate(_b):
4343
_max_ = max(_max_, j)
4444

4545
result: list[int] = []
4646

4747
for i in range(2, _max_):
48-
if is_factor(i, _a) and factor_of(i, _b):
48+
if isFactor(i, _a) and factorOf(i, _b):
4949
result.append(i)
5050

5151
output = len(result)
Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import unittest
2-
from .between_two_sets import get_total_x, is_factor, factor_of
2+
from .between_two_sets import getTotalX, isFactor, factorOf
33

44

55
class TestProblemBetweenTwoSets(unittest.TestCase):
@@ -9,39 +9,39 @@ def test_get_total_x(self):
99
tinput: list[int] = [16, 32, 96]
1010
solution_found: int = 0
1111

12-
calculated_a = get_total_x([], tinput)
12+
calculated_a = getTotalX([], tinput)
1313

1414
self.assertEqual(
1515
calculated_a, solution_found,
16-
f"get_total_x([], tinput) must be "
16+
f"getTotalX([], tinput) must be "
1717
f"=> {solution_found}")
1818

19-
calculated_b = get_total_x(tinput, [])
19+
calculated_b = getTotalX(tinput, [])
2020

2121
self.assertEqual(
2222
calculated_b, solution_found,
23-
f"get_total_x({tinput}, {[]}) must be "
23+
f"getTotalX({tinput}, {[]}) must be "
2424
f"=> {solution_found}")
2525

26-
calculated_c = get_total_x([], [])
26+
calculated_c = getTotalX([], [])
2727

2828
self.assertEqual(
2929
calculated_c, solution_found,
30-
f"get_total_x({[]}, {[]}) must be "
30+
f"getTotalX({[]}, {[]}) must be "
3131
f"=> {solution_found}")
3232

33-
calculated_d = is_factor(1, [])
33+
calculated_d = isFactor(1, [])
3434

3535
self.assertEqual(
3636
calculated_d, solution_found,
37-
f"is_factor({1}, {[]}) must be "
37+
f"isFactor({1}, {[]}) must be "
3838
f"=> {False}")
3939

40-
calculated_e = factor_of(1, [])
40+
calculated_e = factorOf(1, [])
4141

4242
self.assertEqual(
4343
calculated_e, solution_found,
44-
f"factor_of({1}, {[]}) must be "
44+
f"factorOf({1}, {[]}) must be "
4545
f"=> {False}")
4646

4747
def test_get_total_x_case_0(self):
@@ -53,11 +53,11 @@ def test_get_total_x_case_0(self):
5353
solution_found = 3
5454

5555
self.assertEqual(
56-
get_total_x(_a_, _b_), solution_found,
57-
f"get_total_x({_a_}, {_b_}) must be "
56+
getTotalX(_a_, _b_), solution_found,
57+
f"getTotalX({_a_}, {_b_}) must be "
5858
f"=> {solution_found}")
5959

6060
self.assertEqual(
61-
get_total_x(_a_, _b_reverse_), solution_found,
62-
f"get_total_x({_a_}, {_b_reverse_}) must be "
61+
getTotalX(_a_, _b_reverse_), solution_found,
62+
f"getTotalX({_a_}, {_b_reverse_}) must be "
6363
f"=> {solution_found}")

src/hackerrank/interview_preparation_kit/arrays/cruch_bruteforce.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
LOGGER = logging.getLogger(__name__)
77

88

9-
def array_manipulation(n_operations: int, queries: list[list[int]]) -> int:
9+
def arrayManipulation(n_operations: int, queries: list[list[int]]) -> int:
1010
result = [0] * (n_operations + 1)
1111
maximum = 0
1212

src/hackerrank/interview_preparation_kit/arrays/cruch_bruteforce_test.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from pathlib import Path
33

44
from ....hackerrank.lib.loader import load_test_cases
5-
from .cruch_bruteforce import array_manipulation
5+
from .cruch_bruteforce import arrayManipulation
66

77
FILE_PATH = str(Path(__file__).resolve().parent)
88

@@ -17,6 +17,6 @@ def test_array_manipulation(self):
1717
for _, _tt in enumerate(CRUCH_SMALL_TEST_CASES):
1818

1919
self.assertEqual(
20-
array_manipulation(_tt['n'], _tt['queries']), _tt['expected'],
21-
f"{_} | array_manipulation({_tt['n']}, {_tt['queries']}) must be "
20+
arrayManipulation(_tt['n'], _tt['queries']), _tt['expected'],
21+
f"{_} | arrayManipulation({_tt['n']}, {_tt['queries']}) must be "
2222
f"=> {_tt['expected']}")

src/hackerrank/interview_preparation_kit/arrays/cruch_optimized.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
LOGGER = logging.getLogger(__name__)
1010

1111

12-
def array_manipulation_optimized(n_operations: int, queries: list[list[int]]) -> int:
12+
def arrayManipulation(n_operations: int, queries: list[list[int]]) -> int:
1313
# why adding 2?
1414
# first slot to adjust 1-based index and
1515
# last slot for storing accum_sum result

0 commit comments

Comments
 (0)