pycons 0.1.0__tar.gz → 0.2.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.
Files changed (36) hide show
  1. {pycons-0.1.0 → pycons-0.2.0}/PKG-INFO +32 -36
  2. {pycons-0.1.0 → pycons-0.2.0}/README.md +0 -6
  3. pycons-0.2.0/pyproject.toml +263 -0
  4. pycons-0.2.0/src/pycons/__init__.py +25 -0
  5. pycons-0.2.0/src/pycons/asciicons.py +237 -0
  6. pycons-0.2.0/src/pycons/favicon.py +51 -0
  7. {pycons-0.1.0/src/pycons → pycons-0.2.0/src/pycons/font_providers}/base.py +48 -48
  8. {pycons-0.1.0/src/pycons → pycons-0.2.0/src/pycons/font_providers}/models.py +44 -44
  9. {pycons-0.1.0/src/pycons → pycons-0.2.0/src/pycons/font_providers}/providers.py +372 -367
  10. {pycons-0.1.0/src/pycons → pycons-0.2.0/src/pycons/font_providers}/registry.py +160 -157
  11. {pycons-0.1.0 → pycons-0.2.0}/src/pycons/functional.py +94 -94
  12. pycons-0.2.0/src/pycons/iconify/__init__.py +1 -0
  13. pycons-0.2.0/src/pycons/iconify/api.py +489 -0
  14. pycons-0.2.0/src/pycons/iconify/iconify.py +386 -0
  15. pycons-0.2.0/src/pycons/iconify/iconify_types.py +186 -0
  16. pycons-0.2.0/src/pycons/utils.py +37 -0
  17. pycons-0.1.0/.copier-answers.yml +0 -21
  18. pycons-0.1.0/.github/FUNDING.yml +0 -3
  19. pycons-0.1.0/.github/copilot-instructions.md +0 -19
  20. pycons-0.1.0/.github/dependabot.yml +0 -9
  21. pycons-0.1.0/.github/workflows/build.yml +0 -88
  22. pycons-0.1.0/.github/workflows/documentation.yml +0 -57
  23. pycons-0.1.0/.gitignore +0 -32
  24. pycons-0.1.0/.pre-commit-config.yaml +0 -48
  25. pycons-0.1.0/duties.py +0 -60
  26. pycons-0.1.0/mkdocs.yml +0 -92
  27. pycons-0.1.0/overrides/_dummy.txt +0 -1
  28. pycons-0.1.0/pyproject.toml +0 -248
  29. pycons-0.1.0/src/pycons/__init__.py +0 -6
  30. pycons-0.1.0/src/pycons/utils.py +0 -84
  31. pycons-0.1.0/tests/__init__.py +0 -3
  32. pycons-0.1.0/tests/conftest.py +0 -1
  33. pycons-0.1.0/tests/test_icons.py +0 -58
  34. {pycons-0.1.0 → pycons-0.2.0}/LICENSE +0 -0
  35. /pycons-0.1.0/docs/.empty → /pycons-0.2.0/src/pycons/font_providers/__init__.py +0 -0
  36. {pycons-0.1.0 → pycons-0.2.0}/src/pycons/py.typed +0 -0
@@ -1,36 +1,32 @@
1
- Metadata-Version: 2.4
1
+ Metadata-Version: 2.3
2
2
  Name: pycons
3
- Version: 0.1.0
3
+ Version: 0.2.0
4
4
  Summary: Icon utilities (Material Design icons & similar)
5
- Project-URL: Documentation, https://phil65.github.io/pycons/
6
- Project-URL: Source, https://github.com/phil65/pycons
7
- Project-URL: Issues, https://github.com/phil65/pycons/issues
8
- Project-URL: Discussions, https://github.com/phil65/pycons/discussions
9
- Project-URL: Code coverage, https://app.codecov.io/gh/phil65/pycons
5
+ Keywords:
6
+ Author: Philipp Temminghoff
10
7
  Author-email: Philipp Temminghoff <philipptemminghoff@googlemail.com>
11
8
  License: MIT License
12
-
13
- Copyright (c) 2024, Philipp Temminghoff
14
-
15
- Permission is hereby granted, free of charge, to any person obtaining a copy
16
- of this software and associated documentation files (the "Software"), to deal
17
- in the Software without restriction, including without limitation the rights
18
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
19
- copies of the Software, and to permit persons to whom the Software is
20
- furnished to do so, subject to the following conditions:
21
-
22
- The above copyright notice and this permission notice shall be included in all
23
- copies or substantial portions of the Software.
24
-
25
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
26
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
27
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
28
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
29
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
30
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31
- SOFTWARE.
32
-
33
- License-File: LICENSE
9
+
10
+ Copyright (c) 2024, Philipp Temminghoff
11
+
12
+ Permission is hereby granted, free of charge, to any person obtaining a copy
13
+ of this software and associated documentation files (the "Software"), to deal
14
+ in the Software without restriction, including without limitation the rights
15
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
+ copies of the Software, and to permit persons to whom the Software is
17
+ furnished to do so, subject to the following conditions:
18
+
19
+ The above copyright notice and this permission notice shall be included in all
20
+ copies or substantial portions of the Software.
21
+
22
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
+ SOFTWARE.
29
+
34
30
  Classifier: Development Status :: 4 - Beta
35
31
  Classifier: Intended Audience :: Developers
36
32
  Classifier: Operating System :: OS Independent
@@ -43,18 +39,22 @@ Classifier: Topic :: Documentation
43
39
  Classifier: Topic :: Software Development
44
40
  Classifier: Topic :: Utilities
45
41
  Classifier: Typing :: Typed
46
- Requires-Python: >=3.12
42
+ Requires-Dist: anyenv>=0.2.0
47
43
  Requires-Dist: appdirs>=1.4.4
48
44
  Requires-Dist: hishel>=0.1.1
49
45
  Requires-Dist: httpx>=0.28.1
46
+ Requires-Python: >=3.12
47
+ Project-URL: Code coverage, https://app.codecov.io/gh/phil65/pycons
48
+ Project-URL: Discussions, https://github.com/phil65/pycons/discussions
49
+ Project-URL: Documentation, https://phil65.github.io/pycons/
50
+ Project-URL: Issues, https://github.com/phil65/pycons/issues
51
+ Project-URL: Source, https://github.com/phil65/pycons
50
52
  Description-Content-Type: text/markdown
51
53
 
52
54
  # Pycons
53
55
 
54
56
  [![PyPI License](https://img.shields.io/pypi/l/pycons.svg)](https://pypi.org/project/pycons/)
55
57
  [![Package status](https://img.shields.io/pypi/status/pycons.svg)](https://pypi.org/project/pycons/)
56
- [![Daily downloads](https://img.shields.io/pypi/dd/pycons.svg)](https://pypi.org/project/pycons/)
57
- [![Weekly downloads](https://img.shields.io/pypi/dw/pycons.svg)](https://pypi.org/project/pycons/)
58
58
  [![Monthly downloads](https://img.shields.io/pypi/dm/pycons.svg)](https://pypi.org/project/pycons/)
59
59
  [![Distribution format](https://img.shields.io/pypi/format/pycons.svg)](https://pypi.org/project/pycons/)
60
60
  [![Wheel availability](https://img.shields.io/pypi/wheel/pycons.svg)](https://pypi.org/project/pycons/)
@@ -72,12 +72,8 @@ Description-Content-Type: text/markdown
72
72
  [![Github last commit](https://img.shields.io/github/last-commit/phil65/pycons)](https://github.com/phil65/pycons/commits)
73
73
  [![Github release date](https://img.shields.io/github/release-date/phil65/pycons)](https://github.com/phil65/pycons/releases)
74
74
  [![Github language count](https://img.shields.io/github/languages/count/phil65/pycons)](https://github.com/phil65/pycons)
75
- [![Github commits this week](https://img.shields.io/github/commit-activity/w/phil65/pycons)](https://github.com/phil65/pycons)
76
75
  [![Github commits this month](https://img.shields.io/github/commit-activity/m/phil65/pycons)](https://github.com/phil65/pycons)
77
- [![Github commits this year](https://img.shields.io/github/commit-activity/y/phil65/pycons)](https://github.com/phil65/pycons)
78
76
  [![Package status](https://codecov.io/gh/phil65/pycons/branch/main/graph/badge.svg)](https://codecov.io/gh/phil65/pycons/)
79
- [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
80
77
  [![PyUp](https://pyup.io/repos/github/phil65/pycons/shield.svg)](https://pyup.io/repos/github/phil65/pycons/)
81
78
 
82
79
  [Read the documentation!](https://phil65.github.io/pycons/)
83
-
@@ -2,8 +2,6 @@
2
2
 
3
3
  [![PyPI License](https://img.shields.io/pypi/l/pycons.svg)](https://pypi.org/project/pycons/)
4
4
  [![Package status](https://img.shields.io/pypi/status/pycons.svg)](https://pypi.org/project/pycons/)
5
- [![Daily downloads](https://img.shields.io/pypi/dd/pycons.svg)](https://pypi.org/project/pycons/)
6
- [![Weekly downloads](https://img.shields.io/pypi/dw/pycons.svg)](https://pypi.org/project/pycons/)
7
5
  [![Monthly downloads](https://img.shields.io/pypi/dm/pycons.svg)](https://pypi.org/project/pycons/)
8
6
  [![Distribution format](https://img.shields.io/pypi/format/pycons.svg)](https://pypi.org/project/pycons/)
9
7
  [![Wheel availability](https://img.shields.io/pypi/wheel/pycons.svg)](https://pypi.org/project/pycons/)
@@ -21,12 +19,8 @@
21
19
  [![Github last commit](https://img.shields.io/github/last-commit/phil65/pycons)](https://github.com/phil65/pycons/commits)
22
20
  [![Github release date](https://img.shields.io/github/release-date/phil65/pycons)](https://github.com/phil65/pycons/releases)
23
21
  [![Github language count](https://img.shields.io/github/languages/count/phil65/pycons)](https://github.com/phil65/pycons)
24
- [![Github commits this week](https://img.shields.io/github/commit-activity/w/phil65/pycons)](https://github.com/phil65/pycons)
25
22
  [![Github commits this month](https://img.shields.io/github/commit-activity/m/phil65/pycons)](https://github.com/phil65/pycons)
26
- [![Github commits this year](https://img.shields.io/github/commit-activity/y/phil65/pycons)](https://github.com/phil65/pycons)
27
23
  [![Package status](https://codecov.io/gh/phil65/pycons/branch/main/graph/badge.svg)](https://codecov.io/gh/phil65/pycons/)
28
- [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
29
24
  [![PyUp](https://pyup.io/repos/github/phil65/pycons/shield.svg)](https://pyup.io/repos/github/phil65/pycons/)
30
25
 
31
26
  [Read the documentation!](https://phil65.github.io/pycons/)
32
-
@@ -0,0 +1,263 @@
1
+ [project]
2
+ name = "pycons"
3
+ version = "0.2.0"
4
+ description = "Icon utilities (Material Design icons & similar)"
5
+ readme = "README.md"
6
+ requires-python = ">=3.12"
7
+ license = { file = "LICENSE" }
8
+ authors = [
9
+ { name = "Philipp Temminghoff", email = "philipptemminghoff@googlemail.com" },
10
+ ]
11
+ keywords = []
12
+ classifiers = [
13
+ "Development Status :: 4 - Beta",
14
+ "Intended Audience :: Developers",
15
+ "Operating System :: OS Independent",
16
+ "Programming Language :: Python :: 3",
17
+ "Programming Language :: Python :: 3 :: Only",
18
+ "Programming Language :: Python :: 3.12",
19
+ "Programming Language :: Python :: 3.13",
20
+ "Programming Language :: Python :: 3.14",
21
+ "Topic :: Documentation",
22
+ "Topic :: Software Development",
23
+ "Topic :: Utilities",
24
+ "Typing :: Typed",
25
+ ]
26
+ dependencies = [
27
+ "anyenv>=0.2.0",
28
+ "appdirs>=1.4.4",
29
+ "hishel>=0.1.1",
30
+ # Only add below (Copier)
31
+ "httpx>=0.28.1",
32
+ ]
33
+
34
+ [project.urls]
35
+ "Code coverage" = "https://app.codecov.io/gh/phil65/pycons"
36
+ Discussions = "https://github.com/phil65/pycons/discussions"
37
+ Documentation = "https://phil65.github.io/pycons/"
38
+ Issues = "https://github.com/phil65/pycons/issues"
39
+ Source = "https://github.com/phil65/pycons"
40
+
41
+ [dependency-groups]
42
+ dev = [
43
+ "devtools",
44
+ "pyreadline3",
45
+ "pytest",
46
+ # Only add below (Copier)
47
+ "pytest-asyncio>=0.25.3",
48
+ "pytest-cov",
49
+ ]
50
+ benchmark = ["pyinstrument"]
51
+ docs = [
52
+ "mkdocs-material",
53
+ "mkdocs-mknodes",
54
+ # Only add below (Copier)
55
+ ]
56
+ lint = [
57
+ "mypy; python_version >= '3.14'",
58
+ "mypy[faster-cache]; python_version < '3.14'",
59
+ "ruff",
60
+ # Only add below (Copier)
61
+ ]
62
+
63
+ [build-system]
64
+ requires = ["uv_build>=0.8.22"]
65
+ build-backend = "uv_build"
66
+
67
+ [tool.coverage.report]
68
+ exclude_lines = [
69
+ "pragma: no cover",
70
+ "if TYPE_CHECKING:",
71
+ "@overload",
72
+ "except ImportError",
73
+ 'if __name__ == "__main__":',
74
+ ]
75
+
76
+ [tool.mknodes]
77
+ allowed-commit-types = [
78
+ "fix",
79
+ "feat",
80
+ "refactor",
81
+ "docs",
82
+ "test",
83
+ "build",
84
+ "chore",
85
+ ]
86
+ docstring-style = "google"
87
+
88
+ [tool.mypy]
89
+ python_version = "3.12"
90
+ disable_error_code = ["misc", "import"]
91
+ pretty = true
92
+ check_untyped_defs = true
93
+ exclude = ["venv/", ".venv/", "tests/"]
94
+ plugins = []
95
+
96
+ [tool.pyright]
97
+ venvPath = "."
98
+ venv = ".venv"
99
+ pythonVersion = "3.12"
100
+ pythonPlatform = "All"
101
+ typeCheckingMode = "basic"
102
+ deprecateTypingAliases = true
103
+ reportMissingTypeStubs = false
104
+ reportUnusedCallResult = false
105
+ reportUnknownVariableType = false
106
+ reportAny = false
107
+ reportImplicitOverride = false
108
+ reportUnusedFunction = false
109
+ reportImplicitStringConcatenation = false
110
+ reportIgnoreCommentWithoutRule = false
111
+ reportUnannotatedClassAttribute = false
112
+ reportSelfClsParameterName = false
113
+ reportPrivateImportUsage = false
114
+
115
+ [tool.pytest.ini_options]
116
+ log_cli = true
117
+ log_date_format = "%Y-%m-%d %H:%M:%S"
118
+ log_format = "%(asctime)s %(levelname)s %(message)s"
119
+ testpaths = "tests/"
120
+ asyncio_mode = "auto"
121
+
122
+ [tool.ruff]
123
+ line-length = 90
124
+ extend-exclude = ["docs"]
125
+ target-version = "py312"
126
+
127
+ [tool.ruff.lint]
128
+ future-annotations = true
129
+ select = [
130
+ "A", # Flake8-builtins
131
+ # "ANN", # Flake8-Annotations
132
+ # "ASYNC", # Flake8-Async
133
+ # "ARG", # # Flake8-Unused-Arguments
134
+ "B", # flake8-bugbear
135
+ "BLE", # Flake8-blind-except
136
+ "C",
137
+ "C4", # flake8-comprehensions
138
+ # "C90", # MCCabe
139
+ "COM", # Flake8-commas
140
+ # "CPY", # Copyright-related rules
141
+ "D", # PyDocStyle
142
+ # "DTZ", # Flake8- Datetimez
143
+ "E", # PyCodeStyle Error
144
+ "EM", # flake8-errmsg
145
+ # "ERA", # Eradicate
146
+ "EXE", # flake8-executable
147
+ "F", # PyFlakes
148
+ "FA", # flake8-future-annotations
149
+ # "FBT", # flake8-boolean-trap
150
+ # "FIX", # flake8-fixme
151
+ "FLY", # flynt
152
+ "G", # flake8-logging-format
153
+ "I", # ISort
154
+ "ICN", # Flake8-import-conventions
155
+ "INP", # flake8-no-pep420
156
+ "INT", # flake8-gettext
157
+ "ISC", # flake8-implicit-str-concat
158
+ "N", # pep8-naming
159
+ # "NPY", # numpy-specific rules
160
+ # "PD", # pandas-vet
161
+ "PERF", # perflint
162
+ # "PGH", # pygrep-hooks
163
+ "PIE", # flake8-pie
164
+ "PLE", # PyLint Error
165
+ "PLC", # PyLint convention
166
+ # "PLW", # PyLint Warning
167
+ "PLR", # PyLint refactor
168
+ "PT", # flake8-pytest-style
169
+ "PTH", # flake8-use-pathlib
170
+ "PYI", # flake8-pyi
171
+ "Q", # flake8-quotes
172
+ "RET", # flake8-return
173
+ "RSE", # flake8-raise
174
+ "RUF", # ruff-specific rules
175
+ # "S", # flake8-bandit
176
+ "SIM", # flake8-simplify
177
+ "SLF", # flake8-self
178
+ "SLOT", # flake8-slots
179
+ # "T",
180
+ # "TD", # flake8-todos
181
+ "T10", # flake8-debugger
182
+ # "T20", # flake8-print
183
+ "TC", # flake8-type-checking
184
+ "TID", # flake8-tidy-imports
185
+ "TRY", # tryceratops
186
+ "UP", # PyUpgrade
187
+ "W", # PyCodeStyle warning
188
+ "YTT", # flake8-2020
189
+ ]
190
+ ignore = [
191
+ "C408", # Unnecessary {obj_type} call (rewrite as a literal)
192
+ "B905", # zip() without an explicit strict= parameter
193
+ "C901", # {name} is too complex ({complexity} > {max_complexity})
194
+ "COM812",
195
+ # "CPY001", # Missing copyright notice at top of file
196
+ "D100", # Missing docstring in public module
197
+ "D101", # Missing docstring in public class
198
+ "D102", # Missing docstring in public method
199
+ "D103", # Missing docstring in public function
200
+ "D104", # Missing docstring in public package
201
+ "D105", # Missing docstring in magic method
202
+ "D106", # Missing docstring in public nested class
203
+ "D107", # Missing docstring in __init__
204
+ "D203", # 1 blank line required before class docstring
205
+ "D204", # 1 blank line required after class docstring
206
+ "D213", # Multi-line docstring summary should start at the second line
207
+ "D215", # Section underline is over-indented ("{name}")
208
+ "D400", # First line should end with a period
209
+ "D401", # First line of docstring should be in imperative mood: "{first_line}"
210
+ "D404", # First word of the docstring should not be "This"
211
+ "D406", # Section name should end with a newline ("{name}")
212
+ "D407", # Missing dashed underline after section ("{name}")
213
+ "D408", # Section underline should be in the line following the section's name ("{name}")
214
+ "D409", # Section underline should match the length of its name ("{name}")
215
+ "D413", # Missing blank line after last section ("{name}")
216
+ "ISC001",
217
+ "PLC0415",
218
+ "PLR0912", # Too many branches
219
+ "PLR0913", # Too many arguments to function call
220
+ "PLR0915", # Too many statements
221
+ # "PLR2004", # Magic values instead of named consts
222
+ "SLF001", # Private member accessed
223
+ "TRY003", # Avoid specifying long messages outside the exception class
224
+ "TC006", # runtime-cast-value
225
+ ]
226
+
227
+ [tool.ruff.lint.flake8-quotes]
228
+ docstring-quotes = "double"
229
+
230
+ [tool.ruff.lint.flake8-type-checking]
231
+ runtime-evaluated-base-classes = [
232
+ "pydantic.BaseModel",
233
+ "sqlalchemy.orm.DeclarativeBase",
234
+ "schemez.Schema",
235
+ ]
236
+ runtime-evaluated-decorators = [
237
+ "pydantic.validate_call",
238
+ "attrs.define",
239
+ "fastapi.FastAPI.get",
240
+ "fastapi.FastAPI.post",
241
+ "fastmcp.FastMCP.tool",
242
+ ]
243
+
244
+ [tool.ruff.lint.isort]
245
+ lines-after-imports = 2
246
+ # lines-between-types = 1
247
+ # atomic = true
248
+ force-sort-within-sections = true
249
+ combine-as-imports = true
250
+
251
+ [tool.ruff.lint.per-file-ignores]
252
+ "__init__.py" = ["E402", "I001"]
253
+ "scripts/*" = ["INP001"]
254
+
255
+ [tool.ruff.format]
256
+ # Enable preview style formatting.
257
+ preview = true
258
+
259
+ [tool.ty.environment]
260
+ python-version = "3.12"
261
+
262
+ [tool.uv]
263
+ default-groups = ["dev", "lint", "docs"]
@@ -0,0 +1,25 @@
1
+ """Pycons: main package.
2
+
3
+ Icon utilities (Material Design icons & similar).
4
+ """
5
+
6
+ from __future__ import annotations
7
+
8
+ from importlib.metadata import version
9
+
10
+ __version__ = version("pycons")
11
+ __title__ = "Pycons"
12
+
13
+ __author__ = "Philipp Temminghoff"
14
+ __author_email__ = "philipptemminghoff@googlemail.com"
15
+ __copyright__ = "Copyright (c) 2025 Philipp Temminghoff"
16
+ __license__ = "MIT"
17
+ __url__ = "https://github.com/phil65/pycons"
18
+
19
+ from pycons.functional import get_icon_sync, get_icon
20
+
21
+ __all__ = [
22
+ "__version__",
23
+ "get_icon",
24
+ "get_icon_sync",
25
+ ]
@@ -0,0 +1,237 @@
1
+ """Ascii icons for different file types."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from enum import StrEnum
6
+ from typing import TYPE_CHECKING, Final
7
+
8
+
9
+ if TYPE_CHECKING:
10
+ import os
11
+
12
+
13
+ class AsciiIcon(StrEnum):
14
+ """ASCII icons for different file types."""
15
+
16
+ # Default icons
17
+ FOLDER = "📁"
18
+ FILE = "📄"
19
+ HIDDEN = "🔒"
20
+ SYMLINK = "🔗"
21
+
22
+ # Documents
23
+ PDF = "📕"
24
+ DOC = "📘"
25
+ TXT = "📝"
26
+ PRESENTATION = "📊"
27
+ SPREADSHEET = "📈"
28
+ EBOOK = "📚"
29
+
30
+ # Code
31
+ PYTHON = "🐍"
32
+ JAVA = "☕"
33
+ JS = "📜"
34
+ HTML = "🌐"
35
+ CSS = "🎨"
36
+ CPP = "⚡"
37
+ RUST = "🦀"
38
+ GO = "🐹"
39
+ RUBY = "💎"
40
+ PHP = "🐘"
41
+ SWIFT = "🎯"
42
+ KOTLIN = "🎳"
43
+
44
+ # Config & Data
45
+ JSON = "📊"
46
+ CSV = "📑"
47
+ XML = "📐"
48
+ YAML = "⚙️"
49
+ INI = "🔧"
50
+ ENV = "🔐"
51
+ SQL = "🗄️"
52
+ TOML = "⚡"
53
+
54
+ # Media
55
+ IMAGE = "🖼️"
56
+ VIDEO = "🎥"
57
+ AUDIO = "🎵"
58
+ FONT = "🔤"
59
+ MODEL_3D = "💠"
60
+
61
+ # Design
62
+ PSD = "🎨"
63
+ AI = "🖌️"
64
+ SKETCH = "✏️"
65
+ FIGMA = "🎯"
66
+
67
+ # Archives
68
+ ARCHIVE = "📦"
69
+ BACKUP = "💾"
70
+
71
+ # Executables & Binaries
72
+ EXECUTABLE = "⚙️"
73
+ DLL = "🔌"
74
+ BINARY = "👾"
75
+
76
+ # Development
77
+ GIT = "🌿"
78
+ DOCKERFILE = "🐋"
79
+ LOG = "📋"
80
+ TEST = "🧪"
81
+
82
+ # Special
83
+ TEMP = "⌛"
84
+ TRASH = "🗑️"
85
+ LOCK = "🔒"
86
+
87
+
88
+ EXTENSION_MAP: Final[dict[str, AsciiIcon]] = {
89
+ # Documents
90
+ ".pdf": AsciiIcon.PDF,
91
+ ".doc": AsciiIcon.DOC,
92
+ ".docx": AsciiIcon.DOC,
93
+ ".txt": AsciiIcon.TXT,
94
+ ".md": AsciiIcon.TXT,
95
+ ".rst": AsciiIcon.TXT,
96
+ ".rtf": AsciiIcon.TXT,
97
+ ".ppt": AsciiIcon.PRESENTATION,
98
+ ".pptx": AsciiIcon.PRESENTATION,
99
+ ".xls": AsciiIcon.SPREADSHEET,
100
+ ".xlsx": AsciiIcon.SPREADSHEET,
101
+ ".csv": AsciiIcon.CSV,
102
+ ".epub": AsciiIcon.EBOOK,
103
+ ".mobi": AsciiIcon.EBOOK,
104
+ # Code
105
+ ".py": AsciiIcon.PYTHON,
106
+ ".pyi": AsciiIcon.PYTHON,
107
+ ".ipynb": AsciiIcon.PYTHON,
108
+ ".java": AsciiIcon.JAVA,
109
+ ".class": AsciiIcon.JAVA,
110
+ ".jar": AsciiIcon.JAVA,
111
+ ".js": AsciiIcon.JS,
112
+ ".jsx": AsciiIcon.JS,
113
+ ".ts": AsciiIcon.JS,
114
+ ".tsx": AsciiIcon.JS,
115
+ ".html": AsciiIcon.HTML,
116
+ ".htm": AsciiIcon.HTML,
117
+ ".css": AsciiIcon.CSS,
118
+ ".scss": AsciiIcon.CSS,
119
+ ".sass": AsciiIcon.CSS,
120
+ ".less": AsciiIcon.CSS,
121
+ ".cpp": AsciiIcon.CPP,
122
+ ".cc": AsciiIcon.CPP,
123
+ ".c": AsciiIcon.CPP,
124
+ ".hpp": AsciiIcon.CPP,
125
+ ".h": AsciiIcon.CPP,
126
+ ".rs": AsciiIcon.RUST,
127
+ ".go": AsciiIcon.GO,
128
+ ".rb": AsciiIcon.RUBY,
129
+ ".php": AsciiIcon.PHP,
130
+ ".swift": AsciiIcon.SWIFT,
131
+ ".kt": AsciiIcon.KOTLIN,
132
+ # Config & Data
133
+ ".json": AsciiIcon.JSON,
134
+ ".xml": AsciiIcon.XML,
135
+ ".yaml": AsciiIcon.YAML,
136
+ ".yml": AsciiIcon.YAML,
137
+ ".ini": AsciiIcon.INI,
138
+ ".env": AsciiIcon.ENV,
139
+ ".sql": AsciiIcon.SQL,
140
+ ".toml": AsciiIcon.TOML,
141
+ ".db": AsciiIcon.SQL,
142
+ ".sqlite": AsciiIcon.SQL,
143
+ # Media
144
+ ".jpg": AsciiIcon.IMAGE,
145
+ ".jpeg": AsciiIcon.IMAGE,
146
+ ".png": AsciiIcon.IMAGE,
147
+ ".gif": AsciiIcon.IMAGE,
148
+ ".svg": AsciiIcon.IMAGE,
149
+ ".webp": AsciiIcon.IMAGE,
150
+ ".ico": AsciiIcon.IMAGE,
151
+ ".mp4": AsciiIcon.VIDEO,
152
+ ".avi": AsciiIcon.VIDEO,
153
+ ".mov": AsciiIcon.VIDEO,
154
+ ".mkv": AsciiIcon.VIDEO,
155
+ ".webm": AsciiIcon.VIDEO,
156
+ ".mp3": AsciiIcon.AUDIO,
157
+ ".wav": AsciiIcon.AUDIO,
158
+ ".flac": AsciiIcon.AUDIO,
159
+ ".m4a": AsciiIcon.AUDIO,
160
+ ".ogg": AsciiIcon.AUDIO,
161
+ ".ttf": AsciiIcon.FONT,
162
+ ".otf": AsciiIcon.FONT,
163
+ ".woff": AsciiIcon.FONT,
164
+ ".woff2": AsciiIcon.FONT,
165
+ ".obj": AsciiIcon.MODEL_3D,
166
+ ".fbx": AsciiIcon.MODEL_3D,
167
+ ".blend": AsciiIcon.MODEL_3D,
168
+ # Design
169
+ ".psd": AsciiIcon.PSD,
170
+ ".ai": AsciiIcon.AI,
171
+ ".sketch": AsciiIcon.SKETCH,
172
+ ".fig": AsciiIcon.FIGMA,
173
+ # Archives
174
+ ".zip": AsciiIcon.ARCHIVE,
175
+ ".tar": AsciiIcon.ARCHIVE,
176
+ ".gz": AsciiIcon.ARCHIVE,
177
+ ".7z": AsciiIcon.ARCHIVE,
178
+ ".rar": AsciiIcon.ARCHIVE,
179
+ ".bak": AsciiIcon.BACKUP,
180
+ # Executables & Binaries
181
+ ".exe": AsciiIcon.EXECUTABLE,
182
+ ".msi": AsciiIcon.EXECUTABLE,
183
+ ".app": AsciiIcon.EXECUTABLE,
184
+ ".sh": AsciiIcon.EXECUTABLE,
185
+ ".dll": AsciiIcon.DLL,
186
+ ".so": AsciiIcon.DLL,
187
+ ".dylib": AsciiIcon.DLL,
188
+ ".bin": AsciiIcon.BINARY,
189
+ # Development
190
+ ".git": AsciiIcon.GIT,
191
+ ".gitignore": AsciiIcon.GIT,
192
+ ".dockerfile": AsciiIcon.DOCKERFILE,
193
+ ".log": AsciiIcon.LOG,
194
+ ".test": AsciiIcon.TEST,
195
+ ".spec": AsciiIcon.TEST,
196
+ # Temporary
197
+ ".tmp": AsciiIcon.TEMP,
198
+ ".temp": AsciiIcon.TEMP,
199
+ ".swp": AsciiIcon.TEMP,
200
+ ".lock": AsciiIcon.LOCK,
201
+ }
202
+
203
+
204
+ def get_path_ascii_icon(path: str | os.PathLike[str]) -> str:
205
+ """Get an ASCII icon for a given file path based on its type.
206
+
207
+ Args:
208
+ path: File path as string or Path object
209
+
210
+ Returns:
211
+ ASCII icon representing the file type
212
+ """
213
+ import upath
214
+
215
+ path_obj = upath.UPath(path)
216
+
217
+ # Handle symbolic links
218
+ if path_obj.is_symlink():
219
+ return AsciiIcon.SYMLINK
220
+
221
+ # Handle folders
222
+ if path_obj.is_dir():
223
+ return AsciiIcon.FOLDER
224
+
225
+ # Handle hidden files (Unix-style)
226
+ if path_obj.name.startswith("."):
227
+ return AsciiIcon.HIDDEN
228
+
229
+ # Get extension and return corresponding icon or default
230
+ extension = path_obj.suffix.lower()
231
+ name_lower = path_obj.name.lower()
232
+
233
+ # Check full filename for special cases
234
+ if name_lower in EXTENSION_MAP:
235
+ return EXTENSION_MAP[name_lower]
236
+
237
+ return EXTENSION_MAP.get(extension, AsciiIcon.FILE)