Skip to content

Commit 0cdbd9a

Browse files
authored
Merge pull request #709 from sir-gon/develop
Develop
2 parents 5b28236 + dba8023 commit 0cdbd9a

23 files changed

+5982
-255
lines changed

.github/workflows/python.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,23 @@ name: Python CI Tests
33

44
on: # yamllint disable-line rule:truthy
55
push:
6-
branches: ["main"]
6+
branches: ['main']
77
pull_request:
88
# The branches below must be a subset of the branches above
9-
branches: ["main"]
9+
branches: ['main']
1010
workflow_dispatch:
1111

1212
env:
1313
LOG_LEVEL: INFO
1414

1515
jobs:
1616
build:
17-
name: "Run CI"
17+
name: 'Run CI'
1818
strategy:
1919
fail-fast: false
2020
matrix:
21-
os: ["ubuntu-24.04", "macos-14", "windows-2022"]
22-
python: ["3.10", "3.11", "3.12"]
21+
os: ['ubuntu-24.04', 'macos-14', 'windows-2022']
22+
python: ['3.10', '3.11', '3.12']
2323
runs-on: ${{ matrix.os }}
2424
steps:
2525
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
@@ -49,6 +49,9 @@ jobs:
4949
run: |
5050
python3 -m pycodestyle --statistics src/
5151
52+
- name: Styling (autopep8)
53+
run: |
54+
python3 -m autopep8 --diff --recursive --exit-code --verbose .
5255
- name: Test
5356
run: >
5457
coverage run -m pytest --verbose

.prettierrc.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
singleQuote: true
3+
quoteProps: preserve
4+
useTabs: false
5+
printWidth: 80
6+
tabWidth: 2
7+
trailingComma: none

Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ WORKDIR ${WORKDIR}
2727

2828
RUN apk add --update --no-cache make nodejs npm \
2929
&& apk add --update --no-cache yamllint \
30-
&& npm install -g --ignore-scripts markdownlint-cli
30+
&& npm install -g --ignore-scripts markdownlint-cli \
31+
&& npm install -g --ignore-scripts markdownlint-cli prettier
3132

3233
# [!TIP] Use a bind-mount to "/app" to override following "copys"
3334
# for lint and test against "current" sources in this stage

Makefile

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,24 @@ test/static: dependencies
7979
${RUNTIME_TOOL} -m flake8 --verbose src/
8080
${RUNTIME_TOOL} -m pyright --verbose src/
8181

82-
test/styling: dependencies
82+
83+
test/styling/json: dependencies
84+
prettier --check ./src/**/*.json
85+
86+
test/styling/sources: dependencies
8387
${RUNTIME_TOOL} -m pycodestyle --statistics src/
88+
${RUNTIME_TOOL} -m autopep8 --diff --recursive --exit-code --verbose .
89+
90+
test/styling: dependencies test/styling/sources test/styling/json
8491

85-
format:
92+
format/json:
93+
prettier --write ./src/**/*.json
94+
95+
format/sources:
8696
${RUNTIME_TOOL} -m autopep8 --in-place --recursive --aggressive --aggressive --verbose src/
8797

98+
format: format/sources format/json
99+
88100
build: env
89101
rsync -av --prune-empty-dirs \
90102
--exclude '*_test.py' \
Lines changed: 31 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,33 @@
11
[
2-
{
3-
"title": "Sample Test Case 0",
4-
"n": 5,
5-
"queries": [[1, 2, 100],
6-
[2, 5, 100],
7-
[3, 4, 100]],
8-
"expected": 200
9-
},
10-
{
11-
"title": "Sample Test Case 1",
12-
"n": 10,
13-
"queries": [[1, 5, 3],
14-
[4, 8, 7],
15-
[6, 9, 1]],
16-
"expected": 10
17-
},
18-
{
19-
"title": "Sample Test Case 3",
20-
"n": 10,
21-
"queries": [[2, 6, 8],
22-
[3, 5, 7],
23-
[1, 8, 1],
24-
[5, 9, 15]],
25-
"expected": 31
26-
}
2+
{
3+
"title": "Sample Test Case 0",
4+
"n": 5,
5+
"queries": [
6+
[1, 2, 100],
7+
[2, 5, 100],
8+
[3, 4, 100]
9+
],
10+
"expected": 200
11+
},
12+
{
13+
"title": "Sample Test Case 1",
14+
"n": 10,
15+
"queries": [
16+
[1, 5, 3],
17+
[4, 8, 7],
18+
[6, 9, 1]
19+
],
20+
"expected": 10
21+
},
22+
{
23+
"title": "Sample Test Case 3",
24+
"n": 10,
25+
"queries": [
26+
[2, 6, 8],
27+
[3, 5, 7],
28+
[1, 8, 1],
29+
[5, 9, 15]
30+
],
31+
"expected": 31
32+
}
2733
]
Lines changed: 54 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,56 @@
11
[
2-
{"title": "Own 0", "input": [1, 2, 3, 4, 5], "d_rotations": 1, "expected": [2, 3, 4, 5, 1]},
3-
{"title": "Own 1", "input": [2, 3, 4, 5, 1], "d_rotations": 1, "expected": [3, 4, 5, 1, 2]},
4-
{"title": "Own 2", "input": [3, 4, 5, 1, 2], "d_rotations": 1, "expected": [4, 5, 1, 2, 3]},
5-
{"title": "Own 3", "input": [4, 5, 1, 2, 3], "d_rotations": 1, "expected": [5, 1, 2, 3, 4]},
6-
{"title": "Own 4", "input": [5, 1, 2, 3, 4], "d_rotations": 1, "expected": [1, 2, 3, 4, 5]},
7-
{"title": "Sample Test case 0", "input": [1, 2, 3, 4, 5], "d_rotations": 4, "expected": [5, 1, 2, 3, 4]},
8-
{"title": "Sample Test case 1", "input": [41, 73, 89, 7, 10, 1, 59, 58, 84, 77, 77, 97, 58, 1, 86, 58, 26, 10, 86, 51], "d_rotations": 10, "expected": [77, 97, 58, 1, 86, 58, 26, 10, 86, 51, 41, 73, 89, 7, 10, 1, 59, 58, 84, 77]},
9-
{"title": "Sample Test case 2", "input": [33, 47, 70, 37, 8, 53, 13, 93, 71, 72, 51, 100, 60, 87, 97], "d_rotations": 13, "expected": [87, 97, 33, 47, 70, 37, 8, 53, 13, 93, 71, 72, 51, 100, 60]}
2+
{
3+
"title": "Own 0",
4+
"input": [1, 2, 3, 4, 5],
5+
"d_rotations": 1,
6+
"expected": [2, 3, 4, 5, 1]
7+
},
8+
{
9+
"title": "Own 1",
10+
"input": [2, 3, 4, 5, 1],
11+
"d_rotations": 1,
12+
"expected": [3, 4, 5, 1, 2]
13+
},
14+
{
15+
"title": "Own 2",
16+
"input": [3, 4, 5, 1, 2],
17+
"d_rotations": 1,
18+
"expected": [4, 5, 1, 2, 3]
19+
},
20+
{
21+
"title": "Own 3",
22+
"input": [4, 5, 1, 2, 3],
23+
"d_rotations": 1,
24+
"expected": [5, 1, 2, 3, 4]
25+
},
26+
{
27+
"title": "Own 4",
28+
"input": [5, 1, 2, 3, 4],
29+
"d_rotations": 1,
30+
"expected": [1, 2, 3, 4, 5]
31+
},
32+
{
33+
"title": "Sample Test case 0",
34+
"input": [1, 2, 3, 4, 5],
35+
"d_rotations": 4,
36+
"expected": [5, 1, 2, 3, 4]
37+
},
38+
{
39+
"title": "Sample Test case 1",
40+
"input": [
41+
41, 73, 89, 7, 10, 1, 59, 58, 84, 77, 77, 97, 58, 1, 86, 58, 26, 10, 86,
42+
51
43+
],
44+
"d_rotations": 10,
45+
"expected": [
46+
77, 97, 58, 1, 86, 58, 26, 10, 86, 51, 41, 73, 89, 7, 10, 1, 59, 58, 84,
47+
77
48+
]
49+
},
50+
{
51+
"title": "Sample Test case 2",
52+
"input": [33, 47, 70, 37, 8, 53, 13, 93, 71, 72, 51, 100, 60, 87, 97],
53+
"d_rotations": 13,
54+
"expected": [87, 97, 33, 47, 70, 37, 8, 53, 13, 93, 71, 72, 51, 100, 60]
55+
}
1056
]
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[
2-
{"title": "Sample input 0", "input": [4, 3, 1, 2], "expected": 3},
3-
{"title": "Sample input 1", "input": [2, 3, 4, 1, 5], "expected": 3},
4-
{"title": "Sample input 2", "input": [1, 3, 5, 2, 4, 6, 7], "expected": 3}
2+
{ "title": "Sample input 0", "input": [4, 3, 1, 2], "expected": 3 },
3+
{ "title": "Sample input 1", "input": [2, 3, 4, 1, 5], "expected": 3 },
4+
{ "title": "Sample input 2", "input": [1, 3, 5, 2, 4, 6, 7], "expected": 3 }
55
]
Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
[
2-
{
3-
"title": "Test Case 0-0",
4-
"input": [2, 1, 5, 3, 4],
5-
"expected": 3
6-
},
7-
{
8-
"title": "Test Case 0-1",
9-
"input": [2, 5, 1, 3, 4],
10-
"expected": "Too chaotic"
11-
},
12-
{
13-
"title": "Test Case 1-1",
14-
"input": [5, 1, 2, 3, 7, 8, 6, 4],
15-
"expected": "Too chaotic"
16-
},
17-
{
18-
"title": "Test Case 1-2",
19-
"input": [1, 2, 5, 3, 7, 8, 6, 4],
20-
"expected": 7
21-
},
22-
{
23-
"title": "Test Case 2",
24-
"input": [1, 2, 5, 3, 4, 7, 8, 6],
25-
"expected": 4
26-
}
27-
]
2+
{
3+
"title": "Test Case 0-0",
4+
"input": [2, 1, 5, 3, 4],
5+
"expected": 3
6+
},
7+
{
8+
"title": "Test Case 0-1",
9+
"input": [2, 5, 1, 3, 4],
10+
"expected": "Too chaotic"
11+
},
12+
{
13+
"title": "Test Case 1-1",
14+
"input": [5, 1, 2, 3, 7, 8, 6, 4],
15+
"expected": "Too chaotic"
16+
},
17+
{
18+
"title": "Test Case 1-2",
19+
"input": [1, 2, 5, 3, 7, 8, 6, 4],
20+
"expected": 7
21+
},
22+
{
23+
"title": "Test Case 2",
24+
"input": [1, 2, 5, 3, 4, 7, 8, 6],
25+
"expected": 4
26+
}
27+
]

src/hackerrank/interview_preparation_kit/dictionaries_and_hashmaps/count_triplets_1.big.testcases.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
[
22
{
33
"title": "Sample Test Case 2",
4-
"input": [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
5-
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
6-
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
7-
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
8-
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
4+
"input": [
5+
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
6+
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
7+
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
8+
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
9+
],
910
"r": 1,
1011
"expected": 161700
1112
}

src/hackerrank/interview_preparation_kit/dictionaries_and_hashmaps/sherlock_and_anagrams.testcases.json

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -38,53 +38,43 @@
3838
"title": "Test case 3",
3939
"tests": [
4040
{
41-
"input":
42-
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
41+
"input": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
4342
"expected": 166650
4443
},
4544
{
46-
"input":
47-
"bbcaadacaacbdddcdbddaddabcccdaaadcadcbddadababdaaabcccdcdaacadcababbabbdbacabbdcbbbbbddacdbbcdddbaaa",
45+
"input": "bbcaadacaacbdddcdbddaddabcccdaaadcadcbddadababdaaabcccdcdaacadcababbabbdbacabbdcbbbbbddacdbbcdddbaaa",
4846
"expected": 4832
4947
},
5048
{
51-
"input":
52-
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
49+
"input": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
5350
"expected": 166650
5451
},
5552
{
56-
"input":
57-
"cacccbbcaaccbaacbbbcaaaababcacbbababbaacabccccaaaacbcababcbaaaaaacbacbccabcabbaaacabccbabccabbabcbba",
53+
"input": "cacccbbcaaccbaacbbbcaaaababcacbbababbaacabccccaaaacbcababcbaaaaaacbacbccabcabbaaacabccbabccabbabcbba",
5854
"expected": 13022
5955
},
6056
{
61-
"input":
62-
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
57+
"input": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
6358
"expected": 166650
6459
},
6560
{
66-
"input":
67-
"bbcbacaabacacaaacbbcaabccacbaaaabbcaaaaaaaccaccabcacabbbbabbbbacaaccbabbccccaacccccabcabaacaabbcbaca",
61+
"input": "bbcbacaabacacaaacbbcaabccacbaaaabbcaaaaaaaccaccabcacabbbbabbbbacaaccbabbccccaacccccabcabaacaabbcbaca",
6862
"expected": 9644
6963
},
7064
{
71-
"input":
72-
"cbaacdbaadbabbdbbaabddbdabbbccbdaccdbbdacdcabdbacbcadbbbbacbdabddcaccbbacbcadcdcabaabdbaacdccbbabbbc",
65+
"input": "cbaacdbaadbabbdbbaabddbdabbbccbdaccdbbdacdcabdbacbcadbbbbacbdabddcaccbbacbcadcdcabaabdbaacdccbbabbbc",
7366
"expected": 6346
7467
},
7568
{
76-
"input":
77-
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
69+
"input": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
7870
"expected": 166650
7971
},
8072
{
81-
"input":
82-
"babacaccaaabaaaaaaaccaaaccaaccabcbbbabccbbabababccaabcccacccaaabaccbccccbaacbcaacbcaaaaaaabacbcbbbcc",
73+
"input": "babacaccaaabaaaaaaaccaaaccaaccabcbbbabccbbabababccaabcccacccaaabaccbccccbaacbcaacbcaaaaaaabacbcbbbcc",
8374
"expected": 8640
8475
},
8576
{
86-
"input":
87-
"bcbabbaccacbacaacbbaccbcbccbaaaabbbcaccaacaccbabcbabccacbaabbaaaabbbcbbbbbaababacacbcaabbcbcbcabbaba",
77+
"input": "bcbabbaccacbacaacbbaccbcbccbaaaabbbcaccaacaccbabcbabccacbaabbaaaabbbcbbbbbaababacacbcaabbcbcbcabbaba",
8878
"expected": 11577
8979
}
9080
]

0 commit comments

Comments
 (0)