repo stringlengths 7 55 | path stringlengths 4 223 | func_name stringlengths 1 134 | original_string stringlengths 75 104k | language stringclasses 1
value | code stringlengths 75 104k | code_tokens listlengths 19 28.4k | docstring stringlengths 1 46.9k | docstring_tokens listlengths 1 1.97k | sha stringlengths 40 40 | url stringlengths 87 315 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
santoshphilip/eppy | eppy/bunch_subclass.py | getrange | def getrange(bch, fieldname):
"""get the ranges for this field"""
keys = ['maximum', 'minimum', 'maximum<', 'minimum>', 'type']
index = bch.objls.index(fieldname)
fielddct_orig = bch.objidd[index]
fielddct = copy.deepcopy(fielddct_orig)
therange = {}
for key in keys:
therange[key] = ... | python | def getrange(bch, fieldname):
"""get the ranges for this field"""
keys = ['maximum', 'minimum', 'maximum<', 'minimum>', 'type']
index = bch.objls.index(fieldname)
fielddct_orig = bch.objidd[index]
fielddct = copy.deepcopy(fielddct_orig)
therange = {}
for key in keys:
therange[key] = ... | [
"def",
"getrange",
"(",
"bch",
",",
"fieldname",
")",
":",
"keys",
"=",
"[",
"'maximum'",
",",
"'minimum'",
",",
"'maximum<'",
",",
"'minimum>'",
",",
"'type'",
"]",
"index",
"=",
"bch",
".",
"objls",
".",
"index",
"(",
"fieldname",
")",
"fielddct_orig",... | get the ranges for this field | [
"get",
"the",
"ranges",
"for",
"this",
"field"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/bunch_subclass.py#L380-L399 | train |
santoshphilip/eppy | eppy/bunch_subclass.py | checkrange | def checkrange(bch, fieldname):
"""throw exception if the out of range"""
fieldvalue = bch[fieldname]
therange = bch.getrange(fieldname)
if therange['maximum'] != None:
if fieldvalue > therange['maximum']:
astr = "Value %s is not less or equal to the 'maximum' of %s"
astr... | python | def checkrange(bch, fieldname):
"""throw exception if the out of range"""
fieldvalue = bch[fieldname]
therange = bch.getrange(fieldname)
if therange['maximum'] != None:
if fieldvalue > therange['maximum']:
astr = "Value %s is not less or equal to the 'maximum' of %s"
astr... | [
"def",
"checkrange",
"(",
"bch",
",",
"fieldname",
")",
":",
"fieldvalue",
"=",
"bch",
"[",
"fieldname",
"]",
"therange",
"=",
"bch",
".",
"getrange",
"(",
"fieldname",
")",
"if",
"therange",
"[",
"'maximum'",
"]",
"!=",
"None",
":",
"if",
"fieldvalue",
... | throw exception if the out of range | [
"throw",
"exception",
"if",
"the",
"out",
"of",
"range"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/bunch_subclass.py#L402-L428 | train |
santoshphilip/eppy | eppy/bunch_subclass.py | getfieldidd | def getfieldidd(bch, fieldname):
"""get the idd dict for this field
Will return {} if the fieldname does not exist"""
# print(bch)
try:
fieldindex = bch.objls.index(fieldname)
except ValueError as e:
return {} # the fieldname does not exist
# so there is no idd
... | python | def getfieldidd(bch, fieldname):
"""get the idd dict for this field
Will return {} if the fieldname does not exist"""
# print(bch)
try:
fieldindex = bch.objls.index(fieldname)
except ValueError as e:
return {} # the fieldname does not exist
# so there is no idd
... | [
"def",
"getfieldidd",
"(",
"bch",
",",
"fieldname",
")",
":",
"# print(bch)",
"try",
":",
"fieldindex",
"=",
"bch",
".",
"objls",
".",
"index",
"(",
"fieldname",
")",
"except",
"ValueError",
"as",
"e",
":",
"return",
"{",
"}",
"# the fieldname does not exist... | get the idd dict for this field
Will return {} if the fieldname does not exist | [
"get",
"the",
"idd",
"dict",
"for",
"this",
"field",
"Will",
"return",
"{}",
"if",
"the",
"fieldname",
"does",
"not",
"exist"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/bunch_subclass.py#L430-L440 | train |
santoshphilip/eppy | eppy/bunch_subclass.py | getfieldidd_item | def getfieldidd_item(bch, fieldname, iddkey):
"""return an item from the fieldidd, given the iddkey
will return and empty list if it does not have the iddkey
or if the fieldname does not exist"""
fieldidd = getfieldidd(bch, fieldname)
try:
return fieldidd[iddkey]
except KeyError as e:
... | python | def getfieldidd_item(bch, fieldname, iddkey):
"""return an item from the fieldidd, given the iddkey
will return and empty list if it does not have the iddkey
or if the fieldname does not exist"""
fieldidd = getfieldidd(bch, fieldname)
try:
return fieldidd[iddkey]
except KeyError as e:
... | [
"def",
"getfieldidd_item",
"(",
"bch",
",",
"fieldname",
",",
"iddkey",
")",
":",
"fieldidd",
"=",
"getfieldidd",
"(",
"bch",
",",
"fieldname",
")",
"try",
":",
"return",
"fieldidd",
"[",
"iddkey",
"]",
"except",
"KeyError",
"as",
"e",
":",
"return",
"["... | return an item from the fieldidd, given the iddkey
will return and empty list if it does not have the iddkey
or if the fieldname does not exist | [
"return",
"an",
"item",
"from",
"the",
"fieldidd",
"given",
"the",
"iddkey",
"will",
"return",
"and",
"empty",
"list",
"if",
"it",
"does",
"not",
"have",
"the",
"iddkey",
"or",
"if",
"the",
"fieldname",
"does",
"not",
"exist"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/bunch_subclass.py#L442-L450 | train |
santoshphilip/eppy | eppy/bunch_subclass.py | isequal | def isequal(bch, fieldname, value, places=7):
"""return True if the field is equal to value"""
def equalalphanumeric(bch, fieldname, value):
if bch.get_retaincase(fieldname):
return bch[fieldname] == value
else:
return bch[fieldname].upper() == value.upper()
fieldidd... | python | def isequal(bch, fieldname, value, places=7):
"""return True if the field is equal to value"""
def equalalphanumeric(bch, fieldname, value):
if bch.get_retaincase(fieldname):
return bch[fieldname] == value
else:
return bch[fieldname].upper() == value.upper()
fieldidd... | [
"def",
"isequal",
"(",
"bch",
",",
"fieldname",
",",
"value",
",",
"places",
"=",
"7",
")",
":",
"def",
"equalalphanumeric",
"(",
"bch",
",",
"fieldname",
",",
"value",
")",
":",
"if",
"bch",
".",
"get_retaincase",
"(",
"fieldname",
")",
":",
"return",... | return True if the field is equal to value | [
"return",
"True",
"if",
"the",
"field",
"is",
"equal",
"to",
"value"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/bunch_subclass.py#L459-L475 | train |
santoshphilip/eppy | eppy/bunch_subclass.py | getreferingobjs | def getreferingobjs(referedobj, iddgroups=None, fields=None):
"""Get a list of objects that refer to this object"""
# pseudocode for code below
# referringobjs = []
# referedobj has: -> Name
# -> reference
# for each obj in idf:
# [optional filter -> objects in iddgroup]
... | python | def getreferingobjs(referedobj, iddgroups=None, fields=None):
"""Get a list of objects that refer to this object"""
# pseudocode for code below
# referringobjs = []
# referedobj has: -> Name
# -> reference
# for each obj in idf:
# [optional filter -> objects in iddgroup]
... | [
"def",
"getreferingobjs",
"(",
"referedobj",
",",
"iddgroups",
"=",
"None",
",",
"fields",
"=",
"None",
")",
":",
"# pseudocode for code below",
"# referringobjs = []",
"# referedobj has: -> Name",
"# -> reference",
"# for each obj in idf:",
"# [optional filter ... | Get a list of objects that refer to this object | [
"Get",
"a",
"list",
"of",
"objects",
"that",
"refer",
"to",
"this",
"object"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/bunch_subclass.py#L478-L519 | train |
santoshphilip/eppy | eppy/bunch_subclass.py | get_referenced_object | def get_referenced_object(referring_object, fieldname):
"""
Get an object referred to by a field in another object.
For example an object of type Construction has fields for each layer, each
of which refers to a Material. This functions allows the object
representing a Material to be fetched using ... | python | def get_referenced_object(referring_object, fieldname):
"""
Get an object referred to by a field in another object.
For example an object of type Construction has fields for each layer, each
of which refers to a Material. This functions allows the object
representing a Material to be fetched using ... | [
"def",
"get_referenced_object",
"(",
"referring_object",
",",
"fieldname",
")",
":",
"idf",
"=",
"referring_object",
".",
"theidf",
"object_list",
"=",
"referring_object",
".",
"getfieldidd_item",
"(",
"fieldname",
",",
"u'object-list'",
")",
"for",
"obj_type",
"in"... | Get an object referred to by a field in another object.
For example an object of type Construction has fields for each layer, each
of which refers to a Material. This functions allows the object
representing a Material to be fetched using the name of the layer.
Returns the first item found since if th... | [
"Get",
"an",
"object",
"referred",
"to",
"by",
"a",
"field",
"in",
"another",
"object",
"."
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/bunch_subclass.py#L522-L554 | train |
santoshphilip/eppy | eppy/bunch_subclass.py | EpBunch.isequal | def isequal(self, fieldname, value, places=7):
"""return True if the field == value
Will retain case if get_retaincase == True
for real value will compare to decimal 'places'
"""
return isequal(self, fieldname, value, places=places) | python | def isequal(self, fieldname, value, places=7):
"""return True if the field == value
Will retain case if get_retaincase == True
for real value will compare to decimal 'places'
"""
return isequal(self, fieldname, value, places=places) | [
"def",
"isequal",
"(",
"self",
",",
"fieldname",
",",
"value",
",",
"places",
"=",
"7",
")",
":",
"return",
"isequal",
"(",
"self",
",",
"fieldname",
",",
"value",
",",
"places",
"=",
"places",
")"
] | return True if the field == value
Will retain case if get_retaincase == True
for real value will compare to decimal 'places' | [
"return",
"True",
"if",
"the",
"field",
"==",
"value",
"Will",
"retain",
"case",
"if",
"get_retaincase",
"==",
"True",
"for",
"real",
"value",
"will",
"compare",
"to",
"decimal",
"places"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/bunch_subclass.py#L228-L233 | train |
santoshphilip/eppy | eppy/bunch_subclass.py | EpBunch.getreferingobjs | def getreferingobjs(self, iddgroups=None, fields=None):
"""Get a list of objects that refer to this object"""
return getreferingobjs(self, iddgroups=iddgroups, fields=fields) | python | def getreferingobjs(self, iddgroups=None, fields=None):
"""Get a list of objects that refer to this object"""
return getreferingobjs(self, iddgroups=iddgroups, fields=fields) | [
"def",
"getreferingobjs",
"(",
"self",
",",
"iddgroups",
"=",
"None",
",",
"fields",
"=",
"None",
")",
":",
"return",
"getreferingobjs",
"(",
"self",
",",
"iddgroups",
"=",
"iddgroups",
",",
"fields",
"=",
"fields",
")"
] | Get a list of objects that refer to this object | [
"Get",
"a",
"list",
"of",
"objects",
"that",
"refer",
"to",
"this",
"object"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/bunch_subclass.py#L235-L237 | train |
santoshphilip/eppy | eppy/geometry/volume_zone.py | vol_tehrahedron | def vol_tehrahedron(poly):
"""volume of a irregular tetrahedron"""
p_a = np.array(poly[0])
p_b = np.array(poly[1])
p_c = np.array(poly[2])
p_d = np.array(poly[3])
return abs(np.dot(
np.subtract(p_a, p_d),
np.cross(
np.subtract(p_b, p_d),
np.subtract(p_c, p... | python | def vol_tehrahedron(poly):
"""volume of a irregular tetrahedron"""
p_a = np.array(poly[0])
p_b = np.array(poly[1])
p_c = np.array(poly[2])
p_d = np.array(poly[3])
return abs(np.dot(
np.subtract(p_a, p_d),
np.cross(
np.subtract(p_b, p_d),
np.subtract(p_c, p... | [
"def",
"vol_tehrahedron",
"(",
"poly",
")",
":",
"p_a",
"=",
"np",
".",
"array",
"(",
"poly",
"[",
"0",
"]",
")",
"p_b",
"=",
"np",
".",
"array",
"(",
"poly",
"[",
"1",
"]",
")",
"p_c",
"=",
"np",
".",
"array",
"(",
"poly",
"[",
"2",
"]",
"... | volume of a irregular tetrahedron | [
"volume",
"of",
"a",
"irregular",
"tetrahedron"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/geometry/volume_zone.py#L24-L34 | train |
santoshphilip/eppy | eppy/geometry/volume_zone.py | vol | def vol(poly1, poly2):
""""volume of a zone defined by two polygon bases """
c_point = central_p(poly1, poly2)
c_point = (c_point[0], c_point[1], c_point[2])
vol_therah = 0
num = len(poly1)
poly1.append(poly1[0])
poly2.append(poly2[0])
for i in range(num - 2):
# the upper part
... | python | def vol(poly1, poly2):
""""volume of a zone defined by two polygon bases """
c_point = central_p(poly1, poly2)
c_point = (c_point[0], c_point[1], c_point[2])
vol_therah = 0
num = len(poly1)
poly1.append(poly1[0])
poly2.append(poly2[0])
for i in range(num - 2):
# the upper part
... | [
"def",
"vol",
"(",
"poly1",
",",
"poly2",
")",
":",
"c_point",
"=",
"central_p",
"(",
"poly1",
",",
"poly2",
")",
"c_point",
"=",
"(",
"c_point",
"[",
"0",
"]",
",",
"c_point",
"[",
"1",
"]",
",",
"c_point",
"[",
"2",
"]",
")",
"vol_therah",
"=",... | volume of a zone defined by two polygon bases | [
"volume",
"of",
"a",
"zone",
"defined",
"by",
"two",
"polygon",
"bases"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/geometry/volume_zone.py#L42-L63 | train |
santoshphilip/eppy | eppy/EPlusInterfaceFunctions/iddindex.py | makename2refdct | def makename2refdct(commdct):
"""make the name2refs dict in the idd_index"""
refdct = {}
for comm in commdct: # commdct is a list of dict
try:
idfobj = comm[0]['idfobj'].upper()
field1 = comm[1]
if 'Name' in field1['field']:
references = field1['re... | python | def makename2refdct(commdct):
"""make the name2refs dict in the idd_index"""
refdct = {}
for comm in commdct: # commdct is a list of dict
try:
idfobj = comm[0]['idfobj'].upper()
field1 = comm[1]
if 'Name' in field1['field']:
references = field1['re... | [
"def",
"makename2refdct",
"(",
"commdct",
")",
":",
"refdct",
"=",
"{",
"}",
"for",
"comm",
"in",
"commdct",
":",
"# commdct is a list of dict",
"try",
":",
"idfobj",
"=",
"comm",
"[",
"0",
"]",
"[",
"'idfobj'",
"]",
".",
"upper",
"(",
")",
"field1",
"... | make the name2refs dict in the idd_index | [
"make",
"the",
"name2refs",
"dict",
"in",
"the",
"idd_index"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/iddindex.py#L51-L63 | train |
santoshphilip/eppy | eppy/EPlusInterfaceFunctions/iddindex.py | makeref2namesdct | def makeref2namesdct(name2refdct):
"""make the ref2namesdct in the idd_index"""
ref2namesdct = {}
for key, values in name2refdct.items():
for value in values:
ref2namesdct.setdefault(value, set()).add(key)
return ref2namesdct | python | def makeref2namesdct(name2refdct):
"""make the ref2namesdct in the idd_index"""
ref2namesdct = {}
for key, values in name2refdct.items():
for value in values:
ref2namesdct.setdefault(value, set()).add(key)
return ref2namesdct | [
"def",
"makeref2namesdct",
"(",
"name2refdct",
")",
":",
"ref2namesdct",
"=",
"{",
"}",
"for",
"key",
",",
"values",
"in",
"name2refdct",
".",
"items",
"(",
")",
":",
"for",
"value",
"in",
"values",
":",
"ref2namesdct",
".",
"setdefault",
"(",
"value",
"... | make the ref2namesdct in the idd_index | [
"make",
"the",
"ref2namesdct",
"in",
"the",
"idd_index"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/iddindex.py#L65-L71 | train |
santoshphilip/eppy | eppy/EPlusInterfaceFunctions/iddindex.py | ref2names2commdct | def ref2names2commdct(ref2names, commdct):
"""embed ref2names into commdct"""
for comm in commdct:
for cdct in comm:
try:
refs = cdct['object-list'][0]
validobjects = ref2names[refs]
cdct.update({'validobjects':validobjects})
except... | python | def ref2names2commdct(ref2names, commdct):
"""embed ref2names into commdct"""
for comm in commdct:
for cdct in comm:
try:
refs = cdct['object-list'][0]
validobjects = ref2names[refs]
cdct.update({'validobjects':validobjects})
except... | [
"def",
"ref2names2commdct",
"(",
"ref2names",
",",
"commdct",
")",
":",
"for",
"comm",
"in",
"commdct",
":",
"for",
"cdct",
"in",
"comm",
":",
"try",
":",
"refs",
"=",
"cdct",
"[",
"'object-list'",
"]",
"[",
"0",
"]",
"validobjects",
"=",
"ref2names",
... | embed ref2names into commdct | [
"embed",
"ref2names",
"into",
"commdct"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/iddindex.py#L73-L83 | train |
santoshphilip/eppy | eppy/geometry/area_zone.py | area | def area(poly):
"""Calculation of zone area"""
poly_xy = []
num = len(poly)
for i in range(num):
poly[i] = poly[i][0:2] + (0,)
poly_xy.append(poly[i])
return surface.area(poly) | python | def area(poly):
"""Calculation of zone area"""
poly_xy = []
num = len(poly)
for i in range(num):
poly[i] = poly[i][0:2] + (0,)
poly_xy.append(poly[i])
return surface.area(poly) | [
"def",
"area",
"(",
"poly",
")",
":",
"poly_xy",
"=",
"[",
"]",
"num",
"=",
"len",
"(",
"poly",
")",
"for",
"i",
"in",
"range",
"(",
"num",
")",
":",
"poly",
"[",
"i",
"]",
"=",
"poly",
"[",
"i",
"]",
"[",
"0",
":",
"2",
"]",
"+",
"(",
... | Calculation of zone area | [
"Calculation",
"of",
"zone",
"area"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/geometry/area_zone.py#L19-L26 | train |
santoshphilip/eppy | eppy/walk_hvac.py | prevnode | def prevnode(edges, component):
"""get the pervious component in the loop"""
e = edges
c = component
n2c = [(a, b) for a, b in e if type(a) == tuple]
c2n = [(a, b) for a, b in e if type(b) == tuple]
node2cs = [(a, b) for a, b in e if b == c]
c2nodes = []
for node2c in node2cs:
c2... | python | def prevnode(edges, component):
"""get the pervious component in the loop"""
e = edges
c = component
n2c = [(a, b) for a, b in e if type(a) == tuple]
c2n = [(a, b) for a, b in e if type(b) == tuple]
node2cs = [(a, b) for a, b in e if b == c]
c2nodes = []
for node2c in node2cs:
c2... | [
"def",
"prevnode",
"(",
"edges",
",",
"component",
")",
":",
"e",
"=",
"edges",
"c",
"=",
"component",
"n2c",
"=",
"[",
"(",
"a",
",",
"b",
")",
"for",
"a",
",",
"b",
"in",
"e",
"if",
"type",
"(",
"a",
")",
"==",
"tuple",
"]",
"c2n",
"=",
"... | get the pervious component in the loop | [
"get",
"the",
"pervious",
"component",
"in",
"the",
"loop"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/walk_hvac.py#L39-L61 | train |
santoshphilip/eppy | eppy/geometry/height_surface.py | height | def height(poly):
"""height"""
num = len(poly)
hgt = 0.0
for i in range(num):
hgt += (poly[i][2])
return hgt/num | python | def height(poly):
"""height"""
num = len(poly)
hgt = 0.0
for i in range(num):
hgt += (poly[i][2])
return hgt/num | [
"def",
"height",
"(",
"poly",
")",
":",
"num",
"=",
"len",
"(",
"poly",
")",
"hgt",
"=",
"0.0",
"for",
"i",
"in",
"range",
"(",
"num",
")",
":",
"hgt",
"+=",
"(",
"poly",
"[",
"i",
"]",
"[",
"2",
"]",
")",
"return",
"hgt",
"/",
"num"
] | height | [
"height"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/geometry/height_surface.py#L40-L46 | train |
santoshphilip/eppy | eppy/geometry/height_surface.py | unit_normal | def unit_normal(apnt, bpnt, cpnt):
"""unit normal"""
xvar = np.tinylinalg.det([
[1, apnt[1], apnt[2]], [1, bpnt[1], bpnt[2]], [1, cpnt[1], cpnt[2]]])
yvar = np.tinylinalg.det([
[apnt[0], 1, apnt[2]], [bpnt[0], 1, bpnt[2]], [cpnt[0], 1, cpnt[2]]])
zvar = np.tinylinalg.det([
[apnt[... | python | def unit_normal(apnt, bpnt, cpnt):
"""unit normal"""
xvar = np.tinylinalg.det([
[1, apnt[1], apnt[2]], [1, bpnt[1], bpnt[2]], [1, cpnt[1], cpnt[2]]])
yvar = np.tinylinalg.det([
[apnt[0], 1, apnt[2]], [bpnt[0], 1, bpnt[2]], [cpnt[0], 1, cpnt[2]]])
zvar = np.tinylinalg.det([
[apnt[... | [
"def",
"unit_normal",
"(",
"apnt",
",",
"bpnt",
",",
"cpnt",
")",
":",
"xvar",
"=",
"np",
".",
"tinylinalg",
".",
"det",
"(",
"[",
"[",
"1",
",",
"apnt",
"[",
"1",
"]",
",",
"apnt",
"[",
"2",
"]",
"]",
",",
"[",
"1",
",",
"bpnt",
"[",
"1",
... | unit normal | [
"unit",
"normal"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/geometry/height_surface.py#L49-L61 | train |
santoshphilip/eppy | eppy/idf_msequence.py | Idf_MSequence.insert | def insert(self, i, v):
"""Insert an idfobject (bunch) to list1 and its object to list2."""
self.list1.insert(i, v)
self.list2.insert(i, v.obj)
if isinstance(v, EpBunch):
v.theidf = self.theidf | python | def insert(self, i, v):
"""Insert an idfobject (bunch) to list1 and its object to list2."""
self.list1.insert(i, v)
self.list2.insert(i, v.obj)
if isinstance(v, EpBunch):
v.theidf = self.theidf | [
"def",
"insert",
"(",
"self",
",",
"i",
",",
"v",
")",
":",
"self",
".",
"list1",
".",
"insert",
"(",
"i",
",",
"v",
")",
"self",
".",
"list2",
".",
"insert",
"(",
"i",
",",
"v",
".",
"obj",
")",
"if",
"isinstance",
"(",
"v",
",",
"EpBunch",
... | Insert an idfobject (bunch) to list1 and its object to list2. | [
"Insert",
"an",
"idfobject",
"(",
"bunch",
")",
"to",
"list1",
"and",
"its",
"object",
"to",
"list2",
"."
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/idf_msequence.py#L71-L76 | train |
santoshphilip/eppy | eppy/function_helpers.py | grouper | def grouper(num, iterable, fillvalue=None):
"Collect data into fixed-length chunks or blocks"
# grouper(3, 'ABCDEFG', 'x') --> ABC DEF Gxx
args = [iter(iterable)] * num
return zip_longest(fillvalue=fillvalue, *args) | python | def grouper(num, iterable, fillvalue=None):
"Collect data into fixed-length chunks or blocks"
# grouper(3, 'ABCDEFG', 'x') --> ABC DEF Gxx
args = [iter(iterable)] * num
return zip_longest(fillvalue=fillvalue, *args) | [
"def",
"grouper",
"(",
"num",
",",
"iterable",
",",
"fillvalue",
"=",
"None",
")",
":",
"# grouper(3, 'ABCDEFG', 'x') --> ABC DEF Gxx",
"args",
"=",
"[",
"iter",
"(",
"iterable",
")",
"]",
"*",
"num",
"return",
"zip_longest",
"(",
"fillvalue",
"=",
"fillvalue"... | Collect data into fixed-length chunks or blocks | [
"Collect",
"data",
"into",
"fixed",
"-",
"length",
"chunks",
"or",
"blocks"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/function_helpers.py#L21-L25 | train |
santoshphilip/eppy | eppy/function_helpers.py | getcoords | def getcoords(ddtt):
"""return the coordinates of the surface"""
n_vertices_index = ddtt.objls.index('Number_of_Vertices')
first_x = n_vertices_index + 1 # X of first coordinate
pts = ddtt.obj[first_x:]
return list(grouper(3, pts)) | python | def getcoords(ddtt):
"""return the coordinates of the surface"""
n_vertices_index = ddtt.objls.index('Number_of_Vertices')
first_x = n_vertices_index + 1 # X of first coordinate
pts = ddtt.obj[first_x:]
return list(grouper(3, pts)) | [
"def",
"getcoords",
"(",
"ddtt",
")",
":",
"n_vertices_index",
"=",
"ddtt",
".",
"objls",
".",
"index",
"(",
"'Number_of_Vertices'",
")",
"first_x",
"=",
"n_vertices_index",
"+",
"1",
"# X of first coordinate",
"pts",
"=",
"ddtt",
".",
"obj",
"[",
"first_x",
... | return the coordinates of the surface | [
"return",
"the",
"coordinates",
"of",
"the",
"surface"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/function_helpers.py#L27-L32 | train |
santoshphilip/eppy | eppy/function_helpers.py | buildingname | def buildingname(ddtt):
"""return building name"""
idf = ddtt.theidf
building = idf.idfobjects['building'.upper()][0]
return building.Name | python | def buildingname(ddtt):
"""return building name"""
idf = ddtt.theidf
building = idf.idfobjects['building'.upper()][0]
return building.Name | [
"def",
"buildingname",
"(",
"ddtt",
")",
":",
"idf",
"=",
"ddtt",
".",
"theidf",
"building",
"=",
"idf",
".",
"idfobjects",
"[",
"'building'",
".",
"upper",
"(",
")",
"]",
"[",
"0",
"]",
"return",
"building",
".",
"Name"
] | return building name | [
"return",
"building",
"name"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/function_helpers.py#L59-L63 | train |
santoshphilip/eppy | eppy/easyopen.py | cleanupversion | def cleanupversion(ver):
"""massage the version number so it matches the format of install folder"""
lst = ver.split(".")
if len(lst) == 1:
lst.extend(['0', '0'])
elif len(lst) == 2:
lst.extend(['0'])
elif len(lst) > 2:
lst = lst[:3]
lst[2] = '0' # ensure the 3rd number i... | python | def cleanupversion(ver):
"""massage the version number so it matches the format of install folder"""
lst = ver.split(".")
if len(lst) == 1:
lst.extend(['0', '0'])
elif len(lst) == 2:
lst.extend(['0'])
elif len(lst) > 2:
lst = lst[:3]
lst[2] = '0' # ensure the 3rd number i... | [
"def",
"cleanupversion",
"(",
"ver",
")",
":",
"lst",
"=",
"ver",
".",
"split",
"(",
"\".\"",
")",
"if",
"len",
"(",
"lst",
")",
"==",
"1",
":",
"lst",
".",
"extend",
"(",
"[",
"'0'",
",",
"'0'",
"]",
")",
"elif",
"len",
"(",
"lst",
")",
"=="... | massage the version number so it matches the format of install folder | [
"massage",
"the",
"version",
"number",
"so",
"it",
"matches",
"the",
"format",
"of",
"install",
"folder"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/easyopen.py#L32-L43 | train |
santoshphilip/eppy | eppy/easyopen.py | getiddfile | def getiddfile(versionid):
"""find the IDD file of the E+ installation"""
vlist = versionid.split('.')
if len(vlist) == 1:
vlist = vlist + ['0', '0']
elif len(vlist) == 2:
vlist = vlist + ['0']
ver_str = '-'.join(vlist)
eplus_exe, _ = eppy.runner.run_functions.install_paths(ver... | python | def getiddfile(versionid):
"""find the IDD file of the E+ installation"""
vlist = versionid.split('.')
if len(vlist) == 1:
vlist = vlist + ['0', '0']
elif len(vlist) == 2:
vlist = vlist + ['0']
ver_str = '-'.join(vlist)
eplus_exe, _ = eppy.runner.run_functions.install_paths(ver... | [
"def",
"getiddfile",
"(",
"versionid",
")",
":",
"vlist",
"=",
"versionid",
".",
"split",
"(",
"'.'",
")",
"if",
"len",
"(",
"vlist",
")",
"==",
"1",
":",
"vlist",
"=",
"vlist",
"+",
"[",
"'0'",
",",
"'0'",
"]",
"elif",
"len",
"(",
"vlist",
")",
... | find the IDD file of the E+ installation | [
"find",
"the",
"IDD",
"file",
"of",
"the",
"E",
"+",
"installation"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/easyopen.py#L45-L56 | train |
santoshphilip/eppy | eppy/easyopen.py | easyopen | def easyopen(fname, idd=None, epw=None):
"""automatically set idd and open idf file. Uses version from idf to set correct idd
It will work under the following circumstances:
- the IDF file should have the VERSION object.
- Needs the version of EnergyPlus installed that matches the IDF version.
... | python | def easyopen(fname, idd=None, epw=None):
"""automatically set idd and open idf file. Uses version from idf to set correct idd
It will work under the following circumstances:
- the IDF file should have the VERSION object.
- Needs the version of EnergyPlus installed that matches the IDF version.
... | [
"def",
"easyopen",
"(",
"fname",
",",
"idd",
"=",
"None",
",",
"epw",
"=",
"None",
")",
":",
"if",
"idd",
":",
"eppy",
".",
"modeleditor",
".",
"IDF",
".",
"setiddname",
"(",
"idd",
")",
"idf",
"=",
"eppy",
".",
"modeleditor",
".",
"IDF",
"(",
"f... | automatically set idd and open idf file. Uses version from idf to set correct idd
It will work under the following circumstances:
- the IDF file should have the VERSION object.
- Needs the version of EnergyPlus installed that matches the IDF version.
- Energyplus should be installed in the default... | [
"automatically",
"set",
"idd",
"and",
"open",
"idf",
"file",
".",
"Uses",
"version",
"from",
"idf",
"to",
"set",
"correct",
"idd",
"It",
"will",
"work",
"under",
"the",
"following",
"circumstances",
":",
"-",
"the",
"IDF",
"file",
"should",
"have",
"the",
... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/easyopen.py#L72-L143 | train |
santoshphilip/eppy | eppy/EPlusInterfaceFunctions/eplusdata.py | removecomment | def removecomment(astr, cphrase):
"""
the comment is similar to that in python.
any charachter after the # is treated as a comment
until the end of the line
astr is the string to be de-commented
cphrase is the comment phrase"""
# linesep = mylib3.getlinesep(astr)
alist = astr.splitlines(... | python | def removecomment(astr, cphrase):
"""
the comment is similar to that in python.
any charachter after the # is treated as a comment
until the end of the line
astr is the string to be de-commented
cphrase is the comment phrase"""
# linesep = mylib3.getlinesep(astr)
alist = astr.splitlines(... | [
"def",
"removecomment",
"(",
"astr",
",",
"cphrase",
")",
":",
"# linesep = mylib3.getlinesep(astr)",
"alist",
"=",
"astr",
".",
"splitlines",
"(",
")",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"alist",
")",
")",
":",
"alist1",
"=",
"alist",
"[",
"i",... | the comment is similar to that in python.
any charachter after the # is treated as a comment
until the end of the line
astr is the string to be de-commented
cphrase is the comment phrase | [
"the",
"comment",
"is",
"similar",
"to",
"that",
"in",
"python",
".",
"any",
"charachter",
"after",
"the",
"#",
"is",
"treated",
"as",
"a",
"comment",
"until",
"the",
"end",
"of",
"the",
"line",
"astr",
"is",
"the",
"string",
"to",
"be",
"de",
"-",
"... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/eplusdata.py#L24-L38 | train |
santoshphilip/eppy | eppy/EPlusInterfaceFunctions/eplusdata.py | Idd.initdict2 | def initdict2(self, dictfile):
"""initdict2"""
dt = {}
dtls = []
adict = dictfile
for element in adict:
dt[element[0].upper()] = [] # dict keys for objects always in caps
dtls.append(element[0].upper())
return dt, dtls | python | def initdict2(self, dictfile):
"""initdict2"""
dt = {}
dtls = []
adict = dictfile
for element in adict:
dt[element[0].upper()] = [] # dict keys for objects always in caps
dtls.append(element[0].upper())
return dt, dtls | [
"def",
"initdict2",
"(",
"self",
",",
"dictfile",
")",
":",
"dt",
"=",
"{",
"}",
"dtls",
"=",
"[",
"]",
"adict",
"=",
"dictfile",
"for",
"element",
"in",
"adict",
":",
"dt",
"[",
"element",
"[",
"0",
"]",
".",
"upper",
"(",
")",
"]",
"=",
"[",
... | initdict2 | [
"initdict2"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/eplusdata.py#L54-L62 | train |
santoshphilip/eppy | eppy/EPlusInterfaceFunctions/eplusdata.py | Eplusdata.initdict | def initdict(self, fname):
"""create a blank dictionary"""
if isinstance(fname, Idd):
self.dt, self.dtls = fname.dt, fname.dtls
return self.dt, self.dtls
astr = mylib2.readfile(fname)
nocom = removecomment(astr, '!')
idfst = nocom
alist = idfst.sp... | python | def initdict(self, fname):
"""create a blank dictionary"""
if isinstance(fname, Idd):
self.dt, self.dtls = fname.dt, fname.dtls
return self.dt, self.dtls
astr = mylib2.readfile(fname)
nocom = removecomment(astr, '!')
idfst = nocom
alist = idfst.sp... | [
"def",
"initdict",
"(",
"self",
",",
"fname",
")",
":",
"if",
"isinstance",
"(",
"fname",
",",
"Idd",
")",
":",
"self",
".",
"dt",
",",
"self",
".",
"dtls",
"=",
"fname",
".",
"dt",
",",
"fname",
".",
"dtls",
"return",
"self",
".",
"dt",
",",
"... | create a blank dictionary | [
"create",
"a",
"blank",
"dictionary"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/eplusdata.py#L146-L174 | train |
santoshphilip/eppy | eppy/EPlusInterfaceFunctions/eplusdata.py | Eplusdata.makedict | def makedict(self, dictfile, fnamefobject):
"""stuff file data into the blank dictionary"""
#fname = './exapmlefiles/5ZoneDD.idf'
#fname = './1ZoneUncontrolled.idf'
if isinstance(dictfile, Idd):
localidd = copy.deepcopy(dictfile)
dt, dtls = localidd.dt, localidd.d... | python | def makedict(self, dictfile, fnamefobject):
"""stuff file data into the blank dictionary"""
#fname = './exapmlefiles/5ZoneDD.idf'
#fname = './1ZoneUncontrolled.idf'
if isinstance(dictfile, Idd):
localidd = copy.deepcopy(dictfile)
dt, dtls = localidd.dt, localidd.d... | [
"def",
"makedict",
"(",
"self",
",",
"dictfile",
",",
"fnamefobject",
")",
":",
"#fname = './exapmlefiles/5ZoneDD.idf'",
"#fname = './1ZoneUncontrolled.idf'",
"if",
"isinstance",
"(",
"dictfile",
",",
"Idd",
")",
":",
"localidd",
"=",
"copy",
".",
"deepcopy",
"(",
... | stuff file data into the blank dictionary | [
"stuff",
"file",
"data",
"into",
"the",
"blank",
"dictionary"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/eplusdata.py#L177-L220 | train |
santoshphilip/eppy | eppy/EPlusInterfaceFunctions/eplusdata.py | Eplusdata.replacenode | def replacenode(self, othereplus, node):
"""replace the node here with the node from othereplus"""
node = node.upper()
self.dt[node.upper()] = othereplus.dt[node.upper()] | python | def replacenode(self, othereplus, node):
"""replace the node here with the node from othereplus"""
node = node.upper()
self.dt[node.upper()] = othereplus.dt[node.upper()] | [
"def",
"replacenode",
"(",
"self",
",",
"othereplus",
",",
"node",
")",
":",
"node",
"=",
"node",
".",
"upper",
"(",
")",
"self",
".",
"dt",
"[",
"node",
".",
"upper",
"(",
")",
"]",
"=",
"othereplus",
".",
"dt",
"[",
"node",
".",
"upper",
"(",
... | replace the node here with the node from othereplus | [
"replace",
"the",
"node",
"here",
"with",
"the",
"node",
"from",
"othereplus"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/eplusdata.py#L222-L225 | train |
santoshphilip/eppy | eppy/EPlusInterfaceFunctions/eplusdata.py | Eplusdata.add2node | def add2node(self, othereplus, node):
"""add the node here with the node from othereplus
this will potentially have duplicates"""
node = node.upper()
self.dt[node.upper()] = self.dt[node.upper()] + \
othereplus.dt[node.upper()] | python | def add2node(self, othereplus, node):
"""add the node here with the node from othereplus
this will potentially have duplicates"""
node = node.upper()
self.dt[node.upper()] = self.dt[node.upper()] + \
othereplus.dt[node.upper()] | [
"def",
"add2node",
"(",
"self",
",",
"othereplus",
",",
"node",
")",
":",
"node",
"=",
"node",
".",
"upper",
"(",
")",
"self",
".",
"dt",
"[",
"node",
".",
"upper",
"(",
")",
"]",
"=",
"self",
".",
"dt",
"[",
"node",
".",
"upper",
"(",
")",
"... | add the node here with the node from othereplus
this will potentially have duplicates | [
"add",
"the",
"node",
"here",
"with",
"the",
"node",
"from",
"othereplus",
"this",
"will",
"potentially",
"have",
"duplicates"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/eplusdata.py#L227-L232 | train |
santoshphilip/eppy | eppy/EPlusInterfaceFunctions/eplusdata.py | Eplusdata.addinnode | def addinnode(self, otherplus, node, objectname):
"""add an item to the node.
example: add a new zone to the element 'ZONE' """
# do a test for unique object here
newelement = otherplus.dt[node.upper()] | python | def addinnode(self, otherplus, node, objectname):
"""add an item to the node.
example: add a new zone to the element 'ZONE' """
# do a test for unique object here
newelement = otherplus.dt[node.upper()] | [
"def",
"addinnode",
"(",
"self",
",",
"otherplus",
",",
"node",
",",
"objectname",
")",
":",
"# do a test for unique object here",
"newelement",
"=",
"otherplus",
".",
"dt",
"[",
"node",
".",
"upper",
"(",
")",
"]"
] | add an item to the node.
example: add a new zone to the element 'ZONE' | [
"add",
"an",
"item",
"to",
"the",
"node",
".",
"example",
":",
"add",
"a",
"new",
"zone",
"to",
"the",
"element",
"ZONE"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/eplusdata.py#L234-L238 | train |
santoshphilip/eppy | eppy/EPlusInterfaceFunctions/eplusdata.py | Eplusdata.getrefs | def getrefs(self, reflist):
"""
reflist is got from getobjectref in parse_idd.py
getobjectref returns a dictionary.
reflist is an item in the dictionary
getrefs gathers all the fields refered by reflist
"""
alist = []
for element in reflist:
if... | python | def getrefs(self, reflist):
"""
reflist is got from getobjectref in parse_idd.py
getobjectref returns a dictionary.
reflist is an item in the dictionary
getrefs gathers all the fields refered by reflist
"""
alist = []
for element in reflist:
if... | [
"def",
"getrefs",
"(",
"self",
",",
"reflist",
")",
":",
"alist",
"=",
"[",
"]",
"for",
"element",
"in",
"reflist",
":",
"if",
"element",
"[",
"0",
"]",
".",
"upper",
"(",
")",
"in",
"self",
".",
"dt",
":",
"for",
"elm",
"in",
"self",
".",
"dt"... | reflist is got from getobjectref in parse_idd.py
getobjectref returns a dictionary.
reflist is an item in the dictionary
getrefs gathers all the fields refered by reflist | [
"reflist",
"is",
"got",
"from",
"getobjectref",
"in",
"parse_idd",
".",
"py",
"getobjectref",
"returns",
"a",
"dictionary",
".",
"reflist",
"is",
"an",
"item",
"in",
"the",
"dictionary",
"getrefs",
"gathers",
"all",
"the",
"fields",
"refered",
"by",
"reflist"
... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/eplusdata.py#L240-L252 | train |
santoshphilip/eppy | eppy/useful_scripts/loopdiagram.py | dropnodes | def dropnodes(edges):
"""draw a graph without the nodes"""
newedges = []
added = False
for edge in edges:
if bothnodes(edge):
newtup = (edge[0][0], edge[1][0])
newedges.append(newtup)
added = True
elif firstisnode(edge):
for edge1 in edges:... | python | def dropnodes(edges):
"""draw a graph without the nodes"""
newedges = []
added = False
for edge in edges:
if bothnodes(edge):
newtup = (edge[0][0], edge[1][0])
newedges.append(newtup)
added = True
elif firstisnode(edge):
for edge1 in edges:... | [
"def",
"dropnodes",
"(",
"edges",
")",
":",
"newedges",
"=",
"[",
"]",
"added",
"=",
"False",
"for",
"edge",
"in",
"edges",
":",
"if",
"bothnodes",
"(",
"edge",
")",
":",
"newtup",
"=",
"(",
"edge",
"[",
"0",
"]",
"[",
"0",
"]",
",",
"edge",
"[... | draw a graph without the nodes | [
"draw",
"a",
"graph",
"without",
"the",
"nodes"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/useful_scripts/loopdiagram.py#L65-L99 | train |
santoshphilip/eppy | eppy/useful_scripts/loopdiagram.py | edges2nodes | def edges2nodes(edges):
"""gather the nodes from the edges"""
nodes = []
for e1, e2 in edges:
nodes.append(e1)
nodes.append(e2)
nodedict = dict([(n, None) for n in nodes])
justnodes = list(nodedict.keys())
# justnodes.sort()
justnodes = sorted(justnodes, key=lambda x: str(x[0... | python | def edges2nodes(edges):
"""gather the nodes from the edges"""
nodes = []
for e1, e2 in edges:
nodes.append(e1)
nodes.append(e2)
nodedict = dict([(n, None) for n in nodes])
justnodes = list(nodedict.keys())
# justnodes.sort()
justnodes = sorted(justnodes, key=lambda x: str(x[0... | [
"def",
"edges2nodes",
"(",
"edges",
")",
":",
"nodes",
"=",
"[",
"]",
"for",
"e1",
",",
"e2",
"in",
"edges",
":",
"nodes",
".",
"append",
"(",
"e1",
")",
"nodes",
".",
"append",
"(",
"e2",
")",
"nodedict",
"=",
"dict",
"(",
"[",
"(",
"n",
",",
... | gather the nodes from the edges | [
"gather",
"the",
"nodes",
"from",
"the",
"edges"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/useful_scripts/loopdiagram.py#L127-L137 | train |
santoshphilip/eppy | eppy/useful_scripts/loopdiagram.py | makediagram | def makediagram(edges):
"""make the diagram with the edges"""
graph = pydot.Dot(graph_type='digraph')
nodes = edges2nodes(edges)
epnodes = [(node,
makeanode(node[0])) for node in nodes if nodetype(node)=="epnode"]
endnodes = [(node,
makeendnode(node[0])) for node in nodes if nodety... | python | def makediagram(edges):
"""make the diagram with the edges"""
graph = pydot.Dot(graph_type='digraph')
nodes = edges2nodes(edges)
epnodes = [(node,
makeanode(node[0])) for node in nodes if nodetype(node)=="epnode"]
endnodes = [(node,
makeendnode(node[0])) for node in nodes if nodety... | [
"def",
"makediagram",
"(",
"edges",
")",
":",
"graph",
"=",
"pydot",
".",
"Dot",
"(",
"graph_type",
"=",
"'digraph'",
")",
"nodes",
"=",
"edges2nodes",
"(",
"edges",
")",
"epnodes",
"=",
"[",
"(",
"node",
",",
"makeanode",
"(",
"node",
"[",
"0",
"]",... | make the diagram with the edges | [
"make",
"the",
"diagram",
"with",
"the",
"edges"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/useful_scripts/loopdiagram.py#L140-L154 | train |
santoshphilip/eppy | eppy/useful_scripts/loopdiagram.py | makebranchcomponents | def makebranchcomponents(data, commdct, anode="epnode"):
"""return the edges jointing the components of a branch"""
alledges = []
objkey = 'BRANCH'
cnamefield = "Component %s Name"
inletfield = "Component %s Inlet Node Name"
outletfield = "Component %s Outlet Node Name"
numobjects = len(da... | python | def makebranchcomponents(data, commdct, anode="epnode"):
"""return the edges jointing the components of a branch"""
alledges = []
objkey = 'BRANCH'
cnamefield = "Component %s Name"
inletfield = "Component %s Inlet Node Name"
outletfield = "Component %s Outlet Node Name"
numobjects = len(da... | [
"def",
"makebranchcomponents",
"(",
"data",
",",
"commdct",
",",
"anode",
"=",
"\"epnode\"",
")",
":",
"alledges",
"=",
"[",
"]",
"objkey",
"=",
"'BRANCH'",
"cnamefield",
"=",
"\"Component %s Name\"",
"inletfield",
"=",
"\"Component %s Inlet Node Name\"",
"outletfie... | return the edges jointing the components of a branch | [
"return",
"the",
"edges",
"jointing",
"the",
"components",
"of",
"a",
"branch"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/useful_scripts/loopdiagram.py#L173-L203 | train |
santoshphilip/eppy | eppy/useful_scripts/loopdiagram.py | makeairplantloop | def makeairplantloop(data, commdct):
"""make the edges for the airloop and the plantloop"""
anode = "epnode"
endnode = "EndNode"
# in plantloop get:
# demand inlet, outlet, branchlist
# supply inlet, outlet, branchlist
plantloops = loops.plantloopfields(data, commdct)
# splitter... | python | def makeairplantloop(data, commdct):
"""make the edges for the airloop and the plantloop"""
anode = "epnode"
endnode = "EndNode"
# in plantloop get:
# demand inlet, outlet, branchlist
# supply inlet, outlet, branchlist
plantloops = loops.plantloopfields(data, commdct)
# splitter... | [
"def",
"makeairplantloop",
"(",
"data",
",",
"commdct",
")",
":",
"anode",
"=",
"\"epnode\"",
"endnode",
"=",
"\"EndNode\"",
"# in plantloop get:",
"# demand inlet, outlet, branchlist",
"# supply inlet, outlet, branchlist",
"plantloops",
"=",
"loops",
".",
"plantloo... | make the edges for the airloop and the plantloop | [
"make",
"the",
"edges",
"for",
"the",
"airloop",
"and",
"the",
"plantloop"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/useful_scripts/loopdiagram.py#L206-L494 | train |
santoshphilip/eppy | eppy/useful_scripts/loopdiagram.py | getedges | def getedges(fname, iddfile):
"""return the edges of the idf file fname"""
data, commdct, _idd_index = readidf.readdatacommdct(fname, iddfile=iddfile)
edges = makeairplantloop(data, commdct)
return edges | python | def getedges(fname, iddfile):
"""return the edges of the idf file fname"""
data, commdct, _idd_index = readidf.readdatacommdct(fname, iddfile=iddfile)
edges = makeairplantloop(data, commdct)
return edges | [
"def",
"getedges",
"(",
"fname",
",",
"iddfile",
")",
":",
"data",
",",
"commdct",
",",
"_idd_index",
"=",
"readidf",
".",
"readdatacommdct",
"(",
"fname",
",",
"iddfile",
"=",
"iddfile",
")",
"edges",
"=",
"makeairplantloop",
"(",
"data",
",",
"commdct",
... | return the edges of the idf file fname | [
"return",
"the",
"edges",
"of",
"the",
"idf",
"file",
"fname"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/useful_scripts/loopdiagram.py#L497-L501 | train |
santoshphilip/eppy | eppy/EPlusInterfaceFunctions/parse_idd.py | get_nocom_vars | def get_nocom_vars(astr):
"""
input 'astr' which is the Energy+.idd file as a string
returns (st1, st2, lss)
st1 = with all the ! comments striped
st2 = strips all comments - both the '!' and '\\'
lss = nested list of all the variables in Energy+.idd file
"""
nocom = nocomment(astr, '!')... | python | def get_nocom_vars(astr):
"""
input 'astr' which is the Energy+.idd file as a string
returns (st1, st2, lss)
st1 = with all the ! comments striped
st2 = strips all comments - both the '!' and '\\'
lss = nested list of all the variables in Energy+.idd file
"""
nocom = nocomment(astr, '!')... | [
"def",
"get_nocom_vars",
"(",
"astr",
")",
":",
"nocom",
"=",
"nocomment",
"(",
"astr",
",",
"'!'",
")",
"# remove '!' comments",
"st1",
"=",
"nocom",
"nocom1",
"=",
"nocomment",
"(",
"st1",
",",
"'\\\\'",
")",
"# remove '\\' comments",
"st1",
"=",
"nocom",
... | input 'astr' which is the Energy+.idd file as a string
returns (st1, st2, lss)
st1 = with all the ! comments striped
st2 = strips all comments - both the '!' and '\\'
lss = nested list of all the variables in Energy+.idd file | [
"input",
"astr",
"which",
"is",
"the",
"Energy",
"+",
".",
"idd",
"file",
"as",
"a",
"string",
"returns",
"(",
"st1",
"st2",
"lss",
")",
"st1",
"=",
"with",
"all",
"the",
"!",
"comments",
"striped",
"st2",
"=",
"strips",
"all",
"comments",
"-",
"both... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/parse_idd.py#L39-L71 | train |
santoshphilip/eppy | eppy/EPlusInterfaceFunctions/parse_idd.py | removeblanklines | def removeblanklines(astr):
"""remove the blank lines in astr"""
lines = astr.splitlines()
lines = [line for line in lines if line.strip() != ""]
return "\n".join(lines) | python | def removeblanklines(astr):
"""remove the blank lines in astr"""
lines = astr.splitlines()
lines = [line for line in lines if line.strip() != ""]
return "\n".join(lines) | [
"def",
"removeblanklines",
"(",
"astr",
")",
":",
"lines",
"=",
"astr",
".",
"splitlines",
"(",
")",
"lines",
"=",
"[",
"line",
"for",
"line",
"in",
"lines",
"if",
"line",
".",
"strip",
"(",
")",
"!=",
"\"\"",
"]",
"return",
"\"\\n\"",
".",
"join",
... | remove the blank lines in astr | [
"remove",
"the",
"blank",
"lines",
"in",
"astr"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/parse_idd.py#L74-L78 | train |
santoshphilip/eppy | eppy/EPlusInterfaceFunctions/parse_idd.py | _readfname | def _readfname(fname):
"""copied from extractidddata below.
It deals with all the types of fnames"""
try:
if isinstance(fname, (file, StringIO)):
astr = fname.read()
else:
astr = open(fname, 'rb').read()
except NameError:
if isinstance(fname, (FileIO, Str... | python | def _readfname(fname):
"""copied from extractidddata below.
It deals with all the types of fnames"""
try:
if isinstance(fname, (file, StringIO)):
astr = fname.read()
else:
astr = open(fname, 'rb').read()
except NameError:
if isinstance(fname, (FileIO, Str... | [
"def",
"_readfname",
"(",
"fname",
")",
":",
"try",
":",
"if",
"isinstance",
"(",
"fname",
",",
"(",
"file",
",",
"StringIO",
")",
")",
":",
"astr",
"=",
"fname",
".",
"read",
"(",
")",
"else",
":",
"astr",
"=",
"open",
"(",
"fname",
",",
"'rb'",... | copied from extractidddata below.
It deals with all the types of fnames | [
"copied",
"from",
"extractidddata",
"below",
".",
"It",
"deals",
"with",
"all",
"the",
"types",
"of",
"fnames"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/parse_idd.py#L80-L93 | train |
santoshphilip/eppy | eppy/EPlusInterfaceFunctions/parse_idd.py | make_idd_index | def make_idd_index(extract_func, fname, debug):
"""generate the iddindex"""
astr = _readfname(fname)
# fname is exhausted by the above read
# reconstitute fname as a StringIO
fname = StringIO(astr)
# glist = iddgroups.iddtxt2grouplist(astr.decode('ISO-8859-2'))
blocklst, commlst,... | python | def make_idd_index(extract_func, fname, debug):
"""generate the iddindex"""
astr = _readfname(fname)
# fname is exhausted by the above read
# reconstitute fname as a StringIO
fname = StringIO(astr)
# glist = iddgroups.iddtxt2grouplist(astr.decode('ISO-8859-2'))
blocklst, commlst,... | [
"def",
"make_idd_index",
"(",
"extract_func",
",",
"fname",
",",
"debug",
")",
":",
"astr",
"=",
"_readfname",
"(",
"fname",
")",
"# fname is exhausted by the above read",
"# reconstitute fname as a StringIO",
"fname",
"=",
"StringIO",
"(",
"astr",
")",
"# glist = idd... | generate the iddindex | [
"generate",
"the",
"iddindex"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/parse_idd.py#L96-L114 | train |
santoshphilip/eppy | eppy/EPlusInterfaceFunctions/parse_idd.py | embedgroupdata | def embedgroupdata(extract_func, fname, debug):
"""insert group info into extracted idd"""
astr = _readfname(fname)
# fname is exhausted by the above read
# reconstitute fname as a StringIO
fname = StringIO(astr)
try:
astr = astr.decode('ISO-8859-2')
except Exception as e:... | python | def embedgroupdata(extract_func, fname, debug):
"""insert group info into extracted idd"""
astr = _readfname(fname)
# fname is exhausted by the above read
# reconstitute fname as a StringIO
fname = StringIO(astr)
try:
astr = astr.decode('ISO-8859-2')
except Exception as e:... | [
"def",
"embedgroupdata",
"(",
"extract_func",
",",
"fname",
",",
"debug",
")",
":",
"astr",
"=",
"_readfname",
"(",
"fname",
")",
"# fname is exhausted by the above read",
"# reconstitute fname as a StringIO",
"fname",
"=",
"StringIO",
"(",
"astr",
")",
"try",
":",
... | insert group info into extracted idd | [
"insert",
"group",
"info",
"into",
"extracted",
"idd"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/parse_idd.py#L117-L138 | train |
santoshphilip/eppy | eppy/EPlusInterfaceFunctions/parse_idd.py | extractidddata | def extractidddata(fname, debug=False):
"""
extracts all the needed information out of the idd file
if debug is True, it generates a series of text files.
Each text file is incrementally different. You can do a diff
see what the change is
-
this code is from 2004.
it works.
I am try... | python | def extractidddata(fname, debug=False):
"""
extracts all the needed information out of the idd file
if debug is True, it generates a series of text files.
Each text file is incrementally different. You can do a diff
see what the change is
-
this code is from 2004.
it works.
I am try... | [
"def",
"extractidddata",
"(",
"fname",
",",
"debug",
"=",
"False",
")",
":",
"try",
":",
"if",
"isinstance",
"(",
"fname",
",",
"(",
"file",
",",
"StringIO",
")",
")",
":",
"astr",
"=",
"fname",
".",
"read",
"(",
")",
"try",
":",
"astr",
"=",
"as... | extracts all the needed information out of the idd file
if debug is True, it generates a series of text files.
Each text file is incrementally different. You can do a diff
see what the change is
-
this code is from 2004.
it works.
I am trying not to change it (until I rewrite the whole thin... | [
"extracts",
"all",
"the",
"needed",
"information",
"out",
"of",
"the",
"idd",
"file",
"if",
"debug",
"is",
"True",
"it",
"generates",
"a",
"series",
"of",
"text",
"files",
".",
"Each",
"text",
"file",
"is",
"incrementally",
"different",
".",
"You",
"can",
... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/parse_idd.py#L142-L385 | train |
santoshphilip/eppy | eppy/EPlusInterfaceFunctions/parse_idd.py | getobjectref | def getobjectref(blocklst, commdct):
"""
makes a dictionary of object-lists
each item in the dictionary points to a list of tuples
the tuple is (objectname, fieldindex)
"""
objlst_dct = {}
for eli in commdct:
for elj in eli:
if 'object-list' in elj:
objli... | python | def getobjectref(blocklst, commdct):
"""
makes a dictionary of object-lists
each item in the dictionary points to a list of tuples
the tuple is (objectname, fieldindex)
"""
objlst_dct = {}
for eli in commdct:
for elj in eli:
if 'object-list' in elj:
objli... | [
"def",
"getobjectref",
"(",
"blocklst",
",",
"commdct",
")",
":",
"objlst_dct",
"=",
"{",
"}",
"for",
"eli",
"in",
"commdct",
":",
"for",
"elj",
"in",
"eli",
":",
"if",
"'object-list'",
"in",
"elj",
":",
"objlist",
"=",
"elj",
"[",
"'object-list'",
"]"... | makes a dictionary of object-lists
each item in the dictionary points to a list of tuples
the tuple is (objectname, fieldindex) | [
"makes",
"a",
"dictionary",
"of",
"object",
"-",
"lists",
"each",
"item",
"in",
"the",
"dictionary",
"points",
"to",
"a",
"list",
"of",
"tuples",
"the",
"tuple",
"is",
"(",
"objectname",
"fieldindex",
")"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/parse_idd.py#L388-L408 | train |
santoshphilip/eppy | eppy/EPlusInterfaceFunctions/readidf.py | readdatacommlst | def readdatacommlst(idfname):
"""read the idf file"""
# iddfile = sys.path[0] + '/EplusCode/Energy+.idd'
iddfile = 'Energy+.idd'
# iddfile = './EPlusInterfaceFunctions/E1.idd' # TODO : can the path name be not hard coded
iddtxt = open(iddfile, 'r').read()
block, commlst, commdct = parse_idd.extr... | python | def readdatacommlst(idfname):
"""read the idf file"""
# iddfile = sys.path[0] + '/EplusCode/Energy+.idd'
iddfile = 'Energy+.idd'
# iddfile = './EPlusInterfaceFunctions/E1.idd' # TODO : can the path name be not hard coded
iddtxt = open(iddfile, 'r').read()
block, commlst, commdct = parse_idd.extr... | [
"def",
"readdatacommlst",
"(",
"idfname",
")",
":",
"# iddfile = sys.path[0] + '/EplusCode/Energy+.idd'",
"iddfile",
"=",
"'Energy+.idd'",
"# iddfile = './EPlusInterfaceFunctions/E1.idd' # TODO : can the path name be not hard coded",
"iddtxt",
"=",
"open",
"(",
"iddfile",
",",
"'r'... | read the idf file | [
"read",
"the",
"idf",
"file"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/readidf.py#L60-L70 | train |
santoshphilip/eppy | eppy/EPlusInterfaceFunctions/readidf.py | readdatacommdct | def readdatacommdct(idfname, iddfile='Energy+.idd', commdct=None):
"""read the idf file"""
if not commdct:
block, commlst, commdct, idd_index = parse_idd.extractidddata(iddfile)
theidd = eplusdata.Idd(block, 2)
else:
theidd = iddfile
data = eplusdata.Eplusdata(theidd, idfname)
... | python | def readdatacommdct(idfname, iddfile='Energy+.idd', commdct=None):
"""read the idf file"""
if not commdct:
block, commlst, commdct, idd_index = parse_idd.extractidddata(iddfile)
theidd = eplusdata.Idd(block, 2)
else:
theidd = iddfile
data = eplusdata.Eplusdata(theidd, idfname)
... | [
"def",
"readdatacommdct",
"(",
"idfname",
",",
"iddfile",
"=",
"'Energy+.idd'",
",",
"commdct",
"=",
"None",
")",
":",
"if",
"not",
"commdct",
":",
"block",
",",
"commlst",
",",
"commdct",
",",
"idd_index",
"=",
"parse_idd",
".",
"extractidddata",
"(",
"id... | read the idf file | [
"read",
"the",
"idf",
"file"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/readidf.py#L72-L80 | train |
santoshphilip/eppy | eppy/loops.py | extractfields | def extractfields(data, commdct, objkey, fieldlists):
"""get all the objects of objkey.
fieldlists will have a fieldlist for each of those objects.
return the contents of those fields"""
# TODO : this assumes that the field list identical for
# each instance of the object. This is not true.
# So... | python | def extractfields(data, commdct, objkey, fieldlists):
"""get all the objects of objkey.
fieldlists will have a fieldlist for each of those objects.
return the contents of those fields"""
# TODO : this assumes that the field list identical for
# each instance of the object. This is not true.
# So... | [
"def",
"extractfields",
"(",
"data",
",",
"commdct",
",",
"objkey",
",",
"fieldlists",
")",
":",
"# TODO : this assumes that the field list identical for",
"# each instance of the object. This is not true.",
"# So we should have a field list for each instance of the object",
"# and map... | get all the objects of objkey.
fieldlists will have a fieldlist for each of those objects.
return the contents of those fields | [
"get",
"all",
"the",
"objects",
"of",
"objkey",
".",
"fieldlists",
"will",
"have",
"a",
"fieldlist",
"for",
"each",
"of",
"those",
"objects",
".",
"return",
"the",
"contents",
"of",
"those",
"fields"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/loops.py#L21-L60 | train |
santoshphilip/eppy | eppy/loops.py | plantloopfieldlists | def plantloopfieldlists(data):
"""return the plantloopfield list"""
objkey = 'plantloop'.upper()
numobjects = len(data.dt[objkey])
return [[
'Name',
'Plant Side Inlet Node Name',
'Plant Side Outlet Node Name',
'Plant Side Branch List Name',
'Demand Side Inlet Node... | python | def plantloopfieldlists(data):
"""return the plantloopfield list"""
objkey = 'plantloop'.upper()
numobjects = len(data.dt[objkey])
return [[
'Name',
'Plant Side Inlet Node Name',
'Plant Side Outlet Node Name',
'Plant Side Branch List Name',
'Demand Side Inlet Node... | [
"def",
"plantloopfieldlists",
"(",
"data",
")",
":",
"objkey",
"=",
"'plantloop'",
".",
"upper",
"(",
")",
"numobjects",
"=",
"len",
"(",
"data",
".",
"dt",
"[",
"objkey",
"]",
")",
"return",
"[",
"[",
"'Name'",
",",
"'Plant Side Inlet Node Name'",
",",
... | return the plantloopfield list | [
"return",
"the",
"plantloopfield",
"list"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/loops.py#L62-L73 | train |
santoshphilip/eppy | eppy/loops.py | plantloopfields | def plantloopfields(data, commdct):
"""get plantloop fields to diagram it"""
fieldlists = plantloopfieldlists(data)
objkey = 'plantloop'.upper()
return extractfields(data, commdct, objkey, fieldlists) | python | def plantloopfields(data, commdct):
"""get plantloop fields to diagram it"""
fieldlists = plantloopfieldlists(data)
objkey = 'plantloop'.upper()
return extractfields(data, commdct, objkey, fieldlists) | [
"def",
"plantloopfields",
"(",
"data",
",",
"commdct",
")",
":",
"fieldlists",
"=",
"plantloopfieldlists",
"(",
"data",
")",
"objkey",
"=",
"'plantloop'",
".",
"upper",
"(",
")",
"return",
"extractfields",
"(",
"data",
",",
"commdct",
",",
"objkey",
",",
"... | get plantloop fields to diagram it | [
"get",
"plantloop",
"fields",
"to",
"diagram",
"it"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/loops.py#L75-L79 | train |
santoshphilip/eppy | eppy/loops.py | branchlist2branches | def branchlist2branches(data, commdct, branchlist):
"""get branches from the branchlist"""
objkey = 'BranchList'.upper()
theobjects = data.dt[objkey]
fieldlists = []
objnames = [obj[1] for obj in theobjects]
for theobject in theobjects:
fieldlists.append(list(range(2, len(theobject))))
... | python | def branchlist2branches(data, commdct, branchlist):
"""get branches from the branchlist"""
objkey = 'BranchList'.upper()
theobjects = data.dt[objkey]
fieldlists = []
objnames = [obj[1] for obj in theobjects]
for theobject in theobjects:
fieldlists.append(list(range(2, len(theobject))))
... | [
"def",
"branchlist2branches",
"(",
"data",
",",
"commdct",
",",
"branchlist",
")",
":",
"objkey",
"=",
"'BranchList'",
".",
"upper",
"(",
")",
"theobjects",
"=",
"data",
".",
"dt",
"[",
"objkey",
"]",
"fieldlists",
"=",
"[",
"]",
"objnames",
"=",
"[",
... | get branches from the branchlist | [
"get",
"branches",
"from",
"the",
"branchlist"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/loops.py#L81-L92 | train |
santoshphilip/eppy | eppy/loops.py | branch_inlet_outlet | def branch_inlet_outlet(data, commdct, branchname):
"""return the inlet and outlet of a branch"""
objkey = 'Branch'.upper()
theobjects = data.dt[objkey]
theobject = [obj for obj in theobjects if obj[1] == branchname]
theobject = theobject[0]
inletindex = 6
outletindex = len(theobject) - 2
... | python | def branch_inlet_outlet(data, commdct, branchname):
"""return the inlet and outlet of a branch"""
objkey = 'Branch'.upper()
theobjects = data.dt[objkey]
theobject = [obj for obj in theobjects if obj[1] == branchname]
theobject = theobject[0]
inletindex = 6
outletindex = len(theobject) - 2
... | [
"def",
"branch_inlet_outlet",
"(",
"data",
",",
"commdct",
",",
"branchname",
")",
":",
"objkey",
"=",
"'Branch'",
".",
"upper",
"(",
")",
"theobjects",
"=",
"data",
".",
"dt",
"[",
"objkey",
"]",
"theobject",
"=",
"[",
"obj",
"for",
"obj",
"in",
"theo... | return the inlet and outlet of a branch | [
"return",
"the",
"inlet",
"and",
"outlet",
"of",
"a",
"branch"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/loops.py#L94-L102 | train |
santoshphilip/eppy | eppy/loops.py | splittermixerfieldlists | def splittermixerfieldlists(data, commdct, objkey):
"""docstring for splittermixerfieldlists"""
objkey = objkey.upper()
objindex = data.dtls.index(objkey)
objcomms = commdct[objindex]
theobjects = data.dt[objkey]
fieldlists = []
for theobject in theobjects:
fieldlist = list(range(1, ... | python | def splittermixerfieldlists(data, commdct, objkey):
"""docstring for splittermixerfieldlists"""
objkey = objkey.upper()
objindex = data.dtls.index(objkey)
objcomms = commdct[objindex]
theobjects = data.dt[objkey]
fieldlists = []
for theobject in theobjects:
fieldlist = list(range(1, ... | [
"def",
"splittermixerfieldlists",
"(",
"data",
",",
"commdct",
",",
"objkey",
")",
":",
"objkey",
"=",
"objkey",
".",
"upper",
"(",
")",
"objindex",
"=",
"data",
".",
"dtls",
".",
"index",
"(",
"objkey",
")",
"objcomms",
"=",
"commdct",
"[",
"objindex",
... | docstring for splittermixerfieldlists | [
"docstring",
"for",
"splittermixerfieldlists"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/loops.py#L104-L114 | train |
santoshphilip/eppy | eppy/loops.py | splitterfields | def splitterfields(data, commdct):
"""get splitter fields to diagram it"""
objkey = "Connector:Splitter".upper()
fieldlists = splittermixerfieldlists(data, commdct, objkey)
return extractfields(data, commdct, objkey, fieldlists) | python | def splitterfields(data, commdct):
"""get splitter fields to diagram it"""
objkey = "Connector:Splitter".upper()
fieldlists = splittermixerfieldlists(data, commdct, objkey)
return extractfields(data, commdct, objkey, fieldlists) | [
"def",
"splitterfields",
"(",
"data",
",",
"commdct",
")",
":",
"objkey",
"=",
"\"Connector:Splitter\"",
".",
"upper",
"(",
")",
"fieldlists",
"=",
"splittermixerfieldlists",
"(",
"data",
",",
"commdct",
",",
"objkey",
")",
"return",
"extractfields",
"(",
"dat... | get splitter fields to diagram it | [
"get",
"splitter",
"fields",
"to",
"diagram",
"it"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/loops.py#L116-L120 | train |
santoshphilip/eppy | eppy/loops.py | mixerfields | def mixerfields(data, commdct):
"""get mixer fields to diagram it"""
objkey = "Connector:Mixer".upper()
fieldlists = splittermixerfieldlists(data, commdct, objkey)
return extractfields(data, commdct, objkey, fieldlists) | python | def mixerfields(data, commdct):
"""get mixer fields to diagram it"""
objkey = "Connector:Mixer".upper()
fieldlists = splittermixerfieldlists(data, commdct, objkey)
return extractfields(data, commdct, objkey, fieldlists) | [
"def",
"mixerfields",
"(",
"data",
",",
"commdct",
")",
":",
"objkey",
"=",
"\"Connector:Mixer\"",
".",
"upper",
"(",
")",
"fieldlists",
"=",
"splittermixerfieldlists",
"(",
"data",
",",
"commdct",
",",
"objkey",
")",
"return",
"extractfields",
"(",
"data",
... | get mixer fields to diagram it | [
"get",
"mixer",
"fields",
"to",
"diagram",
"it"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/loops.py#L122-L126 | train |
santoshphilip/eppy | eppy/loops.py | repeatingfields | def repeatingfields(theidd, commdct, objkey, flds):
"""return a list of repeating fields
fld is in format 'Component %s Name'
so flds = [fld % (i, ) for i in range(n)]
does not work for 'fields as indicated' """
# TODO : make it work for 'fields as indicated'
if type(flds) != list:
flds ... | python | def repeatingfields(theidd, commdct, objkey, flds):
"""return a list of repeating fields
fld is in format 'Component %s Name'
so flds = [fld % (i, ) for i in range(n)]
does not work for 'fields as indicated' """
# TODO : make it work for 'fields as indicated'
if type(flds) != list:
flds ... | [
"def",
"repeatingfields",
"(",
"theidd",
",",
"commdct",
",",
"objkey",
",",
"flds",
")",
":",
"# TODO : make it work for 'fields as indicated'",
"if",
"type",
"(",
"flds",
")",
"!=",
"list",
":",
"flds",
"=",
"[",
"flds",
"]",
"# for backward compatability",
"o... | return a list of repeating fields
fld is in format 'Component %s Name'
so flds = [fld % (i, ) for i in range(n)]
does not work for 'fields as indicated' | [
"return",
"a",
"list",
"of",
"repeating",
"fields",
"fld",
"is",
"in",
"format",
"Component",
"%s",
"Name",
"so",
"flds",
"=",
"[",
"fld",
"%",
"(",
"i",
")",
"for",
"i",
"in",
"range",
"(",
"n",
")",
"]",
"does",
"not",
"work",
"for",
"fields",
... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/loops.py#L129-L153 | train |
santoshphilip/eppy | eppy/loops.py | objectcount | def objectcount(data, key):
"""return the count of objects of key"""
objkey = key.upper()
return len(data.dt[objkey]) | python | def objectcount(data, key):
"""return the count of objects of key"""
objkey = key.upper()
return len(data.dt[objkey]) | [
"def",
"objectcount",
"(",
"data",
",",
"key",
")",
":",
"objkey",
"=",
"key",
".",
"upper",
"(",
")",
"return",
"len",
"(",
"data",
".",
"dt",
"[",
"objkey",
"]",
")"
] | return the count of objects of key | [
"return",
"the",
"count",
"of",
"objects",
"of",
"key"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/loops.py#L155-L158 | train |
santoshphilip/eppy | eppy/loops.py | getfieldindex | def getfieldindex(data, commdct, objkey, fname):
"""given objkey and fieldname, return its index"""
objindex = data.dtls.index(objkey)
objcomm = commdct[objindex]
for i_index, item in enumerate(objcomm):
try:
if item['field'] == [fname]:
break
except KeyError ... | python | def getfieldindex(data, commdct, objkey, fname):
"""given objkey and fieldname, return its index"""
objindex = data.dtls.index(objkey)
objcomm = commdct[objindex]
for i_index, item in enumerate(objcomm):
try:
if item['field'] == [fname]:
break
except KeyError ... | [
"def",
"getfieldindex",
"(",
"data",
",",
"commdct",
",",
"objkey",
",",
"fname",
")",
":",
"objindex",
"=",
"data",
".",
"dtls",
".",
"index",
"(",
"objkey",
")",
"objcomm",
"=",
"commdct",
"[",
"objindex",
"]",
"for",
"i_index",
",",
"item",
"in",
... | given objkey and fieldname, return its index | [
"given",
"objkey",
"and",
"fieldname",
"return",
"its",
"index"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/loops.py#L160-L170 | train |
santoshphilip/eppy | eppy/loops.py | getadistus | def getadistus(data, commdct):
"""docstring for fname"""
objkey = "ZoneHVAC:AirDistributionUnit".upper()
objindex = data.dtls.index(objkey)
objcomm = commdct[objindex]
adistutypefield = "Air Terminal Object Type"
ifield = getfieldindex(data, commdct, objkey, adistutypefield)
adistus = objcom... | python | def getadistus(data, commdct):
"""docstring for fname"""
objkey = "ZoneHVAC:AirDistributionUnit".upper()
objindex = data.dtls.index(objkey)
objcomm = commdct[objindex]
adistutypefield = "Air Terminal Object Type"
ifield = getfieldindex(data, commdct, objkey, adistutypefield)
adistus = objcom... | [
"def",
"getadistus",
"(",
"data",
",",
"commdct",
")",
":",
"objkey",
"=",
"\"ZoneHVAC:AirDistributionUnit\"",
".",
"upper",
"(",
")",
"objindex",
"=",
"data",
".",
"dtls",
".",
"index",
"(",
"objkey",
")",
"objcomm",
"=",
"commdct",
"[",
"objindex",
"]",
... | docstring for fname | [
"docstring",
"for",
"fname"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/loops.py#L172-L180 | train |
santoshphilip/eppy | eppy/loops.py | makeadistu_inlets | def makeadistu_inlets(data, commdct):
"""make the dict adistu_inlets"""
adistus = getadistus(data, commdct)
# assume that the inlet node has the words "Air Inlet Node Name"
airinletnode = "Air Inlet Node Name"
adistu_inlets = {}
for adistu in adistus:
objkey = adistu.upper()
obji... | python | def makeadistu_inlets(data, commdct):
"""make the dict adistu_inlets"""
adistus = getadistus(data, commdct)
# assume that the inlet node has the words "Air Inlet Node Name"
airinletnode = "Air Inlet Node Name"
adistu_inlets = {}
for adistu in adistus:
objkey = adistu.upper()
obji... | [
"def",
"makeadistu_inlets",
"(",
"data",
",",
"commdct",
")",
":",
"adistus",
"=",
"getadistus",
"(",
"data",
",",
"commdct",
")",
"# assume that the inlet node has the words \"Air Inlet Node Name\"",
"airinletnode",
"=",
"\"Air Inlet Node Name\"",
"adistu_inlets",
"=",
"... | make the dict adistu_inlets | [
"make",
"the",
"dict",
"adistu_inlets"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/loops.py#L182-L200 | train |
santoshphilip/eppy | eppy/idd_helpers.py | folder2ver | def folder2ver(folder):
"""get the version number from the E+ install folder"""
ver = folder.split('EnergyPlus')[-1]
ver = ver[1:]
splitapp = ver.split('-')
ver = '.'.join(splitapp)
return ver | python | def folder2ver(folder):
"""get the version number from the E+ install folder"""
ver = folder.split('EnergyPlus')[-1]
ver = ver[1:]
splitapp = ver.split('-')
ver = '.'.join(splitapp)
return ver | [
"def",
"folder2ver",
"(",
"folder",
")",
":",
"ver",
"=",
"folder",
".",
"split",
"(",
"'EnergyPlus'",
")",
"[",
"-",
"1",
"]",
"ver",
"=",
"ver",
"[",
"1",
":",
"]",
"splitapp",
"=",
"ver",
".",
"split",
"(",
"'-'",
")",
"ver",
"=",
"'.'",
"."... | get the version number from the E+ install folder | [
"get",
"the",
"version",
"number",
"from",
"the",
"E",
"+",
"install",
"folder"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/idd_helpers.py#L29-L35 | train |
santoshphilip/eppy | eppy/simpleread.py | nocomment | def nocomment(astr, com='!'):
"""
just like the comment in python.
removes any text after the phrase 'com'
"""
alist = astr.splitlines()
for i in range(len(alist)):
element = alist[i]
pnt = element.find(com)
if pnt != -1:
alist[i] = element[:pnt]
return '\... | python | def nocomment(astr, com='!'):
"""
just like the comment in python.
removes any text after the phrase 'com'
"""
alist = astr.splitlines()
for i in range(len(alist)):
element = alist[i]
pnt = element.find(com)
if pnt != -1:
alist[i] = element[:pnt]
return '\... | [
"def",
"nocomment",
"(",
"astr",
",",
"com",
"=",
"'!'",
")",
":",
"alist",
"=",
"astr",
".",
"splitlines",
"(",
")",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"alist",
")",
")",
":",
"element",
"=",
"alist",
"[",
"i",
"]",
"pnt",
"=",
"eleme... | just like the comment in python.
removes any text after the phrase 'com' | [
"just",
"like",
"the",
"comment",
"in",
"python",
".",
"removes",
"any",
"text",
"after",
"the",
"phrase",
"com"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/simpleread.py#L16-L27 | train |
santoshphilip/eppy | eppy/simpleread.py | idf2txt | def idf2txt(txt):
"""convert the idf text to a simple text"""
astr = nocomment(txt)
objs = astr.split(';')
objs = [obj.split(',') for obj in objs]
objs = [[line.strip() for line in obj] for obj in objs]
objs = [[_tofloat(line) for line in obj] for obj in objs]
objs = [tuple(obj) for obj in o... | python | def idf2txt(txt):
"""convert the idf text to a simple text"""
astr = nocomment(txt)
objs = astr.split(';')
objs = [obj.split(',') for obj in objs]
objs = [[line.strip() for line in obj] for obj in objs]
objs = [[_tofloat(line) for line in obj] for obj in objs]
objs = [tuple(obj) for obj in o... | [
"def",
"idf2txt",
"(",
"txt",
")",
":",
"astr",
"=",
"nocomment",
"(",
"txt",
")",
"objs",
"=",
"astr",
".",
"split",
"(",
"';'",
")",
"objs",
"=",
"[",
"obj",
".",
"split",
"(",
"','",
")",
"for",
"obj",
"in",
"objs",
"]",
"objs",
"=",
"[",
... | convert the idf text to a simple text | [
"convert",
"the",
"idf",
"text",
"to",
"a",
"simple",
"text"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/simpleread.py#L37-L53 | train |
santoshphilip/eppy | eppy/idfreader.py | iddversiontuple | def iddversiontuple(afile):
"""given the idd file or filehandle, return the version handle"""
def versiontuple(vers):
"""version tuple"""
return tuple([int(num) for num in vers.split(".")])
try:
fhandle = open(afile, 'rb')
except TypeError:
fhandle = afile
line1 = fha... | python | def iddversiontuple(afile):
"""given the idd file or filehandle, return the version handle"""
def versiontuple(vers):
"""version tuple"""
return tuple([int(num) for num in vers.split(".")])
try:
fhandle = open(afile, 'rb')
except TypeError:
fhandle = afile
line1 = fha... | [
"def",
"iddversiontuple",
"(",
"afile",
")",
":",
"def",
"versiontuple",
"(",
"vers",
")",
":",
"\"\"\"version tuple\"\"\"",
"return",
"tuple",
"(",
"[",
"int",
"(",
"num",
")",
"for",
"num",
"in",
"vers",
".",
"split",
"(",
"\".\"",
")",
"]",
")",
"tr... | given the idd file or filehandle, return the version handle | [
"given",
"the",
"idd",
"file",
"or",
"filehandle",
"return",
"the",
"version",
"handle"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/idfreader.py#L23-L41 | train |
santoshphilip/eppy | eppy/idfreader.py | makeabunch | def makeabunch(commdct, obj, obj_i):
"""make a bunch from the object"""
objidd = commdct[obj_i]
objfields = [comm.get('field') for comm in commdct[obj_i]]
objfields[0] = ['key']
objfields = [field[0] for field in objfields]
obj_fields = [bunchhelpers.makefieldname(field) for field in objfields]
... | python | def makeabunch(commdct, obj, obj_i):
"""make a bunch from the object"""
objidd = commdct[obj_i]
objfields = [comm.get('field') for comm in commdct[obj_i]]
objfields[0] = ['key']
objfields = [field[0] for field in objfields]
obj_fields = [bunchhelpers.makefieldname(field) for field in objfields]
... | [
"def",
"makeabunch",
"(",
"commdct",
",",
"obj",
",",
"obj_i",
")",
":",
"objidd",
"=",
"commdct",
"[",
"obj_i",
"]",
"objfields",
"=",
"[",
"comm",
".",
"get",
"(",
"'field'",
")",
"for",
"comm",
"in",
"commdct",
"[",
"obj_i",
"]",
"]",
"objfields",... | make a bunch from the object | [
"make",
"a",
"bunch",
"from",
"the",
"object"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/idfreader.py#L44-L52 | train |
santoshphilip/eppy | eppy/idfreader.py | makebunches | def makebunches(data, commdct):
"""make bunches with data"""
bunchdt = {}
ddtt, dtls = data.dt, data.dtls
for obj_i, key in enumerate(dtls):
key = key.upper()
bunchdt[key] = []
objs = ddtt[key]
for obj in objs:
bobj = makeabunch(commdct, obj, obj_i)
... | python | def makebunches(data, commdct):
"""make bunches with data"""
bunchdt = {}
ddtt, dtls = data.dt, data.dtls
for obj_i, key in enumerate(dtls):
key = key.upper()
bunchdt[key] = []
objs = ddtt[key]
for obj in objs:
bobj = makeabunch(commdct, obj, obj_i)
... | [
"def",
"makebunches",
"(",
"data",
",",
"commdct",
")",
":",
"bunchdt",
"=",
"{",
"}",
"ddtt",
",",
"dtls",
"=",
"data",
".",
"dt",
",",
"data",
".",
"dtls",
"for",
"obj_i",
",",
"key",
"in",
"enumerate",
"(",
"dtls",
")",
":",
"key",
"=",
"key",... | make bunches with data | [
"make",
"bunches",
"with",
"data"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/idfreader.py#L55-L66 | train |
santoshphilip/eppy | eppy/idfreader.py | makebunches_alter | def makebunches_alter(data, commdct, theidf):
"""make bunches with data"""
bunchdt = {}
dt, dtls = data.dt, data.dtls
for obj_i, key in enumerate(dtls):
key = key.upper()
objs = dt[key]
list1 = []
for obj in objs:
bobj = makeabunch(commdct, obj, obj_i)
... | python | def makebunches_alter(data, commdct, theidf):
"""make bunches with data"""
bunchdt = {}
dt, dtls = data.dt, data.dtls
for obj_i, key in enumerate(dtls):
key = key.upper()
objs = dt[key]
list1 = []
for obj in objs:
bobj = makeabunch(commdct, obj, obj_i)
... | [
"def",
"makebunches_alter",
"(",
"data",
",",
"commdct",
",",
"theidf",
")",
":",
"bunchdt",
"=",
"{",
"}",
"dt",
",",
"dtls",
"=",
"data",
".",
"dt",
",",
"data",
".",
"dtls",
"for",
"obj_i",
",",
"key",
"in",
"enumerate",
"(",
"dtls",
")",
":",
... | make bunches with data | [
"make",
"bunches",
"with",
"data"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/idfreader.py#L69-L81 | train |
santoshphilip/eppy | eppy/idfreader.py | convertfields_old | def convertfields_old(key_comm, obj, inblock=None):
"""convert the float and interger fields"""
convinidd = ConvInIDD()
typefunc = dict(integer=convinidd.integer, real=convinidd.real)
types = []
for comm in key_comm:
types.append(comm.get('type', [None])[0])
convs = [typefunc.get(typ, co... | python | def convertfields_old(key_comm, obj, inblock=None):
"""convert the float and interger fields"""
convinidd = ConvInIDD()
typefunc = dict(integer=convinidd.integer, real=convinidd.real)
types = []
for comm in key_comm:
types.append(comm.get('type', [None])[0])
convs = [typefunc.get(typ, co... | [
"def",
"convertfields_old",
"(",
"key_comm",
",",
"obj",
",",
"inblock",
"=",
"None",
")",
":",
"convinidd",
"=",
"ConvInIDD",
"(",
")",
"typefunc",
"=",
"dict",
"(",
"integer",
"=",
"convinidd",
".",
"integer",
",",
"real",
"=",
"convinidd",
".",
"real"... | convert the float and interger fields | [
"convert",
"the",
"float",
"and",
"interger",
"fields"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/idfreader.py#L110-L129 | train |
santoshphilip/eppy | eppy/idfreader.py | convertafield | def convertafield(field_comm, field_val, field_iddname):
"""convert field based on field info in IDD"""
convinidd = ConvInIDD()
field_typ = field_comm.get('type', [None])[0]
conv = convinidd.conv_dict().get(field_typ, convinidd.no_type)
return conv(field_val, field_iddname) | python | def convertafield(field_comm, field_val, field_iddname):
"""convert field based on field info in IDD"""
convinidd = ConvInIDD()
field_typ = field_comm.get('type', [None])[0]
conv = convinidd.conv_dict().get(field_typ, convinidd.no_type)
return conv(field_val, field_iddname) | [
"def",
"convertafield",
"(",
"field_comm",
",",
"field_val",
",",
"field_iddname",
")",
":",
"convinidd",
"=",
"ConvInIDD",
"(",
")",
"field_typ",
"=",
"field_comm",
".",
"get",
"(",
"'type'",
",",
"[",
"None",
"]",
")",
"[",
"0",
"]",
"conv",
"=",
"co... | convert field based on field info in IDD | [
"convert",
"field",
"based",
"on",
"field",
"info",
"in",
"IDD"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/idfreader.py#L132-L137 | train |
santoshphilip/eppy | eppy/idfreader.py | convertfields | def convertfields(key_comm, obj, inblock=None):
"""convert based on float, integer, and A1, N1"""
# f_ stands for field_
convinidd = ConvInIDD()
if not inblock:
inblock = ['does not start with N'] * len(obj)
for i, (f_comm, f_val, f_iddname) in enumerate(zip(key_comm, obj, inblock)):
... | python | def convertfields(key_comm, obj, inblock=None):
"""convert based on float, integer, and A1, N1"""
# f_ stands for field_
convinidd = ConvInIDD()
if not inblock:
inblock = ['does not start with N'] * len(obj)
for i, (f_comm, f_val, f_iddname) in enumerate(zip(key_comm, obj, inblock)):
... | [
"def",
"convertfields",
"(",
"key_comm",
",",
"obj",
",",
"inblock",
"=",
"None",
")",
":",
"# f_ stands for field_",
"convinidd",
"=",
"ConvInIDD",
"(",
")",
"if",
"not",
"inblock",
":",
"inblock",
"=",
"[",
"'does not start with N'",
"]",
"*",
"len",
"(",
... | convert based on float, integer, and A1, N1 | [
"convert",
"based",
"on",
"float",
"integer",
"and",
"A1",
"N1"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/idfreader.py#L139-L151 | train |
santoshphilip/eppy | eppy/idfreader.py | convertallfields | def convertallfields(data, commdct, block=None):
"""docstring for convertallfields"""
# import pdbdb; pdb.set_trace()
for key in list(data.dt.keys()):
objs = data.dt[key]
for i, obj in enumerate(objs):
key_i = data.dtls.index(key)
key_comm = commdct[key_i]
... | python | def convertallfields(data, commdct, block=None):
"""docstring for convertallfields"""
# import pdbdb; pdb.set_trace()
for key in list(data.dt.keys()):
objs = data.dt[key]
for i, obj in enumerate(objs):
key_i = data.dtls.index(key)
key_comm = commdct[key_i]
... | [
"def",
"convertallfields",
"(",
"data",
",",
"commdct",
",",
"block",
"=",
"None",
")",
":",
"# import pdbdb; pdb.set_trace()",
"for",
"key",
"in",
"list",
"(",
"data",
".",
"dt",
".",
"keys",
"(",
")",
")",
":",
"objs",
"=",
"data",
".",
"dt",
"[",
... | docstring for convertallfields | [
"docstring",
"for",
"convertallfields"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/idfreader.py#L156-L169 | train |
santoshphilip/eppy | eppy/idfreader.py | addfunctions | def addfunctions(dtls, bunchdt):
"""add functions to the objects"""
snames = [
"BuildingSurface:Detailed",
"Wall:Detailed",
"RoofCeiling:Detailed",
"Floor:Detailed",
"FenestrationSurface:Detailed",
"Shading:Site:Detailed",
"Shading:Building:Detailed",
... | python | def addfunctions(dtls, bunchdt):
"""add functions to the objects"""
snames = [
"BuildingSurface:Detailed",
"Wall:Detailed",
"RoofCeiling:Detailed",
"Floor:Detailed",
"FenestrationSurface:Detailed",
"Shading:Site:Detailed",
"Shading:Building:Detailed",
... | [
"def",
"addfunctions",
"(",
"dtls",
",",
"bunchdt",
")",
":",
"snames",
"=",
"[",
"\"BuildingSurface:Detailed\"",
",",
"\"Wall:Detailed\"",
",",
"\"RoofCeiling:Detailed\"",
",",
"\"Floor:Detailed\"",
",",
"\"FenestrationSurface:Detailed\"",
",",
"\"Shading:Site:Detailed\"",... | add functions to the objects | [
"add",
"functions",
"to",
"the",
"objects"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/idfreader.py#L172-L198 | train |
santoshphilip/eppy | eppy/idfreader.py | addfunctions2new | def addfunctions2new(abunch, key):
"""add functions to a new bunch/munch object"""
snames = [
"BuildingSurface:Detailed",
"Wall:Detailed",
"RoofCeiling:Detailed",
"Floor:Detailed",
"FenestrationSurface:Detailed",
"Shading:Site:Detailed",
"Shading:Building:... | python | def addfunctions2new(abunch, key):
"""add functions to a new bunch/munch object"""
snames = [
"BuildingSurface:Detailed",
"Wall:Detailed",
"RoofCeiling:Detailed",
"Floor:Detailed",
"FenestrationSurface:Detailed",
"Shading:Site:Detailed",
"Shading:Building:... | [
"def",
"addfunctions2new",
"(",
"abunch",
",",
"key",
")",
":",
"snames",
"=",
"[",
"\"BuildingSurface:Detailed\"",
",",
"\"Wall:Detailed\"",
",",
"\"RoofCeiling:Detailed\"",
",",
"\"Floor:Detailed\"",
",",
"\"FenestrationSurface:Detailed\"",
",",
"\"Shading:Site:Detailed\"... | add functions to a new bunch/munch object | [
"add",
"functions",
"to",
"a",
"new",
"bunch",
"/",
"munch",
"object"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/idfreader.py#L208-L233 | train |
santoshphilip/eppy | eppy/idfreader.py | idfreader | def idfreader(fname, iddfile, conv=True):
"""read idf file and return bunches"""
data, commdct, idd_index = readidf.readdatacommdct(fname, iddfile=iddfile)
if conv:
convertallfields(data, commdct)
# fill gaps in idd
ddtt, dtls = data.dt, data.dtls
# skiplist = ["TABLE:MULTIVARIABLELOOKUP... | python | def idfreader(fname, iddfile, conv=True):
"""read idf file and return bunches"""
data, commdct, idd_index = readidf.readdatacommdct(fname, iddfile=iddfile)
if conv:
convertallfields(data, commdct)
# fill gaps in idd
ddtt, dtls = data.dt, data.dtls
# skiplist = ["TABLE:MULTIVARIABLELOOKUP... | [
"def",
"idfreader",
"(",
"fname",
",",
"iddfile",
",",
"conv",
"=",
"True",
")",
":",
"data",
",",
"commdct",
",",
"idd_index",
"=",
"readidf",
".",
"readdatacommdct",
"(",
"fname",
",",
"iddfile",
"=",
"iddfile",
")",
"if",
"conv",
":",
"convertallfield... | read idf file and return bunches | [
"read",
"idf",
"file",
"and",
"return",
"bunches"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/idfreader.py#L236-L249 | train |
santoshphilip/eppy | eppy/idfreader.py | idfreader1 | def idfreader1(fname, iddfile, theidf, conv=True, commdct=None, block=None):
"""read idf file and return bunches"""
versiontuple = iddversiontuple(iddfile)
# import pdb; pdb.set_trace()
block, data, commdct, idd_index = readidf.readdatacommdct1(
fname,
iddfile=iddfile,
commdct=co... | python | def idfreader1(fname, iddfile, theidf, conv=True, commdct=None, block=None):
"""read idf file and return bunches"""
versiontuple = iddversiontuple(iddfile)
# import pdb; pdb.set_trace()
block, data, commdct, idd_index = readidf.readdatacommdct1(
fname,
iddfile=iddfile,
commdct=co... | [
"def",
"idfreader1",
"(",
"fname",
",",
"iddfile",
",",
"theidf",
",",
"conv",
"=",
"True",
",",
"commdct",
"=",
"None",
",",
"block",
"=",
"None",
")",
":",
"versiontuple",
"=",
"iddversiontuple",
"(",
"iddfile",
")",
"# import pdb; pdb.set_trace()",
"block... | read idf file and return bunches | [
"read",
"idf",
"file",
"and",
"return",
"bunches"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/idfreader.py#L252-L275 | train |
santoshphilip/eppy | eppy/idfreader.py | ConvInIDD.conv_dict | def conv_dict(self):
"""dictionary of conversion"""
return dict(integer=self.integer, real=self.real, no_type=self.no_type) | python | def conv_dict(self):
"""dictionary of conversion"""
return dict(integer=self.integer, real=self.real, no_type=self.no_type) | [
"def",
"conv_dict",
"(",
"self",
")",
":",
"return",
"dict",
"(",
"integer",
"=",
"self",
".",
"integer",
",",
"real",
"=",
"self",
".",
"real",
",",
"no_type",
"=",
"self",
".",
"no_type",
")"
] | dictionary of conversion | [
"dictionary",
"of",
"conversion"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/idfreader.py#L103-L105 | train |
santoshphilip/eppy | eppy/idf_helpers.py | getanymentions | def getanymentions(idf, anidfobject):
"""Find out if idjobject is mentioned an any object anywhere"""
name = anidfobject.obj[1]
foundobjs = []
keys = idfobjectkeys(idf)
idfkeyobjects = [idf.idfobjects[key.upper()] for key in keys]
for idfobjects in idfkeyobjects:
for idfobject in idfobje... | python | def getanymentions(idf, anidfobject):
"""Find out if idjobject is mentioned an any object anywhere"""
name = anidfobject.obj[1]
foundobjs = []
keys = idfobjectkeys(idf)
idfkeyobjects = [idf.idfobjects[key.upper()] for key in keys]
for idfobjects in idfkeyobjects:
for idfobject in idfobje... | [
"def",
"getanymentions",
"(",
"idf",
",",
"anidfobject",
")",
":",
"name",
"=",
"anidfobject",
".",
"obj",
"[",
"1",
"]",
"foundobjs",
"=",
"[",
"]",
"keys",
"=",
"idfobjectkeys",
"(",
"idf",
")",
"idfkeyobjects",
"=",
"[",
"idf",
".",
"idfobjects",
"[... | Find out if idjobject is mentioned an any object anywhere | [
"Find",
"out",
"if",
"idjobject",
"is",
"mentioned",
"an",
"any",
"object",
"anywhere"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/idf_helpers.py#L30-L42 | train |
santoshphilip/eppy | eppy/idf_helpers.py | getobject_use_prevfield | def getobject_use_prevfield(idf, idfobject, fieldname):
"""field=object_name, prev_field=object_type. Return the object"""
if not fieldname.endswith("Name"):
return None
# test if prevfieldname ends with "Object_Type"
fdnames = idfobject.fieldnames
ifieldname = fdnames.index(fieldname)
p... | python | def getobject_use_prevfield(idf, idfobject, fieldname):
"""field=object_name, prev_field=object_type. Return the object"""
if not fieldname.endswith("Name"):
return None
# test if prevfieldname ends with "Object_Type"
fdnames = idfobject.fieldnames
ifieldname = fdnames.index(fieldname)
p... | [
"def",
"getobject_use_prevfield",
"(",
"idf",
",",
"idfobject",
",",
"fieldname",
")",
":",
"if",
"not",
"fieldname",
".",
"endswith",
"(",
"\"Name\"",
")",
":",
"return",
"None",
"# test if prevfieldname ends with \"Object_Type\"",
"fdnames",
"=",
"idfobject",
".",... | field=object_name, prev_field=object_type. Return the object | [
"field",
"=",
"object_name",
"prev_field",
"=",
"object_type",
".",
"Return",
"the",
"object"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/idf_helpers.py#L44-L60 | train |
santoshphilip/eppy | eppy/idf_helpers.py | getidfkeyswithnodes | def getidfkeyswithnodes():
"""return a list of keys of idfobjects that hve 'None Name' fields"""
idf = IDF(StringIO(""))
keys = idfobjectkeys(idf)
keysfieldnames = ((key, idf.newidfobject(key.upper()).fieldnames)
for key in keys)
keysnodefdnames = ((key, (name for name in fdnames
... | python | def getidfkeyswithnodes():
"""return a list of keys of idfobjects that hve 'None Name' fields"""
idf = IDF(StringIO(""))
keys = idfobjectkeys(idf)
keysfieldnames = ((key, idf.newidfobject(key.upper()).fieldnames)
for key in keys)
keysnodefdnames = ((key, (name for name in fdnames
... | [
"def",
"getidfkeyswithnodes",
"(",
")",
":",
"idf",
"=",
"IDF",
"(",
"StringIO",
"(",
"\"\"",
")",
")",
"keys",
"=",
"idfobjectkeys",
"(",
"idf",
")",
"keysfieldnames",
"=",
"(",
"(",
"key",
",",
"idf",
".",
"newidfobject",
"(",
"key",
".",
"upper",
... | return a list of keys of idfobjects that hve 'None Name' fields | [
"return",
"a",
"list",
"of",
"keys",
"of",
"idfobjects",
"that",
"hve",
"None",
"Name",
"fields"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/idf_helpers.py#L62-L72 | train |
santoshphilip/eppy | eppy/idf_helpers.py | getobjectswithnode | def getobjectswithnode(idf, nodekeys, nodename):
"""return all objects that mention this node name"""
keys = nodekeys
# TODO getidfkeyswithnodes needs to be done only once. take out of here
listofidfobjects = (idf.idfobjects[key.upper()]
for key in keys if idf.idfobjects[key.upper()])
... | python | def getobjectswithnode(idf, nodekeys, nodename):
"""return all objects that mention this node name"""
keys = nodekeys
# TODO getidfkeyswithnodes needs to be done only once. take out of here
listofidfobjects = (idf.idfobjects[key.upper()]
for key in keys if idf.idfobjects[key.upper()])
... | [
"def",
"getobjectswithnode",
"(",
"idf",
",",
"nodekeys",
",",
"nodename",
")",
":",
"keys",
"=",
"nodekeys",
"# TODO getidfkeyswithnodes needs to be done only once. take out of here",
"listofidfobjects",
"=",
"(",
"idf",
".",
"idfobjects",
"[",
"key",
".",
"upper",
"... | return all objects that mention this node name | [
"return",
"all",
"objects",
"that",
"mention",
"this",
"node",
"name"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/idf_helpers.py#L74-L92 | train |
santoshphilip/eppy | eppy/idf_helpers.py | name2idfobject | def name2idfobject(idf, groupnamess=None, objkeys=None, **kwargs):
"""return the object, if the Name or some other field is known.
send filed in **kwargs as Name='a name', Roughness='smooth'
Returns the first find (field search is unordered)
objkeys -> if objkeys=['ZONE', 'Material'], search only those
... | python | def name2idfobject(idf, groupnamess=None, objkeys=None, **kwargs):
"""return the object, if the Name or some other field is known.
send filed in **kwargs as Name='a name', Roughness='smooth'
Returns the first find (field search is unordered)
objkeys -> if objkeys=['ZONE', 'Material'], search only those
... | [
"def",
"name2idfobject",
"(",
"idf",
",",
"groupnamess",
"=",
"None",
",",
"objkeys",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"# TODO : this is a very slow search. revist to speed it up.",
"if",
"not",
"objkeys",
":",
"objkeys",
"=",
"idfobjectkeys",
"(",
... | return the object, if the Name or some other field is known.
send filed in **kwargs as Name='a name', Roughness='smooth'
Returns the first find (field search is unordered)
objkeys -> if objkeys=['ZONE', 'Material'], search only those
groupnames -> not yet coded | [
"return",
"the",
"object",
"if",
"the",
"Name",
"or",
"some",
"other",
"field",
"is",
"known",
".",
"send",
"filed",
"in",
"**",
"kwargs",
"as",
"Name",
"=",
"a",
"name",
"Roughness",
"=",
"smooth",
"Returns",
"the",
"first",
"find",
"(",
"field",
"sea... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/idf_helpers.py#L94-L111 | train |
santoshphilip/eppy | eppy/idf_helpers.py | getidfobjectlist | def getidfobjectlist(idf):
"""return a list of all idfobjects in idf"""
idfobjects = idf.idfobjects
# idfobjlst = [idfobjects[key] for key in idfobjects if idfobjects[key]]
idfobjlst = [idfobjects[key] for key in idf.model.dtls if idfobjects[key]]
# `for key in idf.model.dtls` maintains the or... | python | def getidfobjectlist(idf):
"""return a list of all idfobjects in idf"""
idfobjects = idf.idfobjects
# idfobjlst = [idfobjects[key] for key in idfobjects if idfobjects[key]]
idfobjlst = [idfobjects[key] for key in idf.model.dtls if idfobjects[key]]
# `for key in idf.model.dtls` maintains the or... | [
"def",
"getidfobjectlist",
"(",
"idf",
")",
":",
"idfobjects",
"=",
"idf",
".",
"idfobjects",
"# idfobjlst = [idfobjects[key] for key in idfobjects if idfobjects[key]]",
"idfobjlst",
"=",
"[",
"idfobjects",
"[",
"key",
"]",
"for",
"key",
"in",
"idf",
".",
"model",
"... | return a list of all idfobjects in idf | [
"return",
"a",
"list",
"of",
"all",
"idfobjects",
"in",
"idf"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/idf_helpers.py#L113-L122 | train |
santoshphilip/eppy | eppy/idf_helpers.py | copyidfintoidf | def copyidfintoidf(toidf, fromidf):
"""copy fromidf completely into toidf"""
idfobjlst = getidfobjectlist(fromidf)
for idfobj in idfobjlst:
toidf.copyidfobject(idfobj) | python | def copyidfintoidf(toidf, fromidf):
"""copy fromidf completely into toidf"""
idfobjlst = getidfobjectlist(fromidf)
for idfobj in idfobjlst:
toidf.copyidfobject(idfobj) | [
"def",
"copyidfintoidf",
"(",
"toidf",
",",
"fromidf",
")",
":",
"idfobjlst",
"=",
"getidfobjectlist",
"(",
"fromidf",
")",
"for",
"idfobj",
"in",
"idfobjlst",
":",
"toidf",
".",
"copyidfobject",
"(",
"idfobj",
")"
] | copy fromidf completely into toidf | [
"copy",
"fromidf",
"completely",
"into",
"toidf"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/idf_helpers.py#L124-L128 | train |
santoshphilip/eppy | eppy/useful_scripts/idfdiff_missing.py | idfdiffs | def idfdiffs(idf1, idf2):
"""return the diffs between the two idfs"""
thediffs = {}
keys = idf1.model.dtls # undocumented variable
for akey in keys:
idfobjs1 = idf1.idfobjects[akey]
idfobjs2 = idf2.idfobjects[akey]
names = set([getobjname(i) for i in idfobjs1] +
... | python | def idfdiffs(idf1, idf2):
"""return the diffs between the two idfs"""
thediffs = {}
keys = idf1.model.dtls # undocumented variable
for akey in keys:
idfobjs1 = idf1.idfobjects[akey]
idfobjs2 = idf2.idfobjects[akey]
names = set([getobjname(i) for i in idfobjs1] +
... | [
"def",
"idfdiffs",
"(",
"idf1",
",",
"idf2",
")",
":",
"thediffs",
"=",
"{",
"}",
"keys",
"=",
"idf1",
".",
"model",
".",
"dtls",
"# undocumented variable",
"for",
"akey",
"in",
"keys",
":",
"idfobjs1",
"=",
"idf1",
".",
"idfobjects",
"[",
"akey",
"]",... | return the diffs between the two idfs | [
"return",
"the",
"diffs",
"between",
"the",
"two",
"idfs"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/useful_scripts/idfdiff_missing.py#L92-L127 | train |
santoshphilip/eppy | eppy/useful_scripts/autosize.py | autosize_fieldname | def autosize_fieldname(idfobject):
"""return autsizeable field names in idfobject"""
# undocumented stuff in this code
return [fname for (fname, dct) in zip(idfobject.objls,
idfobject['objidd'])
if 'autosizable' in dct] | python | def autosize_fieldname(idfobject):
"""return autsizeable field names in idfobject"""
# undocumented stuff in this code
return [fname for (fname, dct) in zip(idfobject.objls,
idfobject['objidd'])
if 'autosizable' in dct] | [
"def",
"autosize_fieldname",
"(",
"idfobject",
")",
":",
"# undocumented stuff in this code",
"return",
"[",
"fname",
"for",
"(",
"fname",
",",
"dct",
")",
"in",
"zip",
"(",
"idfobject",
".",
"objls",
",",
"idfobject",
"[",
"'objidd'",
"]",
")",
"if",
"'auto... | return autsizeable field names in idfobject | [
"return",
"autsizeable",
"field",
"names",
"in",
"idfobject"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/useful_scripts/autosize.py#L36-L41 | train |
santoshphilip/eppy | eppy/EPlusInterfaceFunctions/iddgroups.py | idd2group | def idd2group(fhandle):
"""wrapper for iddtxt2groups"""
try:
txt = fhandle.read()
return iddtxt2groups(txt)
except AttributeError as e:
txt = open(fhandle, 'r').read()
return iddtxt2groups(txt) | python | def idd2group(fhandle):
"""wrapper for iddtxt2groups"""
try:
txt = fhandle.read()
return iddtxt2groups(txt)
except AttributeError as e:
txt = open(fhandle, 'r').read()
return iddtxt2groups(txt) | [
"def",
"idd2group",
"(",
"fhandle",
")",
":",
"try",
":",
"txt",
"=",
"fhandle",
".",
"read",
"(",
")",
"return",
"iddtxt2groups",
"(",
"txt",
")",
"except",
"AttributeError",
"as",
"e",
":",
"txt",
"=",
"open",
"(",
"fhandle",
",",
"'r'",
")",
".",
... | wrapper for iddtxt2groups | [
"wrapper",
"for",
"iddtxt2groups"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/iddgroups.py#L27-L34 | train |
santoshphilip/eppy | eppy/EPlusInterfaceFunctions/iddgroups.py | idd2grouplist | def idd2grouplist(fhandle):
"""wrapper for iddtxt2grouplist"""
try:
txt = fhandle.read()
return iddtxt2grouplist(txt)
except AttributeError as e:
txt = open(fhandle, 'r').read()
return iddtxt2grouplist(txt) | python | def idd2grouplist(fhandle):
"""wrapper for iddtxt2grouplist"""
try:
txt = fhandle.read()
return iddtxt2grouplist(txt)
except AttributeError as e:
txt = open(fhandle, 'r').read()
return iddtxt2grouplist(txt) | [
"def",
"idd2grouplist",
"(",
"fhandle",
")",
":",
"try",
":",
"txt",
"=",
"fhandle",
".",
"read",
"(",
")",
"return",
"iddtxt2grouplist",
"(",
"txt",
")",
"except",
"AttributeError",
"as",
"e",
":",
"txt",
"=",
"open",
"(",
"fhandle",
",",
"'r'",
")",
... | wrapper for iddtxt2grouplist | [
"wrapper",
"for",
"iddtxt2grouplist"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/iddgroups.py#L36-L43 | train |
santoshphilip/eppy | eppy/EPlusInterfaceFunctions/iddgroups.py | iddtxt2groups | def iddtxt2groups(txt):
"""extract the groups from the idd file"""
try:
txt = txt.decode('ISO-8859-2')
except AttributeError as e:
pass # for python 3
txt = nocomment(txt, '!')
txt = txt.replace("\\group", "!-group") # retains group in next line
txt = nocomment(txt, '\\') # remov... | python | def iddtxt2groups(txt):
"""extract the groups from the idd file"""
try:
txt = txt.decode('ISO-8859-2')
except AttributeError as e:
pass # for python 3
txt = nocomment(txt, '!')
txt = txt.replace("\\group", "!-group") # retains group in next line
txt = nocomment(txt, '\\') # remov... | [
"def",
"iddtxt2groups",
"(",
"txt",
")",
":",
"try",
":",
"txt",
"=",
"txt",
".",
"decode",
"(",
"'ISO-8859-2'",
")",
"except",
"AttributeError",
"as",
"e",
":",
"pass",
"# for python 3",
"txt",
"=",
"nocomment",
"(",
"txt",
",",
"'!'",
")",
"txt",
"="... | extract the groups from the idd file | [
"extract",
"the",
"groups",
"from",
"the",
"idd",
"file"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/iddgroups.py#L46-L82 | train |
santoshphilip/eppy | eppy/EPlusInterfaceFunctions/iddgroups.py | iddtxt2grouplist | def iddtxt2grouplist(txt):
"""return a list of group names
the list in the same order as the idf objects in idd file
"""
def makenone(astr):
if astr == 'None':
return None
else:
return astr
txt = nocomment(txt, '!')
txt = txt.replace("\\group", "!-group")... | python | def iddtxt2grouplist(txt):
"""return a list of group names
the list in the same order as the idf objects in idd file
"""
def makenone(astr):
if astr == 'None':
return None
else:
return astr
txt = nocomment(txt, '!')
txt = txt.replace("\\group", "!-group")... | [
"def",
"iddtxt2grouplist",
"(",
"txt",
")",
":",
"def",
"makenone",
"(",
"astr",
")",
":",
"if",
"astr",
"==",
"'None'",
":",
"return",
"None",
"else",
":",
"return",
"astr",
"txt",
"=",
"nocomment",
"(",
"txt",
",",
"'!'",
")",
"txt",
"=",
"txt",
... | return a list of group names
the list in the same order as the idf objects in idd file | [
"return",
"a",
"list",
"of",
"group",
"names",
"the",
"list",
"in",
"the",
"same",
"order",
"as",
"the",
"idf",
"objects",
"in",
"idd",
"file"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/iddgroups.py#L84-L129 | train |
santoshphilip/eppy | eppy/EPlusInterfaceFunctions/iddgroups.py | group2commlst | def group2commlst(commlst, glist):
"""add group info to commlst"""
for (gname, objname), commitem in zip(glist, commlst):
newitem1 = "group %s" % (gname, )
newitem2 = "idfobj %s" % (objname, )
commitem[0].insert(0, newitem1)
commitem[0].insert(1, newitem2)
return commlst | python | def group2commlst(commlst, glist):
"""add group info to commlst"""
for (gname, objname), commitem in zip(glist, commlst):
newitem1 = "group %s" % (gname, )
newitem2 = "idfobj %s" % (objname, )
commitem[0].insert(0, newitem1)
commitem[0].insert(1, newitem2)
return commlst | [
"def",
"group2commlst",
"(",
"commlst",
",",
"glist",
")",
":",
"for",
"(",
"gname",
",",
"objname",
")",
",",
"commitem",
"in",
"zip",
"(",
"glist",
",",
"commlst",
")",
":",
"newitem1",
"=",
"\"group %s\"",
"%",
"(",
"gname",
",",
")",
"newitem2",
... | add group info to commlst | [
"add",
"group",
"info",
"to",
"commlst"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/iddgroups.py#L131-L138 | train |
santoshphilip/eppy | eppy/EPlusInterfaceFunctions/iddgroups.py | group2commdct | def group2commdct(commdct, glist):
"""add group info tocomdct"""
for (gname, objname), commitem in zip(glist, commdct):
commitem[0]['group'] = gname
commitem[0]['idfobj'] = objname
return commdct | python | def group2commdct(commdct, glist):
"""add group info tocomdct"""
for (gname, objname), commitem in zip(glist, commdct):
commitem[0]['group'] = gname
commitem[0]['idfobj'] = objname
return commdct | [
"def",
"group2commdct",
"(",
"commdct",
",",
"glist",
")",
":",
"for",
"(",
"gname",
",",
"objname",
")",
",",
"commitem",
"in",
"zip",
"(",
"glist",
",",
"commdct",
")",
":",
"commitem",
"[",
"0",
"]",
"[",
"'group'",
"]",
"=",
"gname",
"commitem",
... | add group info tocomdct | [
"add",
"group",
"info",
"tocomdct"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/iddgroups.py#L140-L145 | train |
santoshphilip/eppy | eppy/EPlusInterfaceFunctions/iddgroups.py | commdct2grouplist | def commdct2grouplist(gcommdct):
"""extract embedded group data from commdct.
return gdict -> {g1:[obj1, obj2, obj3], g2:[obj4, ..]}"""
gdict = {}
for objidd in gcommdct:
group = objidd[0]['group']
objname = objidd[0]['idfobj']
if group in gdict:
gdict[group].append(o... | python | def commdct2grouplist(gcommdct):
"""extract embedded group data from commdct.
return gdict -> {g1:[obj1, obj2, obj3], g2:[obj4, ..]}"""
gdict = {}
for objidd in gcommdct:
group = objidd[0]['group']
objname = objidd[0]['idfobj']
if group in gdict:
gdict[group].append(o... | [
"def",
"commdct2grouplist",
"(",
"gcommdct",
")",
":",
"gdict",
"=",
"{",
"}",
"for",
"objidd",
"in",
"gcommdct",
":",
"group",
"=",
"objidd",
"[",
"0",
"]",
"[",
"'group'",
"]",
"objname",
"=",
"objidd",
"[",
"0",
"]",
"[",
"'idfobj'",
"]",
"if",
... | extract embedded group data from commdct.
return gdict -> {g1:[obj1, obj2, obj3], g2:[obj4, ..]} | [
"extract",
"embedded",
"group",
"data",
"from",
"commdct",
".",
"return",
"gdict",
"-",
">",
"{",
"g1",
":",
"[",
"obj1",
"obj2",
"obj3",
"]",
"g2",
":",
"[",
"obj4",
"..",
"]",
"}"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/iddgroups.py#L147-L158 | train |
santoshphilip/eppy | eppy/hvacbuilder.py | flattencopy | def flattencopy(lst):
"""flatten and return a copy of the list
indefficient on large lists"""
# modified from
# http://stackoverflow.com/questions/2158395/flatten-an-irregular-list-of-lists-in-python
thelist = copy.deepcopy(lst)
list_is_nested = True
while list_is_nested: # outer loop
... | python | def flattencopy(lst):
"""flatten and return a copy of the list
indefficient on large lists"""
# modified from
# http://stackoverflow.com/questions/2158395/flatten-an-irregular-list-of-lists-in-python
thelist = copy.deepcopy(lst)
list_is_nested = True
while list_is_nested: # outer loop
... | [
"def",
"flattencopy",
"(",
"lst",
")",
":",
"# modified from",
"# http://stackoverflow.com/questions/2158395/flatten-an-irregular-list-of-lists-in-python",
"thelist",
"=",
"copy",
".",
"deepcopy",
"(",
"lst",
")",
"list_is_nested",
"=",
"True",
"while",
"list_is_nested",
":... | flatten and return a copy of the list
indefficient on large lists | [
"flatten",
"and",
"return",
"a",
"copy",
"of",
"the",
"list",
"indefficient",
"on",
"large",
"lists"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/hvacbuilder.py#L52-L70 | train |
santoshphilip/eppy | eppy/hvacbuilder.py | makepipecomponent | def makepipecomponent(idf, pname):
"""make a pipe component
generate inlet outlet names"""
apipe = idf.newidfobject("Pipe:Adiabatic".upper(), Name=pname)
apipe.Inlet_Node_Name = "%s_inlet" % (pname,)
apipe.Outlet_Node_Name = "%s_outlet" % (pname,)
return apipe | python | def makepipecomponent(idf, pname):
"""make a pipe component
generate inlet outlet names"""
apipe = idf.newidfobject("Pipe:Adiabatic".upper(), Name=pname)
apipe.Inlet_Node_Name = "%s_inlet" % (pname,)
apipe.Outlet_Node_Name = "%s_outlet" % (pname,)
return apipe | [
"def",
"makepipecomponent",
"(",
"idf",
",",
"pname",
")",
":",
"apipe",
"=",
"idf",
".",
"newidfobject",
"(",
"\"Pipe:Adiabatic\"",
".",
"upper",
"(",
")",
",",
"Name",
"=",
"pname",
")",
"apipe",
".",
"Inlet_Node_Name",
"=",
"\"%s_inlet\"",
"%",
"(",
"... | make a pipe component
generate inlet outlet names | [
"make",
"a",
"pipe",
"component",
"generate",
"inlet",
"outlet",
"names"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/hvacbuilder.py#L72-L78 | train |
santoshphilip/eppy | eppy/hvacbuilder.py | makeductcomponent | def makeductcomponent(idf, dname):
"""make a duct component
generate inlet outlet names"""
aduct = idf.newidfobject("duct".upper(), Name=dname)
aduct.Inlet_Node_Name = "%s_inlet" % (dname,)
aduct.Outlet_Node_Name = "%s_outlet" % (dname,)
return aduct | python | def makeductcomponent(idf, dname):
"""make a duct component
generate inlet outlet names"""
aduct = idf.newidfobject("duct".upper(), Name=dname)
aduct.Inlet_Node_Name = "%s_inlet" % (dname,)
aduct.Outlet_Node_Name = "%s_outlet" % (dname,)
return aduct | [
"def",
"makeductcomponent",
"(",
"idf",
",",
"dname",
")",
":",
"aduct",
"=",
"idf",
".",
"newidfobject",
"(",
"\"duct\"",
".",
"upper",
"(",
")",
",",
"Name",
"=",
"dname",
")",
"aduct",
".",
"Inlet_Node_Name",
"=",
"\"%s_inlet\"",
"%",
"(",
"dname",
... | make a duct component
generate inlet outlet names | [
"make",
"a",
"duct",
"component",
"generate",
"inlet",
"outlet",
"names"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/hvacbuilder.py#L80-L86 | train |
santoshphilip/eppy | eppy/hvacbuilder.py | makepipebranch | def makepipebranch(idf, bname):
"""make a branch with a pipe
use standard inlet outlet names"""
# make the pipe component first
pname = "%s_pipe" % (bname,)
apipe = makepipecomponent(idf, pname)
# now make the branch with the pipe in it
abranch = idf.newidfobject("BRANCH", Name=bname)
ab... | python | def makepipebranch(idf, bname):
"""make a branch with a pipe
use standard inlet outlet names"""
# make the pipe component first
pname = "%s_pipe" % (bname,)
apipe = makepipecomponent(idf, pname)
# now make the branch with the pipe in it
abranch = idf.newidfobject("BRANCH", Name=bname)
ab... | [
"def",
"makepipebranch",
"(",
"idf",
",",
"bname",
")",
":",
"# make the pipe component first",
"pname",
"=",
"\"%s_pipe\"",
"%",
"(",
"bname",
",",
")",
"apipe",
"=",
"makepipecomponent",
"(",
"idf",
",",
"pname",
")",
"# now make the branch with the pipe in it",
... | make a branch with a pipe
use standard inlet outlet names | [
"make",
"a",
"branch",
"with",
"a",
"pipe",
"use",
"standard",
"inlet",
"outlet",
"names"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/hvacbuilder.py#L88-L101 | train |
santoshphilip/eppy | eppy/hvacbuilder.py | makeductbranch | def makeductbranch(idf, bname):
"""make a branch with a duct
use standard inlet outlet names"""
# make the duct component first
pname = "%s_duct" % (bname,)
aduct = makeductcomponent(idf, pname)
# now make the branch with the duct in it
abranch = idf.newidfobject("BRANCH", Name=bname)
ab... | python | def makeductbranch(idf, bname):
"""make a branch with a duct
use standard inlet outlet names"""
# make the duct component first
pname = "%s_duct" % (bname,)
aduct = makeductcomponent(idf, pname)
# now make the branch with the duct in it
abranch = idf.newidfobject("BRANCH", Name=bname)
ab... | [
"def",
"makeductbranch",
"(",
"idf",
",",
"bname",
")",
":",
"# make the duct component first",
"pname",
"=",
"\"%s_duct\"",
"%",
"(",
"bname",
",",
")",
"aduct",
"=",
"makeductcomponent",
"(",
"idf",
",",
"pname",
")",
"# now make the branch with the duct in it",
... | make a branch with a duct
use standard inlet outlet names | [
"make",
"a",
"branch",
"with",
"a",
"duct",
"use",
"standard",
"inlet",
"outlet",
"names"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/hvacbuilder.py#L103-L116 | train |
santoshphilip/eppy | eppy/hvacbuilder.py | getbranchcomponents | def getbranchcomponents(idf, branch, utest=False):
"""get the components of the branch"""
fobjtype = 'Component_%s_Object_Type'
fobjname = 'Component_%s_Name'
complist = []
for i in range(1, 100000):
try:
objtype = branch[fobjtype % (i,)]
if objtype.strip() == '':
... | python | def getbranchcomponents(idf, branch, utest=False):
"""get the components of the branch"""
fobjtype = 'Component_%s_Object_Type'
fobjname = 'Component_%s_Name'
complist = []
for i in range(1, 100000):
try:
objtype = branch[fobjtype % (i,)]
if objtype.strip() == '':
... | [
"def",
"getbranchcomponents",
"(",
"idf",
",",
"branch",
",",
"utest",
"=",
"False",
")",
":",
"fobjtype",
"=",
"'Component_%s_Object_Type'",
"fobjname",
"=",
"'Component_%s_Name'",
"complist",
"=",
"[",
"]",
"for",
"i",
"in",
"range",
"(",
"1",
",",
"100000... | get the components of the branch | [
"get",
"the",
"components",
"of",
"the",
"branch"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/hvacbuilder.py#L118-L135 | train |
santoshphilip/eppy | eppy/hvacbuilder.py | renamenodes | def renamenodes(idf, fieldtype):
"""rename all the changed nodes"""
renameds = []
for key in idf.model.dtls:
for idfobject in idf.idfobjects[key]:
for fieldvalue in idfobject.obj:
if type(fieldvalue) is list:
if fieldvalue not in renameds:
... | python | def renamenodes(idf, fieldtype):
"""rename all the changed nodes"""
renameds = []
for key in idf.model.dtls:
for idfobject in idf.idfobjects[key]:
for fieldvalue in idfobject.obj:
if type(fieldvalue) is list:
if fieldvalue not in renameds:
... | [
"def",
"renamenodes",
"(",
"idf",
",",
"fieldtype",
")",
":",
"renameds",
"=",
"[",
"]",
"for",
"key",
"in",
"idf",
".",
"model",
".",
"dtls",
":",
"for",
"idfobject",
"in",
"idf",
".",
"idfobjects",
"[",
"key",
"]",
":",
"for",
"fieldvalue",
"in",
... | rename all the changed nodes | [
"rename",
"all",
"the",
"changed",
"nodes"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/hvacbuilder.py#L137-L162 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.