[sasview] 03/06: Patch class/instance variabls in FileReader

Stuart Prescott stuart at debian.org
Thu Nov 2 13:42:46 UTC 2017


This is an automated email from the git hooks/post-receive script.

stuart pushed a commit to branch master
in repository sasview.

commit 5d86e88745bfd1ec513c600c4a3e1f63e1bc6ae6
Author: Stuart Prescott <stuart at debian.org>
Date:   Fri Nov 3 00:38:25 2017 +1100

    Patch class/instance variabls in FileReader
---
 debian/patches/filereader-class.patch | 43 +++++++++++++++++++++++++++++++++++
 debian/patches/series                 |  1 +
 2 files changed, 44 insertions(+)

diff --git a/debian/patches/filereader-class.patch b/debian/patches/filereader-class.patch
new file mode 100644
index 0000000..c71ae4b
--- /dev/null
+++ b/debian/patches/filereader-class.patch
@@ -0,0 +1,43 @@
+Description: Remove side-effects from FileReader
+ Side-effects of the reader break test invocation
+Author: Stuart Prescott <stuart at debian.org>
+Forwarded: https://github.com/SasView/sasview/pull/122
+diff --git a/src/sas/sascalc/dataloader/file_reader_base_class.py b/src/sas/sascalc/dataloader/file_reader_base_class.py
+index 6504096..2a222be 100644
+--- a/src/sas/sascalc/dataloader/file_reader_base_class.py
++++ b/src/sas/sascalc/dataloader/file_reader_base_class.py
+@@ -26,12 +26,6 @@ else:
+         return s.decode() if isinstance(s, bytes) else s
+
+ class FileReader(object):
+-    # List of Data1D and Data2D objects to be sent back to data_loader
+-    output = []
+-    # Current plottable_(1D/2D) object being loaded in
+-    current_dataset = None
+-    # Current DataInfo object being loaded in
+-    current_datainfo = None
+     # String to describe the type of data this reader can load
+     type_name = "ASCII"
+     # Wildcards to display
+@@ -42,11 +36,19 @@ class FileReader(object):
+     allow_all = False
+     # Able to import the unit converter
+     has_converter = True
+-    # Open file handle
+-    f_open = None
+     # Default value of zero
+     _ZERO = 1e-16
+
++    def __init__(self):
++        # List of Data1D and Data2D objects to be sent back to data_loader
++        self.output = []
++        # Current plottable_(1D/2D) object being loaded in
++        self.current_dataset = None
++        # Current DataInfo object being loaded in
++        self.current_datainfo = None
++        # Open file handle
++        self.f_open = None
++
+     def read(self, filepath):
+         """
+         Basic file reader
diff --git a/debian/patches/series b/debian/patches/series
index ec146d6..bb99bc0 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -3,3 +3,4 @@ uniquelist-builtin.patch
 setup-entry-point.patch
 limit-docs-sasview.patch
 sphinx-local-mathjax.patch
+filereader-class.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/sasview.git



More information about the debian-science-commits mailing list