commit efdd930fa0b7808d663da689d4f0f08824f78c36 parent 2d336652b6b4fa2c55e32d5afca2b9b4f55fc5fa Author: parazyd <parazyd@dyne.org> Date: Wed, 7 Apr 2021 17:20:43 +0200 Start adding some utility functions. Diffstat:
A | electrumobelisk/util.py | | | 27 | +++++++++++++++++++++++++++ |
1 file changed, 27 insertions(+), 0 deletions(-)
diff --git a/electrumobelisk/util.py b/electrumobelisk/util.py @@ -0,0 +1,27 @@ +#!/usr/bin/env python3 +# Copyright (C) 2020-2021 Ivan J. <parazyd@dyne.org> +# +# This file is part of obelisk +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License version 3 +# as published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +"""Utility functions""" + + +def is_integer(val): + return isinstance(val, int) + + +def is_non_negative_integer(val): + if is_integer(val): + return val >= 0 + return False