Skip to content
Snippets Groups Projects
Commit defdee6d authored by Piotr Maślanka's avatar Piotr Maślanka
Browse files

+Number type

parent 3495ad13
No related branches found
No related tags found
No related merge requests found
......@@ -2,6 +2,7 @@
* Pomniejsze usprawnienia do TimerHeap
* Dodano `self` do @typed
* Dodano typ `Number` do @typed
## v2.0.11
......
......@@ -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'
]
......@@ -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
......
......@@ -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',
......
......@@ -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):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment