Skip to main content

Dexv-Stuff

Stuff i use in my projects

Installation

pip install dexvstuff

Features

  • Logger: My own logger which i like
  • Files: Simplified file operations
  • JsdomRuntime: Execute js in a dom environment
  • Wabt: WebAssembly Binary Toolkit wrapper for Python. For a better WABT wrapper, check out wabt.py

Usage

Logger

from dexvstuff import Logger

# basic logger
log = Logger()

# customized
log = Logger(prefix="Dexv", indent=2)  # prefix is optional, indent can be any number (default is 0)

log.info("This is an info message")
log.success("This is a success message")
log.warning("This is a warning message")
log.failure("This is a failure message")
log.debug("This is a debug message")
log.captcha("This is a captcha message")
log.PETC()  # Press Enter To Continue

Files

from dexvstuff import Files

Files.create("example.txt")
Files.create(["dir1/file1.txt", "dir2/file2.txt"])

Files.write("example.txt", "Dexvstuff is cool")
print(Files.read("example.txt"))
Files.append("example.txt", "\nDexvstuff is even cooler")

print(Files.get_file_size("example.txt"))
Files.delete("example.txt")

JsdomRuntime

from dexvstuff import JsdomRuntime

runtime = JsdomRuntime()

print(runtime.eval("console.log('Dexvstuff is cool')"))
print(runtime.eval("new Promise((resolve) => setTimeout(() => resolve('Dexvstuff is cool'), 1000))", promise=True)) # resolves promises
print(runtime.eval('''(function() { return new Uint8Array([1, 2, 3]) })()''', byte_array=False)) # support js byte arrays

Wabt

from dexvstuff import Wabt

wabt = Wabt()


wat_output, errors = wabt.wasm2wat("example.wasm")
wasm_output, errors = wabt.wat2wasm("example.wat")
objdump_output, errors = wabt.wasm_objdump("example.wasm")
...

Documentation

Logger

  • Logger(prefix=None, indent=0): create a new logger instance
    • prefix: optional string to prefix all messages (default: None)
    • indent: number of spaces to indent messages (default: 0)
  • info(message): info message
  • success(message): success message
  • warning(message): warning message
  • failure(message): error message
  • debug(message): debug message (only shown in debug mode)
  • captcha(message): captcha-related message
  • PETC(): pause execution until Enter is pressed

Files

  • create(path): create file or directory
  • read(path): read file content
  • write(path, content): write content to file
  • append(path, content): append content to file
  • delete(path): delete file
  • get_file_size(path): get file size in bytes
  • exists(path): check if file/directory exists

JsdomRuntime

  • eval(code, promise=False, byte_array=False): execute JavaScript code
    • promise: set to True if code returns a promise
    • byte_array: set to True if code returns a byte array

Wabt

  • wat2wasm(file): convert .wat to .wasm
  • wasm2wat(file): convert .wasm to .wat
  • wasm_objdump(file): inspect WASM file
  • wasm_decompile(file): decompile WASM to C-like code
  • All WABT tools are supported but not all are defined in the wrapper, you can still use them through dynamic attribute access
    • Example: wabt.wasm_validate('file.wasm') will call the wasm-validate tool
    • See WABT documentation for all available tools

License

MIT License - See LICENSE for more information

Metadata

Release files for dexvstuff 0.0.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dexvstuff 0.0.9
File Size Uploaded
dexvstuff-0.0.9.tar.gz 6.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dexvstuff 0.0.9
File Interpreter ABI Platform
dexvstuff-0.0.9-py3-none-any.whl Python 3 none any Details

Total release size: 14.3 kB

Release files / dexvstuff-0.0.9.tar.gz

Download URL dexvstuff-0.0.9.tar.gz
Size 6.8 kB
Tags Source
SHA-256 checksum
How to use checksums
d2cc4a3ca0528d2dc6a780fda806637bcc988abd75608b0cd1c73102d5757b05
BLAKE2b-256 checksum
How to use checksums
bd742646f20e2d451abf2b362ba60f02793886a9f60b90fa73c136bb9ef7df3b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.0

Release files / dexvstuff-0.0.9-py3-none-any.whl

Download URL dexvstuff-0.0.9-py3-none-any.whl
Size 7.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fd145ec6e04154fdcd894253aa40d51975b2c47ebe5d1769ca9a0961efe1e7b5
BLAKE2b-256 checksum
How to use checksums
2807d8676213dee3dbd7dd85c68406acfed2cd4a9936dfe26584335fa17e494f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.0

Release history Release notifications | RSS feed

This release

0.0.9 This release

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page