Skip to main content

Snug for python3.

Project description

Snugthon

Snug for python3.

See Also

Installation (Pip)

pip install snugthon

Example(s)

Parse Snug

From File (Dictionary)

import snugthon

data = snugthon.load("test.snug") # File name
print(data) # Output the converted object

From Source (Dictionary)

import snugthon

data = snugthon.loads("users [(? name \"aiocat\" id 0) (? name \"john\" id 1)]") # Snug source
print(data) # Output the converted object

From File (JSON)

import snugthon

data = snugthon.load_as_json("test.snug") # File name
print(data) # Output the transpiled JSON object

From Source (JSON)

import snugthon

data = snugthon.loads_as_json("users [(? name \"aiocat\" id 0) (? name \"john\" id 1)]") # Snug source
print(data) # Output the transpiled JSON object

Create Snug

import snugthon

data = snugthon.dumps({ # Dictionary -> Snug converter
    "users": [
        { "id": 0, "name": "aiocat" }
    ]
})
# Or you can use:
data = snugthon.dump({ # Dictionary -> Snug converter
    "users": [
        { "id": 0, "name": "aiocat" }
    ]
}, "test.snug") # Path to save

print(data)

Found a bug? Got an error?

Please create a new issue on gitlab repository.

Contributing

If you want to contribute to this project:

  • Please do not something useless.
  • Use autopep8 for formatting.

Authors

License

This project is distributed with MIT license

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

snugthon-0.1.0.tar.gz (6.0 kB view hashes)

Uploaded Source

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