partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | easyopen | 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... | eppy/easyopen.py | 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):
"""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.
... | [
"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",
... | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/easyopen.py#L72-L143 | [
"def",
"easyopen",
"(",
"fname",
",",
"idd",
"=",
"None",
",",
"epw",
"=",
"None",
")",
":",
"if",
"idd",
":",
"eppy",
".",
"modeleditor",
".",
"IDF",
".",
"setiddname",
"(",
"idd",
")",
"idf",
"=",
"eppy",
".",
"modeleditor",
".",
"IDF",
"(",
"f... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | removecomment | 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 | eppy/EPlusInterfaceFunctions/eplusdata.py | 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):
"""
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(... | [
"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",
"-",
"... | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/eplusdata.py#L24-L38 | [
"def",
"removecomment",
"(",
"astr",
",",
"cphrase",
")",
":",
"# linesep = mylib3.getlinesep(astr)",
"alist",
"=",
"astr",
".",
"splitlines",
"(",
")",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"alist",
")",
")",
":",
"alist1",
"=",
"alist",
"[",
"i",... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | Idd.initdict2 | initdict2 | eppy/EPlusInterfaceFunctions/eplusdata.py | 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):
"""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 | [
"initdict2"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/eplusdata.py#L54-L62 | [
"def",
"initdict2",
"(",
"self",
",",
"dictfile",
")",
":",
"dt",
"=",
"{",
"}",
"dtls",
"=",
"[",
"]",
"adict",
"=",
"dictfile",
"for",
"element",
"in",
"adict",
":",
"dt",
"[",
"element",
"[",
"0",
"]",
".",
"upper",
"(",
")",
"]",
"=",
"[",
... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | Eplusdata.initdict | create a blank dictionary | eppy/EPlusInterfaceFunctions/eplusdata.py | 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):
"""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... | [
"create",
"a",
"blank",
"dictionary"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/eplusdata.py#L146-L174 | [
"def",
"initdict",
"(",
"self",
",",
"fname",
")",
":",
"if",
"isinstance",
"(",
"fname",
",",
"Idd",
")",
":",
"self",
".",
"dt",
",",
"self",
".",
"dtls",
"=",
"fname",
".",
"dt",
",",
"fname",
".",
"dtls",
"return",
"self",
".",
"dt",
",",
"... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | Eplusdata.makedict | stuff file data into the blank dictionary | eppy/EPlusInterfaceFunctions/eplusdata.py | 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):
"""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... | [
"stuff",
"file",
"data",
"into",
"the",
"blank",
"dictionary"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/eplusdata.py#L177-L220 | [
"def",
"makedict",
"(",
"self",
",",
"dictfile",
",",
"fnamefobject",
")",
":",
"#fname = './exapmlefiles/5ZoneDD.idf'",
"#fname = './1ZoneUncontrolled.idf'",
"if",
"isinstance",
"(",
"dictfile",
",",
"Idd",
")",
":",
"localidd",
"=",
"copy",
".",
"deepcopy",
"(",
... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | Eplusdata.replacenode | replace the node here with the node from othereplus | eppy/EPlusInterfaceFunctions/eplusdata.py | 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):
"""replace the node here with the node from othereplus"""
node = node.upper()
self.dt[node.upper()] = othereplus.dt[node.upper()] | [
"replace",
"the",
"node",
"here",
"with",
"the",
"node",
"from",
"othereplus"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/eplusdata.py#L222-L225 | [
"def",
"replacenode",
"(",
"self",
",",
"othereplus",
",",
"node",
")",
":",
"node",
"=",
"node",
".",
"upper",
"(",
")",
"self",
".",
"dt",
"[",
"node",
".",
"upper",
"(",
")",
"]",
"=",
"othereplus",
".",
"dt",
"[",
"node",
".",
"upper",
"(",
... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | Eplusdata.add2node | add the node here with the node from othereplus
this will potentially have duplicates | eppy/EPlusInterfaceFunctions/eplusdata.py | 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):
"""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()] | [
"add",
"the",
"node",
"here",
"with",
"the",
"node",
"from",
"othereplus",
"this",
"will",
"potentially",
"have",
"duplicates"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/eplusdata.py#L227-L232 | [
"def",
"add2node",
"(",
"self",
",",
"othereplus",
",",
"node",
")",
":",
"node",
"=",
"node",
".",
"upper",
"(",
")",
"self",
".",
"dt",
"[",
"node",
".",
"upper",
"(",
")",
"]",
"=",
"self",
".",
"dt",
"[",
"node",
".",
"upper",
"(",
")",
"... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | Eplusdata.addinnode | add an item to the node.
example: add a new zone to the element 'ZONE' | eppy/EPlusInterfaceFunctions/eplusdata.py | 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):
"""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()] | [
"add",
"an",
"item",
"to",
"the",
"node",
".",
"example",
":",
"add",
"a",
"new",
"zone",
"to",
"the",
"element",
"ZONE"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/eplusdata.py#L234-L238 | [
"def",
"addinnode",
"(",
"self",
",",
"otherplus",
",",
"node",
",",
"objectname",
")",
":",
"# do a test for unique object here",
"newelement",
"=",
"otherplus",
".",
"dt",
"[",
"node",
".",
"upper",
"(",
")",
"]"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | Eplusdata.getrefs | 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 | eppy/EPlusInterfaceFunctions/eplusdata.py | 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):
"""
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... | [
"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"
... | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/eplusdata.py#L240-L252 | [
"def",
"getrefs",
"(",
"self",
",",
"reflist",
")",
":",
"alist",
"=",
"[",
"]",
"for",
"element",
"in",
"reflist",
":",
"if",
"element",
"[",
"0",
"]",
".",
"upper",
"(",
")",
"in",
"self",
".",
"dt",
":",
"for",
"elm",
"in",
"self",
".",
"dt"... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | dropnodes | draw a graph without the nodes | eppy/useful_scripts/loopdiagram.py | 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):
"""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:... | [
"draw",
"a",
"graph",
"without",
"the",
"nodes"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/useful_scripts/loopdiagram.py#L65-L99 | [
"def",
"dropnodes",
"(",
"edges",
")",
":",
"newedges",
"=",
"[",
"]",
"added",
"=",
"False",
"for",
"edge",
"in",
"edges",
":",
"if",
"bothnodes",
"(",
"edge",
")",
":",
"newtup",
"=",
"(",
"edge",
"[",
"0",
"]",
"[",
"0",
"]",
",",
"edge",
"[... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | edges2nodes | gather the nodes from the edges | eppy/useful_scripts/loopdiagram.py | 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):
"""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... | [
"gather",
"the",
"nodes",
"from",
"the",
"edges"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/useful_scripts/loopdiagram.py#L127-L137 | [
"def",
"edges2nodes",
"(",
"edges",
")",
":",
"nodes",
"=",
"[",
"]",
"for",
"e1",
",",
"e2",
"in",
"edges",
":",
"nodes",
".",
"append",
"(",
"e1",
")",
"nodes",
".",
"append",
"(",
"e2",
")",
"nodedict",
"=",
"dict",
"(",
"[",
"(",
"n",
",",
... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | makediagram | make the diagram with the edges | eppy/useful_scripts/loopdiagram.py | 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):
"""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... | [
"make",
"the",
"diagram",
"with",
"the",
"edges"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/useful_scripts/loopdiagram.py#L140-L154 | [
"def",
"makediagram",
"(",
"edges",
")",
":",
"graph",
"=",
"pydot",
".",
"Dot",
"(",
"graph_type",
"=",
"'digraph'",
")",
"nodes",
"=",
"edges2nodes",
"(",
"edges",
")",
"epnodes",
"=",
"[",
"(",
"node",
",",
"makeanode",
"(",
"node",
"[",
"0",
"]",... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | makebranchcomponents | return the edges jointing the components of a branch | eppy/useful_scripts/loopdiagram.py | 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"):
"""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... | [
"return",
"the",
"edges",
"jointing",
"the",
"components",
"of",
"a",
"branch"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/useful_scripts/loopdiagram.py#L173-L203 | [
"def",
"makebranchcomponents",
"(",
"data",
",",
"commdct",
",",
"anode",
"=",
"\"epnode\"",
")",
":",
"alledges",
"=",
"[",
"]",
"objkey",
"=",
"'BRANCH'",
"cnamefield",
"=",
"\"Component %s Name\"",
"inletfield",
"=",
"\"Component %s Inlet Node Name\"",
"outletfie... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | makeairplantloop | make the edges for the airloop and the plantloop | eppy/useful_scripts/loopdiagram.py | 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):
"""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... | [
"make",
"the",
"edges",
"for",
"the",
"airloop",
"and",
"the",
"plantloop"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/useful_scripts/loopdiagram.py#L206-L494 | [
"def",
"makeairplantloop",
"(",
"data",
",",
"commdct",
")",
":",
"anode",
"=",
"\"epnode\"",
"endnode",
"=",
"\"EndNode\"",
"# in plantloop get:",
"# demand inlet, outlet, branchlist",
"# supply inlet, outlet, branchlist",
"plantloops",
"=",
"loops",
".",
"plantloo... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | getedges | return the edges of the idf file fname | eppy/useful_scripts/loopdiagram.py | 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):
"""return the edges of the idf file fname"""
data, commdct, _idd_index = readidf.readdatacommdct(fname, iddfile=iddfile)
edges = makeairplantloop(data, commdct)
return edges | [
"return",
"the",
"edges",
"of",
"the",
"idf",
"file",
"fname"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/useful_scripts/loopdiagram.py#L497-L501 | [
"def",
"getedges",
"(",
"fname",
",",
"iddfile",
")",
":",
"data",
",",
"commdct",
",",
"_idd_index",
"=",
"readidf",
".",
"readdatacommdct",
"(",
"fname",
",",
"iddfile",
"=",
"iddfile",
")",
"edges",
"=",
"makeairplantloop",
"(",
"data",
",",
"commdct",
... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | get_nocom_vars | 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 | eppy/EPlusInterfaceFunctions/parse_idd.py | 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):
"""
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, '!')... | [
"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... | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/parse_idd.py#L39-L71 | [
"def",
"get_nocom_vars",
"(",
"astr",
")",
":",
"nocom",
"=",
"nocomment",
"(",
"astr",
",",
"'!'",
")",
"# remove '!' comments",
"st1",
"=",
"nocom",
"nocom1",
"=",
"nocomment",
"(",
"st1",
",",
"'\\\\'",
")",
"# remove '\\' comments",
"st1",
"=",
"nocom",
... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | removeblanklines | remove the blank lines in astr | eppy/EPlusInterfaceFunctions/parse_idd.py | 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):
"""remove the blank lines in astr"""
lines = astr.splitlines()
lines = [line for line in lines if line.strip() != ""]
return "\n".join(lines) | [
"remove",
"the",
"blank",
"lines",
"in",
"astr"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/parse_idd.py#L74-L78 | [
"def",
"removeblanklines",
"(",
"astr",
")",
":",
"lines",
"=",
"astr",
".",
"splitlines",
"(",
")",
"lines",
"=",
"[",
"line",
"for",
"line",
"in",
"lines",
"if",
"line",
".",
"strip",
"(",
")",
"!=",
"\"\"",
"]",
"return",
"\"\\n\"",
".",
"join",
... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | _readfname | copied from extractidddata below.
It deals with all the types of fnames | eppy/EPlusInterfaceFunctions/parse_idd.py | 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):
"""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... | [
"copied",
"from",
"extractidddata",
"below",
".",
"It",
"deals",
"with",
"all",
"the",
"types",
"of",
"fnames"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/parse_idd.py#L80-L93 | [
"def",
"_readfname",
"(",
"fname",
")",
":",
"try",
":",
"if",
"isinstance",
"(",
"fname",
",",
"(",
"file",
",",
"StringIO",
")",
")",
":",
"astr",
"=",
"fname",
".",
"read",
"(",
")",
"else",
":",
"astr",
"=",
"open",
"(",
"fname",
",",
"'rb'",... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | make_idd_index | generate the iddindex | eppy/EPlusInterfaceFunctions/parse_idd.py | 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):
"""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,... | [
"generate",
"the",
"iddindex"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/parse_idd.py#L96-L114 | [
"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... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | embedgroupdata | insert group info into extracted idd | eppy/EPlusInterfaceFunctions/parse_idd.py | 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):
"""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:... | [
"insert",
"group",
"info",
"into",
"extracted",
"idd"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/parse_idd.py#L117-L138 | [
"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",
":",
... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | extractidddata | 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... | eppy/EPlusInterfaceFunctions/parse_idd.py | 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):
"""
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... | [
"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",
... | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/parse_idd.py#L142-L385 | [
"def",
"extractidddata",
"(",
"fname",
",",
"debug",
"=",
"False",
")",
":",
"try",
":",
"if",
"isinstance",
"(",
"fname",
",",
"(",
"file",
",",
"StringIO",
")",
")",
":",
"astr",
"=",
"fname",
".",
"read",
"(",
")",
"try",
":",
"astr",
"=",
"as... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | getobjectref | makes a dictionary of object-lists
each item in the dictionary points to a list of tuples
the tuple is (objectname, fieldindex) | eppy/EPlusInterfaceFunctions/parse_idd.py | 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):
"""
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... | [
"makes",
"a",
"dictionary",
"of",
"object",
"-",
"lists",
"each",
"item",
"in",
"the",
"dictionary",
"points",
"to",
"a",
"list",
"of",
"tuples",
"the",
"tuple",
"is",
"(",
"objectname",
"fieldindex",
")"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/parse_idd.py#L388-L408 | [
"def",
"getobjectref",
"(",
"blocklst",
",",
"commdct",
")",
":",
"objlst_dct",
"=",
"{",
"}",
"for",
"eli",
"in",
"commdct",
":",
"for",
"elj",
"in",
"eli",
":",
"if",
"'object-list'",
"in",
"elj",
":",
"objlist",
"=",
"elj",
"[",
"'object-list'",
"]"... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | readdatacommlst | read the idf file | eppy/EPlusInterfaceFunctions/readidf.py | 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):
"""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... | [
"read",
"the",
"idf",
"file"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/readidf.py#L60-L70 | [
"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'... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | readdatacommdct | read the idf file | eppy/EPlusInterfaceFunctions/readidf.py | 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):
"""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)
... | [
"read",
"the",
"idf",
"file"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/readidf.py#L72-L80 | [
"def",
"readdatacommdct",
"(",
"idfname",
",",
"iddfile",
"=",
"'Energy+.idd'",
",",
"commdct",
"=",
"None",
")",
":",
"if",
"not",
"commdct",
":",
"block",
",",
"commlst",
",",
"commdct",
",",
"idd_index",
"=",
"parse_idd",
".",
"extractidddata",
"(",
"id... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | extractfields | get all the objects of objkey.
fieldlists will have a fieldlist for each of those objects.
return the contents of those fields | eppy/loops.py | 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):
"""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... | [
"get",
"all",
"the",
"objects",
"of",
"objkey",
".",
"fieldlists",
"will",
"have",
"a",
"fieldlist",
"for",
"each",
"of",
"those",
"objects",
".",
"return",
"the",
"contents",
"of",
"those",
"fields"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/loops.py#L21-L60 | [
"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... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | plantloopfieldlists | return the plantloopfield list | eppy/loops.py | 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):
"""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... | [
"return",
"the",
"plantloopfield",
"list"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/loops.py#L62-L73 | [
"def",
"plantloopfieldlists",
"(",
"data",
")",
":",
"objkey",
"=",
"'plantloop'",
".",
"upper",
"(",
")",
"numobjects",
"=",
"len",
"(",
"data",
".",
"dt",
"[",
"objkey",
"]",
")",
"return",
"[",
"[",
"'Name'",
",",
"'Plant Side Inlet Node Name'",
",",
... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | plantloopfields | get plantloop fields to diagram it | eppy/loops.py | 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):
"""get plantloop fields to diagram it"""
fieldlists = plantloopfieldlists(data)
objkey = 'plantloop'.upper()
return extractfields(data, commdct, objkey, fieldlists) | [
"get",
"plantloop",
"fields",
"to",
"diagram",
"it"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/loops.py#L75-L79 | [
"def",
"plantloopfields",
"(",
"data",
",",
"commdct",
")",
":",
"fieldlists",
"=",
"plantloopfieldlists",
"(",
"data",
")",
"objkey",
"=",
"'plantloop'",
".",
"upper",
"(",
")",
"return",
"extractfields",
"(",
"data",
",",
"commdct",
",",
"objkey",
",",
"... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | branchlist2branches | get branches from the branchlist | eppy/loops.py | 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):
"""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))))
... | [
"get",
"branches",
"from",
"the",
"branchlist"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/loops.py#L81-L92 | [
"def",
"branchlist2branches",
"(",
"data",
",",
"commdct",
",",
"branchlist",
")",
":",
"objkey",
"=",
"'BranchList'",
".",
"upper",
"(",
")",
"theobjects",
"=",
"data",
".",
"dt",
"[",
"objkey",
"]",
"fieldlists",
"=",
"[",
"]",
"objnames",
"=",
"[",
... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | branch_inlet_outlet | return the inlet and outlet of a branch | eppy/loops.py | 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):
"""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
... | [
"return",
"the",
"inlet",
"and",
"outlet",
"of",
"a",
"branch"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/loops.py#L94-L102 | [
"def",
"branch_inlet_outlet",
"(",
"data",
",",
"commdct",
",",
"branchname",
")",
":",
"objkey",
"=",
"'Branch'",
".",
"upper",
"(",
")",
"theobjects",
"=",
"data",
".",
"dt",
"[",
"objkey",
"]",
"theobject",
"=",
"[",
"obj",
"for",
"obj",
"in",
"theo... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | splittermixerfieldlists | docstring for splittermixerfieldlists | eppy/loops.py | 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):
"""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, ... | [
"docstring",
"for",
"splittermixerfieldlists"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/loops.py#L104-L114 | [
"def",
"splittermixerfieldlists",
"(",
"data",
",",
"commdct",
",",
"objkey",
")",
":",
"objkey",
"=",
"objkey",
".",
"upper",
"(",
")",
"objindex",
"=",
"data",
".",
"dtls",
".",
"index",
"(",
"objkey",
")",
"objcomms",
"=",
"commdct",
"[",
"objindex",
... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | splitterfields | get splitter fields to diagram it | eppy/loops.py | 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):
"""get splitter fields to diagram it"""
objkey = "Connector:Splitter".upper()
fieldlists = splittermixerfieldlists(data, commdct, objkey)
return extractfields(data, commdct, objkey, fieldlists) | [
"get",
"splitter",
"fields",
"to",
"diagram",
"it"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/loops.py#L116-L120 | [
"def",
"splitterfields",
"(",
"data",
",",
"commdct",
")",
":",
"objkey",
"=",
"\"Connector:Splitter\"",
".",
"upper",
"(",
")",
"fieldlists",
"=",
"splittermixerfieldlists",
"(",
"data",
",",
"commdct",
",",
"objkey",
")",
"return",
"extractfields",
"(",
"dat... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | mixerfields | get mixer fields to diagram it | eppy/loops.py | 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):
"""get mixer fields to diagram it"""
objkey = "Connector:Mixer".upper()
fieldlists = splittermixerfieldlists(data, commdct, objkey)
return extractfields(data, commdct, objkey, fieldlists) | [
"get",
"mixer",
"fields",
"to",
"diagram",
"it"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/loops.py#L122-L126 | [
"def",
"mixerfields",
"(",
"data",
",",
"commdct",
")",
":",
"objkey",
"=",
"\"Connector:Mixer\"",
".",
"upper",
"(",
")",
"fieldlists",
"=",
"splittermixerfieldlists",
"(",
"data",
",",
"commdct",
",",
"objkey",
")",
"return",
"extractfields",
"(",
"data",
... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | repeatingfields | 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' | eppy/loops.py | 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):
"""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 ... | [
"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",
... | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/loops.py#L129-L153 | [
"def",
"repeatingfields",
"(",
"theidd",
",",
"commdct",
",",
"objkey",
",",
"flds",
")",
":",
"# TODO : make it work for 'fields as indicated'",
"if",
"type",
"(",
"flds",
")",
"!=",
"list",
":",
"flds",
"=",
"[",
"flds",
"]",
"# for backward compatability",
"o... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | objectcount | return the count of objects of key | eppy/loops.py | def objectcount(data, key):
"""return the count of objects of key"""
objkey = key.upper()
return len(data.dt[objkey]) | def objectcount(data, key):
"""return the count of objects of key"""
objkey = key.upper()
return len(data.dt[objkey]) | [
"return",
"the",
"count",
"of",
"objects",
"of",
"key"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/loops.py#L155-L158 | [
"def",
"objectcount",
"(",
"data",
",",
"key",
")",
":",
"objkey",
"=",
"key",
".",
"upper",
"(",
")",
"return",
"len",
"(",
"data",
".",
"dt",
"[",
"objkey",
"]",
")"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | getfieldindex | given objkey and fieldname, return its index | eppy/loops.py | 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):
"""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 ... | [
"given",
"objkey",
"and",
"fieldname",
"return",
"its",
"index"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/loops.py#L160-L170 | [
"def",
"getfieldindex",
"(",
"data",
",",
"commdct",
",",
"objkey",
",",
"fname",
")",
":",
"objindex",
"=",
"data",
".",
"dtls",
".",
"index",
"(",
"objkey",
")",
"objcomm",
"=",
"commdct",
"[",
"objindex",
"]",
"for",
"i_index",
",",
"item",
"in",
... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | getadistus | docstring for fname | eppy/loops.py | 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):
"""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... | [
"docstring",
"for",
"fname"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/loops.py#L172-L180 | [
"def",
"getadistus",
"(",
"data",
",",
"commdct",
")",
":",
"objkey",
"=",
"\"ZoneHVAC:AirDistributionUnit\"",
".",
"upper",
"(",
")",
"objindex",
"=",
"data",
".",
"dtls",
".",
"index",
"(",
"objkey",
")",
"objcomm",
"=",
"commdct",
"[",
"objindex",
"]",
... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | makeadistu_inlets | make the dict adistu_inlets | eppy/loops.py | 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):
"""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... | [
"make",
"the",
"dict",
"adistu_inlets"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/loops.py#L182-L200 | [
"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",
"=",
"... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | folder2ver | get the version number from the E+ install folder | eppy/idd_helpers.py | 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):
"""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 | [
"get",
"the",
"version",
"number",
"from",
"the",
"E",
"+",
"install",
"folder"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/idd_helpers.py#L29-L35 | [
"def",
"folder2ver",
"(",
"folder",
")",
":",
"ver",
"=",
"folder",
".",
"split",
"(",
"'EnergyPlus'",
")",
"[",
"-",
"1",
"]",
"ver",
"=",
"ver",
"[",
"1",
":",
"]",
"splitapp",
"=",
"ver",
".",
"split",
"(",
"'-'",
")",
"ver",
"=",
"'.'",
"."... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | nocomment | just like the comment in python.
removes any text after the phrase 'com' | eppy/simpleread.py | 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='!'):
"""
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 '\... | [
"just",
"like",
"the",
"comment",
"in",
"python",
".",
"removes",
"any",
"text",
"after",
"the",
"phrase",
"com"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/simpleread.py#L16-L27 | [
"def",
"nocomment",
"(",
"astr",
",",
"com",
"=",
"'!'",
")",
":",
"alist",
"=",
"astr",
".",
"splitlines",
"(",
")",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"alist",
")",
")",
":",
"element",
"=",
"alist",
"[",
"i",
"]",
"pnt",
"=",
"eleme... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | idf2txt | convert the idf text to a simple text | eppy/simpleread.py | 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):
"""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... | [
"convert",
"the",
"idf",
"text",
"to",
"a",
"simple",
"text"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/simpleread.py#L37-L53 | [
"def",
"idf2txt",
"(",
"txt",
")",
":",
"astr",
"=",
"nocomment",
"(",
"txt",
")",
"objs",
"=",
"astr",
".",
"split",
"(",
"';'",
")",
"objs",
"=",
"[",
"obj",
".",
"split",
"(",
"','",
")",
"for",
"obj",
"in",
"objs",
"]",
"objs",
"=",
"[",
... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | iddversiontuple | given the idd file or filehandle, return the version handle | eppy/idfreader.py | 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):
"""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... | [
"given",
"the",
"idd",
"file",
"or",
"filehandle",
"return",
"the",
"version",
"handle"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/idfreader.py#L23-L41 | [
"def",
"iddversiontuple",
"(",
"afile",
")",
":",
"def",
"versiontuple",
"(",
"vers",
")",
":",
"\"\"\"version tuple\"\"\"",
"return",
"tuple",
"(",
"[",
"int",
"(",
"num",
")",
"for",
"num",
"in",
"vers",
".",
"split",
"(",
"\".\"",
")",
"]",
")",
"tr... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | makeabunch | make a bunch from the object | eppy/idfreader.py | 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):
"""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]
... | [
"make",
"a",
"bunch",
"from",
"the",
"object"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/idfreader.py#L44-L52 | [
"def",
"makeabunch",
"(",
"commdct",
",",
"obj",
",",
"obj_i",
")",
":",
"objidd",
"=",
"commdct",
"[",
"obj_i",
"]",
"objfields",
"=",
"[",
"comm",
".",
"get",
"(",
"'field'",
")",
"for",
"comm",
"in",
"commdct",
"[",
"obj_i",
"]",
"]",
"objfields",... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | makebunches | make bunches with data | eppy/idfreader.py | 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):
"""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)
... | [
"make",
"bunches",
"with",
"data"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/idfreader.py#L55-L66 | [
"def",
"makebunches",
"(",
"data",
",",
"commdct",
")",
":",
"bunchdt",
"=",
"{",
"}",
"ddtt",
",",
"dtls",
"=",
"data",
".",
"dt",
",",
"data",
".",
"dtls",
"for",
"obj_i",
",",
"key",
"in",
"enumerate",
"(",
"dtls",
")",
":",
"key",
"=",
"key",... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | makebunches_alter | make bunches with data | eppy/idfreader.py | 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):
"""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)
... | [
"make",
"bunches",
"with",
"data"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/idfreader.py#L69-L81 | [
"def",
"makebunches_alter",
"(",
"data",
",",
"commdct",
",",
"theidf",
")",
":",
"bunchdt",
"=",
"{",
"}",
"dt",
",",
"dtls",
"=",
"data",
".",
"dt",
",",
"data",
".",
"dtls",
"for",
"obj_i",
",",
"key",
"in",
"enumerate",
"(",
"dtls",
")",
":",
... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | convertfields_old | convert the float and interger fields | eppy/idfreader.py | 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):
"""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... | [
"convert",
"the",
"float",
"and",
"interger",
"fields"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/idfreader.py#L110-L129 | [
"def",
"convertfields_old",
"(",
"key_comm",
",",
"obj",
",",
"inblock",
"=",
"None",
")",
":",
"convinidd",
"=",
"ConvInIDD",
"(",
")",
"typefunc",
"=",
"dict",
"(",
"integer",
"=",
"convinidd",
".",
"integer",
",",
"real",
"=",
"convinidd",
".",
"real"... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | convertafield | convert field based on field info in IDD | eppy/idfreader.py | 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):
"""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) | [
"convert",
"field",
"based",
"on",
"field",
"info",
"in",
"IDD"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/idfreader.py#L132-L137 | [
"def",
"convertafield",
"(",
"field_comm",
",",
"field_val",
",",
"field_iddname",
")",
":",
"convinidd",
"=",
"ConvInIDD",
"(",
")",
"field_typ",
"=",
"field_comm",
".",
"get",
"(",
"'type'",
",",
"[",
"None",
"]",
")",
"[",
"0",
"]",
"conv",
"=",
"co... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | convertfields | convert based on float, integer, and A1, N1 | eppy/idfreader.py | 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):
"""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)):
... | [
"convert",
"based",
"on",
"float",
"integer",
"and",
"A1",
"N1"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/idfreader.py#L139-L151 | [
"def",
"convertfields",
"(",
"key_comm",
",",
"obj",
",",
"inblock",
"=",
"None",
")",
":",
"# f_ stands for field_",
"convinidd",
"=",
"ConvInIDD",
"(",
")",
"if",
"not",
"inblock",
":",
"inblock",
"=",
"[",
"'does not start with N'",
"]",
"*",
"len",
"(",
... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | convertallfields | docstring for convertallfields | eppy/idfreader.py | 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):
"""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]
... | [
"docstring",
"for",
"convertallfields"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/idfreader.py#L156-L169 | [
"def",
"convertallfields",
"(",
"data",
",",
"commdct",
",",
"block",
"=",
"None",
")",
":",
"# import pdbdb; pdb.set_trace()",
"for",
"key",
"in",
"list",
"(",
"data",
".",
"dt",
".",
"keys",
"(",
")",
")",
":",
"objs",
"=",
"data",
".",
"dt",
"[",
... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | addfunctions | add functions to the objects | eppy/idfreader.py | 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):
"""add functions to the objects"""
snames = [
"BuildingSurface:Detailed",
"Wall:Detailed",
"RoofCeiling:Detailed",
"Floor:Detailed",
"FenestrationSurface:Detailed",
"Shading:Site:Detailed",
"Shading:Building:Detailed",
... | [
"add",
"functions",
"to",
"the",
"objects"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/idfreader.py#L172-L198 | [
"def",
"addfunctions",
"(",
"dtls",
",",
"bunchdt",
")",
":",
"snames",
"=",
"[",
"\"BuildingSurface:Detailed\"",
",",
"\"Wall:Detailed\"",
",",
"\"RoofCeiling:Detailed\"",
",",
"\"Floor:Detailed\"",
",",
"\"FenestrationSurface:Detailed\"",
",",
"\"Shading:Site:Detailed\"",... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | addfunctions2new | add functions to a new bunch/munch object | eppy/idfreader.py | 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):
"""add functions to a new bunch/munch object"""
snames = [
"BuildingSurface:Detailed",
"Wall:Detailed",
"RoofCeiling:Detailed",
"Floor:Detailed",
"FenestrationSurface:Detailed",
"Shading:Site:Detailed",
"Shading:Building:... | [
"add",
"functions",
"to",
"a",
"new",
"bunch",
"/",
"munch",
"object"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/idfreader.py#L208-L233 | [
"def",
"addfunctions2new",
"(",
"abunch",
",",
"key",
")",
":",
"snames",
"=",
"[",
"\"BuildingSurface:Detailed\"",
",",
"\"Wall:Detailed\"",
",",
"\"RoofCeiling:Detailed\"",
",",
"\"Floor:Detailed\"",
",",
"\"FenestrationSurface:Detailed\"",
",",
"\"Shading:Site:Detailed\"... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | idfreader | read idf file and return bunches | eppy/idfreader.py | 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):
"""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... | [
"read",
"idf",
"file",
"and",
"return",
"bunches"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/idfreader.py#L236-L249 | [
"def",
"idfreader",
"(",
"fname",
",",
"iddfile",
",",
"conv",
"=",
"True",
")",
":",
"data",
",",
"commdct",
",",
"idd_index",
"=",
"readidf",
".",
"readdatacommdct",
"(",
"fname",
",",
"iddfile",
"=",
"iddfile",
")",
"if",
"conv",
":",
"convertallfield... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | idfreader1 | read idf file and return bunches | eppy/idfreader.py | 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):
"""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... | [
"read",
"idf",
"file",
"and",
"return",
"bunches"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/idfreader.py#L252-L275 | [
"def",
"idfreader1",
"(",
"fname",
",",
"iddfile",
",",
"theidf",
",",
"conv",
"=",
"True",
",",
"commdct",
"=",
"None",
",",
"block",
"=",
"None",
")",
":",
"versiontuple",
"=",
"iddversiontuple",
"(",
"iddfile",
")",
"# import pdb; pdb.set_trace()",
"block... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | ConvInIDD.conv_dict | dictionary of conversion | eppy/idfreader.py | def conv_dict(self):
"""dictionary of conversion"""
return dict(integer=self.integer, real=self.real, no_type=self.no_type) | def conv_dict(self):
"""dictionary of conversion"""
return dict(integer=self.integer, real=self.real, no_type=self.no_type) | [
"dictionary",
"of",
"conversion"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/idfreader.py#L103-L105 | [
"def",
"conv_dict",
"(",
"self",
")",
":",
"return",
"dict",
"(",
"integer",
"=",
"self",
".",
"integer",
",",
"real",
"=",
"self",
".",
"real",
",",
"no_type",
"=",
"self",
".",
"no_type",
")"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | getanymentions | Find out if idjobject is mentioned an any object anywhere | eppy/idf_helpers.py | 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):
"""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... | [
"Find",
"out",
"if",
"idjobject",
"is",
"mentioned",
"an",
"any",
"object",
"anywhere"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/idf_helpers.py#L30-L42 | [
"def",
"getanymentions",
"(",
"idf",
",",
"anidfobject",
")",
":",
"name",
"=",
"anidfobject",
".",
"obj",
"[",
"1",
"]",
"foundobjs",
"=",
"[",
"]",
"keys",
"=",
"idfobjectkeys",
"(",
"idf",
")",
"idfkeyobjects",
"=",
"[",
"idf",
".",
"idfobjects",
"[... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | getobject_use_prevfield | field=object_name, prev_field=object_type. Return the object | eppy/idf_helpers.py | 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):
"""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... | [
"field",
"=",
"object_name",
"prev_field",
"=",
"object_type",
".",
"Return",
"the",
"object"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/idf_helpers.py#L44-L60 | [
"def",
"getobject_use_prevfield",
"(",
"idf",
",",
"idfobject",
",",
"fieldname",
")",
":",
"if",
"not",
"fieldname",
".",
"endswith",
"(",
"\"Name\"",
")",
":",
"return",
"None",
"# test if prevfieldname ends with \"Object_Type\"",
"fdnames",
"=",
"idfobject",
".",... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | getidfkeyswithnodes | return a list of keys of idfobjects that hve 'None Name' fields | eppy/idf_helpers.py | 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():
"""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
... | [
"return",
"a",
"list",
"of",
"keys",
"of",
"idfobjects",
"that",
"hve",
"None",
"Name",
"fields"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/idf_helpers.py#L62-L72 | [
"def",
"getidfkeyswithnodes",
"(",
")",
":",
"idf",
"=",
"IDF",
"(",
"StringIO",
"(",
"\"\"",
")",
")",
"keys",
"=",
"idfobjectkeys",
"(",
"idf",
")",
"keysfieldnames",
"=",
"(",
"(",
"key",
",",
"idf",
".",
"newidfobject",
"(",
"key",
".",
"upper",
... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | getobjectswithnode | return all objects that mention this node name | eppy/idf_helpers.py | 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):
"""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()])
... | [
"return",
"all",
"objects",
"that",
"mention",
"this",
"node",
"name"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/idf_helpers.py#L74-L92 | [
"def",
"getobjectswithnode",
"(",
"idf",
",",
"nodekeys",
",",
"nodename",
")",
":",
"keys",
"=",
"nodekeys",
"# TODO getidfkeyswithnodes needs to be done only once. take out of here",
"listofidfobjects",
"=",
"(",
"idf",
".",
"idfobjects",
"[",
"key",
".",
"upper",
"... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | name2idfobject | 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 | eppy/idf_helpers.py | 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):
"""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
... | [
"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... | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/idf_helpers.py#L94-L111 | [
"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",
"(",
... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | getidfobjectlist | return a list of all idfobjects in idf | eppy/idf_helpers.py | 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):
"""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... | [
"return",
"a",
"list",
"of",
"all",
"idfobjects",
"in",
"idf"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/idf_helpers.py#L113-L122 | [
"def",
"getidfobjectlist",
"(",
"idf",
")",
":",
"idfobjects",
"=",
"idf",
".",
"idfobjects",
"# idfobjlst = [idfobjects[key] for key in idfobjects if idfobjects[key]]",
"idfobjlst",
"=",
"[",
"idfobjects",
"[",
"key",
"]",
"for",
"key",
"in",
"idf",
".",
"model",
"... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | copyidfintoidf | copy fromidf completely into toidf | eppy/idf_helpers.py | def copyidfintoidf(toidf, fromidf):
"""copy fromidf completely into toidf"""
idfobjlst = getidfobjectlist(fromidf)
for idfobj in idfobjlst:
toidf.copyidfobject(idfobj) | def copyidfintoidf(toidf, fromidf):
"""copy fromidf completely into toidf"""
idfobjlst = getidfobjectlist(fromidf)
for idfobj in idfobjlst:
toidf.copyidfobject(idfobj) | [
"copy",
"fromidf",
"completely",
"into",
"toidf"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/idf_helpers.py#L124-L128 | [
"def",
"copyidfintoidf",
"(",
"toidf",
",",
"fromidf",
")",
":",
"idfobjlst",
"=",
"getidfobjectlist",
"(",
"fromidf",
")",
"for",
"idfobj",
"in",
"idfobjlst",
":",
"toidf",
".",
"copyidfobject",
"(",
"idfobj",
")"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | idfdiffs | return the diffs between the two idfs | eppy/useful_scripts/idfdiff_missing.py | 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):
"""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] +
... | [
"return",
"the",
"diffs",
"between",
"the",
"two",
"idfs"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/useful_scripts/idfdiff_missing.py#L92-L127 | [
"def",
"idfdiffs",
"(",
"idf1",
",",
"idf2",
")",
":",
"thediffs",
"=",
"{",
"}",
"keys",
"=",
"idf1",
".",
"model",
".",
"dtls",
"# undocumented variable",
"for",
"akey",
"in",
"keys",
":",
"idfobjs1",
"=",
"idf1",
".",
"idfobjects",
"[",
"akey",
"]",... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | autosize_fieldname | return autsizeable field names in idfobject | eppy/useful_scripts/autosize.py | 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):
"""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] | [
"return",
"autsizeable",
"field",
"names",
"in",
"idfobject"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/useful_scripts/autosize.py#L36-L41 | [
"def",
"autosize_fieldname",
"(",
"idfobject",
")",
":",
"# undocumented stuff in this code",
"return",
"[",
"fname",
"for",
"(",
"fname",
",",
"dct",
")",
"in",
"zip",
"(",
"idfobject",
".",
"objls",
",",
"idfobject",
"[",
"'objidd'",
"]",
")",
"if",
"'auto... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | idd2group | wrapper for iddtxt2groups | eppy/EPlusInterfaceFunctions/iddgroups.py | 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):
"""wrapper for iddtxt2groups"""
try:
txt = fhandle.read()
return iddtxt2groups(txt)
except AttributeError as e:
txt = open(fhandle, 'r').read()
return iddtxt2groups(txt) | [
"wrapper",
"for",
"iddtxt2groups"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/iddgroups.py#L27-L34 | [
"def",
"idd2group",
"(",
"fhandle",
")",
":",
"try",
":",
"txt",
"=",
"fhandle",
".",
"read",
"(",
")",
"return",
"iddtxt2groups",
"(",
"txt",
")",
"except",
"AttributeError",
"as",
"e",
":",
"txt",
"=",
"open",
"(",
"fhandle",
",",
"'r'",
")",
".",
... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | idd2grouplist | wrapper for iddtxt2grouplist | eppy/EPlusInterfaceFunctions/iddgroups.py | 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):
"""wrapper for iddtxt2grouplist"""
try:
txt = fhandle.read()
return iddtxt2grouplist(txt)
except AttributeError as e:
txt = open(fhandle, 'r').read()
return iddtxt2grouplist(txt) | [
"wrapper",
"for",
"iddtxt2grouplist"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/iddgroups.py#L36-L43 | [
"def",
"idd2grouplist",
"(",
"fhandle",
")",
":",
"try",
":",
"txt",
"=",
"fhandle",
".",
"read",
"(",
")",
"return",
"iddtxt2grouplist",
"(",
"txt",
")",
"except",
"AttributeError",
"as",
"e",
":",
"txt",
"=",
"open",
"(",
"fhandle",
",",
"'r'",
")",
... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | iddtxt2groups | extract the groups from the idd file | eppy/EPlusInterfaceFunctions/iddgroups.py | 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):
"""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... | [
"extract",
"the",
"groups",
"from",
"the",
"idd",
"file"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/iddgroups.py#L46-L82 | [
"def",
"iddtxt2groups",
"(",
"txt",
")",
":",
"try",
":",
"txt",
"=",
"txt",
".",
"decode",
"(",
"'ISO-8859-2'",
")",
"except",
"AttributeError",
"as",
"e",
":",
"pass",
"# for python 3",
"txt",
"=",
"nocomment",
"(",
"txt",
",",
"'!'",
")",
"txt",
"="... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | iddtxt2grouplist | return a list of group names
the list in the same order as the idf objects in idd file | eppy/EPlusInterfaceFunctions/iddgroups.py | 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):
"""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")... | [
"return",
"a",
"list",
"of",
"group",
"names",
"the",
"list",
"in",
"the",
"same",
"order",
"as",
"the",
"idf",
"objects",
"in",
"idd",
"file"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/iddgroups.py#L84-L129 | [
"def",
"iddtxt2grouplist",
"(",
"txt",
")",
":",
"def",
"makenone",
"(",
"astr",
")",
":",
"if",
"astr",
"==",
"'None'",
":",
"return",
"None",
"else",
":",
"return",
"astr",
"txt",
"=",
"nocomment",
"(",
"txt",
",",
"'!'",
")",
"txt",
"=",
"txt",
... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | group2commlst | add group info to commlst | eppy/EPlusInterfaceFunctions/iddgroups.py | 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):
"""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 | [
"add",
"group",
"info",
"to",
"commlst"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/iddgroups.py#L131-L138 | [
"def",
"group2commlst",
"(",
"commlst",
",",
"glist",
")",
":",
"for",
"(",
"gname",
",",
"objname",
")",
",",
"commitem",
"in",
"zip",
"(",
"glist",
",",
"commlst",
")",
":",
"newitem1",
"=",
"\"group %s\"",
"%",
"(",
"gname",
",",
")",
"newitem2",
... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | group2commdct | add group info tocomdct | eppy/EPlusInterfaceFunctions/iddgroups.py | 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):
"""add group info tocomdct"""
for (gname, objname), commitem in zip(glist, commdct):
commitem[0]['group'] = gname
commitem[0]['idfobj'] = objname
return commdct | [
"add",
"group",
"info",
"tocomdct"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/iddgroups.py#L140-L145 | [
"def",
"group2commdct",
"(",
"commdct",
",",
"glist",
")",
":",
"for",
"(",
"gname",
",",
"objname",
")",
",",
"commitem",
"in",
"zip",
"(",
"glist",
",",
"commdct",
")",
":",
"commitem",
"[",
"0",
"]",
"[",
"'group'",
"]",
"=",
"gname",
"commitem",
... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | commdct2grouplist | extract embedded group data from commdct.
return gdict -> {g1:[obj1, obj2, obj3], g2:[obj4, ..]} | eppy/EPlusInterfaceFunctions/iddgroups.py | 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):
"""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... | [
"extract",
"embedded",
"group",
"data",
"from",
"commdct",
".",
"return",
"gdict",
"-",
">",
"{",
"g1",
":",
"[",
"obj1",
"obj2",
"obj3",
"]",
"g2",
":",
"[",
"obj4",
"..",
"]",
"}"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/iddgroups.py#L147-L158 | [
"def",
"commdct2grouplist",
"(",
"gcommdct",
")",
":",
"gdict",
"=",
"{",
"}",
"for",
"objidd",
"in",
"gcommdct",
":",
"group",
"=",
"objidd",
"[",
"0",
"]",
"[",
"'group'",
"]",
"objname",
"=",
"objidd",
"[",
"0",
"]",
"[",
"'idfobj'",
"]",
"if",
... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | flattencopy | flatten and return a copy of the list
indefficient on large lists | eppy/hvacbuilder.py | 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):
"""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
... | [
"flatten",
"and",
"return",
"a",
"copy",
"of",
"the",
"list",
"indefficient",
"on",
"large",
"lists"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/hvacbuilder.py#L52-L70 | [
"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",
":... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | makepipecomponent | make a pipe component
generate inlet outlet names | eppy/hvacbuilder.py | 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):
"""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 | [
"make",
"a",
"pipe",
"component",
"generate",
"inlet",
"outlet",
"names"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/hvacbuilder.py#L72-L78 | [
"def",
"makepipecomponent",
"(",
"idf",
",",
"pname",
")",
":",
"apipe",
"=",
"idf",
".",
"newidfobject",
"(",
"\"Pipe:Adiabatic\"",
".",
"upper",
"(",
")",
",",
"Name",
"=",
"pname",
")",
"apipe",
".",
"Inlet_Node_Name",
"=",
"\"%s_inlet\"",
"%",
"(",
"... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | makeductcomponent | make a duct component
generate inlet outlet names | eppy/hvacbuilder.py | 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):
"""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 | [
"make",
"a",
"duct",
"component",
"generate",
"inlet",
"outlet",
"names"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/hvacbuilder.py#L80-L86 | [
"def",
"makeductcomponent",
"(",
"idf",
",",
"dname",
")",
":",
"aduct",
"=",
"idf",
".",
"newidfobject",
"(",
"\"duct\"",
".",
"upper",
"(",
")",
",",
"Name",
"=",
"dname",
")",
"aduct",
".",
"Inlet_Node_Name",
"=",
"\"%s_inlet\"",
"%",
"(",
"dname",
... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | makepipebranch | make a branch with a pipe
use standard inlet outlet names | eppy/hvacbuilder.py | 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 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... | [
"make",
"a",
"branch",
"with",
"a",
"pipe",
"use",
"standard",
"inlet",
"outlet",
"names"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/hvacbuilder.py#L88-L101 | [
"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",
... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | makeductbranch | make a branch with a duct
use standard inlet outlet names | eppy/hvacbuilder.py | 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 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... | [
"make",
"a",
"branch",
"with",
"a",
"duct",
"use",
"standard",
"inlet",
"outlet",
"names"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/hvacbuilder.py#L103-L116 | [
"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",
... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | getbranchcomponents | get the components of the branch | eppy/hvacbuilder.py | 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):
"""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() == '':
... | [
"get",
"the",
"components",
"of",
"the",
"branch"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/hvacbuilder.py#L118-L135 | [
"def",
"getbranchcomponents",
"(",
"idf",
",",
"branch",
",",
"utest",
"=",
"False",
")",
":",
"fobjtype",
"=",
"'Component_%s_Object_Type'",
"fobjname",
"=",
"'Component_%s_Name'",
"complist",
"=",
"[",
"]",
"for",
"i",
"in",
"range",
"(",
"1",
",",
"100000... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | renamenodes | rename all the changed nodes | eppy/hvacbuilder.py | 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):
"""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:
... | [
"rename",
"all",
"the",
"changed",
"nodes"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/hvacbuilder.py#L137-L162 | [
"def",
"renamenodes",
"(",
"idf",
",",
"fieldtype",
")",
":",
"renameds",
"=",
"[",
"]",
"for",
"key",
"in",
"idf",
".",
"model",
".",
"dtls",
":",
"for",
"idfobject",
"in",
"idf",
".",
"idfobjects",
"[",
"key",
"]",
":",
"for",
"fieldvalue",
"in",
... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | getfieldnamesendswith | get the filednames for the idfobject based on endswith | eppy/hvacbuilder.py | def getfieldnamesendswith(idfobject, endswith):
"""get the filednames for the idfobject based on endswith"""
objls = idfobject.objls
tmp = [name for name in objls if name.endswith(endswith)]
if tmp == []:
pass
return [name for name in objls if name.endswith(endswith)] | def getfieldnamesendswith(idfobject, endswith):
"""get the filednames for the idfobject based on endswith"""
objls = idfobject.objls
tmp = [name for name in objls if name.endswith(endswith)]
if tmp == []:
pass
return [name for name in objls if name.endswith(endswith)] | [
"get",
"the",
"filednames",
"for",
"the",
"idfobject",
"based",
"on",
"endswith"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/hvacbuilder.py#L164-L170 | [
"def",
"getfieldnamesendswith",
"(",
"idfobject",
",",
"endswith",
")",
":",
"objls",
"=",
"idfobject",
".",
"objls",
"tmp",
"=",
"[",
"name",
"for",
"name",
"in",
"objls",
"if",
"name",
".",
"endswith",
"(",
"endswith",
")",
"]",
"if",
"tmp",
"==",
"[... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | getnodefieldname | return the field name of the node
fluid is only needed if there are air and water nodes
fluid is Air or Water or ''.
if the fluid is Steam, use Water | eppy/hvacbuilder.py | def getnodefieldname(idfobject, endswith, fluid=None, startswith=None):
"""return the field name of the node
fluid is only needed if there are air and water nodes
fluid is Air or Water or ''.
if the fluid is Steam, use Water"""
if startswith is None:
startswith = ''
if fluid is None:
... | def getnodefieldname(idfobject, endswith, fluid=None, startswith=None):
"""return the field name of the node
fluid is only needed if there are air and water nodes
fluid is Air or Water or ''.
if the fluid is Steam, use Water"""
if startswith is None:
startswith = ''
if fluid is None:
... | [
"return",
"the",
"field",
"name",
"of",
"the",
"node",
"fluid",
"is",
"only",
"needed",
"if",
"there",
"are",
"air",
"and",
"water",
"nodes",
"fluid",
"is",
"Air",
"or",
"Water",
"or",
".",
"if",
"the",
"fluid",
"is",
"Steam",
"use",
"Water"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/hvacbuilder.py#L172-L189 | [
"def",
"getnodefieldname",
"(",
"idfobject",
",",
"endswith",
",",
"fluid",
"=",
"None",
",",
"startswith",
"=",
"None",
")",
":",
"if",
"startswith",
"is",
"None",
":",
"startswith",
"=",
"''",
"if",
"fluid",
"is",
"None",
":",
"fluid",
"=",
"''",
"no... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | connectcomponents | rename nodes so that the components get connected
fluid is only needed if there are air and water nodes
fluid is Air or Water or ''.
if the fluid is Steam, use Water | eppy/hvacbuilder.py | def connectcomponents(idf, components, fluid=None):
"""rename nodes so that the components get connected
fluid is only needed if there are air and water nodes
fluid is Air or Water or ''.
if the fluid is Steam, use Water"""
if fluid is None:
fluid = ''
if len(components) == 1:
th... | def connectcomponents(idf, components, fluid=None):
"""rename nodes so that the components get connected
fluid is only needed if there are air and water nodes
fluid is Air or Water or ''.
if the fluid is Steam, use Water"""
if fluid is None:
fluid = ''
if len(components) == 1:
th... | [
"rename",
"nodes",
"so",
"that",
"the",
"components",
"get",
"connected",
"fluid",
"is",
"only",
"needed",
"if",
"there",
"are",
"air",
"and",
"water",
"nodes",
"fluid",
"is",
"Air",
"or",
"Water",
"or",
".",
"if",
"the",
"fluid",
"is",
"Steam",
"use",
... | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/hvacbuilder.py#L192-L220 | [
"def",
"connectcomponents",
"(",
"idf",
",",
"components",
",",
"fluid",
"=",
"None",
")",
":",
"if",
"fluid",
"is",
"None",
":",
"fluid",
"=",
"''",
"if",
"len",
"(",
"components",
")",
"==",
"1",
":",
"thiscomp",
",",
"thiscompnode",
"=",
"components... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | initinletoutlet | initialze values for all the inlet outlet nodes for the object.
if force == False, it willl init only if field = '' | eppy/hvacbuilder.py | def initinletoutlet(idf, idfobject, thisnode, force=False):
"""initialze values for all the inlet outlet nodes for the object.
if force == False, it willl init only if field = '' """
def blankfield(fieldvalue):
"""test for blank field"""
try:
if fieldvalue.strip() == '':
... | def initinletoutlet(idf, idfobject, thisnode, force=False):
"""initialze values for all the inlet outlet nodes for the object.
if force == False, it willl init only if field = '' """
def blankfield(fieldvalue):
"""test for blank field"""
try:
if fieldvalue.strip() == '':
... | [
"initialze",
"values",
"for",
"all",
"the",
"inlet",
"outlet",
"nodes",
"for",
"the",
"object",
".",
"if",
"force",
"==",
"False",
"it",
"willl",
"init",
"only",
"if",
"field",
"="
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/hvacbuilder.py#L223-L260 | [
"def",
"initinletoutlet",
"(",
"idf",
",",
"idfobject",
",",
"thisnode",
",",
"force",
"=",
"False",
")",
":",
"def",
"blankfield",
"(",
"fieldvalue",
")",
":",
"\"\"\"test for blank field\"\"\"",
"try",
":",
"if",
"fieldvalue",
".",
"strip",
"(",
")",
"==",... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | componentsintobranch | insert a list of components into a branch
fluid is only needed if there are air and water nodes in same object
fluid is Air or Water or ''.
if the fluid is Steam, use Water | eppy/hvacbuilder.py | def componentsintobranch(idf, branch, listofcomponents, fluid=None):
"""insert a list of components into a branch
fluid is only needed if there are air and water nodes in same object
fluid is Air or Water or ''.
if the fluid is Steam, use Water"""
if fluid is None:
fluid = ''
componentli... | def componentsintobranch(idf, branch, listofcomponents, fluid=None):
"""insert a list of components into a branch
fluid is only needed if there are air and water nodes in same object
fluid is Air or Water or ''.
if the fluid is Steam, use Water"""
if fluid is None:
fluid = ''
componentli... | [
"insert",
"a",
"list",
"of",
"components",
"into",
"a",
"branch",
"fluid",
"is",
"only",
"needed",
"if",
"there",
"are",
"air",
"and",
"water",
"nodes",
"in",
"same",
"object",
"fluid",
"is",
"Air",
"or",
"Water",
"or",
".",
"if",
"the",
"fluid",
"is",... | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/hvacbuilder.py#L262-L290 | [
"def",
"componentsintobranch",
"(",
"idf",
",",
"branch",
",",
"listofcomponents",
",",
"fluid",
"=",
"None",
")",
":",
"if",
"fluid",
"is",
"None",
":",
"fluid",
"=",
"''",
"componentlist",
"=",
"[",
"item",
"[",
"0",
"]",
"for",
"item",
"in",
"listof... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | makeairloop | make an airloop | eppy/hvacbuilder.py | def makeairloop(idf, loopname, sloop, dloop, testing=None):
"""make an airloop"""
# -------- testing ---------
testn = 0
# -------- testing ---------
newairloop = idf.newidfobject("AirLoopHVAC".upper(), Name=loopname)
# -------- testing ---------
testn = doingtesting(testing, testn, newairlo... | def makeairloop(idf, loopname, sloop, dloop, testing=None):
"""make an airloop"""
# -------- testing ---------
testn = 0
# -------- testing ---------
newairloop = idf.newidfobject("AirLoopHVAC".upper(), Name=loopname)
# -------- testing ---------
testn = doingtesting(testing, testn, newairlo... | [
"make",
"an",
"airloop"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/hvacbuilder.py#L305-L573 | [
"def",
"makeairloop",
"(",
"idf",
",",
"loopname",
",",
"sloop",
",",
"dloop",
",",
"testing",
"=",
"None",
")",
":",
"# -------- testing ---------",
"testn",
"=",
"0",
"# -------- testing ---------",
"newairloop",
"=",
"idf",
".",
"newidfobject",
"(",
"\"AirLoo... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | makeplantloop | make plant loop with pip components | eppy/hvacbuilder.py | def makeplantloop(idf, loopname, sloop, dloop, testing=None):
"""make plant loop with pip components"""
# -------- <testing ---------
testn = 0
# -------- testing> ---------
newplantloop = idf.newidfobject("PLANTLOOP", Name=loopname)
# -------- <testing ---------
testn = doingtesting(testing... | def makeplantloop(idf, loopname, sloop, dloop, testing=None):
"""make plant loop with pip components"""
# -------- <testing ---------
testn = 0
# -------- testing> ---------
newplantloop = idf.newidfobject("PLANTLOOP", Name=loopname)
# -------- <testing ---------
testn = doingtesting(testing... | [
"make",
"plant",
"loop",
"with",
"pip",
"components"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/hvacbuilder.py#L575-L765 | [
"def",
"makeplantloop",
"(",
"idf",
",",
"loopname",
",",
"sloop",
",",
"dloop",
",",
"testing",
"=",
"None",
")",
":",
"# -------- <testing ---------",
"testn",
"=",
"0",
"# -------- testing> ---------",
"newplantloop",
"=",
"idf",
".",
"newidfobject",
"(",
"\"... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | makecondenserloop | make condenser loop with pipe components | eppy/hvacbuilder.py | def makecondenserloop(idf, loopname, sloop, dloop, testing=None):
"""make condenser loop with pipe components"""
# -------- <testing ---------
testn = 0
# -------- testing> ---------
newcondenserloop = idf.newidfobject("CondenserLoop".upper(), Name=loopname)
# -------- <testing ---------
tes... | def makecondenserloop(idf, loopname, sloop, dloop, testing=None):
"""make condenser loop with pipe components"""
# -------- <testing ---------
testn = 0
# -------- testing> ---------
newcondenserloop = idf.newidfobject("CondenserLoop".upper(), Name=loopname)
# -------- <testing ---------
tes... | [
"make",
"condenser",
"loop",
"with",
"pipe",
"components"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/hvacbuilder.py#L767-L960 | [
"def",
"makecondenserloop",
"(",
"idf",
",",
"loopname",
",",
"sloop",
",",
"dloop",
",",
"testing",
"=",
"None",
")",
":",
"# -------- <testing ---------",
"testn",
"=",
"0",
"# -------- testing> ---------",
"newcondenserloop",
"=",
"idf",
".",
"newidfobject",
"(... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | _clean_listofcomponents | force it to be a list of tuples | eppy/hvacbuilder.py | def _clean_listofcomponents(listofcomponents):
"""force it to be a list of tuples"""
def totuple(item):
"""return a tuple"""
if isinstance(item, (tuple, list)):
return item
else:
return (item, None)
return [totuple(item) for item in listofcomponents] | def _clean_listofcomponents(listofcomponents):
"""force it to be a list of tuples"""
def totuple(item):
"""return a tuple"""
if isinstance(item, (tuple, list)):
return item
else:
return (item, None)
return [totuple(item) for item in listofcomponents] | [
"force",
"it",
"to",
"be",
"a",
"list",
"of",
"tuples"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/hvacbuilder.py#L962-L970 | [
"def",
"_clean_listofcomponents",
"(",
"listofcomponents",
")",
":",
"def",
"totuple",
"(",
"item",
")",
":",
"\"\"\"return a tuple\"\"\"",
"if",
"isinstance",
"(",
"item",
",",
"(",
"tuple",
",",
"list",
")",
")",
":",
"return",
"item",
"else",
":",
"return... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | _clean_listofcomponents_tuples | force 3 items in the tuple | eppy/hvacbuilder.py | def _clean_listofcomponents_tuples(listofcomponents_tuples):
"""force 3 items in the tuple"""
def to3tuple(item):
"""return a 3 item tuple"""
if len(item) == 3:
return item
else:
return (item[0], item[1], None)
return [to3tuple(item) for item in listofcomponen... | def _clean_listofcomponents_tuples(listofcomponents_tuples):
"""force 3 items in the tuple"""
def to3tuple(item):
"""return a 3 item tuple"""
if len(item) == 3:
return item
else:
return (item[0], item[1], None)
return [to3tuple(item) for item in listofcomponen... | [
"force",
"3",
"items",
"in",
"the",
"tuple"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/hvacbuilder.py#L972-L980 | [
"def",
"_clean_listofcomponents_tuples",
"(",
"listofcomponents_tuples",
")",
":",
"def",
"to3tuple",
"(",
"item",
")",
":",
"\"\"\"return a 3 item tuple\"\"\"",
"if",
"len",
"(",
"item",
")",
"==",
"3",
":",
"return",
"item",
"else",
":",
"return",
"(",
"item",... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | getmakeidfobject | get idfobject or make it if it does not exist | eppy/hvacbuilder.py | def getmakeidfobject(idf, key, name):
"""get idfobject or make it if it does not exist"""
idfobject = idf.getobject(key, name)
if not idfobject:
return idf.newidfobject(key, Name=name)
else:
return idfobject | def getmakeidfobject(idf, key, name):
"""get idfobject or make it if it does not exist"""
idfobject = idf.getobject(key, name)
if not idfobject:
return idf.newidfobject(key, Name=name)
else:
return idfobject | [
"get",
"idfobject",
"or",
"make",
"it",
"if",
"it",
"does",
"not",
"exist"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/hvacbuilder.py#L982-L988 | [
"def",
"getmakeidfobject",
"(",
"idf",
",",
"key",
",",
"name",
")",
":",
"idfobject",
"=",
"idf",
".",
"getobject",
"(",
"key",
",",
"name",
")",
"if",
"not",
"idfobject",
":",
"return",
"idf",
".",
"newidfobject",
"(",
"key",
",",
"Name",
"=",
"nam... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | replacebranch1 | do I even use this ? .... yup! I do | eppy/hvacbuilder.py | def replacebranch1(idf, loop, branchname, listofcomponents_tuples, fluid=None,
debugsave=False):
"""do I even use this ? .... yup! I do"""
if fluid is None:
fluid = ''
listofcomponents_tuples = _clean_listofcomponents_tuples(listofcomponents_tuples)
branch = idf.getobject('BRA... | def replacebranch1(idf, loop, branchname, listofcomponents_tuples, fluid=None,
debugsave=False):
"""do I even use this ? .... yup! I do"""
if fluid is None:
fluid = ''
listofcomponents_tuples = _clean_listofcomponents_tuples(listofcomponents_tuples)
branch = idf.getobject('BRA... | [
"do",
"I",
"even",
"use",
"this",
"?",
"....",
"yup!",
"I",
"do"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/hvacbuilder.py#L990-L1003 | [
"def",
"replacebranch1",
"(",
"idf",
",",
"loop",
",",
"branchname",
",",
"listofcomponents_tuples",
",",
"fluid",
"=",
"None",
",",
"debugsave",
"=",
"False",
")",
":",
"if",
"fluid",
"is",
"None",
":",
"fluid",
"=",
"''",
"listofcomponents_tuples",
"=",
... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | replacebranch | It will replace the components in the branch with components in
listofcomponents | eppy/hvacbuilder.py | def replacebranch(idf, loop, branch,
listofcomponents, fluid=None,
debugsave=False,
testing=None):
"""It will replace the components in the branch with components in
listofcomponents"""
if fluid is None:
fluid = ''
# -------- testing --------... | def replacebranch(idf, loop, branch,
listofcomponents, fluid=None,
debugsave=False,
testing=None):
"""It will replace the components in the branch with components in
listofcomponents"""
if fluid is None:
fluid = ''
# -------- testing --------... | [
"It",
"will",
"replace",
"the",
"components",
"in",
"the",
"branch",
"with",
"components",
"in",
"listofcomponents"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/hvacbuilder.py#L1005-L1178 | [
"def",
"replacebranch",
"(",
"idf",
",",
"loop",
",",
"branch",
",",
"listofcomponents",
",",
"fluid",
"=",
"None",
",",
"debugsave",
"=",
"False",
",",
"testing",
"=",
"None",
")",
":",
"if",
"fluid",
"is",
"None",
":",
"fluid",
"=",
"''",
"# --------... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | main | the main routine | eppy/hvacbuilder.py | def main():
"""the main routine"""
from six import StringIO
import eppy.iddv7 as iddv7
IDF.setiddname(StringIO(iddv7.iddtxt))
idf1 = IDF(StringIO(''))
loopname = "p_loop"
sloop = ['sb0', ['sb1', 'sb2', 'sb3'], 'sb4']
dloop = ['db0', ['db1', 'db2', 'db3'], 'db4']
# makeplantloop(idf1,... | def main():
"""the main routine"""
from six import StringIO
import eppy.iddv7 as iddv7
IDF.setiddname(StringIO(iddv7.iddtxt))
idf1 = IDF(StringIO(''))
loopname = "p_loop"
sloop = ['sb0', ['sb1', 'sb2', 'sb3'], 'sb4']
dloop = ['db0', ['db1', 'db2', 'db3'], 'db4']
# makeplantloop(idf1,... | [
"the",
"main",
"routine"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/hvacbuilder.py#L1180-L1198 | [
"def",
"main",
"(",
")",
":",
"from",
"six",
"import",
"StringIO",
"import",
"eppy",
".",
"iddv7",
"as",
"iddv7",
"IDF",
".",
"setiddname",
"(",
"StringIO",
"(",
"iddv7",
".",
"iddtxt",
")",
")",
"idf1",
"=",
"IDF",
"(",
"StringIO",
"(",
"''",
")",
... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | area | Area of a polygon poly | eppy/geometry/surface.py | def area(poly):
"""Area of a polygon poly"""
if len(poly) < 3: # not a plane - no area
return 0
total = [0, 0, 0]
num = len(poly)
for i in range(num):
vi1 = poly[i]
vi2 = poly[(i+1) % num]
prod = np.cross(vi1, vi2)
total[0] += prod[0]
total[1] += prod[... | def area(poly):
"""Area of a polygon poly"""
if len(poly) < 3: # not a plane - no area
return 0
total = [0, 0, 0]
num = len(poly)
for i in range(num):
vi1 = poly[i]
vi2 = poly[(i+1) % num]
prod = np.cross(vi1, vi2)
total[0] += prod[0]
total[1] += prod[... | [
"Area",
"of",
"a",
"polygon",
"poly"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/geometry/surface.py#L32-L48 | [
"def",
"area",
"(",
"poly",
")",
":",
"if",
"len",
"(",
"poly",
")",
"<",
"3",
":",
"# not a plane - no area",
"return",
"0",
"total",
"=",
"[",
"0",
",",
"0",
",",
"0",
"]",
"num",
"=",
"len",
"(",
"poly",
")",
"for",
"i",
"in",
"range",
"(",
... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | unit_normal | unit normal vector of plane defined by points pt_a, pt_b, and pt_c | eppy/geometry/surface.py | def unit_normal(pt_a, pt_b, pt_c):
"""unit normal vector of plane defined by points pt_a, pt_b, and pt_c"""
x_val = np.linalg.det([[1, pt_a[1], pt_a[2]], [1, pt_b[1], pt_b[2]], [1, pt_c[1], pt_c[2]]])
y_val = np.linalg.det([[pt_a[0], 1, pt_a[2]], [pt_b[0], 1, pt_b[2]], [pt_c[0], 1, pt_c[2]]])
z_val = np... | def unit_normal(pt_a, pt_b, pt_c):
"""unit normal vector of plane defined by points pt_a, pt_b, and pt_c"""
x_val = np.linalg.det([[1, pt_a[1], pt_a[2]], [1, pt_b[1], pt_b[2]], [1, pt_c[1], pt_c[2]]])
y_val = np.linalg.det([[pt_a[0], 1, pt_a[2]], [pt_b[0], 1, pt_b[2]], [pt_c[0], 1, pt_c[2]]])
z_val = np... | [
"unit",
"normal",
"vector",
"of",
"plane",
"defined",
"by",
"points",
"pt_a",
"pt_b",
"and",
"pt_c"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/geometry/surface.py#L50-L59 | [
"def",
"unit_normal",
"(",
"pt_a",
",",
"pt_b",
",",
"pt_c",
")",
":",
"x_val",
"=",
"np",
".",
"linalg",
".",
"det",
"(",
"[",
"[",
"1",
",",
"pt_a",
"[",
"1",
"]",
",",
"pt_a",
"[",
"2",
"]",
"]",
",",
"[",
"1",
",",
"pt_b",
"[",
"1",
"... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | width | Width of a polygon poly | eppy/geometry/surface.py | def width(poly):
"""Width of a polygon poly"""
num = len(poly) - 1
if abs(poly[num][2] - poly[0][2]) < abs(poly[1][2] - poly[0][2]):
return dist(poly[num], poly[0])
elif abs(poly[num][2] - poly[0][2]) > abs(poly[1][2] - poly[0][2]):
return dist(poly[1], poly[0])
else: return max(dist... | def width(poly):
"""Width of a polygon poly"""
num = len(poly) - 1
if abs(poly[num][2] - poly[0][2]) < abs(poly[1][2] - poly[0][2]):
return dist(poly[num], poly[0])
elif abs(poly[num][2] - poly[0][2]) > abs(poly[1][2] - poly[0][2]):
return dist(poly[1], poly[0])
else: return max(dist... | [
"Width",
"of",
"a",
"polygon",
"poly"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/geometry/surface.py#L68-L75 | [
"def",
"width",
"(",
"poly",
")",
":",
"num",
"=",
"len",
"(",
"poly",
")",
"-",
"1",
"if",
"abs",
"(",
"poly",
"[",
"num",
"]",
"[",
"2",
"]",
"-",
"poly",
"[",
"0",
"]",
"[",
"2",
"]",
")",
"<",
"abs",
"(",
"poly",
"[",
"1",
"]",
"[",... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | height | Height of a polygon poly | eppy/geometry/surface.py | def height(poly):
"""Height of a polygon poly"""
num = len(poly) - 1
if abs(poly[num][2] - poly[0][2]) > abs(poly[1][2] - poly[0][2]):
return dist(poly[num], poly[0])
elif abs(poly[num][2] - poly[0][2]) < abs(poly[1][2] - poly[0][2]):
return dist(poly[1], poly[0])
else:
retur... | def height(poly):
"""Height of a polygon poly"""
num = len(poly) - 1
if abs(poly[num][2] - poly[0][2]) > abs(poly[1][2] - poly[0][2]):
return dist(poly[num], poly[0])
elif abs(poly[num][2] - poly[0][2]) < abs(poly[1][2] - poly[0][2]):
return dist(poly[1], poly[0])
else:
retur... | [
"Height",
"of",
"a",
"polygon",
"poly"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/geometry/surface.py#L78-L86 | [
"def",
"height",
"(",
"poly",
")",
":",
"num",
"=",
"len",
"(",
"poly",
")",
"-",
"1",
"if",
"abs",
"(",
"poly",
"[",
"num",
"]",
"[",
"2",
"]",
"-",
"poly",
"[",
"0",
"]",
"[",
"2",
"]",
")",
">",
"abs",
"(",
"poly",
"[",
"1",
"]",
"["... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | angle2vecs | angle between two vectors | eppy/geometry/surface.py | def angle2vecs(vec1, vec2):
"""angle between two vectors"""
# vector a * vector b = |a|*|b|* cos(angle between vector a and vector b)
dot = np.dot(vec1, vec2)
vec1_modulus = np.sqrt(np.multiply(vec1, vec1).sum())
vec2_modulus = np.sqrt(np.multiply(vec2, vec2).sum())
if (vec1_modulus * vec2_modul... | def angle2vecs(vec1, vec2):
"""angle between two vectors"""
# vector a * vector b = |a|*|b|* cos(angle between vector a and vector b)
dot = np.dot(vec1, vec2)
vec1_modulus = np.sqrt(np.multiply(vec1, vec1).sum())
vec2_modulus = np.sqrt(np.multiply(vec2, vec2).sum())
if (vec1_modulus * vec2_modul... | [
"angle",
"between",
"two",
"vectors"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/geometry/surface.py#L89-L98 | [
"def",
"angle2vecs",
"(",
"vec1",
",",
"vec2",
")",
":",
"# vector a * vector b = |a|*|b|* cos(angle between vector a and vector b)",
"dot",
"=",
"np",
".",
"dot",
"(",
"vec1",
",",
"vec2",
")",
"vec1_modulus",
"=",
"np",
".",
"sqrt",
"(",
"np",
".",
"multiply",... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | azimuth | Azimuth of a polygon poly | eppy/geometry/surface.py | def azimuth(poly):
"""Azimuth of a polygon poly"""
num = len(poly) - 1
vec = unit_normal(poly[0], poly[1], poly[num])
vec_azi = np.array([vec[0], vec[1], 0])
vec_n = np.array([0, 1, 0])
# update by Santosh
# angle2vecs gives the smallest angle between the vectors
# so for a west wall ang... | def azimuth(poly):
"""Azimuth of a polygon poly"""
num = len(poly) - 1
vec = unit_normal(poly[0], poly[1], poly[num])
vec_azi = np.array([vec[0], vec[1], 0])
vec_n = np.array([0, 1, 0])
# update by Santosh
# angle2vecs gives the smallest angle between the vectors
# so for a west wall ang... | [
"Azimuth",
"of",
"a",
"polygon",
"poly"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/geometry/surface.py#L101-L115 | [
"def",
"azimuth",
"(",
"poly",
")",
":",
"num",
"=",
"len",
"(",
"poly",
")",
"-",
"1",
"vec",
"=",
"unit_normal",
"(",
"poly",
"[",
"0",
"]",
",",
"poly",
"[",
"1",
"]",
",",
"poly",
"[",
"num",
"]",
")",
"vec_azi",
"=",
"np",
".",
"array",
... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | tilt | Tilt of a polygon poly | eppy/geometry/surface.py | def tilt(poly):
"""Tilt of a polygon poly"""
num = len(poly) - 1
vec = unit_normal(poly[0], poly[1], poly[num])
vec_alt = np.array([vec[0], vec[1], vec[2]])
vec_z = np.array([0, 0, 1])
# return (90 - angle2vecs(vec_alt, vec_z)) # update by Santosh
return angle2vecs(vec_alt, vec_z) | def tilt(poly):
"""Tilt of a polygon poly"""
num = len(poly) - 1
vec = unit_normal(poly[0], poly[1], poly[num])
vec_alt = np.array([vec[0], vec[1], vec[2]])
vec_z = np.array([0, 0, 1])
# return (90 - angle2vecs(vec_alt, vec_z)) # update by Santosh
return angle2vecs(vec_alt, vec_z) | [
"Tilt",
"of",
"a",
"polygon",
"poly"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/geometry/surface.py#L117-L124 | [
"def",
"tilt",
"(",
"poly",
")",
":",
"num",
"=",
"len",
"(",
"poly",
")",
"-",
"1",
"vec",
"=",
"unit_normal",
"(",
"poly",
"[",
"0",
"]",
",",
"poly",
"[",
"1",
"]",
",",
"poly",
"[",
"num",
"]",
")",
"vec_alt",
"=",
"np",
".",
"array",
"... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | getfields | get all the fields that have the key 'field' | eppy/iddgaps.py | def getfields(comm):
"""get all the fields that have the key 'field' """
fields = []
for field in comm:
if 'field' in field:
fields.append(field)
return fields | def getfields(comm):
"""get all the fields that have the key 'field' """
fields = []
for field in comm:
if 'field' in field:
fields.append(field)
return fields | [
"get",
"all",
"the",
"fields",
"that",
"have",
"the",
"key",
"field"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/iddgaps.py#L63-L69 | [
"def",
"getfields",
"(",
"comm",
")",
":",
"fields",
"=",
"[",
"]",
"for",
"field",
"in",
"comm",
":",
"if",
"'field'",
"in",
"field",
":",
"fields",
".",
"append",
"(",
"field",
")",
"return",
"fields"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | repeatingfieldsnames | get the names of the repeating fields | eppy/iddgaps.py | def repeatingfieldsnames(fields):
"""get the names of the repeating fields"""
fnames = [field['field'][0] for field in fields]
fnames = [bunchhelpers.onlylegalchar(fname) for fname in fnames]
fnames = [fname for fname in fnames if bunchhelpers.intinlist(fname.split())]
fnames = [(bunchhelpers.replac... | def repeatingfieldsnames(fields):
"""get the names of the repeating fields"""
fnames = [field['field'][0] for field in fields]
fnames = [bunchhelpers.onlylegalchar(fname) for fname in fnames]
fnames = [fname for fname in fnames if bunchhelpers.intinlist(fname.split())]
fnames = [(bunchhelpers.replac... | [
"get",
"the",
"names",
"of",
"the",
"repeating",
"fields"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/iddgaps.py#L71-L79 | [
"def",
"repeatingfieldsnames",
"(",
"fields",
")",
":",
"fnames",
"=",
"[",
"field",
"[",
"'field'",
"]",
"[",
"0",
"]",
"for",
"field",
"in",
"fields",
"]",
"fnames",
"=",
"[",
"bunchhelpers",
".",
"onlylegalchar",
"(",
"fname",
")",
"for",
"fname",
"... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
train | missingkeys_standard | put missing keys in commdct for standard objects
return a list of keys where it is unable to do so
commdct is not returned, but is updated | eppy/iddgaps.py | def missingkeys_standard(commdct, dtls, skiplist=None):
"""put missing keys in commdct for standard objects
return a list of keys where it is unable to do so
commdct is not returned, but is updated"""
if skiplist == None:
skiplist = []
# find objects where all the fields are not named
gk... | def missingkeys_standard(commdct, dtls, skiplist=None):
"""put missing keys in commdct for standard objects
return a list of keys where it is unable to do so
commdct is not returned, but is updated"""
if skiplist == None:
skiplist = []
# find objects where all the fields are not named
gk... | [
"put",
"missing",
"keys",
"in",
"commdct",
"for",
"standard",
"objects",
"return",
"a",
"list",
"of",
"keys",
"where",
"it",
"is",
"unable",
"to",
"do",
"so",
"commdct",
"is",
"not",
"returned",
"but",
"is",
"updated"
] | santoshphilip/eppy | python | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/iddgaps.py#L82-L150 | [
"def",
"missingkeys_standard",
"(",
"commdct",
",",
"dtls",
",",
"skiplist",
"=",
"None",
")",
":",
"if",
"skiplist",
"==",
"None",
":",
"skiplist",
"=",
"[",
"]",
"# find objects where all the fields are not named",
"gkeys",
"=",
"[",
"dtls",
"[",
"i",
"]",
... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.