diff --git a/extra-tests/check_all.sh b/extra-tests/check_all.sh index d802fb1..6a3efb3 100644 --- a/extra-tests/check_all.sh +++ b/extra-tests/check_all.sh @@ -9,4 +9,4 @@ cd "`dirname $0`" git submodule update --init --recursive . # Run all checks -python3 org_dom_check.py . +python3 org_rw_check.py . diff --git a/extra-tests/org_dom_check.py b/extra-tests/org_rw_check.py similarity index 86% rename from extra-tests/org_dom_check.py rename to extra-tests/org_rw_check.py index 8197bf8..c9dfabd 100644 --- a/extra-tests/org_dom_check.py +++ b/extra-tests/org_rw_check.py @@ -3,7 +3,7 @@ import os import sys -import org_dom +import org_rw top = sys.argv[1] count = 0 @@ -16,7 +16,7 @@ for root, dirs, files in os.walk(top): path = os.path.join(root, name) count += 1 try: - org_dom.load(open(path), extra_cautious=True) + org_rw.load(open(path), extra_cautious=True) except Exception as err: import traceback diff --git a/org_dom/__init__.py b/org_dom/__init__.py deleted file mode 100644 index 28c7ee6..0000000 --- a/org_dom/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -from .org_dom import * -from .utils import * diff --git a/org_rw/__init__.py b/org_rw/__init__.py new file mode 100644 index 0000000..69398f7 --- /dev/null +++ b/org_rw/__init__.py @@ -0,0 +1,2 @@ +from .org_rw import * +from .utils import * diff --git a/org_dom/org_dom.py b/org_rw/org_rw.py similarity index 99% rename from org_dom/org_dom.py rename to org_rw/org_rw.py index 2ba1ba4..30fe7f2 100644 --- a/org_dom/org_dom.py +++ b/org_rw/org_rw.py @@ -1131,11 +1131,11 @@ class OrgDomReader: def loads(s, environment=BASE_ENVIRONMENT, extra_cautious=True): - doc = OrgDomReader() - doc.read(s, environment) - dom = doc.finalize() + reader = OrgDomReader() + reader.read(s, environment) + doc = reader.finalize() if extra_cautious: # Check that all options can be properly re-serialized - after_dump = dumps(dom) + after_dump = dumps(doc) if after_dump != s: diff = list( difflib.Differ().compare( @@ -1147,7 +1147,7 @@ def loads(s, environment=BASE_ENVIRONMENT, extra_cautious=True): # print("---\n" + after_dump + "\n---") raise Exception("Difference found between existing version and dumped") - return dom + return doc def load(f, environment=BASE_ENVIRONMENT, extra_cautious=False): diff --git a/org_dom/utils.py b/org_rw/utils.py similarity index 88% rename from org_dom/utils.py rename to org_rw/utils.py index ef507c3..04f0f1a 100644 --- a/org_dom/utils.py +++ b/org_rw/utils.py @@ -1,5 +1,5 @@ -from .org_dom import (Bold, Code, Headline, Italic, Line, RawLine, Strike, - Text, Underlined, Verbatim) +from .org_rw import (Bold, Code, Headline, Italic, Line, RawLine, Strike, Text, + Underlined, Verbatim) def get_hl_raw_contents(doc: Headline) -> str: diff --git a/setup.py b/setup.py index d9cdeb4..c29363b 100644 --- a/setup.py +++ b/setup.py @@ -1,13 +1,13 @@ from setuptools import setup setup( - name="org-dom", + name="org-rw", version="0.0.1", - description="Library to de/serialize org-files and manipulate them in a DOM-like manner.", + description="Library to de/serialize org-files and manipulate them.", author="kenkeiras", author_email="kenkeiras@codigoparallevar.com", license="Apache License 2.0", - packages=["org_dom"], + packages=["org_rw"], scripts=[], include_package_data=False, install_requires=[], diff --git a/tests/test_dom.py b/tests/test_org.py similarity index 98% rename from tests/test_dom.py rename to tests/test_org.py index 95fd778..63d94b9 100644 --- a/tests/test_dom.py +++ b/tests/test_org.py @@ -3,10 +3,10 @@ import os import unittest from datetime import datetime as DT -from org_dom import dumps, load, loads +from org_rw import dumps, load, loads -from utils.dom_assertions import (BOLD, CODE, HL, ITALIC, SPAN, STRIKE, - UNDERLINED, VERBATIM, WEB_LINK, Dom, Tokens) +from utils.assertions import (BOLD, CODE, HL, ITALIC, SPAN, STRIKE, UNDERLINED, + VERBATIM, WEB_LINK, Dom, Tokens) DIR = os.path.dirname(os.path.abspath(__file__)) diff --git a/tests/utils/dom_assertions.py b/tests/utils/assertions.py similarity index 98% rename from tests/utils/dom_assertions.py rename to tests/utils/assertions.py index 2494a26..ebcdcf1 100644 --- a/tests/utils/dom_assertions.py +++ b/tests/utils/assertions.py @@ -2,8 +2,8 @@ import collections import unittest from datetime import datetime -from org_dom import (Bold, Code, Italic, Line, Strike, Text, Underlined, - Verbatim, get_raw_contents) +from org_rw import (Bold, Code, Italic, Line, Strike, Text, Underlined, + Verbatim, get_raw_contents) def timestamp_to_datetime(ts): diff --git a/tox.ini b/tox.ini index 363e608..f2824a7 100644 --- a/tox.ini +++ b/tox.ini @@ -9,7 +9,7 @@ envlist = py39 [testenv] commands = - python -m pytest --cov-report term-missing --cov org_dom tests + python -m pytest --cov-report term-missing --cov org_rw tests deps = -r requirements.txt pytest