semvec/pypi-packages huggingface dataset:
pastegram 1.0.1
A set of simple functions to upload and fetch pastes on paste.uploadgram.me
Requires Python: >=3.0

# pastegram-py

A set of simple functions to upload and fetch pastes on [paste.uploadgram.me](https://paste.uploadgram.me/).

## API Documentation

### Methods

#### `upload_paste(contents: bytes, filename: str) -> UploadedPaste`:

Uploads a paste.

| argument | required | default |
| -------- | -------- | ------- |
| contents | yes      |         |
| filename | no       | paste   |

Returns: the `UploadedPaste`

#### `fetch_paste(url: str) -> str`

Fetches the paste and returns the contents as string.

| argument | required | default |
| -------- | -------- | ------- |
| url      | yes      |         |

Returns: The paste's contents as string

### Types

#### `UploadedPaste`

An uploaded paste

##### Fields

| field      | type  | description                                          |
| ---------- | ----- | ---------------------------------------------------- |
| token      | str   | An unique token that can be used to delete the paste |
| downloadId | str   | The paste's download id                              |
| key        | bytes | The paste's decryption key as bytes                  |

##### Methods

`UploadedPaste.get_url() -> str`

Gets the paste's shareable url

### Errors

#### `ParseError`

Raised when an error occurs while parsing. May be thrown by `fetch_paste()`

#### `APIError`

Raised when an error occurs while fetching/parsing an API reponse. May be thrown by `upload_paste()`

### Examples

Upload a paste and fetch it back

```py
from pastegram import upload_paste, fetch_paste, UploadedPaste

def main():
    print('uploading paste...')
    paste: UploadedPaste = upload_paste(b'hello')
    print(paste.token)
    print(paste.get_url())

    print('re-downloading paste...')
    contents: str = fetch_paste(paste.get_url())
    print(contents)

if __name__ == '__main__':
    main()
```
mre 0.12.0
Maker Regular Expressions

# Maker Regular Expression

<a href="https://pypi.org/project/mre/">
  <img alt="PyPI" src="https://img.shields.io/pypi/v/mre.svg">
</a>

This is a simple package to make regular expressions in Python.

```bash
pip install mre
```

- Test regex: [Regex101](https://regex101.com/);
- [Regular expression operations](https://docs.python.org/3/library/re.html).

## Documentation

- [da-DK :denmark:](docs/da_DK.md) <small>(v. 0.8)</small>
- [de-DE :de:](docs/de_DE.md) <small>(v. 0.8)</small>
- [en-US :us:](docs/en_US.md) <small>(v. 0.9)</small>
- [es-ES :es:](docs/es_ES.md) <small>(v. 0.8)</small>
- [pt-BR :brazil:](docs/pt_BR.md) <small>(v. 0.11)</small>
- [ru-RU :ru:](docs/ru_RU.md) <small>(v. 0.8)</small>
- [uk-UA :ukraine:](docs/uk_UA.md) <small>(v. 0.8)</small>

## Examples

```python
from mre import Regex, Group

rgx_one = Regex("Hello world")  # Hello world
rgx_two = Regex("Hello", " world")  # Hello world
rgx_three = Regex("Hello") + " " + Regex("world")  # Hello world
rgx_four = Regex('<', Group('h[1-6]'), '>')  # <(h[1-6])>
rgx_five = Regex('<', Regex.SLASH, 1, '>')  # <\/\1>
```

```python
from mre import Set
from mre.helper import Range

# All digits
digits = Set(Range(0, 9))
# Add comment
digits = digits.comment('Get all digits')

# Output: [0-9](?#Get all digits)
```

```python
from mre import Regex, Set, Comment

# All digits
digits = Set(Regex("0-9"))
# CEP comment
cep_comment = Comment('Get zip code Brazil on input')
# CEP regex
rgx_cep = Regex(
    digits.quantifier(5),
    Regex("-").quantifier(0, 1),
    digits.quantifier(3),
    cep_comment
)

# Output: [0-9]{5}-?[0-9]{3}(?#Get zip code Brazil on input)
```

## Tests

To test the package just run the following command:

```shell
# (first time only) Build the Docker image
make build

# Run tests
make test

# Run tests and check coverage
make test-coverage
```

## Contributing

Contributions are more than welcome. Fork, improve and make a pull request.
For bugs, ideas for improvement or other, please create an [issue][issues].

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

[issues]: https://github.com/alvarofpp/mre/issues