semvec/pypi-packages huggingface dataset:
makemahjongg 0.1.0
Tileset creator for GNOME Mahjongg
Requires Python: >=3.10

# makemahjongg

v0.1.0  
©2023 Jonas Santoso

Tileset creator for [GNOME Mahjongg](https://wiki.gnome.org/Apps/Mahjongg)

## Install

```shell
pip install makemahjongg
```

## Usage

Given a directory containing 41 images, *makemahjongg* creates a tileset from them that can be used with
GNOME Mahjongg. The tileset is based on the blank tile from GNOME Mahjongg's *smooth* theme.

Usage: `makemahjongg source_directory output_file`

The output file is a PNG which may be copied to Mahjongg's *themes* directory
(`/usr/share/gnome-mahjongg/themes`, YMMV). After copying, it can be used in Mahjongg by opening preferences and
selecting it in the *Theme* dropdown. 

An image can be any size, *makemahjongg* will scale it to fit a tile. Generally images with an aspect ratio
close to 1:1 work best.

*makemahjongg* allows for embedding parameters into the filename. So far only one parameter is recognized:
`resample`. E.g. when a file inside `source_directory` is named this:

&emsp;`31-childlike_empress__resample_NEAREST.png`

...*makemahjongg* will resample the image using the `NEAREST` algorithm instead of the default `LANCZOS`. Valid
values for `resample` are keys into PIL's
[Image.Resampling](https://pillow.readthedocs.io/en/stable/handbook/concepts.html#filters) enum.

Parameters are separated by double underscore. If someone expanded on the [`parseparams`](makemahjongg/tileutil.py#120)
function and added e.g. a *flip* parameter with values of *horizontal*, *vertical*, a filename such as

&emsp;`31-childlike_empress__resample_NEAREST__flip_horizontal.png`

would apply both resampling using `NEAREST` and horizontal flipping.

GNOME Mahjongg's [rules](https://help.gnome.org/users/gnome-mahjongg/stable/bonustiles.html.en) include two
groups of four 'bonus tiles' each, where any tile inside a group matches any other tile within the same group.
In the *postmodern* theme for example, these are the four blue and the four yellow tiles. *makemahjongg* applies
rounded rectangles to these tiles to mark them as bonus tiles, so doing this on the input images is not
required.
better-singleton 1.0.1
A clean, transparent and easy to use python singleton wrapper.
Requires Python: >=3.11,<4.0

# Singleton

## About the project

A clean, transparent and easy to use python singleton wrapper.

## Installation

`pip install better-singleton`

## Usage

Singleton definition:

```python
from better_singleton import singleton

@singleton
class Counter:
    def __init__(self, initial_counter):
        self.counter = initial_counter

    def inc(self):
        self.counter += 1
```

Usage:

```python
counter1 = Counter(1)
counter1.inc()
counter2 = Counter(1)
print(counter2.counter)
# >>> 2
```

Ensures that at most only one instance of the class exists at any point in time.
`__init__` and `__new__` of the original class get called only once: the first time
an instance is created. This instance will from then on be the singleton instance.
Every following call to the constructor of the wrapped class returns the singleton instance.

The wrapped class cannot have a class variable called `_singleton` as that stores
the singleton instance. This will throw an error before execution begins.

Not thread safe during first initialization.

## Roadmap

## Contributing

### Publish

1. Bump version in [pyproject.toml](pyproject.toml)
2. `poetry update`
3. `poetry build`
4. `poetry publish`

## License

See [License.md](LICENSE.md).

## Contributors

[Stephan Schmiedmayer](https://github.com/stephanschmiedmayer)

## Acknowledgments

Team Incentive Mechanism App Cluster of "Advanced Python Programming Spring 2022"
Nour Bouzid, Yanjie Li, Stephan Schmiedmayer and Leonhard Zirus under supervision of Valentin Zieglmeier