semvec/pypi-packages huggingface dataset:
my-django-generator 0.1.0
A Django management command to generate views and serializers based on models.

Django View and Serializer Generator
This Django management command automatically generates views.py and serializers.py files with basic viewsets and serializers for each model defined in the projectâ€™s models.py file. It saves development time by creating boilerplate code for API views and serializers based on your models.

Features
Automatically generates views.py and serializers.py files based on models defined in a specified Django app.
Creates a ModelViewSet for each model in views.py to enable CRUD operations.
Generates a ModelSerializer for each model in serializers.py, including all model fields.
Installation
To install this library, use pip:

bash
Copy code
pip install django-view-serializer-generator
Then, add the app to your Django project's INSTALLED_APPS:

python
Copy code
# settings.py
INSTALLED_APPS = [
    # Other installed apps
    'view_serializer_generator',  # Add the generator app
]
Usage
Navigate to your Django project directory where manage.py is located.

Run the command to generate views and serializers:

bash
Copy code
python manage.py generate_views_and_serializers
The command will look for models defined in the app specified in the code and generate views.py and serializers.py with the appropriate viewsets and serializers.

Example Output
The command creates views.py and serializers.py in the specified app (e.g., Paypal), with code similar to:

serializers.py

python
Copy code
from rest_framework import serializers
from .models import YourModel

class YourModelSerializer(serializers.ModelSerializer):
    class Meta:
        model = YourModel
        fields = '__all__'
views.py

python
Copy code
from rest_framework import viewsets
from .models import YourModel
from .serializers import YourModelSerializer

class YourModelViewSet(viewsets.ModelViewSet):
    queryset = YourModel.objects.all()
    serializer_class = YourModelSerializer
Folder Structure
To follow best practices, maintain the following folder structure:

markdown
Copy code
myproject/
â”œâ”€â”€ myapp/
â”‚   â”œâ”€â”€ management/
â”‚   â”‚   â””â”€â”€ commands/
â”‚   â”‚       â””â”€â”€ generate_views_and_serializers.py
â”‚   â”œâ”€â”€ migrations/
â”‚   â”œâ”€â”€ __init__.py
â”‚   â”œâ”€â”€ models.py
â”‚   â”œâ”€â”€ serializers.py
â”‚   â”œâ”€â”€ views.py
â”‚   â”œâ”€â”€ urls.py
â”œâ”€â”€ manage.py
â”œâ”€â”€ settings.py
Customizing the Command
By default, this command looks for an app named Paypal. If your app has a different name, update the app_name variable in generate_views_and_serializers.py:

python
Copy code
app_name = 'YourAppName'
License
This project is licensed under the MIT License - see the LICENSE file for details.
pyswizzle 1.0.2
Python implementation of swizzle and deswizzle of video games textures
Requires Python: >=3.0

A python library which allow to swizzle and deswizzle some video games textures. Supported platforms: Nintendo Switch and PS4

# Usage

## Nintendo Switch:

<code>from pyswizzle import nsw_deswizzle, nsw_swizzle</code>

Deswizzle bytes:

<code>deswizzled_bytes = nsw_deswizzle(bytes, im_size, block_size, bytes_per_block, swizzle_mode)</code>

Swizzle bytes:

<code>swizzled_bytes = nsw_swizzle(bytes, im_size, block_size, bytes_per_block, swizzle_mode)</code>

## PS4:

<code>from pyswizzle import ps4_deswizzle, ps4_swizzle</code>

Deswizzle bytes:

<code>deswizzled_bytes = ps4_deswizzle(bytes, im_size, block_size, bytes_per_block)</code>

Swizzle bytes:

<code>swizzled_bytes = ps4_deswizzle(bytes, im_size, block_size, bytes_per_block)</code>

# Parameters

bytes: a bytes-like object, representing image data

im_size: a tuple (im_width,im_height) representing the dimensions of the image.

block_size: a tuple (bloc_width,bloc_height) representing the dimensions of the compression blocks of the image encoding.
For example, BC7 and BC1 are encoded with blocks of 4x4 pixels, so you should input (4,4), while ASTC6x6 are encoded with blocks of 6x6 pixels, so you should input (6,6).
For format that are not block compressed like RGBA8888, you should input (1,1).

bytes_per_block: the number of bytes used to encode one block. For BC7, it's equal to 16; for BC1: 8; for ASTC6x6: 16; for RGBA8888: 4, etc.

swizzle_mode: the swizzle mode, for Nintendo Switch.

# Notes

Not all images can be swizzled or deswizzled, they might require some padding. 

For Nintendo Switch, the image width must be a multiple of *64 x block_width / bytes_per_block* pixels, <br>and the image_height a multiple of *8 x block_height x (2\*\*swizzle_mode)* pixels.

For PS4, the image width must be a multiple of *8 x block_width* pixels, <br>and the image_height a multiple of *8 x block_height* pixels.