Compare commits

..

No commits in common. "2838efa0c256fb39126f4e0f0d19560d57c83abd" and "6c0c45643af6c826bd1ef21525d8db969c29a29e" have entirely different histories.

12 changed files with 8855 additions and 13640 deletions

View file

@ -1,56 +1,50 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the // For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/python // README at: https://github.com/devcontainers/templates/tree/main/src/python
{ {
"name": "Advent22 API", "name": "Advent22 API",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile "image": "mcr.microsoft.com/vscode/devcontainers/python:1-3.11-bookworm",
"image": "mcr.microsoft.com/devcontainers/python:3-3.14-trixie", // Features to add to the dev container. More info: https://containers.dev/features.
"features": {
// Features to add to the dev container. More info: https://containers.dev/features. "ghcr.io/devcontainers-extra/features/poetry:2": {},
"features": { "ghcr.io/devcontainers-extra/features/apt-get-packages:1": {
"ghcr.io/devcontainers/features/git-lfs:1": {}, "packages": "git-flow, git-lfs"
"ghcr.io/devcontainers-extra/features/poetry:2": {}, },
"ghcr.io/devcontainers-extra/features/apt-get-packages:1": { "ghcr.io/itsmechlark/features/redis-server:1": {}
"packages": "git-flow" },
}, "containerEnv": {
"ghcr.io/itsmechlark/features/redis-server:1": {} "TZ": "Europe/Berlin"
}, },
// Configure tool-specific properties.
"containerEnv": { "customizations": {
"TZ": "Europe/Berlin" // Configure properties specific to VS Code.
}, "vscode": {
// Set *default* container specific settings.json values on container create.
// Configure tool-specific properties. "settings": {
"customizations": { "python.defaultInterpreterPath": "/usr/local/bin/python",
// Configure properties specific to VS Code. "terminal.integrated.defaultProfile.linux": "zsh"
"vscode": { },
// Set *default* container specific settings.json values on container create. // Add the IDs of extensions you want installed when the container is created.
"settings": { "extensions": [
"python.defaultInterpreterPath": "/usr/local/bin/python", "be5invis.toml",
"terminal.integrated.defaultProfile.linux": "zsh" "mhutchie.git-graph",
}, "ms-python.python",
// Add the IDs of extensions you want installed when the container is created. "ms-python.black-formatter",
"extensions": [ "ms-python.flake8",
"be5invis.toml", "ms-python.isort",
"mhutchie.git-graph", "ms-python.vscode-pylance"
"ms-python.python", ]
"ms-python.black-formatter", }
"ms-python.flake8", },
"ms-python.isort", "postCreateCommand": "sudo /usr/local/py-utils/bin/poetry self add poetry-plugin-up",
"ms-python.vscode-pylance" // Use 'postStartCommand' to run commands after the container is started.
] "postStartCommand": "poetry install"
} // Features to add to the dev container. More info: https://containers.dev/features.
}, // "features": {},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// Use 'postCreateCommand' to run commands after the container is created. // "forwardPorts": [],
"postCreateCommand": "sudo /usr/local/py-utils/bin/poetry self add poetry-plugin-up", // Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "pip3 install --user -r requirements.txt",
// Use 'postStartCommand' to run commands after the container is started. // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
"postStartCommand": "poetry install" // "remoteUser": "root"
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
} }

View file

@ -1,33 +1,20 @@
{ {
"git.closeDiffOnOperation": true,
"[python]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "ms-python.black-formatter",
"editor.codeActionsOnSave": {
"source.organizeImports": "explicit",
"source.fixAll": "explicit",
},
},
"python.languageServer": "Pylance", "python.languageServer": "Pylance",
"python.analysis.autoImportCompletions": true, "editor.formatOnSave": true,
"python.analysis.importFormat": "relative", "[python]": {
"python.analysis.fixAll": [ "editor.defaultFormatter": "ms-python.black-formatter"
"source.convertImportFormat", },
"source.unusedImports", "editor.codeActionsOnSave": {
], "source.organizeImports": "explicit"
},
"git.closeDiffOnOperation": true,
"python.analysis.typeCheckingMode": "basic", "python.analysis.typeCheckingMode": "basic",
"python.analysis.diagnosticMode": "workspace", "python.analysis.diagnosticMode": "workspace",
"python.testing.pytestArgs": [
"test"
],
"python.testing.unittestEnabled": false, "python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true, "python.testing.pytestEnabled": true,
"python.testing.pytestArgs": [
"--import-mode=importlib",
"test",
],
"black-formatter.importStrategy": "fromEnvironment", "black-formatter.importStrategy": "fromEnvironment",
"flake8.importStrategy": "fromEnvironment", "flake8.importStrategy": "fromEnvironment",
"isort.importStrategy": "fromEnvironment",
} }

View file

@ -1,7 +1,7 @@
import colorsys import colorsys
import logging import logging
from dataclasses import dataclass from dataclasses import dataclass
from typing import AnyStr, Self, TypeAlias from typing import Self, TypeAlias, cast
import numpy as np import numpy as np
from PIL import Image as PILImage from PIL import Image as PILImage
@ -56,7 +56,7 @@ class AdventImage:
async def get_text_box( async def get_text_box(
self, self,
xy: _XY, xy: _XY,
text: AnyStr, text: str | bytes,
font: FreeTypeFont, font: FreeTypeFont,
anchor: str | None = "mm", anchor: str | None = "mm",
**text_kwargs, **text_kwargs,
@ -95,12 +95,12 @@ class AdventImage:
pixel_data = np.asarray(self.img.crop(box)) pixel_data = np.asarray(self.img.crop(box))
mean_color: np.ndarray = np.mean(pixel_data, axis=(0, 1)) mean_color: np.ndarray = np.mean(pixel_data, axis=(0, 1))
return _RGB(mean_color.astype(int)) return cast(_RGB, tuple(mean_color.astype(int)))
async def hide_text( async def hide_text(
self, self,
xy: _XY, xy: _XY,
text: AnyStr, text: str | bytes,
font: FreeTypeFont, font: FreeTypeFont,
anchor: str | None = "mm", anchor: str | None = "mm",
**text_kwargs, **text_kwargs,
@ -135,14 +135,14 @@ class AdventImage:
tc_v -= 3 tc_v -= 3
text_color = colorsys.hsv_to_rgb(tc_h, tc_s, tc_v) text_color = colorsys.hsv_to_rgb(tc_h, tc_s, tc_v)
text_color = _RGB(int(val) for val in text_color) text_color = tuple(int(val) for val in text_color)
# Buchstaben verstecken # Buchstaben verstecken
ImageDraw.Draw(self.img).text( ImageDraw.Draw(self.img).text(
xy=xy, xy=xy,
text=text, text=text,
font=font, font=font,
fill=text_color, fill=cast(_RGB, text_color),
anchor=anchor, anchor=anchor,
**text_kwargs, **text_kwargs,
) )

View file

@ -4,7 +4,8 @@ from typing import Callable, Hashable
import requests import requests
from cachetools.keys import hashkey from cachetools.keys import hashkey
from CacheToolsUtils import RedisCache as __RedisCache from CacheToolsUtils import RedisCache as __RedisCache
from redis.typing import EncodableT, ResponseT from redis.commands.core import ResponseT
from redis.typing import EncodableT
from webdav3.client import Client as __WebDAVclient from webdav3.client import Client as __WebDAVclient

2401
api/poetry.lock generated

File diff suppressed because it is too large Load diff

View file

@ -9,24 +9,24 @@ name = "advent22_api"
version = "0.1.0" version = "0.1.0"
[tool.poetry.dependencies] [tool.poetry.dependencies]
Pillow = "^12.1.1" Pillow = "^10.2.0"
asyncify = "^0.12.1" asyncify = "^0.9.2"
cachetools = "^7.0.1" cachetools = "^5.3.3"
cachetoolsutils = "^11.0" cachetoolsutils = "^8.5"
fastapi = "^0.129.0" fastapi = "^0.103.1"
markdown = "^3.10.2" markdown = "^3.6"
numpy = "^2.4.2" numpy = "^1.26.4"
pydantic-settings = "^2.13.0" pydantic-settings = "^2.2.1"
python = ">=3.11,<3.15" python = ">=3.11,<3.13"
redis = {extras = ["hiredis"], version = "^7.1.1"} redis = {extras = ["hiredis"], version = "^5.0.3"}
tomli-w = "^1.2.0" tomli-w = "^1.0.0"
uvicorn = {extras = ["standard"], version = "^0.40.0"} uvicorn = {extras = ["standard"], version = "^0.23.2"}
webdavclient3 = "^3.14.7" webdavclient3 = "^3.14.6"
[tool.poetry.group.dev.dependencies] [tool.poetry.group.dev.dependencies]
black = "^26.1.0" black = "^24.3.0"
flake8 = "^7.3.0" flake8 = "^7.0.0"
pytest = "^9.0.2" pytest = "^8.1.1"
[build-system] [build-system]
build-backend = "poetry.core.masonry.api" build-backend = "poetry.core.masonry.api"

View file

@ -4,7 +4,7 @@
"name": "Advent22 UI", "name": "Advent22 UI",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/javascript-node:4-24-trixie", "image": "mcr.microsoft.com/devcontainers/javascript-node:4-20-trixie",
// Features to add to the dev container. More info: https://containers.dev/features. // Features to add to the dev container. More info: https://containers.dev/features.
"features": { "features": {
@ -38,7 +38,7 @@
// "postCreateCommand": "yarn install", // "postCreateCommand": "yarn install",
// Use 'postStartCommand' to run commands after the container is started. // Use 'postStartCommand' to run commands after the container is started.
"postStartCommand": "yarn dlx update-browserslist-db@latest && yarn install" "postStartCommand": "npx --yes update-browserslist-db@latest && yarn install --production false"
// Use 'forwardPorts' to make a list of ports inside the container available locally. // Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [], // "forwardPorts": [],

156
ui/.gitignore vendored
View file

@ -1,149 +1,23 @@
.DS_Store .DS_Store
node_modules
/dist
# https://raw.githubusercontent.com/github/gitignore/refs/heads/main/Node.gitignore
# Logs # local env files
logs .env.local
*.log .env.*.local
# Log files
npm-debug.log* npm-debug.log*
yarn-debug.log* yarn-debug.log*
yarn-error.log* yarn-error.log*
pnpm-debug.log* pnpm-debug.log*
lerna-debug.log*
# Diagnostic reports (https://nodejs.org/api/report.html) # Editor directories and files
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json .idea
# .vscode
# Runtime data *.suo
pids *.ntvs*
*.pid *.njsproj
*.seed *.sln
*.pid.lock *.sw?
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
*.lcov
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# Snowpack dependency directory (https://snowpack.dev/)
web_modules/
# TypeScript cache
*.tsbuildinfo
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional stylelint cache
.stylelintcache
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variable files
.env
.env.*
!.env.example
# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache
# Next.js build output
.next
out
# Nuxt.js build / generate output
.nuxt
dist
.output
# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public
# vuepress build output
.vuepress/dist
# vuepress v2.x temp and cache directory
.temp
.cache
# Sveltekit cache directory
.svelte-kit/
# vitepress build output
**/.vitepress/dist
# vitepress cache directory
**/.vitepress/cache
# Docusaurus cache and generated files
.docusaurus
# Serverless directories
.serverless/
# FuseBox cache
.fusebox/
# DynamoDB Local files
.dynamodb/
# Firebase cache directory
.firebase/
# TernJS port file
.tern-port
# Stores VSCode versions used for testing VSCode extensions
.vscode-test
# pnpm
.pnpm-store
# yarn v3
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
# Vite files
vite.config.js.timestamp-*
vite.config.ts.timestamp-*
.vite/

File diff suppressed because one or more lines are too long

View file

@ -1,2 +0,0 @@
nodeLinker: node-modules
yarnPath: .yarn/releases/yarn-4.12.0.cjs

View file

@ -2,7 +2,6 @@
"name": "advent22_ui", "name": "advent22_ui",
"version": "0.1.0", "version": "0.1.0",
"private": true, "private": true,
"packageManager": "yarn@4.12.0",
"scripts": { "scripts": {
"serve": "vue-cli-service serve", "serve": "vue-cli-service serve",
"build": "vue-cli-service build", "build": "vue-cli-service build",

18807
ui/yarn.lock

File diff suppressed because it is too large Load diff