Skip to content

Commit

Permalink
Merge pull request #111 from learningequality/linting
Browse files Browse the repository at this point in the history
Attempt to fix linting.
  • Loading branch information
rtibbles authored Jun 28, 2023
2 parents 0996f4b + 19e059d commit 88eda41
Show file tree
Hide file tree
Showing 11 changed files with 31 additions and 32 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
name: Linting

on: [push, pull_request]
on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
pre_job:
Expand All @@ -24,5 +30,5 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.11
python-version: '3.10'
- uses: pre-commit/[email protected]
5 changes: 1 addition & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,9 @@ dmypy.json

# ignores specific to this project.
*.whl
src/kolibri
src/*.dist-info
# generated files
assets/preseeded_kolibri_home
src/stdlib_imports.py
tmpenv
whl
package
kolibri
kolibrisrc
3 changes: 2 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ repos:
rev: v3.9.0
hooks:
- id: reorder-python-imports
language_version: python3.11
language_version: python3
args: [--application-directories=.:src, --py37-plus]
- repo: https://github.com/python/black
rev: 22.3.0
hooks:
Expand Down
14 changes: 7 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ guard-%:
fi

needs-version:
$(eval KOLIBRI_VERSION ?= $(shell python3 -c "import os; import sys; sys.path = [os.path.abspath('kolibri')] + sys.path; from pkginfo import Installed; print(Installed('kolibri').version)"))
$(eval KOLIBRI_VERSION ?= $(shell python3 -c "import os; import sys; sys.path = [os.path.abspath('kolibrisrc')] + sys.path; from pkginfo import Installed; print(Installed('kolibri').version)"))
$(eval APP_VERSION ?= $(shell python3 read_version.py))

clean:
Expand All @@ -24,17 +24,17 @@ clean-whl:
mkdir whl

install-whl:
rm -rf kolibri
pip3 install ${whl} -t kolibri/
rm -rf kolibrisrc
pip3 install ${whl} -t kolibrisrc/
# Read SQLAlchemy version from the unpacked whl file to avoid hard coding.
# Manually install the sqlalchemy version
@version=$$(grep -Eo '__version__ = "([0-9]+\.[0-9]+\.[0-9]+)"' kolibri/kolibri/dist/sqlalchemy/__init__.py | grep -Eo "([0-9]+\.[0-9]+\.[0-9]+)"); \
@version=$$(grep -Eo '__version__ = "([0-9]+\.[0-9]+\.[0-9]+)"' kolibrisrc/kolibri/dist/sqlalchemy/__init__.py | grep -Eo "([0-9]+\.[0-9]+\.[0-9]+)"); \
pip3 install sqlalchemy==$$version --no-binary :all:
# Delete sqlalchemy from the dist folder
rm -rf kolibri/kolibri/dist/sqlalchemy
rm -rf kolibri/kolibri/dist/SQLAlchemy*
rm -rf kolibrisrc/kolibri/dist/sqlalchemy
rm -rf kolibrisrc/kolibri/dist/SQLAlchemy*
# This doesn't exist in 0.15, so don't error if it doesn't exist.
echo "3.3.1" > kolibri/kolibri/dist/importlib_resources/version.txt || true
echo "3.3.1" > kolibrisrc/kolibri/dist/importlib_resources/version.txt || true

get-whl: clean-whl
# The eval and shell commands here are evaluated when the recipe is parsed, so we put the cleanup
Expand Down
2 changes: 0 additions & 2 deletions build_config/dmgbuild_settings.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

# Symlinks to create
symlinks = {"Applications": "/Applications"}

Expand Down
4 changes: 2 additions & 2 deletions kolibri.spec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ from glob import glob

block_cipher = None

sys.path = [os.path.abspath('kolibri')] + sys.path
sys.path = [os.path.abspath('kolibrisrc')] + sys.path

import kolibri
kolibri_version = kolibri.__version__
Expand All @@ -26,7 +26,7 @@ locale_datas = [

a = Analysis(
[os.path.join('src', 'kolibri_app', '__main__.py')],
pathex=['kolibri', os.path.join('kolibri', 'kolibri', 'dist')],
pathex=['kolibrisrc', os.path.join('kolibrisrc', 'kolibri', 'dist')],
binaries=[],
datas=[('src/kolibri_app/assets/*.*', 'kolibri_app/assets')] + locale_datas,
hiddenimports=[],
Expand Down
4 changes: 2 additions & 2 deletions src/kolibri_app/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import os

from kolibri_app.constants import MAC

from kolibri.main import enable_plugin

from kolibri_app.constants import MAC

__version__ = "0.3.0"

os.environ["KOLIBRI_INSTALLER_VERSION"] = __version__
Expand Down
10 changes: 5 additions & 5 deletions src/kolibri_app/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@
from threading import Thread

import wx
from kolibri_app.constants import APP_NAME
from kolibri_app.logger import logging
from kolibri_app.view import KolibriView
from magicbus.plugins import SimplePlugin

from kolibri.main import initialize
from kolibri.plugins.app.utils import interface
from kolibri.plugins.app.utils import SHARE_FILE
from kolibri.utils.conf import KOLIBRI_HOME
from kolibri.utils.server import KolibriProcessBus
from magicbus.plugins import SimplePlugin

from kolibri_app.constants import APP_NAME
from kolibri_app.logger import logging
from kolibri_app.view import KolibriView


share_file = None
Expand Down
4 changes: 0 additions & 4 deletions src/kolibri_app/django_app_settings.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals

from kolibri.deployment.default.settings.base import * # noqa

SESSION_EXPIRE_AT_BROWSER_CLOSE = False
Expand Down
4 changes: 2 additions & 2 deletions src/kolibri_app/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ class LoggerWriter(io.IOBase):
def __init__(self, writer):
self._writer = writer
self._msg = ""

def readable(self):
return False

def writable(self):
return True

Expand Down
3 changes: 2 additions & 1 deletion src/kolibri_app/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@
from io import BytesIO

import wx
from wx import html2

from kolibri_app.constants import APP_NAME
from kolibri_app.constants import LINUX
from kolibri_app.constants import MAC
from kolibri_app.constants import WINDOWS
from kolibri_app.i18n import _
from kolibri_app.i18n import locale_info
from wx import html2


html2.WebView.MSWSetEmulationLevel(html2.WEBVIEWIE_EMU_IE11)
Expand Down

0 comments on commit 88eda41

Please sign in to comment.