Skip to main content

Extracting data structures from runtime duck typing.

Project description

git init# duckstruct

Dependencies: None
Developer: Emmanouil (Manios) Krasanakis
Contant: maniospas@hotmail.com

Quickstart

from duckstruct import TypeListener
import numpy as np

x = np.array([1, 2, 3])
y = np.array([5, 6])
z = np.array([7.])
x = TypeListener(x)
y = TypeListener(y)
z = TypeListener(z)
print(x)
print(x+1+y.sum()+z.sum())

After running the code, you can show the structure a new variable should have to replace all others in yaml format.

print(x.type() & y.type() & z.type())

This yields the minimum necessary structure for the code to run:

object:
  __str__: 
    returns:
      class: str
  __add__: 
    returns:
      class: ndarray
  sum: 
    returns:
      -  class: int32
      -  class: float64

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

duckstruct-0.0.1.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

duckstruct-0.0.1-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file duckstruct-0.0.1.tar.gz.

File metadata

  • Download URL: duckstruct-0.0.1.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.4

File hashes

Hashes for duckstruct-0.0.1.tar.gz
Algorithm Hash digest
SHA256 1346f5b4e7840abef2204c5d5fe8b09d1afcfbd1e9d9f3659753626d05d466dd
MD5 f6d2043536d471998eb7fdc9e732d27f
BLAKE2b-256 8bcada521321febeb3ab87f9e0c3c6e7a7171db4453b9eb54f83195b4f76e0b7

See more details on using hashes here.

File details

Details for the file duckstruct-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: duckstruct-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.4

File hashes

Hashes for duckstruct-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9f6be2fb1f38dcc7232b99979944eb4f4da70c139cf66d8d3f0e6f44a2153058
MD5 4e643dd9b4a21a0d439e85f4352f093f
BLAKE2b-256 639f76a9b69916924cb3c439c9712a7b440cfeb0cd506e5df77fced897b0473e

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