Welcome to mirror list, hosted at ThFree Co, Russian Federation.

dev.gajim.org/gajim/python-nbxmpp.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlovetox <philipp@hoerist.com>2021-10-16 18:23:35 +0300
committerlovetox <philipp@hoerist.com>2021-10-16 18:23:35 +0300
commitcd079530dcef49ab141de777cbd5b91a2e38ed41 (patch)
treed37e888828a5533e9bfffd36153ec8c642408d97
parentf2a4cdf0fc09734518024c7f3edd48d770ab893b (diff)
Add annotations
-rw-r--r--nbxmpp/util.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/nbxmpp/util.py b/nbxmpp/util.py
index f6e9854..2c2c1ec 100644
--- a/nbxmpp/util.py
+++ b/nbxmpp/util.py
@@ -15,6 +15,8 @@
# You should have received a copy of the GNU General Public License
# along with this program; If not, see <http://www.gnu.org/licenses/>.
+from typing import Literal
+
import base64
import hashlib
import uuid
@@ -80,7 +82,7 @@ def get_properties_struct(name, own_jid):
return Properties()
-def from_xs_boolean(value):
+def from_xs_boolean(value: str) -> bool:
if value in ('1', 'true', 'True'):
return True
@@ -90,7 +92,7 @@ def from_xs_boolean(value):
raise ValueError('Cant convert %s to python boolean' % value)
-def to_xs_boolean(value):
+def to_xs_boolean(value: bool) -> Literal['true', 'false']:
# Convert to xs:boolean ('true', 'false')
# from a python boolean (True, False) or None
if value is True:
@@ -266,7 +268,7 @@ def compute_caps_hash(info, compare=True):
return b64hash
-def generate_id():
+def generate_id() -> str:
return str(uuid.uuid4())