dfa-mutate-0.1.3
توضیحات
Library for mutating a DFA represented using the dfa library.
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | dfa-mutate-0.1.3 |
| نام | dfa-mutate |
| نسخه کتابخانه | 0.1.3 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Marcell Vazquez-Chanlatte |
| ایمیل نویسنده | mvc@linux.com |
| آدرس صفحه اصلی | https://github.com/mvcisback/dfa-mutate |
| آدرس اینترنتی | https://pypi.org/project/dfa-mutate/ |
| مجوز | MIT |
# DFA Mutate
Primitives and utilities for manipulating deterministic finite automata (DFA) represented using the [dfa](https://github.com/mvcisback/dfa) library.
[](https://cloud.drone.io/mvcisback/dfa_mutate)
[](https://badge.fury.io/py/dfa_mutate)
[](https://opensource.org/licenses/MIT)
**Table of Contents**
- [Installation](#installation)
- [Usage](#usage)
Installation
If you just need to use `dfa_mutate`, you can just run:
`$ pip install dfa_mutate`
For developers, note that this project uses the
[poetry](https://poetry.eustace.io/) python package/dependency
management tool. Please familarize yourself with it and then
run:
`$ poetry install`
# Usage
**Example Usage:**
```python
from dfa import DFA
import dfa_mutate
dfa1 = DFA(
start=0,
inputs={0, 1},
label=lambda s: (s % 4) == 3,
transition=lambda s, c: (s + c) % 4,
)
# Pick a specific mutation.
dfa2 = dfa_mutate.add_state(dfa1)
dfa3 = dfa_mutate.change_start(dfa1)
dfa4 = dfa_mutate.change_transition(dfa1)
dfa5 = dfa_mutate.relabel_state(dfa1)
# Infinite Generator mutations round-robin (will repeat).
dfas = dfa_mutate.generate_mutations(orig)
# Sample DFA using softmax over a scoring function (default constant).
# Uses first n dfas generated by above generator.
# NOTE: requires the optional numpy dependency.
dfa6 = dfa_mutate.sample_mutation(dfa1, n=20, score=lambda d: len(d.states()))
# All functions support passing in random number generator.
import random
dfa7 = dfa_mutate.relabel_state(dfa1, random.Random(0))
```
نیازمندی
| مقدار | نام |
|---|---|
| >=4.6.3,<5.0.0 | dfa |
| >=1.24.3,<2.0.0 | numpy |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.9,<4.0 | Python |
نحوه نصب
نصب پکیج whl dfa-mutate-0.1.3:
pip install dfa-mutate-0.1.3.whl
نصب پکیج tar.gz dfa-mutate-0.1.3:
pip install dfa-mutate-0.1.3.tar.gz