Merge remote-tracking branch 'origin/development' into missing-docstring

This commit is contained in:
Sharan 2022-03-24 16:19:59 +01:00
commit 46259d983d
5 changed files with 12 additions and 5 deletions

View File

@ -1 +1 @@
v3.0.0-alpha6-157-gecb33641d v3.0.0-alpha6-170-gfab34d5c3

View File

@ -144,7 +144,7 @@ class Config(dict):
Configuration from file. Configuration from file.
""" """
fhandle = open(fname) if isinstance(fname, (str, Path)) else \ fhandle = open(Path(fname).expanduser()) if isinstance(fname, (str, Path)) else \
fname fname
return cls(yaml.safe_load(fhandle)) return cls(yaml.safe_load(fhandle))
@ -163,7 +163,7 @@ class Config(dict):
Keyword arguments parsed to yaml.dump. Keyword arguments parsed to yaml.dump.
""" """
fhandle = open(fname,'w',newline='\n') if isinstance(fname, (str, Path)) else \ fhandle = open(Path(fname).expanduser(),'w',newline='\n') if isinstance(fname, (str, Path)) else \
fname fname
if 'width' not in kwargs: if 'width' not in kwargs:

View File

@ -587,7 +587,7 @@ def DREAM3D_base_group(fname: Union[str, Path]) -> str:
Path to the base group. Path to the base group.
""" """
with h5py.File(fname,'r') as f: with h5py.File(Path(fname).expanduser(),'r') as f:
base_group = f.visit(lambda path: path.rsplit('/',2)[0] if '_SIMPL_GEOMETRY/SPACING' in path else None) base_group = f.visit(lambda path: path.rsplit('/',2)[0] if '_SIMPL_GEOMETRY/SPACING' in path else None)
if base_group is None: if base_group is None:
@ -615,7 +615,7 @@ def DREAM3D_cell_data_group(fname: Union[str, Path]) -> str:
""" """
base_group = DREAM3D_base_group(fname) base_group = DREAM3D_base_group(fname)
with h5py.File(fname,'r') as f: with h5py.File(Path(fname).expanduser(),'r') as f:
cells = tuple(f['/'.join([base_group,'_SIMPL_GEOMETRY','DIMENSIONS'])][()][::-1]) cells = tuple(f['/'.join([base_group,'_SIMPL_GEOMETRY','DIMENSIONS'])][()][::-1])
cell_data_group = f[base_group].visititems(lambda path,obj: path.split('/')[0] \ cell_data_group = f[base_group].visititems(lambda path,obj: path.split('/')[0] \
if isinstance(obj,h5py._hl.dataset.Dataset) and np.shape(obj)[:-1] == cells \ if isinstance(obj,h5py._hl.dataset.Dataset) and np.shape(obj)[:-1] == cells \

View File

@ -498,6 +498,8 @@ subroutine IO_error(error_ID,el,ip,g,instance,ext_msg)
msg = 'Length mismatch' msg = 'Length mismatch'
case (710) case (710)
msg = 'Closing quotation mark missing in string' msg = 'Closing quotation mark missing in string'
case (711)
msg = 'Incorrect type'
!------------------------------------------------------------------------------------------------- !-------------------------------------------------------------------------------------------------
! errors related to the mesh solver ! errors related to the mesh solver

View File

@ -1218,6 +1218,7 @@ function tList_as1dFloat(self)
item => self%first item => self%first
do i = 1, self%length do i = 1, self%length
scalar => item%node%asScalar() scalar => item%node%asScalar()
if (.not. associated(scalar)) call IO_error(711,ext_msg='float scalar')
tList_as1dFloat(i) = scalar%asFloat() tList_as1dFloat(i) = scalar%asFloat()
item => item%next item => item%next
end do end do
@ -1245,6 +1246,7 @@ function tList_as2dFloat(self)
do i=1,self%length do i=1,self%length
row => self%get(i) row => self%get(i)
row_data => row%asList() row_data => row%asList()
if (.not. associated(row_data)) call IO_error(711,ext_msg='list of floats')
if (row_data%length /= size(tList_as2dFloat,2)) call IO_error(709,ext_msg='Varying number of columns') if (row_data%length /= size(tList_as2dFloat,2)) call IO_error(709,ext_msg='Varying number of columns')
tList_as2dFloat(i,:) = self%get_as1dFloat(i) tList_as2dFloat(i,:) = self%get_as1dFloat(i)
end do end do
@ -1269,6 +1271,7 @@ function tList_as1dInt(self)
item => self%first item => self%first
do i = 1, self%length do i = 1, self%length
scalar => item%node%asScalar() scalar => item%node%asScalar()
if (.not. associated(scalar)) call IO_error(711,ext_msg='int scalar')
tList_as1dInt(i) = scalar%asInt() tList_as1dInt(i) = scalar%asInt()
item => item%next item => item%next
end do end do
@ -1293,6 +1296,7 @@ function tList_as1dBool(self)
item => self%first item => self%first
do i = 1, self%length do i = 1, self%length
scalar => item%node%asScalar() scalar => item%node%asScalar()
if (.not. associated(scalar)) call IO_error(711,ext_msg='bool scalar')
tList_as1dBool(i) = scalar%asBool() tList_as1dBool(i) = scalar%asBool()
item => item%next item => item%next
end do end do
@ -1317,6 +1321,7 @@ function tList_as1dString(self)
item => self%first item => self%first
do i = 1, self%length do i = 1, self%length
scalar => item%node%asScalar() scalar => item%node%asScalar()
if (.not. associated(scalar)) call IO_error(711,ext_msg='string scalar')
len_max = max(len_max, len_trim(scalar%asString())) len_max = max(len_max, len_trim(scalar%asString()))
item => item%next item => item%next
end do end do