Skip to content

Develop #709

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
May 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,23 @@ name: Python CI Tests

on: # yamllint disable-line rule:truthy
push:
branches: ["main"]
branches: ['main']
pull_request:
# The branches below must be a subset of the branches above
branches: ["main"]
branches: ['main']
workflow_dispatch:

env:
LOG_LEVEL: INFO

jobs:
build:
name: "Run CI"
name: 'Run CI'
strategy:
fail-fast: false
matrix:
os: ["ubuntu-24.04", "macos-14", "windows-2022"]
python: ["3.10", "3.11", "3.12"]
os: ['ubuntu-24.04', 'macos-14', 'windows-2022']
python: ['3.10', '3.11', '3.12']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
Expand Down Expand Up @@ -49,6 +49,9 @@ jobs:
run: |
python3 -m pycodestyle --statistics src/

- name: Styling (autopep8)
run: |
python3 -m autopep8 --diff --recursive --exit-code --verbose .
- name: Test
run: >
coverage run -m pytest --verbose
Expand Down
7 changes: 7 additions & 0 deletions .prettierrc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
singleQuote: true
quoteProps: preserve
useTabs: false
printWidth: 80
tabWidth: 2
trailingComma: none
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ WORKDIR ${WORKDIR}

RUN apk add --update --no-cache make nodejs npm \
&& apk add --update --no-cache yamllint \
&& npm install -g --ignore-scripts markdownlint-cli
&& npm install -g --ignore-scripts markdownlint-cli \
&& npm install -g --ignore-scripts markdownlint-cli prettier

# [!TIP] Use a bind-mount to "/app" to override following "copys"
# for lint and test against "current" sources in this stage
Expand Down
16 changes: 14 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,24 @@ test/static: dependencies
${RUNTIME_TOOL} -m flake8 --verbose src/
${RUNTIME_TOOL} -m pyright --verbose src/

test/styling: dependencies

test/styling/json: dependencies
prettier --check ./src/**/*.json

test/styling/sources: dependencies
${RUNTIME_TOOL} -m pycodestyle --statistics src/
${RUNTIME_TOOL} -m autopep8 --diff --recursive --exit-code --verbose .

test/styling: dependencies test/styling/sources test/styling/json

format:
format/json:
prettier --write ./src/**/*.json

format/sources:
${RUNTIME_TOOL} -m autopep8 --in-place --recursive --aggressive --aggressive --verbose src/

format: format/sources format/json

build: env
rsync -av --prune-empty-dirs \
--exclude '*_test.py' \
Expand Down
Original file line number Diff line number Diff line change
@@ -1,27 +1,33 @@
[
{
"title": "Sample Test Case 0",
"n": 5,
"queries": [[1, 2, 100],
[2, 5, 100],
[3, 4, 100]],
"expected": 200
},
{
"title": "Sample Test Case 1",
"n": 10,
"queries": [[1, 5, 3],
[4, 8, 7],
[6, 9, 1]],
"expected": 10
},
{
"title": "Sample Test Case 3",
"n": 10,
"queries": [[2, 6, 8],
[3, 5, 7],
[1, 8, 1],
[5, 9, 15]],
"expected": 31
}
{
"title": "Sample Test Case 0",
"n": 5,
"queries": [
[1, 2, 100],
[2, 5, 100],
[3, 4, 100]
],
"expected": 200
},
{
"title": "Sample Test Case 1",
"n": 10,
"queries": [
[1, 5, 3],
[4, 8, 7],
[6, 9, 1]
],
"expected": 10
},
{
"title": "Sample Test Case 3",
"n": 10,
"queries": [
[2, 6, 8],
[3, 5, 7],
[1, 8, 1],
[5, 9, 15]
],
"expected": 31
}
]
Original file line number Diff line number Diff line change
@@ -1,10 +1,56 @@
[
{"title": "Own 0", "input": [1, 2, 3, 4, 5], "d_rotations": 1, "expected": [2, 3, 4, 5, 1]},
{"title": "Own 1", "input": [2, 3, 4, 5, 1], "d_rotations": 1, "expected": [3, 4, 5, 1, 2]},
{"title": "Own 2", "input": [3, 4, 5, 1, 2], "d_rotations": 1, "expected": [4, 5, 1, 2, 3]},
{"title": "Own 3", "input": [4, 5, 1, 2, 3], "d_rotations": 1, "expected": [5, 1, 2, 3, 4]},
{"title": "Own 4", "input": [5, 1, 2, 3, 4], "d_rotations": 1, "expected": [1, 2, 3, 4, 5]},
{"title": "Sample Test case 0", "input": [1, 2, 3, 4, 5], "d_rotations": 4, "expected": [5, 1, 2, 3, 4]},
{"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]},
{"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]}
{
"title": "Own 0",
"input": [1, 2, 3, 4, 5],
"d_rotations": 1,
"expected": [2, 3, 4, 5, 1]
},
{
"title": "Own 1",
"input": [2, 3, 4, 5, 1],
"d_rotations": 1,
"expected": [3, 4, 5, 1, 2]
},
{
"title": "Own 2",
"input": [3, 4, 5, 1, 2],
"d_rotations": 1,
"expected": [4, 5, 1, 2, 3]
},
{
"title": "Own 3",
"input": [4, 5, 1, 2, 3],
"d_rotations": 1,
"expected": [5, 1, 2, 3, 4]
},
{
"title": "Own 4",
"input": [5, 1, 2, 3, 4],
"d_rotations": 1,
"expected": [1, 2, 3, 4, 5]
},
{
"title": "Sample Test case 0",
"input": [1, 2, 3, 4, 5],
"d_rotations": 4,
"expected": [5, 1, 2, 3, 4]
},
{
"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
]
},
{
"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]
}
]
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[
{"title": "Sample input 0", "input": [4, 3, 1, 2], "expected": 3},
{"title": "Sample input 1", "input": [2, 3, 4, 1, 5], "expected": 3},
{"title": "Sample input 2", "input": [1, 3, 5, 2, 4, 6, 7], "expected": 3}
{ "title": "Sample input 0", "input": [4, 3, 1, 2], "expected": 3 },
{ "title": "Sample input 1", "input": [2, 3, 4, 1, 5], "expected": 3 },
{ "title": "Sample input 2", "input": [1, 3, 5, 2, 4, 6, 7], "expected": 3 }
]
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
[
{
"title": "Test Case 0-0",
"input": [2, 1, 5, 3, 4],
"expected": 3
},
{
"title": "Test Case 0-1",
"input": [2, 5, 1, 3, 4],
"expected": "Too chaotic"
},
{
"title": "Test Case 1-1",
"input": [5, 1, 2, 3, 7, 8, 6, 4],
"expected": "Too chaotic"
},
{
"title": "Test Case 1-2",
"input": [1, 2, 5, 3, 7, 8, 6, 4],
"expected": 7
},
{
"title": "Test Case 2",
"input": [1, 2, 5, 3, 4, 7, 8, 6],
"expected": 4
}
]
{
"title": "Test Case 0-0",
"input": [2, 1, 5, 3, 4],
"expected": 3
},
{
"title": "Test Case 0-1",
"input": [2, 5, 1, 3, 4],
"expected": "Too chaotic"
},
{
"title": "Test Case 1-1",
"input": [5, 1, 2, 3, 7, 8, 6, 4],
"expected": "Too chaotic"
},
{
"title": "Test Case 1-2",
"input": [1, 2, 5, 3, 7, 8, 6, 4],
"expected": 7
},
{
"title": "Test Case 2",
"input": [1, 2, 5, 3, 4, 7, 8, 6],
"expected": 4
}
]
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
[
{
"title": "Sample Test Case 2",
"input": [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, 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, 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, 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],
"input": [
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,
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,
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,
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
],
"r": 1,
"expected": 161700
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,53 +38,43 @@
"title": "Test case 3",
"tests": [
{
"input":
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"input": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"expected": 166650
},
{
"input":
"bbcaadacaacbdddcdbddaddabcccdaaadcadcbddadababdaaabcccdcdaacadcababbabbdbacabbdcbbbbbddacdbbcdddbaaa",
"input": "bbcaadacaacbdddcdbddaddabcccdaaadcadcbddadababdaaabcccdcdaacadcababbabbdbacabbdcbbbbbddacdbbcdddbaaa",
"expected": 4832
},
{
"input":
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"input": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"expected": 166650
},
{
"input":
"cacccbbcaaccbaacbbbcaaaababcacbbababbaacabccccaaaacbcababcbaaaaaacbacbccabcabbaaacabccbabccabbabcbba",
"input": "cacccbbcaaccbaacbbbcaaaababcacbbababbaacabccccaaaacbcababcbaaaaaacbacbccabcabbaaacabccbabccabbabcbba",
"expected": 13022
},
{
"input":
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"input": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"expected": 166650
},
{
"input":
"bbcbacaabacacaaacbbcaabccacbaaaabbcaaaaaaaccaccabcacabbbbabbbbacaaccbabbccccaacccccabcabaacaabbcbaca",
"input": "bbcbacaabacacaaacbbcaabccacbaaaabbcaaaaaaaccaccabcacabbbbabbbbacaaccbabbccccaacccccabcabaacaabbcbaca",
"expected": 9644
},
{
"input":
"cbaacdbaadbabbdbbaabddbdabbbccbdaccdbbdacdcabdbacbcadbbbbacbdabddcaccbbacbcadcdcabaabdbaacdccbbabbbc",
"input": "cbaacdbaadbabbdbbaabddbdabbbccbdaccdbbdacdcabdbacbcadbbbbacbdabddcaccbbacbcadcdcabaabdbaacdccbbabbbc",
"expected": 6346
},
{
"input":
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"input": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"expected": 166650
},
{
"input":
"babacaccaaabaaaaaaaccaaaccaaccabcbbbabccbbabababccaabcccacccaaabaccbccccbaacbcaacbcaaaaaaabacbcbbbcc",
"input": "babacaccaaabaaaaaaaccaaaccaaccabcbbbabccbbabababccaabcccacccaaabaccbccccbaacbcaacbcaaaaaaabacbcbbbcc",
"expected": 8640
},
{
"input":
"bcbabbaccacbacaacbbaccbcbccbaaaabbbcaccaacaccbabcbabccacbaabbaaaabbbcbbbbbaababacacbcaabbcbcbcabbaba",
"input": "bcbabbaccacbacaacbbaccbcbccbaaaabbbcaccaacaccbabcbabccacbaabbaaaabbbcbbbbbaababacacbcaabbcbcbcabbaba",
"expected": 11577
}
]
Expand Down
Loading