def test_iddversiontuple(): """py.test for iddversiontuple""" iddtxt = """stuff 9.8.4 other stuff""" fhandle = StringIO(iddtxt) result = idfreader.iddversiontuple(fhandle) assert result == (9, 8, 4)
def idfreader1( fname, # type: str iddfile, # type: str theidf, # type: IDF conv=True, # type: Optional[bool] commdct=None, # type: List[List[Dict[str, Any]]] block=None, # type: Optional[List] ): # type: (...) -> Tuple[Dict[str, Any], Optional[List[Any]], Any, List[List[Dict[str, Any]]], Any, Any] """Read idf file and return bunches. :param fname: Name of the IDF file to read. :param iddfile: Name of the IDD file to use to interpret the IDF. :param conv: If True, convert strings to floats and integers where marked in the IDD. Defaults to None. :param commdct: Descriptions of IDF fields from the IDD. Defaults to None. :param block: EnergyPlus field ID names of the IDF from the IDD. Defaults to None. :returns: bunchdt Dict of lists of idf_MSequence objects in the IDF. :returns: block EnergyPlus field ID names of the IDF from the IDD. :returns data: Eplusdata object containing representions of IDF objects. :returns: commdct List of names of IDF objects. :returns: idd_index A pair of dicts used for fast lookups of names of groups of objects. :returns: versiontuple Version of EnergyPlus from the IDD. """ versiontuple = iddversiontuple(iddfile) block, data, commdct, idd_index = readdatacommdct1(fname, iddfile=iddfile, commdct=commdct, block=block) if conv: convertallfields(data, commdct) # fill gaps in idd if versiontuple < (8, ): skiplist = ["TABLE:MULTIVARIABLELOOKUP"] # type: Optional[List[str]] else: skiplist = None nofirstfields = iddgaps.missingkeys_standard(commdct, data.dtls, skiplist=skiplist) iddgaps.missingkeys_nonstandard(block, commdct, data.dtls, nofirstfields) bunchdt = makebunches(data, commdct, theidf) return bunchdt, block, data, commdct, idd_index, versiontuple
def idfreader1(fname, iddfile, theidf, conv=True, commdct=None, block=None): """read idf file and return bunches""" versiontuple = iddversiontuple(iddfile) block, data, commdct, idd_index = readidf.readdatacommdct1(fname, iddfile=iddfile, commdct=commdct, block=block) if conv: convertallfields(data, commdct) # fill gaps in idd ddtt, dtls = data.dt, data.dtls if versiontuple < (8, ): skiplist = ["TABLE:MULTIVARIABLELOOKUP"] else: skiplist = None nofirstfields = iddgaps.missingkeys_standard(commdct, dtls, skiplist=skiplist) iddgaps.missingkeys_nonstandard(commdct, dtls, nofirstfields) # bunchdt = makebunches(data, commdct) bunchdt = makebunches(data, commdct, theidf) return bunchdt, block, data, commdct, idd_index