theopendictionary 0.2.0__py3-none-any.whl → 0.4.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of theopendictionary might be problematic. Click here for more details.

@@ -6,15 +6,6 @@ from typing import List
6
6
 
7
7
 
8
8
  def exec(*args: List[str]):
9
- print(
10
- " ".join(
11
- [
12
- "../bin/odict" if environ.get("RUNTIME_ENV") == "test" else "odict",
13
- "--quiet",
14
- *args,
15
- ]
16
- )
17
- )
18
9
  out = run(
19
10
  [
20
11
  "../bin/odict" if environ.get("RUNTIME_ENV") == "test" else "odict",
@@ -48,6 +39,10 @@ class Dictionary:
48
39
  exec("compile", "-o", path, tmp.name)
49
40
  remove(tmp.name)
50
41
 
42
+ def lexicon(self):
43
+ list = exec("lexicon", self.__path)
44
+ return list.splitlines()
45
+
51
46
  def search(self, query, index: bool = False):
52
47
  if index:
53
48
  return loads(exec("search", "-i", self.__path, query))
@@ -21,6 +21,21 @@ def test_search_dictionary():
21
21
  json,
22
22
  )
23
23
 
24
+ def test_lexicon():
25
+ xml = '<dictionary><entry term="hello"><ety><usage pos="v"><definition>hello world</definition></usage></ety></entry><entry term="world"><ety><usage pos="v"><definition>hello world</definition></usage></ety></entry></dictionary>'
26
+
27
+ Dictionary.write(xml, "test.odict")
28
+
29
+ dict = Dictionary("test.odict")
30
+
31
+ output = dict.lexicon()
32
+
33
+ expected = ['hello', 'world']
34
+
35
+ assert output == expected, "lexicon should be %s, received: %s" % (
36
+ expected,
37
+ output,
38
+ )
24
39
 
25
40
  def test_write_lookup_dictionary():
26
41
  xml = '<dictionary><entry term="hello"><ety><usage pos="v"><definition>hello world</definition></usage></ety></entry></dictionary>'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: theopendictionary
3
- Version: 0.2.0
3
+ Version: 0.4.0
4
4
  Summary:
5
5
  Author: Tyler Nickerson
6
6
  Author-email: nickersoft@gmail.com
@@ -0,0 +1,6 @@
1
+ theopendictionary/__init__.py,sha256=-lQUMgz94sOPrjRsJOLO9FtrVS4CtHKk-Lg2MwKfVKs,29
2
+ theopendictionary/odict.py,sha256=R9W4DCSmF9rNP7QLjN8kcJCe36bpTG9NecWXCCDktOA,1442
3
+ theopendictionary/test_odict.py,sha256=TQva922-lGuKwTmlO8Kn1RaZ91thcnBi6GMuezVlfoA,2405
4
+ theopendictionary-0.4.0.dist-info/METADATA,sha256=xl0xk-n92gb7ivSQx5Mc2CqC7vWmKSaBC1rZ90ARxtE,408
5
+ theopendictionary-0.4.0.dist-info/WHEEL,sha256=7Z8_27uaHI_UZAc4Uox4PpBhQ9Y5_modZXWMxtUi4NU,88
6
+ theopendictionary-0.4.0.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: poetry-core 1.3.2
2
+ Generator: poetry-core 1.5.2
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
@@ -1,6 +0,0 @@
1
- theopendictionary/__init__.py,sha256=-lQUMgz94sOPrjRsJOLO9FtrVS4CtHKk-Lg2MwKfVKs,29
2
- theopendictionary/odict.py,sha256=G5uizh1dQ_ekNsGeaQ25pb_vGgHjX6jmHHkIQcxK4Mk,1545
3
- theopendictionary/test_odict.py,sha256=QhIBMXUedNnTCU9eQA7UL-hhe6_SwAVM8MyQEcDQBps,1896
4
- theopendictionary-0.2.0.dist-info/WHEEL,sha256=vxFmldFsRN_Hx10GDvsdv1wroKq8r5Lzvjp6GZ4OO8c,88
5
- theopendictionary-0.2.0.dist-info/METADATA,sha256=hsgfu1f9wdCyYTelOA9KhGNVz0OKJFPm3IGLhA2bSlg,408
6
- theopendictionary-0.2.0.dist-info/RECORD,,