Skip to content

Updates the patches with the eppy.ext_field_functions.increaseIDDfields#252

Open
samuelduchesne wants to merge 1 commit intojamiebull1:developfrom
samuelduchesne:feature/patches
Open

Updates the patches with the eppy.ext_field_functions.increaseIDDfields#252
samuelduchesne wants to merge 1 commit intojamiebull1:developfrom
samuelduchesne:feature/patches

Conversation

@samuelduchesne
Copy link
Copy Markdown

No description provided.

@samuelduchesne samuelduchesne mentioned this pull request Nov 18, 2022
Copy link
Copy Markdown
Owner

@jamiebull1 jamiebull1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few nitpicky comments... but I don't actually remember why we have this in patches. It may be cleaner to just remove this function and use it directly from eppy.

Comment thread geomeppy/patches.py
Comment on lines +235 to +252
# there are not enough fields in the IDD to match the IDF
# -- increase the number of fields in the IDD (in block and commdct)
# -- start
n = len(obj) - len(objfields)
key_txt = obj[0]
objfields = extff.increaseIDDfields(block, commdct, obj_i, key_txt, n)
# -- increase the number of fields in the IDD (in block and commdct)
# -- end
#
# -- convertfields for added fields - start
key_i = obj_i
key_comm = commdct[obj_i]
try:
inblock = block[obj_i]
except TypeError as e:
inblock = None
obj = convertfields(key_comm, obj, inblock)
# -- convertfields for added fields - end
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Appreciate this is probably taken directly from eppy, but I'd prefer it to be split out as a function with all those inline comments turned into a docstring.

Comment thread geomeppy/patches.py
from eppy.bunch_subclass import EpBunch as BaseBunch
from eppy.idf_msequence import Idf_MSequence
from eppy.idfreader import convertallfields, iddversiontuple
from eppy.idfreader import convertallfields, iddversiontuple, convertfields
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

imports in alphabetical order please

Comment thread geomeppy/patches.py

def obj2bunch(
data, commdct, obj
data, commdct, obj, block=None
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

block argument is missed from the typing

Comment thread geomeppy/patches.py
obj, # type: Union[List[Union[float, str]], List[str]]
obj_i, # type: int
block=None, # type:
debugidd=True,
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing type

Comment thread geomeppy/patches.py
commdct, # type: List[List[Dict[str, Any]]]
obj, # type: Union[List[Union[float, str]], List[str]]
obj_i, # type: int
block=None, # type:
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing type

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants