diff --git a/MyCapytain/__init__.py b/MyCapytain/__init__.py index b3be5ae6..7a644edc 100644 --- a/MyCapytain/__init__.py +++ b/MyCapytain/__init__.py @@ -10,5 +10,5 @@ """ __name__ = "MyCapytain" -__version__ = "0.1.3" -__all__ = ["common", "endpoints", "resources"] +__version__ = "1.0.0" +__all__ = ["common", "retrievers", "resources"] diff --git a/MyCapytain/endpoints/__init__.py b/MyCapytain/endpoints/__init__.py deleted file mode 100644 index 8159be84..00000000 --- a/MyCapytain/endpoints/__init__.py +++ /dev/null @@ -1,9 +0,0 @@ -# -*- coding: utf-8 -*- -""" -.. module:: MyCapytain.endpoints - :synopsis: Implementation and abstraction of CTS related endpoints - -.. moduleauthor:: Thibault Clérice - - -""" \ No newline at end of file diff --git a/MyCapytain/resources/texts/api.py b/MyCapytain/resources/texts/api.py index 52e10e87..b544764a 100644 --- a/MyCapytain/resources/texts/api.py +++ b/MyCapytain/resources/texts/api.py @@ -7,7 +7,7 @@ import MyCapytain.resources.proto.text import MyCapytain.resources.texts.tei import MyCapytain.resources.inventory -import MyCapytain.endpoints.proto +import MyCapytain.retrievers.proto import MyCapytain.common.metadata import MyCapytain.common.utils import MyCapytain.common.reference @@ -19,7 +19,7 @@ class Text(MyCapytain.resources.proto.text.Text): :param urn: A URN identifier :type urn: MyCapytain.common.reference.URN :param resource: An API endpoint - :type resource: MyCapytain.endpoints.proto.CTS + :type resource: MyCapytain.retrievers.proto.CTS :param citation: Citation for children level :type citation: MyCapytain.resources.texts.tei.Citation :param id: Identifier of the subreference without URN informations diff --git a/MyCapytain/retrievers/__init__.py b/MyCapytain/retrievers/__init__.py new file mode 100644 index 00000000..e727d2e3 --- /dev/null +++ b/MyCapytain/retrievers/__init__.py @@ -0,0 +1,9 @@ +# -*- coding: utf-8 -*- +""" +.. module:: MyCapytain.retrievers + :synopsis: Implementation and abstraction of CTS related retrievers + +.. moduleauthor:: Thibault Clérice + + +""" \ No newline at end of file diff --git a/MyCapytain/endpoints/ahab.py b/MyCapytain/retrievers/ahab.py similarity index 79% rename from MyCapytain/endpoints/ahab.py rename to MyCapytain/retrievers/ahab.py index eb6b6967..8e731daf 100644 --- a/MyCapytain/endpoints/ahab.py +++ b/MyCapytain/retrievers/ahab.py @@ -1,13 +1,13 @@ # -*- coding: utf-8 -*- """ -.. module:: MyCapytain.endpoints.ahab +.. module:: MyCapytain.retrievers.ahab :synopsis: Ahab endpoint implementation .. moduleauthor:: Thibault Clérice """ -import MyCapytain.endpoints.proto +import MyCapytain.retrievers.proto import requests diff --git a/MyCapytain/endpoints/cts5.py b/MyCapytain/retrievers/cts5.py similarity index 96% rename from MyCapytain/endpoints/cts5.py rename to MyCapytain/retrievers/cts5.py index 7af3a901..540fcee5 100644 --- a/MyCapytain/endpoints/cts5.py +++ b/MyCapytain/retrievers/cts5.py @@ -1,20 +1,20 @@ # -*- coding: utf-8 -*- """ -.. module:: MyCapytain.endpoints.cts5 +.. module:: MyCapytain.retrievers.cts5 :synopsis: CTS5 endpoint implementation .. moduleauthor:: Thibault Clérice """ -import MyCapytain.endpoints.proto +import MyCapytain.retrievers.proto import requests -class CTS(MyCapytain.endpoints.proto.CTS): +class CTS(MyCapytain.retrievers.proto.CTS): """ - Basic integration of the MyCapytain.endpoints.proto.CTS abstraction + Basic integration of the MyCapytain.retrievers.proto.CTS abstraction """ def __init__(self, endpoint, inventory=None): diff --git a/MyCapytain/endpoints/proto.py b/MyCapytain/retrievers/proto.py similarity index 99% rename from MyCapytain/endpoints/proto.py rename to MyCapytain/retrievers/proto.py index a602af35..8532fcd6 100644 --- a/MyCapytain/endpoints/proto.py +++ b/MyCapytain/retrievers/proto.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- """ -.. module:: MyCapytain.endpoints.proto +.. module:: MyCapytain.retrievers.proto :synopsis: Prototypes of APIs endpoint .. moduleauthor:: Thibault Clérice diff --git a/README.rst b/README.rst index 8e47f9e2..d330bf33 100644 --- a/README.rst +++ b/README.rst @@ -12,6 +12,8 @@ :target: https://zenodo.org/badge/latestdoi/3923/Capitains/MyCapytain .. image:: https://img.shields.io/pypi/dm/MyCapytain.svg :target: https://pypi.python.org/pypi/MyCapytain +.. image:: https://api.codacy.com/project/badge/grade/8e63e69a94274422865e4f275dbf08ea + :target: https://www.codacy.com/app/leponteineptique/MyCapytain MyCapytain is a python package which provides a large set of tools to deal with CTS and Capitains Guidelines in Python. Installation and Requirements diff --git a/doc/MyCapytain.api.rst b/doc/MyCapytain.api.rst index a47b0d8a..a3eca857 100644 --- a/doc/MyCapytain.api.rst +++ b/doc/MyCapytain.api.rst @@ -31,15 +31,15 @@ Utilities :undoc-members: :show-inheritance: -API Endpoints -############# +API Retrievers +############## -Module endpoints contains prototypes and implementation of endpoints calls in MyCapytain +Module endpoints contains prototypes and implementation of retrievers in MyCapytain Ahab **** -.. automodule:: MyCapytain.endpoints.ahab +.. automodule:: MyCapytain.retrievers.ahab :members: :undoc-members: :show-inheritance: @@ -47,7 +47,7 @@ Ahab CTS 5 API ********* -.. automodule:: MyCapytain.endpoints.cts5 +.. automodule:: MyCapytain.retrievers.cts5 :members: :undoc-members: :show-inheritance: @@ -55,7 +55,7 @@ CTS 5 API Prototypes ********** -.. automodule:: MyCapytain.endpoints.proto +.. automodule:: MyCapytain.retrievers.proto :members: :undoc-members: :show-inheritance: diff --git a/doc/MyCapytain.endpoint.rst b/doc/MyCapytain.endpoint.rst index e1e29abd..65980b3d 100644 --- a/doc/MyCapytain.endpoint.rst +++ b/doc/MyCapytain.endpoint.rst @@ -7,12 +7,12 @@ Introduction A first important point for MyCapytains endpoint is that the resources are not parsed into object but should only provide the request by default. -Getting Passage from an Endpoint -################################ +Getting Passage from an endpoint using a Retriever +################################################## .. code-block:: python - from MyCapytain.endpoints import cts5 + from MyCapytain.retrievers import cts5 from MyCapytain.resources.texts.api import Text # We set the variable up, as if we were in a function diff --git a/doc/MyCapytain.uses.rst b/doc/MyCapytain.uses.rst index a1d177b6..1e0ccb16 100644 --- a/doc/MyCapytain.uses.rst +++ b/doc/MyCapytain.uses.rst @@ -6,13 +6,15 @@ If you are using MyCapytain and wish to appear here, please feel free to open an Extensions ########## -Softwares and software extensions +Nautilus +******** +`Nautilus `_ provides a local retriever to build inventory based on a set of folders available locally. Flask Capitains Nemo ******************** `Flask Capitains Nemo `_ is an extension for Flask to build a browsing interface -using both endpoints and resources modules. You will find example of use in a web based environment. +using both retrievers and resources modules. You will find example of use in a web based environment. HookTest ******** diff --git a/setup.py b/setup.py index 7725077d..19e659ec 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setup( name='MyCapytain', version=MyCapytain.__version__, - description='Abstraction of CTS API for Python', + description='Library for CTS APIs and CapiTainS guidelines in Python', url='http://github.com/Capitains/MyCapytain', author='Thibault Clerice', author_email='leponteineptique@gmail.com', diff --git a/tests/endpoints/test_cts5.py b/tests/endpoints/test_cts5.py index 97aca855..1d437294 100644 --- a/tests/endpoints/test_cts5.py +++ b/tests/endpoints/test_cts5.py @@ -1,6 +1,6 @@ import unittest from mock import patch -from MyCapytain.endpoints.cts5 import * +from MyCapytain.retrievers.cts5 import * class TestEndpointsCTS5(unittest.TestCase): diff --git a/tests/endpoints/test_proto.py b/tests/endpoints/test_proto.py index c71c41b4..f84ac30a 100644 --- a/tests/endpoints/test_proto.py +++ b/tests/endpoints/test_proto.py @@ -1,11 +1,11 @@ import unittest -from MyCapytain.endpoints.proto import * +from MyCapytain.retrievers.proto import * class TestEndpointsProto(unittest.TestCase): - """ Testing prototypes endpoints """ + """ Testing prototypes retrievers """ def setUp(self): self.ahab = Ahab("http://ahab.com") diff --git a/tests/resources/texts/test_api.py b/tests/resources/texts/test_api.py index 07385c04..9cc64aff 100644 --- a/tests/resources/texts/test_api.py +++ b/tests/resources/texts/test_api.py @@ -8,7 +8,7 @@ from MyCapytain.common.utils import xmlparser, NS from MyCapytain.resources.texts.api import * from MyCapytain.resources.texts.tei import Citation -from MyCapytain.endpoints.cts5 import CTS +from MyCapytain.retrievers.cts5 import CTS from MyCapytain.common.reference import Reference, URN from lxml import etree import mock @@ -62,7 +62,7 @@ def test_init(self): ) self.assertIsInstance(text.metadata["testing"], MyCapytain.common.metadata.Metadatum) - @mock.patch("MyCapytain.endpoints.cts5.requests.get", create=True) + @mock.patch("MyCapytain.retrievers.cts5.requests.get", create=True) def test_getvalidreff(self, requests): text = Text("urn:cts:latinLit:phi1294.phi002.perseus-lat2", self.endpoint, citation=self.citation) requests.return_value.text = GET_VALID_REFF @@ -125,7 +125,7 @@ def test_getvalidreff(self, requests): # Test the parsing self.assertEqual(reffs[0], "urn:cts:latinLit:phi1294.phi002.perseus-lat2:1.pr.1") - @mock.patch("MyCapytain.endpoints.cts5.requests.get", create=True) + @mock.patch("MyCapytain.retrievers.cts5.requests.get", create=True) def test_getpassage(self, requests): text = Text("urn:cts:latinLit:phi1294.phi002.perseus-lat2", self.endpoint, citation=self.citation) requests.return_value.text = GET_PASSAGE @@ -157,7 +157,7 @@ def test_getpassage(self, requests): } ) - @mock.patch("MyCapytain.endpoints.cts5.requests.get", create=True) + @mock.patch("MyCapytain.retrievers.cts5.requests.get", create=True) def test_getpassageplus(self, requests): text = Text("urn:cts:latinLit:phi1294.phi002.perseus-lat2", self.endpoint) requests.return_value.text = GET_PASSAGE_PLUS @@ -191,7 +191,7 @@ def test_getpassageplus(self, requests): } ) - @mock.patch("MyCapytain.endpoints.cts5.requests.get", create=True) + @mock.patch("MyCapytain.retrievers.cts5.requests.get", create=True) def test_get_prev_next_urn(self, requests): text = Text("urn:cts:latinLit:phi1294.phi002.perseus-lat2", resource=self.endpoint) requests.return_value.text = NEXT_PREV @@ -199,7 +199,7 @@ def test_get_prev_next_urn(self, requests): self.assertEqual(str(_prev.reference), "1.pr", "Endpoint should be called and URN should be parsed") self.assertEqual(str(_next.reference), "1.2", "Endpoint should be called and URN should be parsed") - @mock.patch("MyCapytain.endpoints.cts5.requests.get", create=True) + @mock.patch("MyCapytain.retrievers.cts5.requests.get", create=True) def test_first_urn(self, requests): text = Text("urn:cts:latinLit:phi1294.phi002.perseus-lat2", resource=self.endpoint) requests.return_value.text = Get_FIRST @@ -216,7 +216,7 @@ def test_first_urn(self, requests): } ) - @mock.patch("MyCapytain.endpoints.cts5.requests.get", create=True) + @mock.patch("MyCapytain.retrievers.cts5.requests.get", create=True) def test_first_urn_when_empty(self, requests): text = Text("urn:cts:latinLit:phi1294.phi002.perseus-lat2", resource=self.endpoint) requests.return_value.text = Get_FIRST_EMPTY @@ -233,7 +233,7 @@ def test_first_urn_when_empty(self, requests): } ) - @mock.patch("MyCapytain.endpoints.cts5.requests.get", create=True) + @mock.patch("MyCapytain.retrievers.cts5.requests.get", create=True) def test_init_without_citation(self, requests): text = Text("urn:cts:latinLit:phi1294.phi002.perseus-lat2", resource=self.endpoint) requests.return_value.text = GET_PASSAGE @@ -249,7 +249,7 @@ def test_init_without_citation(self, requests): ) self.assertEqual(text.citation.name, "book") - @mock.patch("MyCapytain.endpoints.cts5.requests.get", create=True) + @mock.patch("MyCapytain.retrievers.cts5.requests.get", create=True) def test_getLabel(self, requests): text = Text("urn:cts:latinLit:phi1294.phi002.perseus-lat2", resource=self.endpoint) requests.return_value.text = GET_LABEL @@ -257,7 +257,7 @@ def test_getLabel(self, requests): label = text.getLabel() self.assertEqual(label["title"]["eng"], "Epigrammata") - @mock.patch("MyCapytain.endpoints.cts5.requests.get", create=True) + @mock.patch("MyCapytain.retrievers.cts5.requests.get", create=True) def test_reffs(self, requests): text = Text("urn:cts:latinLit:phi1294.phi002.perseus-lat2", citation=self.citation, resource=self.endpoint) requests.return_value.text = GET_VALID_REFF