1818# along with this program. If not, see <http://www.gnu.org/licenses/>.
1919
2020
21- cimport libzim.libzim_wrapper as clibzim
21+ cimport libzim.wrapper as wrapper
2222
2323from cython.operator import dereference, preincrement
2424from cpython.ref cimport PyObject
@@ -36,15 +36,15 @@ import datetime
3636# ########################
3737
3838cdef class WritingBlob:
39- cdef clibzim .Blob* c_blob
39+ cdef wrapper .Blob* c_blob
4040 cdef bytes ref_content
4141
4242 def __cinit__ (self , content ):
4343 if isinstance (content, str ):
4444 self .ref_content = content.encode(' UTF-8' )
4545 else :
4646 self .ref_content = content
47- self .c_blob = new clibzim .Blob(< char * > self .ref_content, len (self .ref_content))
47+ self .c_blob = new wrapper .Blob(< char * > self .ref_content, len (self .ref_content))
4848
4949 def __dealloc__ (self ):
5050 if self .c_blob != NULL :
@@ -53,11 +53,11 @@ cdef class WritingBlob:
5353cdef Py_ssize_t itemsize = 1
5454
5555cdef class ReadingBlob:
56- cdef clibzim .Blob c_blob
56+ cdef wrapper .Blob c_blob
5757 cdef Py_ssize_t size
5858 cdef int view_count
5959
60- cdef __setup(self , clibzim .Blob blob):
60+ cdef __setup(self , wrapper .Blob blob):
6161 """ Assigns an internal pointer to the wrapped C++ article object.
6262
6363 Parameters
@@ -116,7 +116,7 @@ cdef public api:
116116 ret_str = func()
117117 return ret_str.encode(' UTF-8' )
118118
119- clibzim .Blob blob_cy_call_fct(object obj, string method, int * error) with gil:
119+ wrapper .Blob blob_cy_call_fct(object obj, string method, int * error) with gil:
120120 """ Lookup and execute a pure virtual method on ZimArticle returning a Blob"""
121121 cdef WritingBlob blob
122122
@@ -146,7 +146,7 @@ cdef class Creator:
146146 flag if the creator was finalized
147147 """
148148
149- cdef clibzim .ZimCreatorWrapper * c_creator
149+ cdef wrapper .ZimCreatorWrapper * c_creator
150150 cdef bool _finalized
151151
152152 def __cinit__ (self , str filename , str main_page = " " , str index_language = " eng" , min_chunk_size = 2048 ):
@@ -163,7 +163,7 @@ cdef class Creator:
163163 Minimum chunk size (default 2048)
164164 """
165165
166- self .c_creator = clibzim .ZimCreatorWrapper.create(filename.encode(" UTF-8" ), main_page.encode(" UTF-8" ), index_language.encode(" UTF-8" ), min_chunk_size)
166+ self .c_creator = wrapper .ZimCreatorWrapper.create(filename.encode(" UTF-8" ), main_page.encode(" UTF-8" ), index_language.encode(" UTF-8" ), min_chunk_size)
167167 self ._finalized = False
168168
169169 def __dealloc__ (self ):
@@ -185,8 +185,8 @@ cdef class Creator:
185185 raise RuntimeError (" ZimCreator already finalized" )
186186
187187 # Make a shared pointer to ZimArticleWrapper from the ZimArticle object
188- cdef shared_ptr[clibzim .ZimArticleWrapper] art = shared_ptr[clibzim .ZimArticleWrapper](
189- new clibzim .ZimArticleWrapper(< PyObject* > article));
188+ cdef shared_ptr[wrapper .ZimArticleWrapper] art = shared_ptr[wrapper .ZimArticleWrapper](
189+ new wrapper .ZimArticleWrapper(< PyObject* > article));
190190 with nogil:
191191 self .c_creator.addArticle(art)
192192
@@ -239,7 +239,7 @@ cdef class ReadArticle:
239239 from_read_article(zim.Article art)
240240 Creates a python ZimArticle from a C++ zim.Article article.
241241 """
242- cdef clibzim .Article c_article
242+ cdef wrapper .Article c_article
243243 cdef ReadingBlob _blob
244244 cdef bool _haveBlob
245245
@@ -251,7 +251,7 @@ cdef class ReadArticle:
251251 def __cinit__ (self ):
252252 self ._haveBlob = False
253253
254- cdef __setup(self , clibzim .Article art):
254+ cdef __setup(self , wrapper .Article art):
255255 """ Assigns an internal pointer to the wrapped C++ article object.
256256
257257 Parameters
@@ -267,7 +267,7 @@ cdef class ReadArticle:
267267
268268 # Factory functions - Currently Cython can't use classmethods
269269 @staticmethod
270- cdef from_read_article(clibzim .Article art):
270+ cdef from_read_article(wrapper .Article art):
271271 """ Creates a python ZimFileArticle from a C++ Article (zim::).
272272
273273 Parameters
@@ -332,7 +332,7 @@ cdef class ReadArticle:
332332# File #
333333# ########################
334334
335- cdef class File :
335+ cdef class FilePy :
336336 """
337337 A class to represent a Zim File Reader.
338338
@@ -344,7 +344,7 @@ cdef class File:
344344 the file name of the File Reader object
345345 """
346346
347- cdef clibzim .File * c_file
347+ cdef wrapper .File * c_file
348348 cdef object _filename
349349
350350 def __cinit__ (self , str filename ):
@@ -355,7 +355,7 @@ cdef class File:
355355 Full path to a zim file
356356 """
357357
358- self .c_file = new clibzim .File(filename.encode(' UTF-8' ))
358+ self .c_file = new wrapper .File(filename.encode(' UTF-8' ))
359359 self ._filename = self .c_file.getFilename().decode(" UTF-8" , " strict" )
360360
361361 def __dealloc__ (self ):
@@ -384,7 +384,7 @@ cdef class File:
384384 If an article with the provided long url is not found in the file
385385 """
386386 # Read to a zim::Article
387- cdef clibzim .Article art = self .c_file.getArticleByUrl(url.encode(' UTF-8' ))
387+ cdef wrapper .Article art = self .c_file.getArticleByUrl(url.encode(' UTF-8' ))
388388 if not art.good():
389389 raise RuntimeError (" Article not found for url" )
390390
@@ -419,7 +419,7 @@ cdef class File:
419419 """
420420
421421 # Read to a zim::Article
422- cdef clibzim .Article art = self .c_file.getArticle(< int > id )
422+ cdef wrapper .Article art = self .c_file.getArticle(< int > id )
423423 if not art.good():
424424 raise RuntimeError (" Article not found for id" )
425425
@@ -435,8 +435,8 @@ cdef class File:
435435 The url of the main page
436436 TODO Check old formats
437437 """
438- cdef clibzim .Fileheader header = self .c_file.getFileheader()
439- cdef clibzim .Article article
438+ cdef wrapper .Fileheader header = self .c_file.getFileheader()
439+ cdef wrapper .Article article
440440 if header.hasMainPage():
441441 article = self .c_file.getArticle(header.getMainPage())
442442 return article.getLongUrl().decode(" UTF-8" , " strict" );
@@ -504,8 +504,8 @@ cdef class File:
504504 iterator
505505 An interator with the urls of suggested articles starting from start position
506506 """
507- cdef unique_ptr[clibzim .Search] search = self .c_file.suggestions(query.encode(' UTF-8' ),start, end)
508- cdef clibzim .search_iterator it = dereference(search).begin()
507+ cdef unique_ptr[wrapper .Search] search = self .c_file.suggestions(query.encode(' UTF-8' ),start, end)
508+ cdef wrapper .search_iterator it = dereference(search).begin()
509509
510510 while it != dereference(search).end():
511511 yield it.get_url().decode(' UTF-8' )
@@ -527,8 +527,8 @@ cdef class File:
527527 An iterator with the urls of articles matching the search query starting from start position
528528 """
529529
530- cdef unique_ptr[clibzim .Search] search = self .c_file.search(query.encode(' UTF-8' ),start, end)
531- cdef clibzim .search_iterator it = dereference(search).begin()
530+ cdef unique_ptr[wrapper .Search] search = self .c_file.search(query.encode(' UTF-8' ),start, end)
531+ cdef wrapper .search_iterator it = dereference(search).begin()
532532
533533 while it != dereference(search).end():
534534 yield it.get_url().decode(' UTF-8' )
@@ -545,7 +545,7 @@ cdef class File:
545545 int
546546 Number of search results
547547 """
548- cdef unique_ptr[clibzim .Search] search = self .c_file.search(query.encode(' UTF-8' ),0 , 1 )
548+ cdef unique_ptr[wrapper .Search] search = self .c_file.search(query.encode(' UTF-8' ),0 , 1 )
549549 return dereference(search).get_matches_estimated()
550550
551551 def get_suggestions_results_count (self , query ):
@@ -559,7 +559,7 @@ cdef class File:
559559 int
560560 Number of article suggestions
561561 """
562- cdef unique_ptr[clibzim .Search] search = self .c_file.suggestions(query.encode(' UTF-8' ),0 , 1 )
562+ cdef unique_ptr[wrapper .Search] search = self .c_file.suggestions(query.encode(' UTF-8' ),0 , 1 )
563563 return dereference(search).get_matches_estimated()
564564
565565 def __repr__ (self ):
0 commit comments