• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pymorphy2-fork / DAWG-Python / 14779646156

01 May 2025 05:04PM UTC coverage: 89.925%. Remained the same
14779646156

Pull #46

github

web-flow
Merge 13b24eede into bf6170229
Pull Request #46: Bump typing-extensions from 4.12.2 to 4.13.2

204 of 237 branches covered (86.08%)

Branch coverage included in aggregate %.

635 of 696 relevant lines covered (91.24%)

6.38 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/_prepare_dev_data.py
1
#!/usr/bin/env python
2
"""
3
Script for building test DAWGs.
4
"""
5

6
import struct
×
7

8
import dawg
×
9

10
from bench.utils import words100k
×
11
from tests.test_prediction import TestPrediction
×
12

13

14
def create_dawg():
×
15
    words = words100k()
×
16
    return dawg.DAWG(words)
×
17

18

19
def create_bytes_dawg():
×
20
    words = words100k()
×
21
    values = [struct.pack("<H", len(word)) for word in words]
×
22
    return dawg.BytesDAWG(zip(words, values))
×
23

24

25
def create_record_dawg():
×
26
    words = words100k()
×
27
    values = [[len(word)] for word in words]
×
28
    return dawg.RecordDAWG("<H", zip(words, values))
×
29

30

31
def create_int_dawg():
×
32
    words = words100k()
×
33
    values = [len(word) for word in words]
×
34
    return dawg.IntDAWG(zip(words, values))
×
35

36

37
def create_int_completion_dawg():
×
38
    words = words100k()
×
39
    values = [len(word) for word in words]
×
40
    return dawg.IntCompletionDAWG(zip(words, values))
×
41

42

43
def build_test_data() -> None:
×
44
    dawg.CompletionDAWG(["f", "bar", "foo", "foobar"]).save("dev_data/small/completion.dawg")
×
45
    dawg.CompletionDAWG([]).save("dev_data/small/completion-empty.dawg")
×
46

47
    bytes_data = (
×
48
        ("foo", b"data1"),
49
        ("bar", b"data2"),
50
        ("foo", b"data3"),
51
        ("foobar", b"data4"),
52
    )
53
    dawg.BytesDAWG(bytes_data).save("dev_data/small/bytes.dawg")
×
54

55
    record_data = (
×
56
        ("foo", (3, 2, 256)),
57
        ("bar", (3, 1, 0)),
58
        ("foo", (3, 2, 1)),
59
        ("foobar", (6, 3, 0)),
60
    )
61
    dawg.RecordDAWG(">3H", record_data).save("dev_data/small/record.dawg")
×
62

63
    int_data = {"foo": 1, "bar": 5, "foobar": 3}
×
64
    dawg.IntDAWG(int_data).save("dev_data/small/int_dawg.dawg")
×
65
    dawg.IntCompletionDAWG(int_data).save("dev_data/small/int_completion_dawg.dawg")
×
66

67
    dawg.DAWG(TestPrediction.DATA).save("dev_data/small/prediction.dawg")
×
68
    dawg.RecordDAWG("=H", [(k, (len(k),)) for k in TestPrediction.DATA]).save("dev_data/small/prediction-record.dawg")
×
69

70
    create_dawg().save("dev_data/large/dawg.dawg")
×
71
    create_bytes_dawg().save("dev_data/large/bytes_dawg.dawg")
×
72
    create_record_dawg().save("dev_data/large/record_dawg.dawg")
×
73
    create_int_dawg().save("dev_data/large/int_dawg.dawg")
×
74
    # create_int_completion_dawg().save('dev_data/large/int_completion_dawg.dawg')
75

76

77
if __name__ == "__main__":
78
    build_test_data()
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc