testgres.common 0.0.4__tar.gz → 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: testgres.common
3
- Version: 0.0.4
3
+ Version: 1.0.0
4
4
  Summary: Testgres common code
5
5
  Author-email: Postgres Professional <testgres@postgrespro.ru>
6
6
  License: PostgreSQL
@@ -26,6 +26,8 @@ Dynamic: license-file
26
26
 
27
27
  [![Build Status](https://app.travis-ci.com/postgrespro/testgres.common.svg?token=HgEMhyw9n7RCQkHCis4T&branch=master)](https://app.travis-ci.com/postgrespro/testgres.common)
28
28
  [![PyPI package version](https://badge.fury.io/py/testgres_common.svg)](https://badge.fury.io/py/testgres.common)
29
+ [![PyPI python versions](https://img.shields.io/pypi/pyversions/testgres_common)](https://pypi.org/project/testgres.common)
30
+ [![PyPI downloads](https://img.shields.io/pypi/dm/testgres_common)](https://pypi.org/project/testgres.common)
29
31
 
30
32
  # testgres - common
31
33
 
@@ -1,5 +1,7 @@
1
1
  [![Build Status](https://app.travis-ci.com/postgrespro/testgres.common.svg?token=HgEMhyw9n7RCQkHCis4T&branch=master)](https://app.travis-ci.com/postgrespro/testgres.common)
2
2
  [![PyPI package version](https://badge.fury.io/py/testgres_common.svg)](https://badge.fury.io/py/testgres.common)
3
+ [![PyPI python versions](https://img.shields.io/pypi/pyversions/testgres_common)](https://pypi.org/project/testgres.common)
4
+ [![PyPI downloads](https://img.shields.io/pypi/dm/testgres_common)](https://pypi.org/project/testgres.common)
3
5
 
4
6
  # testgres - common
5
7
 
@@ -11,7 +11,7 @@ exclude = [".git", "__pycache__", "env", "venv"]
11
11
 
12
12
  [project]
13
13
  name = "testgres.common"
14
- version = "0.0.4"
14
+ version = "1.0.0"
15
15
 
16
16
  description = "Testgres common code"
17
17
  readme = "README.md"
@@ -0,0 +1,56 @@
1
+ # coding: utf-8
2
+ import typing
3
+
4
+
5
+ class TestgresException(Exception):
6
+ @property
7
+ def message(self) -> str:
8
+ assert isinstance(self, TestgresException)
9
+ r = super().__str__()
10
+ assert r is not None
11
+ assert type(r) == str # noqa: E721
12
+ return r
13
+
14
+ @property
15
+ def source(self) -> typing.Optional[str]:
16
+ assert isinstance(self, TestgresException)
17
+ return None
18
+
19
+ def __str__(self) -> str:
20
+ r = self.message
21
+ assert type(r) == str # noqa: E721
22
+ return r
23
+
24
+
25
+ class InvalidOperationException(TestgresException):
26
+ _message: str
27
+ _source: typing.Optional[str]
28
+
29
+ def __init__(self, message: str, source: typing.Optional[str] = None):
30
+ assert type(message) == str # noqa: E721
31
+ assert source is None or type(source) == str # noqa: E721
32
+ super().__init__()
33
+ self._message = message
34
+ self._source = source
35
+ return
36
+
37
+ @property
38
+ def message(self) -> str:
39
+ assert type(self._message) == str # noqa: E721
40
+ return self._message
41
+
42
+ @property
43
+ def source(self) -> str:
44
+ assert self._source is None or type(self._source) == str # noqa: E721
45
+ return self._source
46
+
47
+ def __repr__(self) -> str:
48
+ # It must be overrided!
49
+ assert type(self) == InvalidOperationException # noqa: E721
50
+ r = "{}({}, {})".format(
51
+ __class__.__name__,
52
+ repr(self._message),
53
+ repr(self._source),
54
+ )
55
+ assert type(r) == str # noqa: E721
56
+ return r
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: testgres.common
3
- Version: 0.0.4
3
+ Version: 1.0.0
4
4
  Summary: Testgres common code
5
5
  Author-email: Postgres Professional <testgres@postgrespro.ru>
6
6
  License: PostgreSQL
@@ -26,6 +26,8 @@ Dynamic: license-file
26
26
 
27
27
  [![Build Status](https://app.travis-ci.com/postgrespro/testgres.common.svg?token=HgEMhyw9n7RCQkHCis4T&branch=master)](https://app.travis-ci.com/postgrespro/testgres.common)
28
28
  [![PyPI package version](https://badge.fury.io/py/testgres_common.svg)](https://badge.fury.io/py/testgres.common)
29
+ [![PyPI python versions](https://img.shields.io/pypi/pyversions/testgres_common)](https://pypi.org/project/testgres.common)
30
+ [![PyPI downloads](https://img.shields.io/pypi/dm/testgres_common)](https://pypi.org/project/testgres.common)
29
31
 
30
32
  # testgres - common
31
33
 
@@ -1,9 +0,0 @@
1
- # coding: utf-8
2
-
3
-
4
- class TestgresException(Exception):
5
- pass
6
-
7
-
8
- class InvalidOperationException(TestgresException):
9
- pass
File without changes