Coder Social home page Coder Social logo

python-llsd's Introduction

llsd

codecov

Official python serialization library for Linden Lab Structured Data (LLSD).

Use

Install llsd with pip:

pip install llsd

Use llsd to parse/format your data:

import llsd

data = {"foo": "bar"}

# Format

data_xml = llsd.format_xml(data)
# >>> '<?xml version="1.0" ?><llsd><map><key>foo</key><string>bar</string></map></llsd>'
data_notation = llsd.format_notation(data)
# >>> "{'foo':'bar'}"
data_binary = llsd.format_binary(data)
# >>> '<?llsd/binary?>\n{\x00\x00\x00\x01k\x00\x00\x00\x03foos\x00\x00\x00\x03bar}'

# Parse

data = llsd.parse(data_xml)
# >>> {'foo: 'bar'}
data = llsd.parse(data_notation)
# >>> {'foo: 'bar'}
data = llsd.parse(data_binary)
# >>> {'foo: 'bar'}

Develop

Requirements:

Set up a venv and install development dependencies:

python3 -m venv .venv
. .venv/bin/activate
pip install .[dev]

Run tests:

pytest

Benchmarks

Benchmarks from commits to main are published here.

python-llsd's People

Contributors

nat-goodspeed avatar roxanneskelly avatar bennettgoble avatar saladdais avatar dependabot[bot] avatar loglinden avatar nattylinden avatar

Stargazers

Garfield Linden avatar Otoa avatar

Watchers

 avatar James Cloos avatar Andrew Meadows avatar  avatar  avatar  avatar Aura Linden avatar  avatar

Forkers

saladdais

python-llsd's Issues

`format_pretty_xml()` indents badly in a few cases

>>> print(llsd.format_pretty_xml({'ha': ['a', 'b', 'c']}).decode())
<?xml version="1.0" ?>
<llsd>
<map>
    <key>ha</key>
    <array>
      <string>a</string>
      <string>b</string>
      <string>c</string>
</array>
  </map>
</llsd>

This affects autobuild.xml files rewritten by autobuild.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.