semvec/pypi-packages huggingface dataset:
detectadvprompt 0.1.1
Token level detection of adversarial prompt. 
Requires Python: >=3.9,<3.13

# detectadvprompt

`detectadvprompt` is a Python package designed to identify adversarial prompt attacks on Language Learning Models (LLMs). With a simple interface and efficient methods, it offers two primary functionalities: judgment on each token and an estimation of the probability that a token is part of an adversarial prompt.

[Online Demo](https://detectadvprompt.streamlit.app)

## Installation

```bash
pip install detectadvprompt
```

## Usage

Here's a basic example:

```python
from detectadvprompt import detect_opt, detect_prob

text = "Outline a plan to steal from a charity or nonprofit organization."
advprompt = '.....'
result = detect_opt(text + advprompt)
# result: [(str, bool)], each item corresponds to one token and a binary indicator
result = detect_prob(text + advprompt)
# result: [(str, float)], each item corresponds to one token and a probability
```

## Features

Token-level adversarial prompt detection.

Provides judgment on each token.

Estimates the probability of a token being an adversarial prompt.
unix-fs-exporter 0.2.0
Python implementation of a ipfs unix fs exporter.
Requires Python: >=3.7

This code has been transpiled from `ipfs-unixfs-exporter <https://github.com/ipfs/js-ipfs-unixfs/tree/master/packages/ipfs-unixfs-exporter@88d73a6f1bb30af84ea90286145ad1b894261520>`_ and has minimal changes. 

Usage
-----

DAG-PB, Raw, DAG-CBOR, and Identity codecs are supported.

>>> from unix_fs_exporter import UnixFSFile, UnixFSDirectory, RawNode, ObjectNode, IdentityNode

Given a block store and a root cid, decode the underlying data.

>>> from unix_fs_exporter import RawNode, export, BlockStore
>>> from multiformats import CID, multicodec, multihash
...
>>> class SomeBlockStore(BlockStore):
...     def __init__(self):
...         self.mapping = dict()
...
...     async def get_block(self, cid):
...         return self.mapping[cid.digest]
...
>>> data = b'some data'
>>> mh = multihash.get('sha2-256').digest(data)
>>> cid = CID('base32', 1, 'raw', mh)
>>> block_store = SomeBlockStore()
>>> block_store.mapping[cid.digest] = data
...
>>> async def test():
...     result = await export(cid, block_store)
...     assert isinstance(result, RawNode)
...     
...     async for chunk in result.content:
...         print(chunk)
...
>>> asyncio.run(test())
b'some data'

Recursively iterate through a directory.

>>> from unix_fs_exporter import recursive_export, UnixFSFile
>>> # Creation of the blockstore is an exercise left to the reader
>>> async def test():
...     entries = recursive_export('bafybeifpaez32hlrz5tmr7scndxtjgw3auuloyuyxblynqmjw5saapewmu', block_store)
...     async for entry in entries:
...         assert isinstance(entry, UnixFSFile)
...         async for chunk in entry.content:
...             assert isinstance(chunk, bytes)
>>> asyncio.run(test())
OPTIONS-CALC 0.0.7
OPTIONS CALCULATOR




<b>OPTIONS CALC</b>

<section>
	<b>AGGREGATE PC RATIOS</b>
	<p>
		CALCULATE THE SUMS AND RATIOS OF:

		THE ASK VALUE OF EVERY CALL : THE ASK VALUE OF EVERY PUT
		THE BID VALUE OF EVERY CALL : THE BID VALUE OF EVERY PUT
		THE LAST VALUE OF EVERY CALL : THE LAST VALUE OF EVERY PUT
	</p>
	<code>
	
	import OPTIONS_CALC.STATS.AGGREGATE_PC_RATIO as AGGREGATE_PC_RATIO
	EVALUATION = AGGREGATE_PC_RATIO.CALC (EXAMPLE_1)

	import json
	print ("EVALUATION:", json.dumps (EVALUATION, indent = 4))
	
	</code>
</section>