semvec/pypi-packages huggingface dataset:
monosplit 0.1.0
Split a single python file into a module with multiple files.
License: MIT
Requires Python: >=3.11


# PySplit

PySplit is your friendly neighborhood Python file splitter! It takes a hefty Python file and splits it into a neat module with smaller, manageable files. It's not too stupid, either!  It figures out which imports are needed in each new file and keeps them intact. If a main function or standard main block is detected, it's moved the new module main at `__main__.py`.

# Installation
Clone the repository and let Poetry do its magic:

```bash 
git clone https://github.com/GRAYgoose124/pysplit.git 
cd pysplit 
poetry install 
```

# Usage
Unleash PySplit on your Python file with a simple command:

```bash 
poetry shell
pysplit your_python_file.py
```

Watch as your file is transformed into a tidy module with smaller files. This new directory module can be imported or ran similarly to the original file!

# Testing
Run the tests with the unittest module:

```bash 
poetry run python -m unittest discover tests 
```

# License
PySplit is released under the MIT license.
xmlobj 1.2.2
xmlobj is simple utility to map xml file to python object
License: MIT
Requires Python: >=3.7

### Description
xmlobj is simple utility to map xml file to python object

xmlobj also allows you to add functionality to mapped object by adding mixin class

### A Simple Example
```
from pathlib import Path

from PIL import Image, ImageDraw

from xmlobj import get_xml_obj


class DrawBoxesMixin:
    def draw_box(self, image) -> Image.Image:
        p1 = (self.object.bndbox.xmin, self.object.bndbox.ymin)
        p2 = (self.object.bndbox.xmax, self.object.bndbox.ymax)
        img_draw = ImageDraw.Draw(image)
        img_draw.text(p1, self.object.name, align="left")
        img_draw.rectangle([p1, p2])
        return image


if __name__ == "__main__":
    pascal_annotation = Path("samples/000027.xml")
    img_file = "samples/000027.jpg"
    img = Image.open(img_file)
    obj = get_xml_obj(pascal_annotation, mixin_clsasses=[DrawBoxesMixin])
    rendered_img = obj.draw_box(img.copy())
    rendered_img.show()

```


### Save xml
```
import xml.etree.cElementTree as ET

from xmlobj import get_xml_obj

if __name__ == "__main__":
    obj = get_xml_obj("samples/books.xml")
    root = obj.to_xml()
    tree = ET.ElementTree(root)
    ET.indent(tree, space="\t", level=0)
    tree.write("my_xml_books.xml")
```

### Limitations

* Tag lowercase  

Original:
```
  <CD>
    <TITLE>Empire Burlesque</TITLE>
    <ARTIST>Bob Dylan</ARTIST>
    <COUNTRY>USA</COUNTRY>
  </CD>
```
Output:
```
<cd>
    <TITLE>Empire Burlesque</TITLE>
    <ARTIST>Bob Dylan</ARTIST>
    <COUNTRY>USA</COUNTRY>
</cd>
```
* Attribute properties

Original:
```
 <book id="bk101">
        <author>Gambardella, Matthew</author>
        <title>XML Developer's Guide</title>
        <genre>Computer</genre>
        <price>44.95</price>
        <publish_date>2000-10-01</publish_date>
        <description>An in-depth look at creating applications
            with XML.
        </description>
    </book>
```
Output:
```
<book>
    <id>bk101</id>
    <author>Gambardella, Matthew</author>
    <title>XML Developer's Guide</title>
    <genre>Computer</genre>
    <price>44.95</price>
    <publish_date>2000-10-01</publish_date>
    <description>An in-depth look at creating applications
        with XML.</description>
</book>
```

### Installation
```
pip install xmlobj
```