prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  2 x Transpose + Preprocess loses information
  **Describe the bug**
  Second transpose cannot retrieve the domain after Preprocess.
  
  **To Reproduce**
  Steps to reproduce the behavior:
  1. File (brown-selected).
  2. Transpose.
  3. Preprocesss (say Normalize).
  4. Transpose.
  
  **Orange version:**
  3.24.dev
  
  **Expected behavior**
  Second Transpose puts columns names into a string variable.
  
  **Screenshots**
  <img width="1232" alt="Screen Shot 2019-11-14 at 09 33 02" src="https://user-images.githubusercontent.com/12524972/68839832-c910d600-06c1-11ea-9286-5bf033a9802f.png">
  
  
  
  </issue>
  <code>
  [start of Orange/preprocess/normalize.py]
  1 import numpy as np
  2 
  3 from Orange.data import ContinuousVariable, Domain
  4 from Orange.statistics import distribution
  5 from Orange.util import Reprable
  6 from .preprocess import Normalize
  7 from .transformation import Normalizer as Norm
  8 __all__ = ["Normalizer"]
  9 
  10 
  11 class Normalizer(Reprable):
  12     def __init__(self,
  13                  zero_based=True,
  14                  norm_type=Normalize.NormalizeBySD,
  15                  transform_class=False,
  16                  center=True,
  17                  normalize_datetime=False):
  18         self.zero_based = zero_based
  19         self.norm_type = norm_type
  20         self.transform_class = transform_class
  21         self.center = center
  22         self.normalize_datetime = normalize_datetime
  23 
  24     def __call__(self, data):
  25         dists = distribution.get_distributions(data)
  26         new_attrs = [self.normalize(dists[i], var) for
  27                      (i, var) in enumerate(data.domain.attributes)]
  28 
  29         new_class_vars = data.domain.class_vars
  30         if self.transform_class:
  31             attr_len = len(data.domain.attributes)
  32             new_class_vars = [self.normalize(dists[i + attr_len], var) for
  33                               (i, var) in enumerate(data.domain.class_vars)]
  34 
  35         domain = Domain(new_attrs, new_class_vars, data.domain.metas)
  36         return data.transform(domain)
  37 
  38     def normalize(self, dist, var):
  39         if not var.is_continuous or (var.is_time and not self.normalize_datetime):
  40             return var
  41         elif self.norm_type == Normalize.NormalizeBySD:
  42             return self.normalize_by_sd(dist, var)
  43         elif self.norm_type == Normalize.NormalizeBySpan:
  44             return self.normalize_by_span(dist, var)
  45 
  46     def normalize_by_sd(self, dist, var):
  47         avg, sd = (dist.mean(), dist.standard_deviation()) if dist.size else (0, 1)
  48         if sd == 0:
  49             sd = 1
  50         if self.center:
  51             compute_val = Norm(var, avg, 1 / sd)
  52         else:
  53             compute_val = Norm(var, 0, 1 / sd)
  54 
  55         return ContinuousVariable(
  56             var.name,
  57             compute_value=compute_val,
  58             sparse=var.sparse,
  59         )
  60 
  61     def normalize_by_span(self, dist, var):
  62         dma, dmi = (dist.max(), dist.min()) if dist.shape[1] else (np.nan, np.nan)
  63         diff = dma - dmi
  64         if diff < 1e-15:
  65             diff = 1
  66         if self.zero_based:
  67             return ContinuousVariable(
  68                 var.name,
  69                 compute_value=Norm(var, dmi, 1 / diff),
  70                 sparse=var.sparse)
  71         else:
  72             return ContinuousVariable(
  73                 var.name,
  74                 compute_value=Norm(var, (dma + dmi) / 2, 2 / diff),
  75                 sparse=var.sparse)
  76
  [end of Orange/preprocess/normalize.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/Orange/preprocess/normalize.py b/Orange/preprocess/normalize.py
  --- a/Orange/preprocess/normalize.py
  +++ b/Orange/preprocess/normalize.py
  @@ -1,6 +1,6 @@
   import numpy as np
   
  -from Orange.data import ContinuousVariable, Domain
  +from Orange.data import Domain
   from Orange.statistics import distribution
   from Orange.util import Reprable
   from .preprocess import Normalize
  @@ -51,12 +51,7 @@
               compute_val = Norm(var, avg, 1 / sd)
           else:
               compute_val = Norm(var, 0, 1 / sd)
  -
  -        return ContinuousVariable(
  -            var.name,
  -            compute_value=compute_val,
  -            sparse=var.sparse,
  -        )
  +        return var.copy(compute_value=compute_val)
   
       def normalize_by_span(self, dist, var):
           dma, dmi = (dist.max(), dist.min()) if dist.shape[1] else (np.nan, np.nan)
  @@ -64,12 +59,7 @@
           if diff < 1e-15:
               diff = 1
           if self.zero_based:
  -            return ContinuousVariable(
  -                var.name,
  -                compute_value=Norm(var, dmi, 1 / diff),
  -                sparse=var.sparse)
  +            compute_val = Norm(var, dmi, 1 / diff)
           else:
  -            return ContinuousVariable(
  -                var.name,
  -                compute_value=Norm(var, (dma + dmi) / 2, 2 / diff),
  -                sparse=var.sparse)
  +            compute_val = Norm(var, (dma + dmi) / 2, 2 / diff)
  +        return var.copy(compute_value=compute_val)
  
verification_info: {"golden_diff": "diff --git a/Orange/preprocess/normalize.py b/Orange/preprocess/normalize.py\n--- a/Orange/preprocess/normalize.py\n+++ b/Orange/preprocess/normalize.py\n@@ -1,6 +1,6 @@\n import numpy as np\n \n-from Orange.data import ContinuousVariable, Domain\n+from Orange.data import Domain\n from Orange.statistics import distribution\n from Orange.util import Reprable\n from .preprocess import Normalize\n@@ -51,12 +51,7 @@\n             compute_val = Norm(var, avg, 1 / sd)\n         else:\n             compute_val = Norm(var, 0, 1 / sd)\n-\n-        return ContinuousVariable(\n-            var.name,\n-            compute_value=compute_val,\n-            sparse=var.sparse,\n-        )\n+        return var.copy(compute_value=compute_val)\n \n     def normalize_by_span(self, dist, var):\n         dma, dmi = (dist.max(), dist.min()) if dist.shape[1] else (np.nan, np.nan)\n@@ -64,12 +59,7 @@\n         if diff < 1e-15:\n             diff = 1\n         if self.zero_based:\n-            return ContinuousVariable(\n-                var.name,\n-                compute_value=Norm(var, dmi, 1 / diff),\n-                sparse=var.sparse)\n+            compute_val = Norm(var, dmi, 1 / diff)\n         else:\n-            return ContinuousVariable(\n-                var.name,\n-                compute_value=Norm(var, (dma + dmi) / 2, 2 / diff),\n-                sparse=var.sparse)\n+            compute_val = Norm(var, (dma + dmi) / 2, 2 / diff)\n+        return var.copy(compute_value=compute_val)\n", "issue": "2 x Transpose + Preprocess loses information\n**Describe the bug**\r\nSecond transpose cannot retrieve the domain after Preprocess.\r\n\r\n**To Reproduce**\r\nSteps to reproduce the behavior:\r\n1. File (brown-selected).\r\n2. Transpose.\r\n3. Preprocesss (say Normalize).\r\n4. Transpose.\r\n\r\n**Orange version:**\r\n3.24.dev\r\n\r\n**Expected behavior**\r\nSecond Transpose puts columns names into a string variable.\r\n\r\n**Screenshots**\r\n<img width=\"1232\" alt=\"Screen Shot 2019-11-14 at 09 33 02\" src=\"https://user-images.githubusercontent.com/12524972/68839832-c910d600-06c1-11ea-9286-5bf033a9802f.png\">\r\n\r\n\n", "before_files": [{"content": "import numpy as np\n\nfrom Orange.data import ContinuousVariable, Domain\nfrom Orange.statistics import distribution\nfrom Orange.util import Reprable\nfrom .preprocess import Normalize\nfrom .transformation import Normalizer as Norm\n__all__ = [\"Normalizer\"]\n\n\nclass Normalizer(Reprable):\n    def __init__(self,\n                 zero_based=True,\n                 norm_type=Normalize.NormalizeBySD,\n                 transform_class=False,\n                 center=True,\n                 normalize_datetime=False):\n        self.zero_based = zero_based\n        self.norm_type = norm_type\n        self.transform_class = transform_class\n        self.center = center\n        self.normalize_datetime = normalize_datetime\n\n    def __call__(self, data):\n        dists = distribution.get_distributions(data)\n        new_attrs = [self.normalize(dists[i], var) for\n                     (i, var) in enumerate(data.domain.attributes)]\n\n        new_class_vars = data.domain.class_vars\n        if self.transform_class:\n            attr_len = len(data.domain.attributes)\n            new_class_vars = [self.normalize(dists[i + attr_len], var) for\n                              (i, var) in enumerate(data.domain.class_vars)]\n\n        domain = Domain(new_attrs, new_class_vars, data.domain.metas)\n        return data.transform(domain)\n\n    def normalize(self, dist, var):\n        if not var.is_continuous or (var.is_time and not self.normalize_datetime):\n            return var\n        elif self.norm_type == Normalize.NormalizeBySD:\n            return self.normalize_by_sd(dist, var)\n        elif self.norm_type == Normalize.NormalizeBySpan:\n            return self.normalize_by_span(dist, var)\n\n    def normalize_by_sd(self, dist, var):\n        avg, sd = (dist.mean(), dist.standard_deviation()) if dist.size else (0, 1)\n        if sd == 0:\n            sd = 1\n        if self.center:\n            compute_val = Norm(var, avg, 1 / sd)\n        else:\n            compute_val = Norm(var, 0, 1 / sd)\n\n        return ContinuousVariable(\n            var.name,\n            compute_value=compute_val,\n            sparse=var.sparse,\n        )\n\n    def normalize_by_span(self, dist, var):\n        dma, dmi = (dist.max(), dist.min()) if dist.shape[1] else (np.nan, np.nan)\n        diff = dma - dmi\n        if diff < 1e-15:\n            diff = 1\n        if self.zero_based:\n            return ContinuousVariable(\n                var.name,\n                compute_value=Norm(var, dmi, 1 / diff),\n                sparse=var.sparse)\n        else:\n            return ContinuousVariable(\n                var.name,\n                compute_value=Norm(var, (dma + dmi) / 2, 2 / diff),\n                sparse=var.sparse)\n", "path": "Orange/preprocess/normalize.py"}]}