Skip to main content

Pre-generated sets of Unicode code points

Project description

Build Status codecov.io PyPI version

uniset

Pre-generated sets of Unicode code points

uniset is a module containing frozensets of Unicode code points (characters).

API

Categories

The module includes a set for all Unicode categories and subcategories except the main category "C" (other) and its subcategories "Co" (private use) and "Cn" (not assigned).

Example:

import uniset

# The letter "A" is in category "L" (letters)
assert "A" in uniset.L
# The letter "A" is also in category "Lu" (uppercase letters)
assert "A" in uniset.Lu

Whitespace

uniset.WHITESPACE contains all Unicode whitespace characters. uniset.WHITESPACE is a union of ASCII whitespace characters and the Unicode category "Zs".

import uniset

assert " " in uniset.WHITESPACE

Punctuation

uniset.PUNCTUATION contains all Unicode punctuation letters. uniset.PUNCTUATION is a union of ASCII punctuation characters and the Unicode category "P".

import uniset

assert "." in uniset.PUNCTUATION

Alternatives

unicategories also provides access to Unicode categories. The implementation is based on "range groups" and iterators, and should be faster and more memory efficient than uniset for inclusion checks.

If you need the frozenset API (unions, intersections, etc.), or the sets beyond Unicode categories (whitespace, punctuation), use uniset. Otherwise unicategories is the better option.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

uniset-0.1.0.tar.gz (324.1 kB view hashes)

Uploaded source

Built Distribution

uniset-0.1.0-py3-none-any.whl (316.5 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page