From defdee6d36107b7d8339f19f504164f413fddaae Mon Sep 17 00:00:00 2001
From: Piotr Maslanka <piotr.maslanka@henrietta.com.pl>
Date: Sat, 7 Oct 2017 21:36:51 +0200
Subject: [PATCH] +Number type

---
 CHANGELOG.md                    | 1 +
 satella/coding/__init__.py      | 4 ++--
 satella/coding/typecheck.py     | 1 +
 setup.py                        | 2 +-
 tests/test_coding/test_debug.py | 6 +++---
 5 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index bcbad5a2..9a051da1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,7 @@
 
 * Pomniejsze usprawnienia do TimerHeap
 * Dodano `self` do @typed
+* Dodano typ `Number` do @typed
 
 ## v2.0.11
 
diff --git a/satella/coding/__init__.py b/satella/coding/__init__.py
index 57c8d81a..8fac1066 100644
--- a/satella/coding/__init__.py
+++ b/satella/coding/__init__.py
@@ -5,7 +5,7 @@ Just useful objects to make your coding nicer every day
 from __future__ import print_function, absolute_import, division
 
 from .typecheck import  typed, List, Tuple, Dict, NewType, Callable, Sequence, \
-    TypeVar, Generic, Mapping, Iterable, Union, Any, Optional, CallSignature
+    TypeVar, Generic, Mapping, Iterable, Union, Any, Optional, CallSignature, Number
 
 from .structures import TimeBasedHeap, CallableGroup, Heap
 from .monitor import Monitor, RMonitor
@@ -15,5 +15,5 @@ __all__ = [
     'TimeBasedHeap', 'Heap', 'CallableGroup',
     'Monitor', 'RMonitor', 'merge_dicts',
     'typed', 'List', 'Tuple', 'Dict', 'NewType', 'Callable', 'Sequence',
-    'TypeVar', 'Generic', 'Mapping', 'Iterable', 'Union', 'Any', 'Optional', 'CallSignature'
+    'TypeVar', 'Generic', 'Mapping', 'Iterable', 'Union', 'Any', 'Optional', 'CallSignature', 'Number'
 ]
diff --git a/satella/coding/typecheck.py b/satella/coding/typecheck.py
index ddbb9e1e..f35c03ad 100644
--- a/satella/coding/typecheck.py
+++ b/satella/coding/typecheck.py
@@ -23,6 +23,7 @@ Dict = typing.Dict
 NewType = typing.NewType
 Callable = typing.Callable
 Sequence = typing.Sequence
+Number = six.integer_types + (float, )
 TypeVar = typing.TypeVar
 Generic = typing.Generic
 Mapping = typing.Mapping
diff --git a/setup.py b/setup.py
index 395c0cae..e7722464 100644
--- a/setup.py
+++ b/setup.py
@@ -2,7 +2,7 @@
 from setuptools import setup, find_packages
 
 setup(name='satella',
-      version='2.0.12rc2',
+      version='2.0.12rc3',
       description=u'Utilities for writing servers in Python',
       author=u'Piotr Maślanka',
       author_email='piotrm@smok.co',
diff --git a/tests/test_coding/test_debug.py b/tests/test_coding/test_debug.py
index e5febb19..10d2d209 100644
--- a/tests/test_coding/test_debug.py
+++ b/tests/test_coding/test_debug.py
@@ -2,7 +2,7 @@
 from __future__ import print_function, absolute_import, division
 import six
 import unittest
-from satella.coding import typed, CallSignature
+from satella.coding import typed, CallSignature, Number
 
 
 class TestTypecheck(unittest.TestCase):
@@ -100,11 +100,11 @@ class TestTypecheck(unittest.TestCase):
     def test_self(self):
 
         class Wtf(object):
-            @typed('self', int, int, returns=int)
+            @typed('self', Number, Number, returns=Number)
             def add(self, a, b):
                 return a+b
 
-        Wtf().add(1,2)
+        Wtf().add(1,2.5)
 
     def test_T2(self):
 
-- 
GitLab