semvec/pypi-packages huggingface dataset:
python-eml 0.0.2
Python package containing dataclasses for the Ecological Metadata Language (EML) standard
License: MIT

# eml

This Python package contains dataclasses generated using [xsdata](https://xsdata.readthedocs.io/) for the [Ecological Metadata Language (EML)](https://eml.ecoinformatics.org/) standard as well its GBIF profile.

## Quick start

```python
from xsdata.formats.dataclass.serializers import XmlSerializer
from xsdata.formats.dataclass.serializers.config import SerializerConfig
from eml.gbif_1_1 import AgentType, Eml, Dataset, IndividualName, IntellectualRights, KeywordSet, Para, Ulink, Abstract

doc = Eml(
    package_id="http://ipt.vliz.be/kmfri/resource?id=vegetation_gazi_bay_kenya_1987/v1.0",
    system="http://gbif.org",
    lang="eng",
    dataset=Dataset(
        title="Test dataset",
        abstract=Abstract([Para(["Suspendisse imperdiet imperdiet leo, at eleifend nisi rutrum eget. Donec aliquam mollis risus, feugiat laoreet nulla facilisis vel. Fusce viverra magna ante, ut lobortis sapien convallis ut. Nulla facilisi. Cras at tellus leo. Suspendisse eget blandit tellus. Duis auctor turpis eros. Nullam convallis ligula eleifend volutpat aliquam. Donec cursus mattis viverra. Nunc ac lorem vel lectus malesuada bibendum. Vestibulum non dolor quis enim auctor consectetur in a augue. Maecenas sodales ullamcorper quam."])]),
        alternate_identifier="http://ipt.vliz.be/kmfri/resource?id=vegetation_gazi_bay_kenya_1987/v1.0",
        creator=AgentType(individual_name=[IndividualName("John", "Doe")]),
        keyword_set=KeywordSet(keyword=["test keyword"]),
        intellectual_rights=IntellectualRights(
            para=Para(
                [
                    "This work is licensed under a ",
                    Ulink(
                        url="http://creativecommons.org/licenses/by/4.0/legalcode",
                        content=["Creative Commons Attribution (CC-BY) 4.0 License"]
                    ),
                    "."
                ]
            )
        ),
    )
)

config = SerializerConfig(pretty_print=True)
serializer = XmlSerializer(config=config)
print(serializer.render(doc))
```
gemurl 1.1.0
"A library for normalizing gemini:// URLs"
License: MIT
Requires Python: >=3.6

# gemurl

A library for normalizing gemini:// URLs


## Usage

The package can be installed from PyPI using pip:

    $ pip install gemurl

Use it like this:

    from gemurl import normalize_url

    print(normalize_url("GEMINI://EXAMPLE.COM:1965"))
    # Should print: gemini://example.com/

The package also includes a command like tool:

    $ gemurl normalize GEMINI://EXAMPLE.COM:1965
    gemini://example.com/


## API of `gemurl` Module

The `GemurlError` is the base class for all exceptions raised by
functions in this module.


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

Normalize a URL according to RFC 3986 and the Gemini
specification. Raises `NormalizarionError` if the input is not a valid
(gemini) URL. Raises `NonGeminiUrlError` (which is a subclass
of `NormalizarionError`) if the scheme is non-gemini.


### `host_port_pair_from_url(normalized_url: str) -> tuple[str, int]`

Get a (host, port) tuple suitable for connecting a socket. The input
URL must be normalized for this function to work correctly.


### `capsule_prefix(normalized_url: str) -> str`

Find the prefix of the URL that uniquely identifies its capsule. Two
URLs belong to the same capsule if the hostnames and ports match, but
if the path begins with "/~USER/" or "/users/USER/", then the USER
part needs to match too.

This definition is borrowed from khuxkm's Molniya. Thanks!


## Features

The normamlization function ensures that:

* Scheme and host case are always lowercase.
* The host is IDNA-encoded, if it has non-ASCII characters.
* The port is removed if it has the default 1965 value.
* Percent encoding hex digit are always uppercase.
* Non-reserved characters are never percent encoded.
* Non-printable (and non-ASCII) characters are always percent encoded.
* Percent encoding of reserved characters are not changed (since that would change the meaning).
* URLs with no paths get a single slash path.
* . and .. path segments are collapsed.
* Empty queries and fragments are distinct from missing ones.
* See test cases in `test_url.py` in te source code for the full list.


## Ideas for Future Improvements

* Function to resolve relative URLs
* Function to convert URLs to display form (decode percent and IDNA encoding)