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
Release history Release notifications | RSS feed
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 details)
File details
Details for the file snugthon-0.1.0.tar.gz.
File metadata
- Download URL: snugthon-0.1.0.tar.gz
- Upload date:
- Size: 6.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ef7957deefbf5c196d4b00d2a16e136e74508fd7fb18512deb289ebd774dc298
|
|
| MD5 |
1605a16420253b830d1b42015b20a662
|
|
| BLAKE2b-256 |
93fbfd02d1f847c3f16bcb34b05094ccf4cd02fe2b656fe7a49f0a543fb9c2e7
|