From a7192215302888fba27268173dd19a2e1705fc7c Mon Sep 17 00:00:00 2001
From: Piotr Maslanka <piotr.maslanka@henrietta.com.pl>
Date: Fri, 8 Dec 2017 21:24:26 +0100
Subject: [PATCH] test

---
 firanka/series/range.py | 36 ++++++++++++++++--------------------
 setup.cfg               |  1 -
 2 files changed, 16 insertions(+), 21 deletions(-)

diff --git a/firanka/series/range.py b/firanka/series/range.py
index 9946770..cf3c36d 100644
--- a/firanka/series/range.py
+++ b/firanka/series/range.py
@@ -22,29 +22,25 @@ class Range(object):
     """
     Range of real numbers
     """
+    def __from_str(self, rs):
+        if rs[0] not in '<(': raise ValueError('Must start with ( or <')
+        if rs[-1] not in '>)': raise ValueError('Must end with ) or >')
+        if ';' not in rs: raise ValueError('Separator ; required')
+
+        start, stop = rs[1:-1].split(';')
+        start = float(start)
+        stop = float(stop)
+        return float(start), float(stop), rs[0] == '<', rs[-1] == '>'
+
+    def __from_range(self, rs):
+        return rs.start, rs.stop, rs.lend_inclusive, rs.rend_inclusive
+
     def __init__(self, *args):
         if len(args) == 1:
             rs, = args
-            if isinstance(rs, type(self)):
-                start = rs.start
-                stop = rs.stop
-                lend_inclusive = rs.lend_inclusive
-                rend_inclusive = rs.rend_inclusive
-            else:
-                rs, = args
-
-                if rs[0] not in '<(': raise ValueError('Must start with ( or <')
-                if rs[-1] not in '>)': raise ValueError('Must end with ) or >')
-                if ';' not in rs: raise ValueError('Separator ; required')
-
-                lend_inclusive = rs[0] == '<'
-                rend_inclusive = rs[-1] == '>'
-
-                start, stop = rs[1:-1].split(';')
-                start = float(start)
-                stop = float(stop)
-        else:
-            start, stop, lend_inclusive, rend_inclusive = args
+            args = self.__from_range(rs) if isinstance(rs, type(self)) else self.__from_str(rs)
+
+        start, stop, lend_inclusive, rend_inclusive = args
 
         if lend_inclusive and math.isinf(start):
             raise ValueError('Greater or equal with infinity!')
diff --git a/setup.cfg b/setup.cfg
index e0b23bb..f5a5bac 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,6 +1,5 @@
 [metadata]
 description-file = README.md
-name = firanka
 license = MIT License
 classifiers =
     Programming Language :: Python
-- 
GitLab