From 2d849bdf2ee12b3f4ba5e1e82e108610ea0c6284 Mon Sep 17 00:00:00 2001 From: Tony Tung Date: Fri, 12 Jul 2019 00:44:52 -0700 Subject: [PATCH 1/2] Add abstractmethod decorators to abstract methods --- slicedimage/_tileset.py | 3 +++ slicedimage/backends/_base.py | 3 +++ slicedimage/cli/_base.py | 4 ++++ slicedimage/io/_base.py | 2 ++ 4 files changed, 12 insertions(+) diff --git a/slicedimage/_tileset.py b/slicedimage/_tileset.py index de7922b..c51d3ba 100644 --- a/slicedimage/_tileset.py +++ b/slicedimage/_tileset.py @@ -1,3 +1,5 @@ +from abc import abstractmethod + from ._dimensions import DimensionNames from ._typeformatting import ( format_enum_keyed_dicts, @@ -60,6 +62,7 @@ def __repr__(self): shape = ", ".join(attributes) return "".format(shape=shape) + @abstractmethod def validate(self): raise NotImplementedError() diff --git a/slicedimage/backends/_base.py b/slicedimage/backends/_base.py index f271f94..a0f1892 100644 --- a/slicedimage/backends/_base.py +++ b/slicedimage/backends/_base.py @@ -1,7 +1,9 @@ import hashlib +from abc import abstractmethod class Backend: + @abstractmethod def read_contextmanager(self, name, checksum_sha256=None): """ Returns a context manager, that when entered, should return a file-like object that can be @@ -21,6 +23,7 @@ def read_contextmanager(self, name, checksum_sha256=None): """ raise NotImplementedError() + @abstractmethod def write_file_handle(self, name): raise NotImplementedError() diff --git a/slicedimage/cli/_base.py b/slicedimage/cli/_base.py index 241d56a..101a257 100644 --- a/slicedimage/cli/_base.py +++ b/slicedimage/cli/_base.py @@ -1,3 +1,6 @@ +from abc import abstractmethod + + class CliCommand: @classmethod def register_parser(cls, subparser_root): @@ -9,5 +12,6 @@ def register_parser(cls, subparser_root): raise NotImplementedError() @classmethod + @abstractmethod def run_command(cls, args): raise NotImplementedError() diff --git a/slicedimage/io/_base.py b/slicedimage/io/_base.py index 5447f15..95cb890 100644 --- a/slicedimage/io/_base.py +++ b/slicedimage/io/_base.py @@ -48,6 +48,7 @@ def parse_doc(name_or_url, baseurl, backend_config=None): def can_parse(cls, doc_version: version.Version): raise NotImplementedError() + @abstractmethod def parse(self, json_doc, baseurl, backend_config): raise NotImplementedError() @@ -87,6 +88,7 @@ def default_tile_opener(tileset_path, tile, ext): delete=False, ) + @abstractmethod def generate_partition_document(self, partition, path, pretty=False, *args, **kwargs): raise NotImplementedError() From e965171af97df778cb45782f5ae40ae9960652bf Mon Sep 17 00:00:00 2001 From: Tony Tung Date: Fri, 12 Jul 2019 11:41:54 -0700 Subject: [PATCH 2/2] fake commit --- .hgtags | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .hgtags diff --git a/.hgtags b/.hgtags new file mode 100644 index 0000000..a7d738c --- /dev/null +++ b/.hgtags @@ -0,0 +1,2 @@ +d0a100ad60012b4f0829a7903178f056e6eeb7a8 t1 +41cfbc30d43603d73b75de522de9831a2c18fb77 t1