pixel-sizes 0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pixel_sizes-0.0/.coveragerc +4 -0
- pixel_sizes-0.0/.editorconfig +10 -0
- pixel_sizes-0.0/.github/renovate.json5 +6 -0
- pixel_sizes-0.0/.github/workflows/gitignore-in.yml +16 -0
- pixel_sizes-0.0/.github/workflows/happy.yml +18 -0
- pixel_sizes-0.0/.github/workflows/pypi-publish.yml +49 -0
- pixel_sizes-0.0/.github/workflows/python-test.yml +61 -0
- pixel_sizes-0.0/.github/workflows/spellcheck.yml +16 -0
- pixel_sizes-0.0/.gitignore +249 -0
- pixel_sizes-0.0/.gitignore.in +5 -0
- pixel_sizes-0.0/LICENSE +11 -0
- pixel_sizes-0.0/PKG-INFO +49 -0
- pixel_sizes-0.0/README.md +18 -0
- pixel_sizes-0.0/pixel_sizes/__init__.py +101 -0
- pixel_sizes-0.0/pixel_sizes/_version.py +21 -0
- pixel_sizes-0.0/pixel_sizes/py.typed +0 -0
- pixel_sizes-0.0/pixel_sizes.egg-info/PKG-INFO +49 -0
- pixel_sizes-0.0/pixel_sizes.egg-info/SOURCES.txt +23 -0
- pixel_sizes-0.0/pixel_sizes.egg-info/dependency_links.txt +1 -0
- pixel_sizes-0.0/pixel_sizes.egg-info/top_level.txt +1 -0
- pixel_sizes-0.0/pyproject.toml +71 -0
- pixel_sizes-0.0/setup.cfg +4 -0
- pixel_sizes-0.0/tests/__init__.py +0 -0
- pixel_sizes-0.0/tests/test_basis.py +54 -0
- pixel_sizes-0.0/uv.lock +430 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
name: Update gitignore file
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
schedule:
|
|
5
|
+
# daily at 00:00
|
|
6
|
+
- cron: '0 0 * * *'
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: write
|
|
10
|
+
pull-requests: write
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
update-gitignore:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
steps:
|
|
16
|
+
- uses: gitignore-in/gh-action@v0.2.2
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
name: happy-commit
|
|
2
|
+
on:
|
|
3
|
+
- pull_request
|
|
4
|
+
|
|
5
|
+
permissions:
|
|
6
|
+
contents: read
|
|
7
|
+
pull-requests: write
|
|
8
|
+
issues: write
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
happy:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
name: happy
|
|
14
|
+
continue-on-error: true
|
|
15
|
+
steps:
|
|
16
|
+
- uses: kitsuyui/happy-commit@v0.9
|
|
17
|
+
with:
|
|
18
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
name: Packaging
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
types: [opened, synchronize, reopened]
|
|
6
|
+
release:
|
|
7
|
+
# "released" events are emitted either when directly be released or be edited from pre-released.
|
|
8
|
+
types: [prereleased, released]
|
|
9
|
+
|
|
10
|
+
env:
|
|
11
|
+
python_version: 3.13
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
deploy:
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
|
|
19
|
+
- name: Set up Python
|
|
20
|
+
id: setup-python
|
|
21
|
+
uses: actions/setup-python@v5
|
|
22
|
+
with:
|
|
23
|
+
python-version: ${{ env.python_version }}
|
|
24
|
+
|
|
25
|
+
- name: Set up uv
|
|
26
|
+
uses: astral-sh/setup-uv@v6
|
|
27
|
+
|
|
28
|
+
- name: Install dependencies
|
|
29
|
+
run: |
|
|
30
|
+
uv python pin ${{ env.python_version }}
|
|
31
|
+
uv sync
|
|
32
|
+
|
|
33
|
+
- name: Build
|
|
34
|
+
run: uv build
|
|
35
|
+
|
|
36
|
+
- name: Publish distribution to Test PyPI
|
|
37
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
38
|
+
if: github.event_name == 'release' && github.event.release.prerelease
|
|
39
|
+
with:
|
|
40
|
+
user: __token__
|
|
41
|
+
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
|
|
42
|
+
repository-url: https://test.pypi.org/legacy/
|
|
43
|
+
|
|
44
|
+
- name: Publish distribution to PyPI
|
|
45
|
+
if: github.event_name == 'release' && !github.event.release.prerelease
|
|
46
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
47
|
+
with:
|
|
48
|
+
user: __token__
|
|
49
|
+
password: ${{ secrets.PYPI_API_TOKEN }}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
name: Test
|
|
2
|
+
on:
|
|
3
|
+
# pull-request events are not triggered when a PR is merged
|
|
4
|
+
# push events are not triggered when a PR created from a fork repository
|
|
5
|
+
# So we need both to run tests on every PR and after merging
|
|
6
|
+
pull_request:
|
|
7
|
+
push:
|
|
8
|
+
branches:
|
|
9
|
+
- main
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
test:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
strategy:
|
|
15
|
+
fail-fast: false
|
|
16
|
+
matrix:
|
|
17
|
+
python: ["3.9", "3.10", "3.11", "3.12", "3.13"]
|
|
18
|
+
|
|
19
|
+
steps:
|
|
20
|
+
- name: Checkout
|
|
21
|
+
uses: actions/checkout@v4
|
|
22
|
+
|
|
23
|
+
- name: Set up Python
|
|
24
|
+
id: setup-python
|
|
25
|
+
uses: actions/setup-python@v5
|
|
26
|
+
with:
|
|
27
|
+
python-version: "${{ matrix.python }}"
|
|
28
|
+
|
|
29
|
+
- name: Set up uv
|
|
30
|
+
uses: astral-sh/setup-uv@v6
|
|
31
|
+
|
|
32
|
+
- name: Install dependencies
|
|
33
|
+
run: uv sync
|
|
34
|
+
|
|
35
|
+
- name: Lint
|
|
36
|
+
run: uv run poe check
|
|
37
|
+
|
|
38
|
+
- name: Check Python version
|
|
39
|
+
run: |
|
|
40
|
+
actual_version=$(uv run python --version)
|
|
41
|
+
expected_version="Python ${{ matrix.python }}"
|
|
42
|
+
if [ "$actual_version" == *"$expected_version"* ]; then
|
|
43
|
+
echo "Expected $expected_version, but got $actual_version"
|
|
44
|
+
exit 1
|
|
45
|
+
fi
|
|
46
|
+
- name: Test
|
|
47
|
+
run: uv run poe test
|
|
48
|
+
|
|
49
|
+
- name: Coverage
|
|
50
|
+
run: uv run poe coverage-xml
|
|
51
|
+
|
|
52
|
+
- name: Upload coverage report to Codecov
|
|
53
|
+
if: matrix.python == '3.13'
|
|
54
|
+
uses: codecov/codecov-action@v5
|
|
55
|
+
with:
|
|
56
|
+
token: ${{ secrets.CODECOV_TOKEN }}
|
|
57
|
+
files: ./coverage.xml
|
|
58
|
+
flags: unittests
|
|
59
|
+
name: codecov-umbrella
|
|
60
|
+
fail_ci_if_error: true
|
|
61
|
+
verbose: true
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
name: Spellcheck
|
|
2
|
+
on:
|
|
3
|
+
- pull_request
|
|
4
|
+
permissions:
|
|
5
|
+
contents: read
|
|
6
|
+
jobs:
|
|
7
|
+
check:
|
|
8
|
+
runs-on: ubuntu-latest
|
|
9
|
+
steps:
|
|
10
|
+
- name: Checkout
|
|
11
|
+
uses: actions/checkout@v4
|
|
12
|
+
|
|
13
|
+
- name: Check spelling
|
|
14
|
+
uses: crate-ci/typos@master
|
|
15
|
+
# typos is a Source code spell checker
|
|
16
|
+
# https://github.com/crate-ci/typos
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
# DO NOT EDIT THIS FILE
|
|
2
|
+
# Generated by gitignore.in
|
|
3
|
+
# Edit .gitignore.in instead of this file
|
|
4
|
+
# Run `gitignore.in` to build .gitignore
|
|
5
|
+
# -----------------------------------------------------------------------------
|
|
6
|
+
# gibo dump Linux
|
|
7
|
+
### Generated by gibo (https://github.com/simonwhitaker/gibo)
|
|
8
|
+
### https://raw.github.com/github/gitignore/4488915eec0b3a45b5c63ead28f286819c0917de/Global/Linux.gitignore
|
|
9
|
+
|
|
10
|
+
*~
|
|
11
|
+
|
|
12
|
+
# temporary files which can be created if a process still has a handle open of a deleted file
|
|
13
|
+
.fuse_hidden*
|
|
14
|
+
|
|
15
|
+
# KDE directory preferences
|
|
16
|
+
.directory
|
|
17
|
+
|
|
18
|
+
# Linux trash folder which might appear on any partition or disk
|
|
19
|
+
.Trash-*
|
|
20
|
+
|
|
21
|
+
# .nfs files are created when an open file is removed but is still being accessed
|
|
22
|
+
.nfs*
|
|
23
|
+
# -----------------------------------------------------------------------------
|
|
24
|
+
# gibo dump Windows
|
|
25
|
+
### Generated by gibo (https://github.com/simonwhitaker/gibo)
|
|
26
|
+
### https://raw.github.com/github/gitignore/4488915eec0b3a45b5c63ead28f286819c0917de/Global/Windows.gitignore
|
|
27
|
+
|
|
28
|
+
# Windows thumbnail cache files
|
|
29
|
+
Thumbs.db
|
|
30
|
+
Thumbs.db:encryptable
|
|
31
|
+
ehthumbs.db
|
|
32
|
+
ehthumbs_vista.db
|
|
33
|
+
|
|
34
|
+
# Dump file
|
|
35
|
+
*.stackdump
|
|
36
|
+
|
|
37
|
+
# Folder config file
|
|
38
|
+
[Dd]esktop.ini
|
|
39
|
+
|
|
40
|
+
# Recycle Bin used on file shares
|
|
41
|
+
$RECYCLE.BIN/
|
|
42
|
+
|
|
43
|
+
# Windows Installer files
|
|
44
|
+
*.cab
|
|
45
|
+
*.msi
|
|
46
|
+
*.msix
|
|
47
|
+
*.msm
|
|
48
|
+
*.msp
|
|
49
|
+
|
|
50
|
+
# Windows shortcuts
|
|
51
|
+
*.lnk
|
|
52
|
+
# -----------------------------------------------------------------------------
|
|
53
|
+
# gibo dump macOS
|
|
54
|
+
### Generated by gibo (https://github.com/simonwhitaker/gibo)
|
|
55
|
+
### https://raw.github.com/github/gitignore/4488915eec0b3a45b5c63ead28f286819c0917de/Global/macOS.gitignore
|
|
56
|
+
|
|
57
|
+
# General
|
|
58
|
+
.DS_Store
|
|
59
|
+
.AppleDouble
|
|
60
|
+
.LSOverride
|
|
61
|
+
|
|
62
|
+
# Icon must end with two \r
|
|
63
|
+
Icon
|
|
64
|
+
|
|
65
|
+
# Thumbnails
|
|
66
|
+
._*
|
|
67
|
+
|
|
68
|
+
# Files that might appear in the root of a volume
|
|
69
|
+
.DocumentRevisions-V100
|
|
70
|
+
.fseventsd
|
|
71
|
+
.Spotlight-V100
|
|
72
|
+
.TemporaryItems
|
|
73
|
+
.Trashes
|
|
74
|
+
.VolumeIcon.icns
|
|
75
|
+
.com.apple.timemachine.donotpresent
|
|
76
|
+
|
|
77
|
+
# Directories potentially created on remote AFP share
|
|
78
|
+
.AppleDB
|
|
79
|
+
.AppleDesktop
|
|
80
|
+
Network Trash Folder
|
|
81
|
+
Temporary Items
|
|
82
|
+
.apdisk
|
|
83
|
+
# -----------------------------------------------------------------------------
|
|
84
|
+
# gibo dump Python
|
|
85
|
+
### Generated by gibo (https://github.com/simonwhitaker/gibo)
|
|
86
|
+
### https://raw.github.com/github/gitignore/4488915eec0b3a45b5c63ead28f286819c0917de/Python.gitignore
|
|
87
|
+
|
|
88
|
+
# Byte-compiled / optimized / DLL files
|
|
89
|
+
__pycache__/
|
|
90
|
+
*.py[cod]
|
|
91
|
+
*$py.class
|
|
92
|
+
|
|
93
|
+
# C extensions
|
|
94
|
+
*.so
|
|
95
|
+
|
|
96
|
+
# Distribution / packaging
|
|
97
|
+
.Python
|
|
98
|
+
build/
|
|
99
|
+
develop-eggs/
|
|
100
|
+
dist/
|
|
101
|
+
downloads/
|
|
102
|
+
eggs/
|
|
103
|
+
.eggs/
|
|
104
|
+
lib/
|
|
105
|
+
lib64/
|
|
106
|
+
parts/
|
|
107
|
+
sdist/
|
|
108
|
+
var/
|
|
109
|
+
wheels/
|
|
110
|
+
share/python-wheels/
|
|
111
|
+
*.egg-info/
|
|
112
|
+
.installed.cfg
|
|
113
|
+
*.egg
|
|
114
|
+
MANIFEST
|
|
115
|
+
|
|
116
|
+
# PyInstaller
|
|
117
|
+
# Usually these files are written by a python script from a template
|
|
118
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
119
|
+
*.manifest
|
|
120
|
+
*.spec
|
|
121
|
+
|
|
122
|
+
# Installer logs
|
|
123
|
+
pip-log.txt
|
|
124
|
+
pip-delete-this-directory.txt
|
|
125
|
+
|
|
126
|
+
# Unit test / coverage reports
|
|
127
|
+
htmlcov/
|
|
128
|
+
.tox/
|
|
129
|
+
.nox/
|
|
130
|
+
.coverage
|
|
131
|
+
.coverage.*
|
|
132
|
+
.cache
|
|
133
|
+
nosetests.xml
|
|
134
|
+
coverage.xml
|
|
135
|
+
*.cover
|
|
136
|
+
*.py,cover
|
|
137
|
+
.hypothesis/
|
|
138
|
+
.pytest_cache/
|
|
139
|
+
cover/
|
|
140
|
+
|
|
141
|
+
# Translations
|
|
142
|
+
*.mo
|
|
143
|
+
*.pot
|
|
144
|
+
|
|
145
|
+
# Django stuff:
|
|
146
|
+
*.log
|
|
147
|
+
local_settings.py
|
|
148
|
+
db.sqlite3
|
|
149
|
+
db.sqlite3-journal
|
|
150
|
+
|
|
151
|
+
# Flask stuff:
|
|
152
|
+
instance/
|
|
153
|
+
.webassets-cache
|
|
154
|
+
|
|
155
|
+
# Scrapy stuff:
|
|
156
|
+
.scrapy
|
|
157
|
+
|
|
158
|
+
# Sphinx documentation
|
|
159
|
+
docs/_build/
|
|
160
|
+
|
|
161
|
+
# PyBuilder
|
|
162
|
+
.pybuilder/
|
|
163
|
+
target/
|
|
164
|
+
|
|
165
|
+
# Jupyter Notebook
|
|
166
|
+
.ipynb_checkpoints
|
|
167
|
+
|
|
168
|
+
# IPython
|
|
169
|
+
profile_default/
|
|
170
|
+
ipython_config.py
|
|
171
|
+
|
|
172
|
+
# pyenv
|
|
173
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
174
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
175
|
+
# .python-version
|
|
176
|
+
|
|
177
|
+
# pipenv
|
|
178
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
179
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
180
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
181
|
+
# install all needed dependencies.
|
|
182
|
+
#Pipfile.lock
|
|
183
|
+
|
|
184
|
+
# poetry
|
|
185
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
186
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
187
|
+
# commonly ignored for libraries.
|
|
188
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
189
|
+
#poetry.lock
|
|
190
|
+
|
|
191
|
+
# pdm
|
|
192
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
193
|
+
#pdm.lock
|
|
194
|
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
|
195
|
+
# in version control.
|
|
196
|
+
# https://pdm.fming.dev/#use-with-ide
|
|
197
|
+
.pdm.toml
|
|
198
|
+
|
|
199
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
200
|
+
__pypackages__/
|
|
201
|
+
|
|
202
|
+
# Celery stuff
|
|
203
|
+
celerybeat-schedule
|
|
204
|
+
celerybeat.pid
|
|
205
|
+
|
|
206
|
+
# SageMath parsed files
|
|
207
|
+
*.sage.py
|
|
208
|
+
|
|
209
|
+
# Environments
|
|
210
|
+
.env
|
|
211
|
+
.venv
|
|
212
|
+
env/
|
|
213
|
+
venv/
|
|
214
|
+
ENV/
|
|
215
|
+
env.bak/
|
|
216
|
+
venv.bak/
|
|
217
|
+
|
|
218
|
+
# Spyder project settings
|
|
219
|
+
.spyderproject
|
|
220
|
+
.spyproject
|
|
221
|
+
|
|
222
|
+
# Rope project settings
|
|
223
|
+
.ropeproject
|
|
224
|
+
|
|
225
|
+
# mkdocs documentation
|
|
226
|
+
/site
|
|
227
|
+
|
|
228
|
+
# mypy
|
|
229
|
+
.mypy_cache/
|
|
230
|
+
.dmypy.json
|
|
231
|
+
dmypy.json
|
|
232
|
+
|
|
233
|
+
# Pyre type checker
|
|
234
|
+
.pyre/
|
|
235
|
+
|
|
236
|
+
# pytype static type analyzer
|
|
237
|
+
.pytype/
|
|
238
|
+
|
|
239
|
+
# Cython debug symbols
|
|
240
|
+
cython_debug/
|
|
241
|
+
|
|
242
|
+
# PyCharm
|
|
243
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
244
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
245
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
246
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
247
|
+
#.idea/
|
|
248
|
+
# -----------------------------------------------------------------------------
|
|
249
|
+
_version.py
|
pixel_sizes-0.0/LICENSE
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
Copyright 2022-2025 Kitsu Yui
|
|
2
|
+
|
|
3
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
4
|
+
|
|
5
|
+
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
6
|
+
|
|
7
|
+
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
8
|
+
|
|
9
|
+
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
|
10
|
+
|
|
11
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
pixel_sizes-0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pixel_sizes
|
|
3
|
+
Version: 0.0
|
|
4
|
+
Summary: Pixel sizes
|
|
5
|
+
Author-email: Yui KITSU <kitsuyui+github@kitsuyui.com>
|
|
6
|
+
License: Copyright 2022-2025 Kitsu Yui
|
|
7
|
+
|
|
8
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
9
|
+
|
|
10
|
+
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
11
|
+
|
|
12
|
+
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
13
|
+
|
|
14
|
+
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
|
15
|
+
|
|
16
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
17
|
+
|
|
18
|
+
Project-URL: Homepage, https://github.com/kitsuyui/python-pixel-sizes
|
|
19
|
+
Classifier: License :: OSI Approved :: BSD License
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
25
|
+
Classifier: Intended Audience :: Developers
|
|
26
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
27
|
+
Requires-Python: >=3.9
|
|
28
|
+
Description-Content-Type: text/markdown
|
|
29
|
+
License-File: LICENSE
|
|
30
|
+
Dynamic: license-file
|
|
31
|
+
|
|
32
|
+
# python-pixel-sizes
|
|
33
|
+
|
|
34
|
+
[](https://codecov.io/gh/kitsuyui/python-pixel-sizes)
|
|
35
|
+
|
|
36
|
+
## Usage
|
|
37
|
+
|
|
38
|
+
```python
|
|
39
|
+
from pixel_sizes import SIZES
|
|
40
|
+
|
|
41
|
+
SIZES['Full HD'].width # 1920
|
|
42
|
+
SIZES['Full HD'].height # 1080
|
|
43
|
+
SIZES['Full HD'].aspect_ratio() # 16/9 == 1.7777777777777777
|
|
44
|
+
SIZES['Full HD'].aspect_ratio_two() # (16, 9)
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
# LICENSE
|
|
48
|
+
|
|
49
|
+
The 3-Clause BSD License. See also LICENSE file.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# python-pixel-sizes
|
|
2
|
+
|
|
3
|
+
[](https://codecov.io/gh/kitsuyui/python-pixel-sizes)
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```python
|
|
8
|
+
from pixel_sizes import SIZES
|
|
9
|
+
|
|
10
|
+
SIZES['Full HD'].width # 1920
|
|
11
|
+
SIZES['Full HD'].height # 1080
|
|
12
|
+
SIZES['Full HD'].aspect_ratio() # 16/9 == 1.7777777777777777
|
|
13
|
+
SIZES['Full HD'].aspect_ratio_two() # (16, 9)
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
# LICENSE
|
|
17
|
+
|
|
18
|
+
The 3-Clause BSD License. See also LICENSE file.
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
import math
|
|
3
|
+
|
|
4
|
+
# https://packaging-guide.openastronomy.org/en/latest/advanced/versioning.html
|
|
5
|
+
from ._version import __version__
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@dataclass(frozen=True)
|
|
9
|
+
class Size:
|
|
10
|
+
"""A class to represent a size in pixels.
|
|
11
|
+
Attributes:
|
|
12
|
+
width (int): The width of the size in pixels.
|
|
13
|
+
height (int): The height of the size in pixels.
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
width: int
|
|
17
|
+
height: int
|
|
18
|
+
|
|
19
|
+
def aspect_ratio(self) -> float:
|
|
20
|
+
"""Returns the aspect ratio as a float.
|
|
21
|
+
Example: 1920x1080 => 16/9 => 1.7777777777777777
|
|
22
|
+
"""
|
|
23
|
+
return self.width / self.height
|
|
24
|
+
|
|
25
|
+
def aspect_ratio_two(self) -> tuple[int, int]:
|
|
26
|
+
"""Returns the aspect ratio as a tuple of integers.
|
|
27
|
+
Example: 1920x1080 => (16, 9)
|
|
28
|
+
"""
|
|
29
|
+
gcd = math.gcd(self.width, self.height)
|
|
30
|
+
return self.width // gcd, self.height // gcd
|
|
31
|
+
|
|
32
|
+
def rotate(self) -> "Size":
|
|
33
|
+
"""Returns a new Size object with the width and height swapped.
|
|
34
|
+
Example: 1920x1080 => 1080x1920
|
|
35
|
+
"""
|
|
36
|
+
return Size(self.height, self.width)
|
|
37
|
+
|
|
38
|
+
def scale(self, factor: int) -> "Size":
|
|
39
|
+
"""Returns a new Size object with the width and height scaled by the given factor.
|
|
40
|
+
Example: 1920x1080, factor=2 => 3840x2160
|
|
41
|
+
"""
|
|
42
|
+
return Size(self.width * factor, self.height * factor)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
SIZES = {
|
|
46
|
+
"480p": Size(854, 480),
|
|
47
|
+
"360p": Size(640, 360),
|
|
48
|
+
"240p": Size(426, 240),
|
|
49
|
+
"144p": Size(256, 144),
|
|
50
|
+
"720p": Size(1280, 720),
|
|
51
|
+
"Full HD": Size(1920, 1080),
|
|
52
|
+
"HD 1080p": Size(1920, 1080),
|
|
53
|
+
"1080p": Size(1920, 1080),
|
|
54
|
+
"1080i": Size(1920, 1080),
|
|
55
|
+
"HD": Size(1280, 720),
|
|
56
|
+
"QCIF": Size(176, 144),
|
|
57
|
+
"QVGA": Size(320, 240),
|
|
58
|
+
"HVGA": Size(480, 320),
|
|
59
|
+
"DCGA": Size(640, 400),
|
|
60
|
+
"VGA": Size(640, 480),
|
|
61
|
+
"SVGA": Size(800, 600),
|
|
62
|
+
"WSVGA": Size(1024, 600), # 2 versions
|
|
63
|
+
"DoubleVGA": Size(960, 640),
|
|
64
|
+
"XGA": Size(1024, 768),
|
|
65
|
+
"HD 720p": Size(1280, 720),
|
|
66
|
+
"WXGA": Size(1280, 800),
|
|
67
|
+
"FWXGA": Size(1366, 768),
|
|
68
|
+
"WXGA+": Size(1440, 900),
|
|
69
|
+
"HD+": Size(1600, 900),
|
|
70
|
+
"WXGA++": Size(1600, 900),
|
|
71
|
+
"SXGA+": Size(1400, 1050),
|
|
72
|
+
"WSXGA+": Size(1680, 1050),
|
|
73
|
+
"UXGA": Size(1600, 1200),
|
|
74
|
+
"WQHD": Size(2560, 1440),
|
|
75
|
+
# https://en.wikipedia.org/wiki/2K_resolution
|
|
76
|
+
"DCI 2K": Size(2048, 1080),
|
|
77
|
+
"DCI 2K (flat cropped)": Size(1998, 1080),
|
|
78
|
+
"DCI 2K (CinemaScope cropped)": Size(2048, 858),
|
|
79
|
+
"QXGA": Size(2048, 1536),
|
|
80
|
+
"WQXGA": Size(2560, 1600),
|
|
81
|
+
"WUXGA": Size(1920, 1200),
|
|
82
|
+
"QWXGA": Size(2048, 1152),
|
|
83
|
+
"QUXGA": Size(3200, 2400),
|
|
84
|
+
"QUXGA Wide": Size(3840, 2400),
|
|
85
|
+
# https://en.wikipedia.org/wiki/4K_resolution
|
|
86
|
+
"DCI 4K": Size(4096, 2160),
|
|
87
|
+
"DCI 4K (flat cropped)": Size(3996, 2160),
|
|
88
|
+
"DCI 4K (CinemaScope cropped)": Size(4096, 1716),
|
|
89
|
+
"4K UHD": Size(3840, 2160),
|
|
90
|
+
"4K UHDTV": Size(3840, 2160),
|
|
91
|
+
"UHDTV1": Size(3840, 2160),
|
|
92
|
+
"2160p": Size(3840, 2160),
|
|
93
|
+
# https://en.wikipedia.org/wiki/5K_resolution
|
|
94
|
+
"5K": Size(5120, 2880),
|
|
95
|
+
"5K2K": Size(5120, 2160),
|
|
96
|
+
# https://en.wikipedia.org/wiki/8K_resolution
|
|
97
|
+
"8K UHD": Size(7680, 4320),
|
|
98
|
+
"UHDTV2": Size(7680, 4320),
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
__all__ = ["Size", "SIZES", "__version__"]
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# file generated by setuptools-scm
|
|
2
|
+
# don't change, don't track in version control
|
|
3
|
+
|
|
4
|
+
__all__ = ["__version__", "__version_tuple__", "version", "version_tuple"]
|
|
5
|
+
|
|
6
|
+
TYPE_CHECKING = False
|
|
7
|
+
if TYPE_CHECKING:
|
|
8
|
+
from typing import Tuple
|
|
9
|
+
from typing import Union
|
|
10
|
+
|
|
11
|
+
VERSION_TUPLE = Tuple[Union[int, str], ...]
|
|
12
|
+
else:
|
|
13
|
+
VERSION_TUPLE = object
|
|
14
|
+
|
|
15
|
+
version: str
|
|
16
|
+
__version__: str
|
|
17
|
+
__version_tuple__: VERSION_TUPLE
|
|
18
|
+
version_tuple: VERSION_TUPLE
|
|
19
|
+
|
|
20
|
+
__version__ = version = '0.0'
|
|
21
|
+
__version_tuple__ = version_tuple = (0, 0)
|
|
File without changes
|