diff --git a/.ruff.toml b/.ruff.toml index aed40b7..96e1c27 100644 --- a/.ruff.toml +++ b/.ruff.toml @@ -1,49 +1,57 @@ -target-version = "py310" +target-version = "py313" +unsafe-fixes = true line-length = 100 -extend-exclude = ["temp"] +extend-exclude = ["alembic", "*.ipynb", "temp"] lint.select = [ - "E", # pycodestyle errors - "W", # pycodestyle warnings - "F", # pyflakes - "I", # isort - 'UP', # pyupgrade 'A', # flake8-builtins "C4", # flake8-comprehensions + 'DTZ', # flake8-datetimez + "E", # pycodestyle errors 'EXE', # flake8-executable + "F", # Pyflakes 'FA', # flake8-future-annotations + "I", # isort 'PT', # flake8-pytest-style 'RSE', # flake8-raise 'SIM', # flake8-simplify - 'DTZ', # flake8-datetimez, https://beta.ruff.rs/docs/rules/#flake8-datetimez-dtz + 'UP', # pyupgrade + "W", # pycodestyle warnings ] lint.ignore = [ 'A003', - 'DTZ007', + # 'C408', # keep dict() as-is + 'DTZ007', # naive datetime.strptime() without %z 'E501', 'E711', 'E712', - # 'E721', # type comparison + 'E721', # type() comparison + # 'E722', # bare except 'E741', - 'F401', # unused imports + 'EXE003', # shebang should contain "python" + 'F401', # unused imports 'F841', + # 'PT018', # assertion should be broken into multiple parts 'SIM102', - #'SIM103', # needless-bool, return the condition {condition} directly + 'SIM103', # return the condition directly 'SIM105', 'SIM108', + # 'SIM110', # use any() instead of a for loop + # 'SIM114', 'SIM115', -# 'DTZ007', # Naive datetime constructed using `datetime.datetime.strptime()` without %z + # 'UP007', # use X | Y instead of Union[X, Y] + # 'UP032', # use an f-string instead of format() + # 'UP046', # prefer type parameters over Generic subclasses ] [format] quote-style = "single" [lint.isort] -known-first-party = ["ssh_lib"] +known-first-party = ["lib", "api", "deploy", "ssh_lib"] lines-after-imports = 2 [lint.flake8-comprehensions] allow-dict-calls-with-keyword-arguments = true - diff --git a/TODO.md b/TODO.md index 300e8a1..70148d0 100644 --- a/TODO.md +++ b/TODO.md @@ -1,3 +1,8 @@ +making web maps free and fun again +add dark themes in website + + + logrotate /var/log/nginx/*.log /var/log/nginx/*/*.log { diff --git a/ssh_lib/java.py b/ssh_lib/java.py index 3ba9a2a..f6370e8 100644 --- a/ssh_lib/java.py +++ b/ssh_lib/java.py @@ -1,14 +1,16 @@ -from ssh_lib.utils import ( +from ssh_lib.apt import ( apt_get_install, apt_get_purge, apt_get_update, - put_str, - sudo_cmd, + setup_apt_repository, +) +from ssh_lib.utils import ( ubuntu_codename, ) JAVA_VER = 24 +ADOPTIUM_REPO_NAME = 'adoptium' def java(c): @@ -16,25 +18,17 @@ def java(c): # remove old Ubuntu version of OpenJDK apt_get_purge(c, 'openjdk* temurin*') - # Download and install the Eclipse Adoptium GPG key - sudo_cmd( - c, - 'wget -qO - https://packages.adoptium.net/artifactory/api/gpg/key/public ' - '| gpg --dearmor ' - '| tee /etc/apt/trusted.gpg.d/adoptium.gpg > /dev/null', - ) - - # Get the Ubuntu codename codename = ubuntu_codename(c) - # Configure the Eclipse Adoptium apt repository - put_str( + setup_apt_repository( c, - '/etc/apt/sources.list.d/adoptium.list', - f'deb https://packages.adoptium.net/artifactory/deb {codename} main', + repo_name=ADOPTIUM_REPO_NAME, + key_url='https://packages.adoptium.net/artifactory/api/gpg/key/public', + repo_url='https://packages.adoptium.net/artifactory/deb', + suite=codename, + component='main', ) - # Update package list and install Temurin JDK apt_get_update(c) apt_get_install(c, f'temurin-{JAVA_VER}-jdk') diff --git a/ssh_lib/rclone.py b/ssh_lib/rclone.py index 5d967fa..3aaa3ec 100644 --- a/ssh_lib/rclone.py +++ b/ssh_lib/rclone.py @@ -1,4 +1,5 @@ -from ssh_lib.utils import apt_get_update, exists +from ssh_lib.apt import apt_get_update +from ssh_lib.utils import exists def rclone(c):