testsAndMisc/python_pkg/anki_decks/polish_license_plates
Krzysztof kuhy Rudnicki ee27d10fef Reduce per-file-ignores by fixing lint violations across codebase
Fix ruff violations in ~15 source files and ~60+ test files to minimize
per-file-ignores in pyproject.toml. Remaining ignores are justified with
comments explaining why each suppression is necessary.

Source fixes: FBT003 (keyword args), S310 (URL validation), SLF001
(private access), T201 (print→logging), C901 (complexity), E501 (line
length), E402 (import order).

Test fixes: SIM117 (combined with), FBT (boolean args), PERF203 (try in
loop), S310/S607 (URLs/executables), E402/E501 (imports/lines), S108
(tmp paths), PLR0913 (too many args), ARG (unused args), ANN (type
annotations), RUF059 (unused unpacked vars), PT019 (fixture naming).

Remaining per-file-ignores (with justifications):
- Tests: ARG, D, PLC0415, PLR2004, S101, SLF001
- music_gen sources: PLC0415 (heavy ML lazy imports)
- moviepy_showcase: PLC0415 (circular dependency)
- generate_images: PLR0913 (matplotlib helpers need many params)
- praca_magisterska_video: E501, E402 (long paths, mpl.use)
2026-03-25 18:58:05 +01:00
..
tests Reduce per-file-ignores by fixing lint violations across codebase 2026-03-25 18:58:05 +01:00
__init__.py Consolidate all Anki deck generators into python_pkg/anki_decks/ 2026-02-07 15:32:23 +01:00
fetch_license_plates.py test: achieve 100% branch coverage across all python_pkg packages 2026-03-21 17:51:36 +01:00
license_plate_data.py Consolidate all Anki deck generators into python_pkg/anki_decks/ 2026-02-07 15:32:23 +01:00
polish_license_plates_anki.py refactor(anki_decks): remove all noqa comments and fix underlying issues 2026-03-13 20:47:52 +01:00
README.md Consolidate all Anki deck generators into python_pkg/anki_decks/ 2026-02-07 15:32:23 +01:00
run.sh feat: added run sh and makefile scripts 2026-02-22 22:00:50 +01:00

Polish License Plates Anki Generator

Generate Anki flashcards for learning Polish car license plate codes.

Overview

This package generates Anki-compatible flashcard decks for all Polish vehicle registration plate codes. Each code is mapped to its corresponding location (city or powiat).

Polish license plates use a system where:

  • First letter indicates the voivodeship (province)
  • Following 1-2 letters indicate the specific city or powiat (county)

Features

  • 444 license plate codes covering all Polish voivodeships, cities, and powiats
  • Bidirectional flashcards:
    • Code → Location (e.g., WYWarszawa Wola)
    • Location → Code (e.g., Warszawa WolaWY)
  • 888 total flashcards for comprehensive learning
  • Visual license plate styling in flashcards (yellow background, monospace font)
  • Dark mode support
  • Self-contained .apkg file - no manual setup required

Data Source

License plate data is automatically extracted from Wikipedia's authoritative table:

This ensures the codes are always based on the most current public information.

Usage

Generate Flashcards

# Generate with default settings
python -m python_pkg.anki_decks.polish_license_plates.polish_license_plates_anki

# Specify custom output file
python -m python_pkg.anki_decks.polish_license_plates.polish_license_plates_anki \
    --output my_plates.apkg

# Use custom deck name
python -m python_pkg.anki_decks.polish_license_plates.polish_license_plates_anki \
    --deck-name "My Polish Plates"

Update License Plate Data

To fetch the latest data from Wikipedia:

# Use cached data if available (default)
python -m python_pkg.anki_decks.polish_license_plates.fetch_license_plates

# Force refresh from Wikipedia (ignore cache)
python -m python_pkg.anki_decks.polish_license_plates.fetch_license_plates --force

Caching: Downloaded Wikipedia data is cached for 7 days in .wikipedia_cache/ to avoid unnecessary requests. Use --force to bypass the cache.

This will update license_plate_data.py with the current codes from Wikipedia.

Requirements: pip install requests beautifulsoup4 lxml

Import into Anki

  1. Open Anki
  2. File → Import
  3. Select the generated .apkg file
  4. Click Import

Examples

License Plate Codes by Voivodeship

Voivodeship First Letter Example Codes
Dolnośląskie D DA (Wrocław), DB (Wałbrzych), DJ (Jelenia Góra)
Kujawsko-Pomorskie C CB (Bydgoszcz), CT (Toruń), CG (Grudziądz)
Lubelskie L LL (Lublin), LC (Chełm), LZ (Zamość)
Lubuskie F FZ (Zielona Góra), FG (Gorzów Wielkopolski)
Łódzkie E ED (Łódź), EP (Piotrków Trybunalski)
Małopolskie K KR (Kraków), KT (Tarnów), KN (Nowy Sącz)
Mazowieckie W WA-WZ (Warsaw), WR (Radom), WS (Siedlce)
Opolskie O OP (Opole), OK (Kędzierzyn-Koźle)
Podkarpackie R RR (Rzeszów), RP (Przemyśl), RK (Krosno)
Podlaskie B BI (Białystok), BL (Łomża), BSU (Suwałki)
Pomorskie G GD (Gdańsk), GDY (Gdynia), GS (Słupsk)
Śląskie S SK (Katowice), SC (Chorzów), SB (Bielsko-Biała)
Świętokrzyskie T TK (Kielce), TSK (Skarżysko-Kamienna)
Warmińsko-Mazurskie N NO (Olsztyn), NE (Elbląg), NG (Giżycko)
Wielkopolskie P PO (Poznań), PKA (Kalisz), PIA (Piła)
Zachodniopomorskie Z ZS (Szczecin), ZKO (Koszalin), ZSW (Świnoujście)

Warsaw (Warszawa) Codes

Warsaw has an extensive range of codes (WA-WZ):

  • WA: Warszawa (general)
  • WB: Warszawa Bemowo
  • WC: Ciechanów
  • WD: Warszawa Praga Południe
  • WE: Warszawa Praga Północ
  • WH: Warszawa Mokotów
  • WY: Warszawa Wola
  • And many more...

Data

The package includes 444 license plate codes covering:

  • All 16 Polish voivodeships
  • Major cities with powiat rights (e.g., Kraków, Gdańsk, Poznań)
  • All powiats (counties) across Poland

Testing

Run the test suite:

python -m pytest python_pkg/polish_license_plates/tests/ -v

All 17 tests validate:

  • Data integrity (444 codes, no duplicates)
  • Correct voivodeship prefixes
  • Major cities present
  • Anki package generation
  • Bidirectional card templates
  • CLI functionality

Technical Details

  • Package format: Anki .apkg (SQLite database)
  • Card model: Bidirectional with two templates per note
  • Styling: Custom CSS with license plate visual design
  • Tags: geography, poland, license-plates, transportation

Requirements

  • Python 3.10+
  • genanki (for Anki package generation)

License

Part of the testsAndMisc repository.