Skip to content

Commit c3ad53f

Browse files
authored
Merge pull request #5044 from akolson/revert-flake8
Revert flake8 and re-formats python files
2 parents 788ee19 + 4aa4582 commit c3ad53f

294 files changed

Lines changed: 13793 additions & 5861 deletions

File tree

Some content is hidden

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

.dockerignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ __pycache__
66
*.pyc
77
*.swp
88
k8s/templates/
9-
cloudbuild-*.yaml
9+
cloudbuild-*.yaml

.git-blame-ignore-revs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33

44
# Linting updates and fixes
55
a52e08e5c2031cecb97a03fbed49997756ebe01b
6+
8ccaaa60efd1c07b220aefce5a307e4791345111

.github/workflows/community-contribution-labeling.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ jobs:
99
uses: learningequality/.github/.github/workflows/community-contribution-label.yml@main
1010
secrets:
1111
LE_BOT_APP_ID: ${{ secrets.LE_BOT_APP_ID }}
12-
LE_BOT_PRIVATE_KEY: ${{ secrets.LE_BOT_PRIVATE_KEY }}
12+
LE_BOT_PRIVATE_KEY: ${{ secrets.LE_BOT_PRIVATE_KEY }}
Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Javascript Linting
1+
name: Linting
22

33
on:
44
push:
@@ -7,6 +7,10 @@ on:
77
- hotfixes
88
- master
99
pull_request:
10+
branches:
11+
- unstable
12+
- hotfixes
13+
- master
1014

1115
jobs:
1216
pre_job:
@@ -20,14 +24,17 @@ jobs:
2024
uses: fkirc/skip-duplicate-actions@master
2125
with:
2226
github_token: ${{ github.token }}
23-
paths: '["**.vue", "**.js", "pnpm-lock.yaml", ".github/workflows/frontendlint.yml"]'
24-
test:
25-
name: Frontend linting
27+
paths_ignore: '["**.po", "**.json"]'
28+
linting:
29+
name: All file linting
2630
needs: pre_job
2731
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
2832
runs-on: ubuntu-latest
2933
steps:
3034
- uses: actions/checkout@v4
35+
- uses: actions/setup-python@v5
36+
with:
37+
python-version: '3.10'
3138
- name: Use pnpm
3239
uses: pnpm/action-setup@v4
3340
- name: Use Node.js
@@ -39,8 +46,7 @@ jobs:
3946
run: |
4047
pnpm install --frozen-lockfile
4148
pnpm rebuild node-sass
42-
- name: Run tests
43-
run: pnpm run lint-frontend:format
49+
- uses: pre-commit/action@v3.0.1
4450
- name: Run pre-commit-ci-lite
4551
uses: pre-commit-ci/lite-action@v1.1.0
4652
if: always()

.pre-commit-config.yaml

Lines changed: 80 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,91 @@
11
repos:
2-
- repo: https://github.com/pre-commit/pre-commit-hooks
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
33
rev: v5.0.0
44
hooks:
5-
- id: trailing-whitespace
6-
- id: check-added-large-files
5+
- id: trailing-whitespace
6+
- id: check-added-large-files
77
exclude: '^.+?\.ttf$'
8-
- id: debug-statements
9-
- id: end-of-file-fixer
8+
- id: debug-statements
9+
- id: end-of-file-fixer
1010
exclude: '^.+?\.json.+?\.yml$'
11-
- repo: https://github.com/PyCQA/flake8
11+
- repo: https://github.com/PyCQA/flake8
1212
rev: 7.1.2
1313
hooks:
14-
- id: flake8
15-
- repo: https://github.com/asottile/reorder_python_imports
14+
- id: flake8
15+
additional_dependencies: [
16+
'flake8-print==5.0.0'
17+
]
18+
- repo: https://github.com/asottile/reorder_python_imports
1619
rev: v3.14.0
1720
hooks:
18-
- id: reorder-python-imports
21+
- id: reorder-python-imports
1922
language_version: python3
20-
- repo: local
23+
- repo: local
2124
hooks:
22-
- id: frontend-lint
23-
name: Linting of JS, Vue, SCSS and CSS files
24-
description: This hook handles all frontend linting for Kolibri Studio
25-
entry: pnpm run lint-frontend:format
26-
language: system
27-
files: \.(js|vue|scss|css)$
25+
- id: frontend-lint
26+
name: Linting of JS, Vue, SCSS and CSS files
27+
description: This hook handles all frontend linting for Kolibri Studio
28+
entry: pnpm run lint-frontend:format
29+
language: system
30+
files: \.(js|vue|scss|css)$
31+
- repo: local
32+
hooks:
33+
- id: no-auto-migrations
34+
name: no auto-named migrations
35+
entry: We do not allow _auto_ in migration names. Please give the migration a telling name.
36+
language: fail
37+
files: .*/migrations/.*_auto_.*\.py$
38+
exclude: (?x)^(
39+
contentcuration/kolibri_content/migrations/0014_auto_20210603_1536.py|
40+
contentcuration/kolibri_content/migrations/0023_auto_20250417_1516.py|
41+
contentcuration/kolibri_content/migrations/0007_auto_20200613_0050.py|
42+
contentcuration/kolibri_content/migrations/0004_auto_20180910_2342.py|
43+
contentcuration/kolibri_content/migrations/0002_auto_20180327_1414.py|
44+
contentcuration/kolibri_content/migrations/0022_auto_20240915_1414.py|
45+
contentcuration/kolibri_content/migrations/0011_auto_20210504_1744.py|
46+
contentcuration/kolibri_content/migrations/0010_auto_20210202_0604.py|
47+
contentcuration/kolibri_content/migrations/0018_auto_20220224_2031.py|
48+
contentcuration/kolibri_content/migrations/0019_auto_20230207_0116.py|
49+
contentcuration/kolibri_content/migrations/0005_auto_20190424_1709.py|
50+
contentcuration/kolibri_content/migrations/0006_auto_20191028_2325.py|
51+
contentcuration/kolibri_content/migrations/0015_auto_20210707_1606.py|
52+
contentcuration/kolibri_content/migrations/0013_auto_20210519_1759.py|
53+
contentcuration/kolibri_content/migrations/0012_auto_20210511_1605.py|
54+
contentcuration/kolibri_content/migrations/0021_auto_20240612_1847.py|
55+
contentcuration/search/migrations/0002_auto_20201215_2110.py|
56+
contentcuration/contentcuration/migrations/0001_squashed_0094_auto_20180910_2342.py|
57+
contentcuration/contentcuration/migrations/0002_auto_20181220_1734.py|
58+
contentcuration/contentcuration/migrations/0102_auto_20190904_1627.py|
59+
contentcuration/contentcuration/migrations/0110_auto_20200511_2245.py|
60+
contentcuration/contentcuration/migrations/0104_auto_20191028_2325.py|
61+
contentcuration/contentcuration/migrations/0111_auto_20200513_2252.py|
62+
contentcuration/contentcuration/migrations/0130_auto_20210706_2005.py|
63+
contentcuration/contentcuration/migrations/0098_auto_20190424_1709.py|
64+
contentcuration/contentcuration/migrations/0128_auto_20210511_1605.py|
65+
contentcuration/contentcuration/migrations/0112_auto_20200613_0050.py|
66+
contentcuration/contentcuration/migrations/0127_auto_20210504_1744.py|
67+
contentcuration/contentcuration/migrations/0106_auto_20191113_0217.py|
68+
contentcuration/contentcuration/migrations/0103_auto_20190905_0408.py|
69+
contentcuration/contentcuration/migrations/0121_auto_20210305_2028.py|
70+
contentcuration/contentcuration/migrations/0133_auto_20220124_2149.py|
71+
contentcuration/contentcuration/migrations/0132_auto_20210708_0011.py|
72+
contentcuration/contentcuration/migrations/0120_auto_20210128_1646.py|
73+
contentcuration/contentcuration/migrations/0131_auto_20210707_2326.py|
74+
contentcuration/contentcuration/migrations/0126_auto_20210219_2314.py|
75+
contentcuration/contentcuration/migrations/0107_auto_20191115_2344.py|
76+
contentcuration/contentcuration/migrations/0151_auto_20250417_1516.py|
77+
contentcuration/contentcuration/migrations/0099_auto_20190715_2201.py|
78+
contentcuration/contentcuration/migrations/0123_auto_20210407_0057.py|
79+
contentcuration/contentcuration/migrations/0129_auto_20210519_2213.py|
80+
contentcuration/contentcuration/migrations/0109_auto_20191202_1759.py|
81+
contentcuration/kolibri_public/migrations/0004_auto_20240612_1847.py|
82+
contentcuration/kolibri_public/migrations/0006_auto_20250417_1516.py|
83+
)$
84+
# Always keep black as the final hook so it reformats any other reformatting.
85+
- repo: https://github.com/python/black
86+
rev: 20.8b1
87+
hooks:
88+
- id: black
89+
additional_dependencies: [
90+
'click==8.0.4'
91+
]

LICENSE

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1919
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2020
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2121
SOFTWARE.
22-
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
# from django.contrib import admin
2-
32
# Register your models here.

contentcuration/automation/apps.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22

33

44
class AutomationConfig(AppConfig):
5-
default_auto_field = 'django.db.models.BigAutoField'
6-
name = 'automation'
5+
default_auto_field = "django.db.models.BigAutoField"
6+
name = "automation"

contentcuration/automation/migrations/0001_initial.py

Lines changed: 42 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -11,43 +11,59 @@ class Migration(migrations.Migration):
1111
initial = True
1212

1313
dependencies = [
14-
('kolibri_public', '0005_alter_localfile_extension'),
14+
("kolibri_public", "0005_alter_localfile_extension"),
1515
]
1616

1717
operations = [
1818
migrations.CreateModel(
19-
name='RecommendationsCache',
19+
name="RecommendationsCache",
2020
fields=[
21-
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
22-
('request_hash', models.CharField(max_length=32, null=True)),
23-
('topic_id', models.UUIDField()),
24-
('rank', models.IntegerField(default=0, null=True)),
25-
('override_threshold', models.BooleanField(default=False)),
26-
('timestamp', models.DateTimeField(auto_now_add=True)),
27-
('channel', models.ForeignKey(
28-
blank=True,
29-
null=True,
30-
on_delete=django.db.models.deletion.CASCADE,
31-
related_name='channel_recommendations',
32-
to='contentcuration.channel')),
33-
('contentnode', models.ForeignKey(
34-
blank=True,
35-
null=True,
36-
on_delete=django.db.models.deletion.CASCADE,
37-
related_name='contentnode_recommendations',
38-
to='kolibri_public.contentnode')),
21+
(
22+
"id",
23+
models.UUIDField(
24+
default=uuid.uuid4,
25+
editable=False,
26+
primary_key=True,
27+
serialize=False,
28+
),
29+
),
30+
("request_hash", models.CharField(max_length=32, null=True)),
31+
("topic_id", models.UUIDField()),
32+
("rank", models.IntegerField(default=0, null=True)),
33+
("override_threshold", models.BooleanField(default=False)),
34+
("timestamp", models.DateTimeField(auto_now_add=True)),
35+
(
36+
"channel",
37+
models.ForeignKey(
38+
blank=True,
39+
null=True,
40+
on_delete=django.db.models.deletion.CASCADE,
41+
related_name="channel_recommendations",
42+
to="contentcuration.channel",
43+
),
44+
),
45+
(
46+
"contentnode",
47+
models.ForeignKey(
48+
blank=True,
49+
null=True,
50+
on_delete=django.db.models.deletion.CASCADE,
51+
related_name="contentnode_recommendations",
52+
to="kolibri_public.contentnode",
53+
),
54+
),
3955
],
4056
),
4157
migrations.AddIndex(
42-
model_name='recommendationscache',
43-
index=models.Index(fields=['request_hash'], name='request_hash_idx'),
58+
model_name="recommendationscache",
59+
index=models.Index(fields=["request_hash"], name="request_hash_idx"),
4460
),
4561
migrations.AddIndex(
46-
model_name='recommendationscache',
47-
index=models.Index(fields=['contentnode'], name='contentnode_idx'),
62+
model_name="recommendationscache",
63+
index=models.Index(fields=["contentnode"], name="contentnode_idx"),
4864
),
4965
migrations.AlterUniqueTogether(
50-
name='recommendationscache',
51-
unique_together={('request_hash', 'contentnode')},
66+
name="recommendationscache",
67+
unique_together={("request_hash", "contentnode")},
5268
),
5369
]

contentcuration/automation/models.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,23 @@ class RecommendationsCache(models.Model):
1818
ContentNode,
1919
null=True,
2020
blank=True,
21-
related_name='contentnode_recommendations',
21+
related_name="contentnode_recommendations",
2222
on_delete=models.CASCADE,
2323
)
2424
channel = models.ForeignKey(
2525
Channel,
2626
null=True,
2727
blank=True,
28-
related_name='channel_recommendations',
28+
related_name="channel_recommendations",
2929
on_delete=models.CASCADE,
3030
)
3131
rank = models.IntegerField(default=0, null=True)
3232
override_threshold = models.BooleanField(default=False)
3333
timestamp = models.DateTimeField(auto_now_add=True)
3434

3535
class Meta:
36-
unique_together = ('request_hash', 'contentnode')
36+
unique_together = ("request_hash", "contentnode")
3737
indexes = [
38-
models.Index(fields=['request_hash'], name=REQUEST_HASH_INDEX_NAME),
39-
models.Index(fields=['contentnode'], name=CONTENTNODE_INDEX_NAME),
38+
models.Index(fields=["request_hash"], name=REQUEST_HASH_INDEX_NAME),
39+
models.Index(fields=["contentnode"], name=CONTENTNODE_INDEX_NAME),
4040
]

0 commit comments

Comments
 (0)