Skip to content

Commit f2b5b40

Browse files
Save progress
I might have done too much refactoring, woops
1 parent a457d74 commit f2b5b40

42 files changed

Lines changed: 5445 additions & 1695 deletions

Some content is hidden

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

.editorconfig

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -9,36 +9,14 @@ trim_trailing_whitespace = true
99
insert_final_newline = true
1010
max_line_length = 100
1111

12-
[*.cs]
13-
indent_size = 4
14-
insert_final_newline = false
15-
16-
[{*.html,*.jte,*.kte,*.jinja}]
12+
[{*.html,*.jinja}]
1713
indent_size = 4
1814
insert_final_newline = false
1915
max_line_length = off
2016

21-
[*.java]
22-
indent_size = 4
23-
insert_final_newline = false
24-
2517
[*.json]
2618
insert_final_newline = false
2719

28-
[{*.kt,*.kts}]
29-
ij_kotlin_allow_trailing_comma = true
30-
ij_kotlin_allow_trailing_comma_on_call_site = true
31-
ij_kotlin_imports_layout = *,java.**,javax.**,kotlin.**,^
32-
ij_kotlin_packages_to_use_import_on_demand = unset
33-
indent_size = 4
34-
ktlint_code_style = ktlint_official
35-
ktlint_standard = enabled
36-
ktlint_experimental = disabled
37-
ktlint_standard_string-template-indent = disabled
38-
ktlint_standard_multiline-expression-wrapping = disabled
39-
ktlint_function_signature_body_expression_wrapping = multiline
40-
max_line_length = 140
41-
4220
[*.md]
4321
trim_trailing_whitespace = false
4422
max_line_length = off

.gitattributes

Lines changed: 85 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,116 @@
1+
# Common settings that generally should always be used with your language specific settings
2+
3+
# Auto detect text files and perform LF normalization
14
* text=auto
25

3-
.gitattributes export-ignore
4-
.gitignore export-ignore
6+
#
7+
# The above will handle all files NOT found below
8+
#
59

6-
*.md text diff=markdown
10+
# Documents
11+
*.bibtex text diff=bibtex
12+
*.doc diff=astextplain
13+
*.DOC diff=astextplain
14+
*.docx diff=astextplain
15+
*.DOCX diff=astextplain
16+
*.dot diff=astextplain
17+
*.DOT diff=astextplain
18+
*.pdf diff=astextplain
19+
*.PDF diff=astextplain
720
*.rtf diff=astextplain
8-
*.sql text
21+
*.RTF diff=astextplain
22+
*.md text diff=markdown
23+
*.mdx text diff=markdown
24+
*.tex text diff=tex
25+
*.adoc text
26+
*.textile text
27+
*.mustache text
28+
*.csv text eol=crlf
29+
*.tab text
30+
*.tsv text
931
*.txt text
32+
*.sql text
33+
*.epub diff=astextplain
1034

11-
*.jpg binary
35+
# Graphics
1236
*.png binary
37+
*.jpg binary
38+
*.jpeg binary
39+
*.gif binary
40+
*.tif binary
41+
*.tiff binary
42+
*.ico binary
43+
# SVG treated as text by default.
44+
*.svg text
45+
# If you want to treat it as binary,
46+
# use the following line instead.
47+
# *.svg binary
48+
*.eps binary
1349

50+
# Scripts
1451
*.bash text eol=lf
15-
*.bat text eol=crlf
16-
*.cmd text eol=crlf
1752
*.fish text eol=lf
18-
*.ps1 text eol=crlf
1953
*.sh text eol=lf
2054
*.zsh text eol=lf
55+
# These are explicitly windows files and should use crlf
56+
*.bat text eol=crlf
57+
*.cmd text eol=crlf
58+
*.ps1 text eol=crlf
2159

22-
*.csv text
60+
# Serialisation
2361
*.json text
2462
*.toml text
2563
*.xml text
2664
*.yaml text
2765
*.yml text
2866

67+
# Archives
2968
*.7z binary
3069
*.gz binary
3170
*.tar binary
3271
*.tgz binary
3372
*.zip binary
3473

35-
# C#
36-
*.cs text diff=csharp
37-
*.cshtml text diff=html
38-
*.csproj text eol=crlf
39-
*.csx text diff=csharp
40-
*.sln text eol=crlf
41-
42-
# Java
43-
*.gradle text diff=java
44-
*.gradle.kts text diff=kotlin
45-
*.groovy text diff=java
46-
*.java text diff=java
47-
*.kt text diff=kotlin
48-
*.scala text diff=java
49-
50-
# Python
74+
# Text files where line endings should be preserved
75+
*.patch -text
76+
77+
#
78+
# Exclude files from exporting
79+
#
80+
81+
.gitattributes export-ignore
82+
.gitignore export-ignore
83+
.gitkeep export-ignore
84+
# Apply override to all files in the directory
85+
*.md linguist-detectable
86+
# Basic .gitattributes for a python repo.
87+
88+
# Source files
89+
# ============
5190
*.pxd text diff=python
5291
*.py text diff=python
5392
*.py3 text diff=python
54-
*.pyi text diff=python
5593
*.pyw text diff=python
5694
*.pyx text diff=python
5795
*.pyz text diff=python
96+
*.pyi text diff=python
97+
98+
# Binary files
99+
# ============
100+
*.db binary
101+
*.p binary
102+
*.pkl binary
103+
*.pickle binary
104+
*.pyc binary export-ignore
105+
*.pyo binary export-ignore
106+
*.pyd binary
107+
108+
# Jupyter notebook
109+
*.ipynb text eol=lf
110+
111+
# Note: .db, .p, and .pkl files are associated
112+
# with the python modules ``pickle``, ``dbm.*``,
113+
# ``shelve``, ``marshal``, ``anydbm``, & ``bsddb``
114+
# (among others).
115+
# Fix syntax highlighting on GitHub to allow comments
116+
.vscode/*.json linguist-language=JSON-with-Comments

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ logs/
1313
*.iml
1414
*.log
1515
*.txt
16+
.coverage
1617
.envrc
1718
.pdm-python
1819
.python-version

mediux_posters/__init__.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,39 +6,44 @@
66
"get_state_root",
77
"setup_logging",
88
]
9-
__version__ = "0.4.2"
9+
__version__ = "0.5.0"
1010

1111
import logging
1212
import os
13+
from functools import cache
1314
from pathlib import Path
1415

1516
from rich.logging import RichHandler
1617
from rich.traceback import install
1718

18-
from mediux_posters.console import CONSOLE
19+
from mediux_posters.constants import CONSOLE
1920

2021

22+
@cache
2123
def get_cache_root() -> Path:
2224
cache_home = os.getenv("XDG_CACHE_HOME", default=str(Path.home() / ".cache"))
2325
folder = Path(cache_home).resolve() / "mediux-posters"
2426
folder.mkdir(exist_ok=True, parents=True)
2527
return folder
2628

2729

30+
@cache
2831
def get_config_root() -> Path:
2932
config_home = os.getenv("XDG_CONFIG_HOME", default=str(Path.home() / ".config"))
3033
folder = Path(config_home).resolve() / "mediux-posters"
3134
folder.mkdir(exist_ok=True, parents=True)
3235
return folder
3336

3437

38+
@cache
3539
def get_data_root() -> Path:
3640
data_home = os.getenv("XDG_DATA_HOME", default=str(Path.home() / ".local" / "share"))
3741
folder = Path(data_home).resolve() / "mediux-posters"
3842
folder.mkdir(exist_ok=True, parents=True)
3943
return folder
4044

4145

46+
@cache
4247
def get_state_root() -> Path:
4348
data_home = os.getenv("XDG_STATE_HOME", default=str(Path.home() / ".local" / "state"))
4449
folder = Path(data_home).resolve() / "mediux-posters"
@@ -47,7 +52,7 @@ def get_state_root() -> Path:
4752

4853

4954
def setup_logging(debug: bool = False) -> None:
50-
install(show_locals=True, max_frames=3, console=CONSOLE)
55+
install(show_locals=debug, max_frames=3, console=CONSOLE)
5156

5257
console_handler = RichHandler(
5358
rich_tracebacks=True,
@@ -68,3 +73,6 @@ def setup_logging(debug: bool = False) -> None:
6873
level=logging.DEBUG if debug else logging.INFO,
6974
handlers=[console_handler, file_handler],
7075
)
76+
77+
logging.getLogger("httpx").setLevel(logging.INFO if debug else logging.WARNING)
78+
logging.getLogger("httpcore").setLevel(logging.INFO if debug else logging.WARNING)

0 commit comments

Comments
 (0)