From 68c93687d7448c824002e9a243954ed3d2b69818 Mon Sep 17 00:00:00 2001 From: Valerio Mariani <valerio.mariani@desy.de> Date: Tue, 6 Jun 2017 21:01:06 +0200 Subject: [PATCH] Fixed some code analysis complaints from PyCharm --- cfel_cxi.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/cfel_cxi.py b/cfel_cxi.py index 8076f96..f3174b2 100644 --- a/cfel_cxi.py +++ b/cfel_cxi.py @@ -31,8 +31,8 @@ import numpy _CXISimpleEntry = namedtuple('SimpleEntry', ['path', 'data', 'overwrite']) -def _assign_data_type(data): +def _assign_data_type(data): if isinstance(data, numpy.ndarray): data_type = data.dtype elif isinstance(data, bytes): @@ -42,6 +42,7 @@ def _assign_data_type(data): return data_type + class _Stack: def __init__(self, path, data, axes, compression, chunk_size): @@ -72,7 +73,7 @@ class _Stack: def write_initial_slice(self, file_handle, max_num_slices): file_handle.create_dataset(self.path, shape=(max_num_slices,) + self._data_shape, - dtype = self._data_type, + dtype=self._data_type, maxshape=(max_num_slices,) + self._data_shape, compression=self._compression, chunks=self._chunk_size) @@ -123,7 +124,6 @@ class _Stack: def _validate_data(data): - if not isinstance(data, (bytes, int, float, numpy.ndarray)): raise RuntimeError('The CXI Writer only accepts numpy objects, numbers and ascii strings.') @@ -354,7 +354,6 @@ class CXIWriter: self._fh[path] = link_target - def create_link_to_group(self, group, path, overwrite=False): """Creates a link to an HDF5 group. @@ -384,7 +383,6 @@ class CXIWriter: self._fh[path] = link_target - def initialize_stacks(self): """Initializes the stacks. @@ -521,4 +519,3 @@ class CXIWriter: self._fh.close() self._file_is_open = False - -- GitLab