diff --git a/README.md b/README.md index 44347358a21f8132d2974f7da083836c03fc99a7..22cf48a5cca904bf43bb0efa37d300fb733db0fc 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,8 @@ Then copy your resulting wheel and install it via pip on the target system. * fixed minor compiler warnings * `TimeSeries.iterate_range` will accept a parameter called `direct_bytes` for compatibility with `VarlenSeries`. - It's value is ignored. + It's value is ignored +* more class constructors use explicit typing - faster tempsdb ## v0.5.4 diff --git a/setup.cfg b/setup.cfg index 6266526cc38b423e2698506789abbe985506e53f..826a120afd476f1af449656febf391ec3d64e7da 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,7 +1,7 @@ # coding: utf-8 [metadata] name = tempsdb -version = 0.6a3 +version = 0.6a4 long-description = file: README.md long-description-content-type = text/markdown; charset=UTF-8 license_files = LICENSE diff --git a/tempsdb/chunks/base.pyx b/tempsdb/chunks/base.pyx index 222f7b0c8f189bc6da75cf7167b49072c6076308..344b725ffdce4947a47e38af6ea7ff4fd0c3f42a 100644 --- a/tempsdb/chunks/base.pyx +++ b/tempsdb/chunks/base.pyx @@ -171,8 +171,8 @@ cdef class Chunk: cpdef object open_file(self, str path): return open(self.path, 'rb+') - def __init__(self, parent: tp.Optional[TimeSeries], path: str, page_size: int, - use_descriptor_access: bool = False): + def __init__(self, TimeSeries parent, str path, int page_size, + bint use_descriptor_access = False): cdef bytes b self.file_size = os.path.getsize(path) self.page_size = page_size diff --git a/tempsdb/chunks/direct.pyx b/tempsdb/chunks/direct.pyx index af811cfe6173ece2a7974a8d9c3fcffc5609939d..266492832f8879eb4e8fc1987528d2f7614af816 100644 --- a/tempsdb/chunks/direct.pyx +++ b/tempsdb/chunks/direct.pyx @@ -30,9 +30,9 @@ cdef class DirectChunk(Chunk): gzip disabled. If given, a warning will be emitted as gzip support is still experimental. :raises ValueError: non-direct descriptor was requested and gzip was enabled """ - def __init__(self, parent: tp.Optional[TimeSeries], path: str, page_size: int, + def __init__(self, TimeSeries parent, str path, int page_size, use_descriptor_access: tp.Optional[bool] = None, - gzip_compression_level: int = 0): + int gzip_compression_level = 0): if path.endswith('.gz'): warnings.warn('Please pass the path without .gz') path = path.replace('.gz', '') diff --git a/tempsdb/chunks/gzip.pyx b/tempsdb/chunks/gzip.pyx index 553190986e9bba6ed7d91c6d2b21d317c01e03b4..c76d10bf4288b7e4979986b86707ca0f02d60470 100644 --- a/tempsdb/chunks/gzip.pyx +++ b/tempsdb/chunks/gzip.pyx @@ -3,7 +3,7 @@ import threading cdef class ReadWriteGzipFile: - def __init__(self, path: str, compresslevel: int = gzip._COMPRESS_LEVEL_FAST): + def __init__(self, str path, int compresslevel = gzip._COMPRESS_LEVEL_FAST): self.path = path self.compress_level = compresslevel self.rw_file = gzip.GzipFile(path, 'ab', compresslevel=self.compress_level) diff --git a/tempsdb/database.pyx b/tempsdb/database.pyx index 97c0e94748240347822b1ff571a5b6caf2302d0b..ce885d87b50ff3a31613982181caa385159ca9a6 100644 --- a/tempsdb/database.pyx +++ b/tempsdb/database.pyx @@ -25,7 +25,7 @@ cdef class Database: :ivar path: path to the directory with the database (str) :ivar metadata: metadata of this DB """ - def __init__(self, path: str): + def __init__(self, str path): if not os.path.isdir(path): raise DoesNotExist('Database does not exist') @@ -135,7 +135,7 @@ cdef class Database: shutil.rmtree(path) return 0 - cpdef TimeSeries get_series(self, name: str, bint use_descriptor_based_access = False): + cpdef TimeSeries get_series(self, str name, bint use_descriptor_based_access = False): """ Load and return an existing series diff --git a/tempsdb/iterators.pyx b/tempsdb/iterators.pyx index 28d5633cb1e11c1673cb6ad30226daf18a49b97b..f0a0f4df8653f3de813fcb93b69b2d8e4d299f19 100644 --- a/tempsdb/iterators.pyx +++ b/tempsdb/iterators.pyx @@ -27,7 +27,7 @@ cdef class Iterator: :meth:`~tempsdb.iterators.Iterator.close`. """ - def __init__(self, parent: TimeSeries, start: int, stop: int, chunks: tp.List[Chunk]): + def __init__(self, TimeSeries parent, int start, int stop, list chunks): self.start = start self.stop = stop self.current_chunk = None diff --git a/tempsdb/series.pyx b/tempsdb/series.pyx index 3c60ab2ff9447fe86db08c8a6ca7fb43072a8d26..d04ad3453974d1d07a1bafe2eeb20f7bed7bcae1 100644 --- a/tempsdb/series.pyx +++ b/tempsdb/series.pyx @@ -94,7 +94,7 @@ cdef class TimeSeries: chunk.switch_to_mmap_based_access() return 0 - def __init__(self, path: str, name: str, use_descriptor_based_access: bool = False): + def __init__(self, str path, str name, bint use_descriptor_based_access = False): self.descriptor_based_access = use_descriptor_based_access self.mpm = None self.name = name diff --git a/tempsdb/varlen.pyx b/tempsdb/varlen.pyx index e8efb8b744a5ebf7e0082ef753823d102efc5a17..f17211ba3e8a480adb4f6a1c0a74ed9df0db8d0a 100644 --- a/tempsdb/varlen.pyx +++ b/tempsdb/varlen.pyx @@ -486,7 +486,7 @@ cdef class VarlenSeries: et.close() it.close() - def __init__(self, path: str, name: str, use_descriptor_based_access: bool = False): + def __init__(self, str path, str name, bint use_descriptor_based_access = False): self.closed = False self.mmap_enabled = not use_descriptor_based_access self.path = path