Commit ef3a10196a26b610e6b30be2a96ce83b2c8af902
1 parent
2f686c76
Exists in
master
Removed six from InVesalius
Showing
6 changed files
with
11 additions
and
19 deletions
Show diff stats
invesalius/data/geometry.py
@@ -22,14 +22,13 @@ import math | @@ -22,14 +22,13 @@ import math | ||
22 | 22 | ||
23 | import numpy as np | 23 | import numpy as np |
24 | import vtk | 24 | import vtk |
25 | -from six import with_metaclass | ||
26 | from pubsub import pub as Publisher | 25 | from pubsub import pub as Publisher |
27 | 26 | ||
28 | import invesalius.constants as const | 27 | import invesalius.constants as const |
29 | import invesalius.utils as utils | 28 | import invesalius.utils as utils |
30 | 29 | ||
31 | 30 | ||
32 | -class Box(with_metaclass(utils.Singleton, object)): | 31 | +class Box(metaclass=utils.Singleton): |
33 | """ | 32 | """ |
34 | This class is a data structure for storing the | 33 | This class is a data structure for storing the |
35 | coordinates (min and max) of box used in crop-mask. | 34 | coordinates (min and max) of box used in crop-mask. |
invesalius/data/measures.py
1 | # -*- coding: UTF-8 -*- | 1 | # -*- coding: UTF-8 -*- |
2 | 2 | ||
3 | -from six import with_metaclass | ||
4 | - | ||
5 | import math | 3 | import math |
6 | import random | 4 | import random |
7 | import sys | 5 | import sys |
@@ -57,7 +55,7 @@ else: | @@ -57,7 +55,7 @@ else: | ||
57 | 55 | ||
58 | DEBUG_DENSITY = False | 56 | DEBUG_DENSITY = False |
59 | 57 | ||
60 | -class MeasureData(with_metaclass(utils.Singleton)): | 58 | +class MeasureData(metaclass=utils.Singleton): |
61 | """ | 59 | """ |
62 | Responsible to keep measures data. | 60 | Responsible to keep measures data. |
63 | """ | 61 | """ |
invesalius/data/slice_.py
@@ -22,7 +22,6 @@ import tempfile | @@ -22,7 +22,6 @@ import tempfile | ||
22 | import numpy as np | 22 | import numpy as np |
23 | import vtk | 23 | import vtk |
24 | from scipy import ndimage | 24 | from scipy import ndimage |
25 | -from six import with_metaclass | ||
26 | from pubsub import pub as Publisher | 25 | from pubsub import pub as Publisher |
27 | 26 | ||
28 | import invesalius.constants as const | 27 | import invesalius.constants as const |
@@ -77,7 +76,7 @@ class SliceBuffer(object): | @@ -77,7 +76,7 @@ class SliceBuffer(object): | ||
77 | # Only one slice will be initialized per time (despite several viewers | 76 | # Only one slice will be initialized per time (despite several viewers |
78 | # show it from distinct perspectives). | 77 | # show it from distinct perspectives). |
79 | # Therefore, we use Singleton design pattern for implementing it. | 78 | # Therefore, we use Singleton design pattern for implementing it. |
80 | -class Slice(with_metaclass(utils.Singleton, object)): | 79 | +class Slice(metaclass=utils.Singleton): |
81 | def __init__(self): | 80 | def __init__(self): |
82 | self.current_mask = None | 81 | self.current_mask = None |
83 | self.blend_filter = None | 82 | self.blend_filter = None |
invesalius/data/styles.py
@@ -30,7 +30,6 @@ import wx | @@ -30,7 +30,6 @@ import wx | ||
30 | from scipy import ndimage | 30 | from scipy import ndimage |
31 | from imageio import imsave | 31 | from imageio import imsave |
32 | from scipy.ndimage import generate_binary_structure, watershed_ift | 32 | from scipy.ndimage import generate_binary_structure, watershed_ift |
33 | -from six import with_metaclass | ||
34 | from skimage.morphology import watershed | 33 | from skimage.morphology import watershed |
35 | from pubsub import pub as Publisher | 34 | from pubsub import pub as Publisher |
36 | 35 | ||
@@ -1127,7 +1126,7 @@ class ChangeSliceInteractorStyle(DefaultInteractorStyle): | @@ -1127,7 +1126,7 @@ class ChangeSliceInteractorStyle(DefaultInteractorStyle): | ||
1127 | self.last_position = position[1] | 1126 | self.last_position = position[1] |
1128 | 1127 | ||
1129 | 1128 | ||
1130 | -class EditorConfig(with_metaclass(utils.Singleton, object)): | 1129 | +class EditorConfig(metaclass=utils.Singleton): |
1131 | def __init__(self): | 1130 | def __init__(self): |
1132 | self.operation = const.BRUSH_THRESH | 1131 | self.operation = const.BRUSH_THRESH |
1133 | self.cursor_type = const.BRUSH_CIRCLE | 1132 | self.cursor_type = const.BRUSH_CIRCLE |
@@ -1394,7 +1393,7 @@ class WatershedProgressWindow(object): | @@ -1394,7 +1393,7 @@ class WatershedProgressWindow(object): | ||
1394 | self.dlg.Destroy() | 1393 | self.dlg.Destroy() |
1395 | 1394 | ||
1396 | 1395 | ||
1397 | -class WatershedConfig(with_metaclass(utils.Singleton, object)): | 1396 | +class WatershedConfig(metaclass=utils.Singleton): |
1398 | def __init__(self): | 1397 | def __init__(self): |
1399 | self.algorithm = "Watershed" | 1398 | self.algorithm = "Watershed" |
1400 | self.con_2d = 4 | 1399 | self.con_2d = 4 |
@@ -2174,7 +2173,7 @@ class ReorientImageInteractorStyle(DefaultInteractorStyle): | @@ -2174,7 +2173,7 @@ class ReorientImageInteractorStyle(DefaultInteractorStyle): | ||
2174 | buffer_.discard_image() | 2173 | buffer_.discard_image() |
2175 | 2174 | ||
2176 | 2175 | ||
2177 | -class FFillConfig(with_metaclass(utils.Singleton, object)): | 2176 | +class FFillConfig(metaclass=utils.Singleton): |
2178 | def __init__(self): | 2177 | def __init__(self): |
2179 | self.dlg_visible = False | 2178 | self.dlg_visible = False |
2180 | self.target = "2D" | 2179 | self.target = "2D" |
@@ -2310,7 +2309,7 @@ class RemoveMaskPartsInteractorStyle(FloodFillMaskInteractorStyle): | @@ -2310,7 +2309,7 @@ class RemoveMaskPartsInteractorStyle(FloodFillMaskInteractorStyle): | ||
2310 | self._progr_title = _(u"Remove part") | 2309 | self._progr_title = _(u"Remove part") |
2311 | self._progr_msg = _(u"Removing part ...") | 2310 | self._progr_msg = _(u"Removing part ...") |
2312 | 2311 | ||
2313 | -class CropMaskConfig(with_metaclass(utils.Singleton, object)): | 2312 | +class CropMaskConfig(metaclass=utils.Singleton): |
2314 | def __init__(self): | 2313 | def __init__(self): |
2315 | self.dlg_visible = False | 2314 | self.dlg_visible = False |
2316 | 2315 | ||
@@ -2411,7 +2410,7 @@ class CropMaskInteractorStyle(DefaultInteractorStyle): | @@ -2411,7 +2410,7 @@ class CropMaskInteractorStyle(DefaultInteractorStyle): | ||
2411 | Publisher.sendMessage('Reload actual slice') | 2410 | Publisher.sendMessage('Reload actual slice') |
2412 | 2411 | ||
2413 | 2412 | ||
2414 | -class SelectPartConfig(with_metaclass(utils.Singleton, object)): | 2413 | +class SelectPartConfig(metaclass=utils.Singleton): |
2415 | def __init__(self): | 2414 | def __init__(self): |
2416 | self.mask = None | 2415 | self.mask = None |
2417 | self.con_3d = 6 | 2416 | self.con_3d = 6 |
@@ -2517,7 +2516,7 @@ class SelectMaskPartsInteractorStyle(DefaultInteractorStyle): | @@ -2517,7 +2516,7 @@ class SelectMaskPartsInteractorStyle(DefaultInteractorStyle): | ||
2517 | self.config.mask = mask | 2516 | self.config.mask = mask |
2518 | 2517 | ||
2519 | 2518 | ||
2520 | -class FFillSegmentationConfig(with_metaclass(utils.Singleton, object)): | 2519 | +class FFillSegmentationConfig(metaclass=utils.Singleton): |
2521 | def __init__(self): | 2520 | def __init__(self): |
2522 | self.dlg_visible = False | 2521 | self.dlg_visible = False |
2523 | self.target = "2D" | 2522 | self.target = "2D" |
invesalius/project.py
@@ -29,7 +29,6 @@ import tempfile | @@ -29,7 +29,6 @@ import tempfile | ||
29 | import numpy as np | 29 | import numpy as np |
30 | import vtk | 30 | import vtk |
31 | import wx | 31 | import wx |
32 | -from six import with_metaclass | ||
33 | 32 | ||
34 | from pubsub import pub as Publisher | 33 | from pubsub import pub as Publisher |
35 | 34 | ||
@@ -52,7 +51,7 @@ else: | @@ -52,7 +51,7 @@ else: | ||
52 | 51 | ||
53 | # Only one project will be initialized per time. Therefore, we use | 52 | # Only one project will be initialized per time. Therefore, we use |
54 | # Singleton design pattern for implementing it | 53 | # Singleton design pattern for implementing it |
55 | -class Project(with_metaclass(Singleton, object)): | 54 | +class Project(metaclass=Singleton): |
56 | def __init__(self): | 55 | def __init__(self): |
57 | # Patient/ acquistion information | 56 | # Patient/ acquistion information |
58 | self.name = '' | 57 | self.name = '' |
invesalius/session.py
@@ -17,8 +17,6 @@ | @@ -17,8 +17,6 @@ | ||
17 | # detalhes. | 17 | # detalhes. |
18 | #-------------------------------------------------------------------------- | 18 | #-------------------------------------------------------------------------- |
19 | 19 | ||
20 | -from six import with_metaclass | ||
21 | - | ||
22 | try: | 20 | try: |
23 | import configparser as ConfigParser | 21 | import configparser as ConfigParser |
24 | except(ImportError): | 22 | except(ImportError): |
@@ -51,7 +49,7 @@ SESSION_ENCODING = 'utf8' | @@ -51,7 +49,7 @@ SESSION_ENCODING = 'utf8' | ||
51 | 49 | ||
52 | # Only one session will be initialized per time. Therefore, we use | 50 | # Only one session will be initialized per time. Therefore, we use |
53 | # Singleton design pattern for implementing it | 51 | # Singleton design pattern for implementing it |
54 | -class Session(with_metaclass(Singleton, object)): | 52 | +class Session(metaclass=Singleton): |
55 | 53 | ||
56 | def __init__(self): | 54 | def __init__(self): |
57 | self.project_path = () | 55 | self.project_path = () |