Skip to main content

A sUTL implementation for python

Project description

# sUTL_py
sUTL Universal Transform Language for Python

This is a python implementation of sUTL. See the [sUTL spec](https://github.com/emlynoregan/sUTL-spec) here.

Import sUTL like this:

from sUTL_py import sUTL

Evaluate a transform like this:

transform = {
"&": "+",
"a": "^@",
"b": 5
}

source = 6

result = sUTL.evaluate(source, transform, {})

# here result is 11

To use library distributions, do the following:

1: Load the libraries. The following loads the core library.

coreString = urllib2.urlopen("http://emlynoregan.github.io/sUTL-spec/sUTL_core.json").read()
distributions = [json.loads(coreString)]

2: Add your transform to a declaration

transform = {
"&": "map_core",
"list": "^@",
"t": {":": {
"&": "+",
"a": "^@.item",
"b": 1
}}
}

declaration = {
"transform-t": transform,
"requires": ["map_core"]
}

3: Compile a set of libraries from the distribution

lib = sUTL.compilelib([declaration], distributions, false)

4: Evaluate your transform

source = [1, 2, 3, 4]

result = sUTL.evaluate(source, transform, lib)

# here result is [2, 3, 4, 5]


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

sUTL-1.0.6.tar.gz (7.7 kB view details)

Uploaded Source

Built Distribution

sUTL-1.0.6-py2.py3-none-any.whl (8.0 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file sUTL-1.0.6.tar.gz.

File metadata

  • Download URL: sUTL-1.0.6.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for sUTL-1.0.6.tar.gz
Algorithm Hash digest
SHA256 bbfe81d14517871713da7f7bbf232ec1146caadb77d724d5894a42d1e4968ed6
MD5 5a066981e9c3631266fa27cf42555d30
BLAKE2b-256 1091a386476fe1e39249fe0b77e8644e4c68f5c890859177dfa93909bb60415b

See more details on using hashes here.

File details

Details for the file sUTL-1.0.6-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for sUTL-1.0.6-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 f0c0faa7dd29bf600a20d045ad425ed129e43ca727480f1a2467e6fbddf76bb4
MD5 eabbbe97f5459bd121e364a05c24ddee
BLAKE2b-256 0228df607e26f5d455bf2c603784fc7b7593f603b06822b95edc308fd3c8b460

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page