feat(phase1): add image storage utilities
- Create backend/services/image_storage.py with 4 core functions:
- sanitize_filename(): remove unsafe chars, limit to 255 chars, convert to lowercase
- get_unique_filename(): handle collisions with UUID suffix (format: {name}_{uuid8}_{variant}.jpg)
- ensure_image_directories(): create /images/ root and category subdirs on startup
- save_image(): save bytes to /images/{category}/{filename}, returns relative path
- Create comprehensive test suite (22 tests) covering all functionality
- Integrate ensure_image_directories() into FastAPI startup event
- Directory structure: /images/{category}/{filename}
- Collision handling: auto-suffix with UUID if filename exists
- All tests passing, pathlib.Path for safe operations
This commit is contained in:
@@ -0,0 +1 @@
|
||||
pip
|
||||
@@ -0,0 +1,118 @@
|
||||
Metadata-Version: 2.4
|
||||
Name: docstring_parser
|
||||
Version: 0.18.0
|
||||
Summary: Parse Python docstrings in reST, Google and Numpydoc format
|
||||
Project-URL: homepage, https://github.com/rr-/docstring_parser
|
||||
Project-URL: repository, https://github.com/rr-/docstring_parser
|
||||
Project-URL: changelog, https://github.com/rr-/docstring_parser/blob/master/CHANGELOG.md
|
||||
Author-email: Marcin Kurczewski <dash@wind.garden>
|
||||
License: MIT
|
||||
License-File: LICENSE.md
|
||||
Classifier: Development Status :: 4 - Beta
|
||||
Classifier: Environment :: Other Environment
|
||||
Classifier: Intended Audience :: Developers
|
||||
Classifier: License :: OSI Approved :: MIT License
|
||||
Classifier: Natural Language :: English
|
||||
Classifier: Operating System :: OS Independent
|
||||
Classifier: Programming Language :: Python :: 3.8
|
||||
Classifier: Programming Language :: Python :: 3.9
|
||||
Classifier: Programming Language :: Python :: 3.10
|
||||
Classifier: Programming Language :: Python :: 3.11
|
||||
Classifier: Programming Language :: Python :: 3.12
|
||||
Classifier: Programming Language :: Python :: 3.13
|
||||
Classifier: Programming Language :: Python :: 3.14
|
||||
Classifier: Topic :: Documentation :: Sphinx
|
||||
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
||||
Classifier: Topic :: Text Processing :: Markup
|
||||
Requires-Python: >=3.8
|
||||
Provides-Extra: dev
|
||||
Requires-Dist: pre-commit>=2.16.0; (python_version >= '3.9') and extra == 'dev'
|
||||
Requires-Dist: pydoctor>=25.4.0; extra == 'dev'
|
||||
Requires-Dist: pytest; extra == 'dev'
|
||||
Provides-Extra: docs
|
||||
Requires-Dist: pydoctor>=25.4.0; extra == 'docs'
|
||||
Provides-Extra: test
|
||||
Requires-Dist: pytest; extra == 'test'
|
||||
Description-Content-Type: text/markdown
|
||||
|
||||
docstring_parser
|
||||
================
|
||||
|
||||
[](https://github.com/rr-/docstring_parser/actions/workflows/build.yml)
|
||||
|
||||
Parse Python docstrings. Currently support ReST, Google, Numpydoc-style and
|
||||
Epydoc docstrings.
|
||||
|
||||
Example usage:
|
||||
|
||||
```python
|
||||
>>> from docstring_parser import parse
|
||||
>>>
|
||||
>>>
|
||||
>>> docstring = parse(
|
||||
... '''
|
||||
... Short description
|
||||
...
|
||||
... Long description spanning multiple lines
|
||||
... - First line
|
||||
... - Second line
|
||||
... - Third line
|
||||
...
|
||||
... :param name: description 1
|
||||
... :param int priority: description 2
|
||||
... :param str sender: description 3
|
||||
... :raises ValueError: if name is invalid
|
||||
... ''')
|
||||
>>>
|
||||
>>> docstring.long_description
|
||||
'Long description spanning multiple lines\n- First line\n- Second line\n- Third line'
|
||||
>>> docstring.params[1].arg_name
|
||||
'priority'
|
||||
>>> docstring.raises[0].type_name
|
||||
'ValueError'
|
||||
```
|
||||
|
||||
Read [API Documentation](https://rr-.github.io/docstring_parser/).
|
||||
|
||||
# Installation
|
||||
|
||||
Installation using pip
|
||||
|
||||
```shell
|
||||
pip install docstring_parser
|
||||
|
||||
# or if you want to install it in a virtual environment
|
||||
|
||||
python -m venv venv # create environment
|
||||
source venv/bin/activate # activate environment
|
||||
python -m pip install docstring_parser
|
||||
```
|
||||
|
||||
Installation using conda
|
||||
|
||||
|
||||
1. Download and install miniconda or anaconda
|
||||
2. Install the package from the conda-forge channel via:
|
||||
- `conda install -c conda-forge docstring_parser`
|
||||
- or create a new conda environment via `conda create -n my-new-environment -c conda-forge docstring_parser`
|
||||
|
||||
|
||||
# Contributing
|
||||
|
||||
To set up the project:
|
||||
```sh
|
||||
git clone https://github.com/rr-/docstring_parser.git
|
||||
cd docstring_parser
|
||||
|
||||
python -m venv venv # create environment
|
||||
source venv/bin/activate # activate environment
|
||||
|
||||
pip install -e ".[dev]" # install as editable
|
||||
pre-commit install # make sure pre-commit is setup
|
||||
```
|
||||
|
||||
To run tests:
|
||||
```
|
||||
source venv/bin/activate
|
||||
pytest
|
||||
```
|
||||
@@ -0,0 +1,24 @@
|
||||
docstring_parser-0.18.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
|
||||
docstring_parser-0.18.0.dist-info/METADATA,sha256=y8QgJ5l_1LGUrl_QZKTR5XuSl2lB0MJtNpVhp8AWozM,3550
|
||||
docstring_parser-0.18.0.dist-info/RECORD,,
|
||||
docstring_parser-0.18.0.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
|
||||
docstring_parser-0.18.0.dist-info/licenses/LICENSE.md,sha256=3-UUozeuhBer0xqK9we71hcrA-VDC7CD4UWJnql6Puo,1084
|
||||
docstring_parser/__init__.py,sha256=78WKoStdo7zvCcEU1Sm2zLvU_BRGKyTYjlScFEB14nk,695
|
||||
docstring_parser/__pycache__/__init__.cpython-312.pyc,,
|
||||
docstring_parser/__pycache__/attrdoc.cpython-312.pyc,,
|
||||
docstring_parser/__pycache__/common.cpython-312.pyc,,
|
||||
docstring_parser/__pycache__/epydoc.cpython-312.pyc,,
|
||||
docstring_parser/__pycache__/google.cpython-312.pyc,,
|
||||
docstring_parser/__pycache__/numpydoc.cpython-312.pyc,,
|
||||
docstring_parser/__pycache__/parser.cpython-312.pyc,,
|
||||
docstring_parser/__pycache__/rest.cpython-312.pyc,,
|
||||
docstring_parser/__pycache__/util.cpython-312.pyc,,
|
||||
docstring_parser/attrdoc.py,sha256=grazLW9kqFIFmvjP9waYtTjgUEurlrzBZBPMED4yRNk,4126
|
||||
docstring_parser/common.py,sha256=Wua16UpvZL8nqmrRMwph2PPNDx774aK3WFnSnjvVPPw,6320
|
||||
docstring_parser/epydoc.py,sha256=qOA77cpOAbuqElDA_FAg_k4IRS4KNghg-i6uL_tL1LY,9410
|
||||
docstring_parser/google.py,sha256=Bu5Cy1fylpbQLQnchvqnosd7aFZLAQmhjVo14JUZyow,13550
|
||||
docstring_parser/numpydoc.py,sha256=VwttH9MIU2JUAPM5D3mU0a2Y5g-9MrNbEI_q8kcGJMY,17643
|
||||
docstring_parser/parser.py,sha256=e6xUG9t8Q-o_q_OOkRxw7vs3TG6GxcIHJAF6_udQwXk,2956
|
||||
docstring_parser/py.typed,sha256=bWew9mHgMy8LqMu7RuqQXFXLBxh2CRx0dUbSx-3wE48,27
|
||||
docstring_parser/rest.py,sha256=XNMfZyEHVqsAH7l4BG1IUB7wgj7qWuysguXJYCikDp8,8301
|
||||
docstring_parser/util.py,sha256=8VmGXhuMcWkrvtZSSKIhX4cKakJmWIILffY6JBQAiCg,4506
|
||||
@@ -0,0 +1,4 @@
|
||||
Wheel-Version: 1.0
|
||||
Generator: hatchling 1.29.0
|
||||
Root-Is-Purelib: true
|
||||
Tag: py3-none-any
|
||||
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2018 Marcin Kurczewski
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
Reference in New Issue
Block a user