repository_name stringlengths 7 55 | func_path_in_repository stringlengths 4 223 | func_name stringlengths 1 134 | whole_func_string stringlengths 75 104k | language stringclasses 1
value | func_code_string stringlengths 75 104k | func_code_tokens listlengths 19 28.4k | func_documentation_string stringlengths 1 46.9k | func_documentation_tokens listlengths 1 1.97k | split_name stringclasses 1
value | func_code_url stringlengths 87 315 |
|---|---|---|---|---|---|---|---|---|---|---|
santoshphilip/eppy | eppy/simplesurface.py | simplefenestration | def simplefenestration(idf, fsd, deletebsd=True, setto000=False):
"""convert a bsd (fenestrationsurface:detailed) into a simple
fenestrations"""
funcs = (window,
door,
glazeddoor,)
for func in funcs:
fenestration = func(idf, fsd, deletebsd=deletebsd, setto000=setto000)
i... | python | def simplefenestration(idf, fsd, deletebsd=True, setto000=False):
"""convert a bsd (fenestrationsurface:detailed) into a simple
fenestrations"""
funcs = (window,
door,
glazeddoor,)
for func in funcs:
fenestration = func(idf, fsd, deletebsd=deletebsd, setto000=setto000)
i... | [
"def",
"simplefenestration",
"(",
"idf",
",",
"fsd",
",",
"deletebsd",
"=",
"True",
",",
"setto000",
"=",
"False",
")",
":",
"funcs",
"=",
"(",
"window",
",",
"door",
",",
"glazeddoor",
",",
")",
"for",
"func",
"in",
"funcs",
":",
"fenestration",
"=",
... | convert a bsd (fenestrationsurface:detailed) into a simple
fenestrations | [
"convert",
"a",
"bsd",
"(",
"fenestrationsurface",
":",
"detailed",
")",
"into",
"a",
"simple",
"fenestrations"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/simplesurface.py#L427-L437 |
santoshphilip/eppy | eppy/results/readhtml.py | tdbr2EOL | def tdbr2EOL(td):
"""convert the <br/> in <td> block into line ending (EOL = \n)"""
for br in td.find_all("br"):
br.replace_with("\n")
txt = six.text_type(td) # make it back into test
# would be unicode(id) in python2
soup = BeautifulSoup(txt, 'lxml') # read it as a ... | python | def tdbr2EOL(td):
"""convert the <br/> in <td> block into line ending (EOL = \n)"""
for br in td.find_all("br"):
br.replace_with("\n")
txt = six.text_type(td) # make it back into test
# would be unicode(id) in python2
soup = BeautifulSoup(txt, 'lxml') # read it as a ... | [
"def",
"tdbr2EOL",
"(",
"td",
")",
":",
"for",
"br",
"in",
"td",
".",
"find_all",
"(",
"\"br\"",
")",
":",
"br",
".",
"replace_with",
"(",
"\"\\n\"",
")",
"txt",
"=",
"six",
".",
"text_type",
"(",
"td",
")",
"# make it back into test ",
"# would be unico... | convert the <br/> in <td> block into line ending (EOL = \n) | [
"convert",
"the",
"<br",
"/",
">",
"in",
"<td",
">",
"block",
"into",
"line",
"ending",
"(",
"EOL",
"=",
"\\",
"n",
")"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/results/readhtml.py#L24-L33 |
santoshphilip/eppy | eppy/results/readhtml.py | is_simpletable | def is_simpletable(table):
"""test if the table has only strings in the cells"""
tds = table('td')
for td in tds:
if td.contents != []:
td = tdbr2EOL(td)
if len(td.contents) == 1:
thecontents = td.contents[0]
if not isinstance(thecontents, Navi... | python | def is_simpletable(table):
"""test if the table has only strings in the cells"""
tds = table('td')
for td in tds:
if td.contents != []:
td = tdbr2EOL(td)
if len(td.contents) == 1:
thecontents = td.contents[0]
if not isinstance(thecontents, Navi... | [
"def",
"is_simpletable",
"(",
"table",
")",
":",
"tds",
"=",
"table",
"(",
"'td'",
")",
"for",
"td",
"in",
"tds",
":",
"if",
"td",
".",
"contents",
"!=",
"[",
"]",
":",
"td",
"=",
"tdbr2EOL",
"(",
"td",
")",
"if",
"len",
"(",
"td",
".",
"conten... | test if the table has only strings in the cells | [
"test",
"if",
"the",
"table",
"has",
"only",
"strings",
"in",
"the",
"cells"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/results/readhtml.py#L35-L47 |
santoshphilip/eppy | eppy/results/readhtml.py | table2matrix | def table2matrix(table):
"""convert a table to a list of lists - a 2D matrix"""
if not is_simpletable(table):
raise NotSimpleTable("Not able read a cell in the table as a string")
rows = []
for tr in table('tr'):
row = []
for td in tr('td'):
td = tdbr2EOL(td) # conve... | python | def table2matrix(table):
"""convert a table to a list of lists - a 2D matrix"""
if not is_simpletable(table):
raise NotSimpleTable("Not able read a cell in the table as a string")
rows = []
for tr in table('tr'):
row = []
for td in tr('td'):
td = tdbr2EOL(td) # conve... | [
"def",
"table2matrix",
"(",
"table",
")",
":",
"if",
"not",
"is_simpletable",
"(",
"table",
")",
":",
"raise",
"NotSimpleTable",
"(",
"\"Not able read a cell in the table as a string\"",
")",
"rows",
"=",
"[",
"]",
"for",
"tr",
"in",
"table",
"(",
"'tr'",
")",... | convert a table to a list of lists - a 2D matrix | [
"convert",
"a",
"table",
"to",
"a",
"list",
"of",
"lists",
"-",
"a",
"2D",
"matrix"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/results/readhtml.py#L49-L64 |
santoshphilip/eppy | eppy/results/readhtml.py | table2val_matrix | def table2val_matrix(table):
"""convert a table to a list of lists - a 2D matrix
Converts numbers to float"""
if not is_simpletable(table):
raise NotSimpleTable("Not able read a cell in the table as a string")
rows = []
for tr in table('tr'):
row = []
for td in tr('td'):
... | python | def table2val_matrix(table):
"""convert a table to a list of lists - a 2D matrix
Converts numbers to float"""
if not is_simpletable(table):
raise NotSimpleTable("Not able read a cell in the table as a string")
rows = []
for tr in table('tr'):
row = []
for td in tr('td'):
... | [
"def",
"table2val_matrix",
"(",
"table",
")",
":",
"if",
"not",
"is_simpletable",
"(",
"table",
")",
":",
"raise",
"NotSimpleTable",
"(",
"\"Not able read a cell in the table as a string\"",
")",
"rows",
"=",
"[",
"]",
"for",
"tr",
"in",
"table",
"(",
"'tr'",
... | convert a table to a list of lists - a 2D matrix
Converts numbers to float | [
"convert",
"a",
"table",
"to",
"a",
"list",
"of",
"lists",
"-",
"a",
"2D",
"matrix",
"Converts",
"numbers",
"to",
"float"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/results/readhtml.py#L66-L87 |
santoshphilip/eppy | eppy/results/readhtml.py | titletable | def titletable(html_doc, tofloat=True):
"""return a list of [(title, table), .....]
title = previous item with a <b> tag
table = rows -> [[cell1, cell2, ..], [cell1, cell2, ..], ..]"""
soup = BeautifulSoup(html_doc, "html.parser")
btables = soup.find_all(['b', 'table']) # find all the <b> and <tabl... | python | def titletable(html_doc, tofloat=True):
"""return a list of [(title, table), .....]
title = previous item with a <b> tag
table = rows -> [[cell1, cell2, ..], [cell1, cell2, ..], ..]"""
soup = BeautifulSoup(html_doc, "html.parser")
btables = soup.find_all(['b', 'table']) # find all the <b> and <tabl... | [
"def",
"titletable",
"(",
"html_doc",
",",
"tofloat",
"=",
"True",
")",
":",
"soup",
"=",
"BeautifulSoup",
"(",
"html_doc",
",",
"\"html.parser\"",
")",
"btables",
"=",
"soup",
".",
"find_all",
"(",
"[",
"'b'",
",",
"'table'",
"]",
")",
"# find all the <b>... | return a list of [(title, table), .....]
title = previous item with a <b> tag
table = rows -> [[cell1, cell2, ..], [cell1, cell2, ..], ..] | [
"return",
"a",
"list",
"of",
"[",
"(",
"title",
"table",
")",
".....",
"]"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/results/readhtml.py#L90-L109 |
santoshphilip/eppy | eppy/results/readhtml.py | _has_name | def _has_name(soup_obj):
"""checks if soup_obj is really a soup object or just a string
If it has a name it is a soup object"""
try:
name = soup_obj.name
if name == None:
return False
return True
except AttributeError:
return False | python | def _has_name(soup_obj):
"""checks if soup_obj is really a soup object or just a string
If it has a name it is a soup object"""
try:
name = soup_obj.name
if name == None:
return False
return True
except AttributeError:
return False | [
"def",
"_has_name",
"(",
"soup_obj",
")",
":",
"try",
":",
"name",
"=",
"soup_obj",
".",
"name",
"if",
"name",
"==",
"None",
":",
"return",
"False",
"return",
"True",
"except",
"AttributeError",
":",
"return",
"False"
] | checks if soup_obj is really a soup object or just a string
If it has a name it is a soup object | [
"checks",
"if",
"soup_obj",
"is",
"really",
"a",
"soup",
"object",
"or",
"just",
"a",
"string",
"If",
"it",
"has",
"a",
"name",
"it",
"is",
"a",
"soup",
"object"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/results/readhtml.py#L111-L120 |
santoshphilip/eppy | eppy/results/readhtml.py | lines_table | def lines_table(html_doc, tofloat=True):
"""return a list of [(lines, table), .....]
lines = all the significant lines before the table.
These are lines between this table and
the previous table or 'hr' tag
table = rows -> [[cell1, cell2, ..], [cell1, cell2, ..], ..]
The lines act as a... | python | def lines_table(html_doc, tofloat=True):
"""return a list of [(lines, table), .....]
lines = all the significant lines before the table.
These are lines between this table and
the previous table or 'hr' tag
table = rows -> [[cell1, cell2, ..], [cell1, cell2, ..], ..]
The lines act as a... | [
"def",
"lines_table",
"(",
"html_doc",
",",
"tofloat",
"=",
"True",
")",
":",
"soup",
"=",
"BeautifulSoup",
"(",
"html_doc",
",",
"\"html.parser\"",
")",
"linestables",
"=",
"[",
"]",
"elements",
"=",
"soup",
".",
"p",
".",
"next_elements",
"# start after th... | return a list of [(lines, table), .....]
lines = all the significant lines before the table.
These are lines between this table and
the previous table or 'hr' tag
table = rows -> [[cell1, cell2, ..], [cell1, cell2, ..], ..]
The lines act as a description for what is in the table | [
"return",
"a",
"list",
"of",
"[",
"(",
"lines",
"table",
")",
".....",
"]"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/results/readhtml.py#L122-L162 |
santoshphilip/eppy | eppy/results/readhtml.py | _make_ntgrid | def _make_ntgrid(grid):
"""make a named tuple grid
[["", "a b", "b c", "c d"],
["x y", 1, 2, 3 ],
["y z", 4, 5, 6 ],
["z z", 7, 8, 9 ],]
will return
ntcol(x_y=ntrow(a_b=1, b_c=2, c_d=3),
y_z=ntrow(a_b=4, b_c=5, c_d=6),
z_z=ntrow(a_b=7, b_c=8, ... | python | def _make_ntgrid(grid):
"""make a named tuple grid
[["", "a b", "b c", "c d"],
["x y", 1, 2, 3 ],
["y z", 4, 5, 6 ],
["z z", 7, 8, 9 ],]
will return
ntcol(x_y=ntrow(a_b=1, b_c=2, c_d=3),
y_z=ntrow(a_b=4, b_c=5, c_d=6),
z_z=ntrow(a_b=7, b_c=8, ... | [
"def",
"_make_ntgrid",
"(",
"grid",
")",
":",
"hnames",
"=",
"[",
"_nospace",
"(",
"n",
")",
"for",
"n",
"in",
"grid",
"[",
"0",
"]",
"[",
"1",
":",
"]",
"]",
"vnames",
"=",
"[",
"_nospace",
"(",
"row",
"[",
"0",
"]",
")",
"for",
"row",
"in",... | make a named tuple grid
[["", "a b", "b c", "c d"],
["x y", 1, 2, 3 ],
["y z", 4, 5, 6 ],
["z z", 7, 8, 9 ],]
will return
ntcol(x_y=ntrow(a_b=1, b_c=2, c_d=3),
y_z=ntrow(a_b=4, b_c=5, c_d=6),
z_z=ntrow(a_b=7, b_c=8, c_d=9)) | [
"make",
"a",
"named",
"tuple",
"grid"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/results/readhtml.py#L179-L199 |
santoshphilip/eppy | eppy/bunchhelpers.py | onlylegalchar | def onlylegalchar(name):
"""return only legal chars"""
legalchar = ascii_letters + digits + ' '
return ''.join([s for s in name[:] if s in legalchar]) | python | def onlylegalchar(name):
"""return only legal chars"""
legalchar = ascii_letters + digits + ' '
return ''.join([s for s in name[:] if s in legalchar]) | [
"def",
"onlylegalchar",
"(",
"name",
")",
":",
"legalchar",
"=",
"ascii_letters",
"+",
"digits",
"+",
"' '",
"return",
"''",
".",
"join",
"(",
"[",
"s",
"for",
"s",
"in",
"name",
"[",
":",
"]",
"if",
"s",
"in",
"legalchar",
"]",
")"
] | return only legal chars | [
"return",
"only",
"legal",
"chars"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/bunchhelpers.py#L16-L19 |
santoshphilip/eppy | eppy/bunchhelpers.py | matchfieldnames | def matchfieldnames(field_a, field_b):
"""Check match between two strings, ignoring case and spaces/underscores.
Parameters
----------
a : str
b : str
Returns
-------
bool
"""
normalised_a = field_a.replace(' ', '_').lower()
normalised_b = field_b.replace(' ', ... | python | def matchfieldnames(field_a, field_b):
"""Check match between two strings, ignoring case and spaces/underscores.
Parameters
----------
a : str
b : str
Returns
-------
bool
"""
normalised_a = field_a.replace(' ', '_').lower()
normalised_b = field_b.replace(' ', ... | [
"def",
"matchfieldnames",
"(",
"field_a",
",",
"field_b",
")",
":",
"normalised_a",
"=",
"field_a",
".",
"replace",
"(",
"' '",
",",
"'_'",
")",
".",
"lower",
"(",
")",
"normalised_b",
"=",
"field_b",
".",
"replace",
"(",
"' '",
",",
"'_'",
")",
".",
... | Check match between two strings, ignoring case and spaces/underscores.
Parameters
----------
a : str
b : str
Returns
-------
bool | [
"Check",
"match",
"between",
"two",
"strings",
"ignoring",
"case",
"and",
"spaces",
"/",
"underscores",
".",
"Parameters",
"----------",
"a",
":",
"str",
"b",
":",
"str",
"Returns",
"-------",
"bool"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/bunchhelpers.py#L27-L43 |
santoshphilip/eppy | eppy/bunchhelpers.py | intinlist | def intinlist(lst):
"""test if int in list"""
for item in lst:
try:
item = int(item)
return True
except ValueError:
pass
return False | python | def intinlist(lst):
"""test if int in list"""
for item in lst:
try:
item = int(item)
return True
except ValueError:
pass
return False | [
"def",
"intinlist",
"(",
"lst",
")",
":",
"for",
"item",
"in",
"lst",
":",
"try",
":",
"item",
"=",
"int",
"(",
"item",
")",
"return",
"True",
"except",
"ValueError",
":",
"pass",
"return",
"False"
] | test if int in list | [
"test",
"if",
"int",
"in",
"list"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/bunchhelpers.py#L45-L53 |
santoshphilip/eppy | eppy/bunchhelpers.py | replaceint | def replaceint(fname, replacewith='%s'):
"""replace int in lst"""
words = fname.split()
for i, word in enumerate(words):
try:
word = int(word)
words[i] = replacewith
except ValueError:
pass
return ' '.join(words) | python | def replaceint(fname, replacewith='%s'):
"""replace int in lst"""
words = fname.split()
for i, word in enumerate(words):
try:
word = int(word)
words[i] = replacewith
except ValueError:
pass
return ' '.join(words) | [
"def",
"replaceint",
"(",
"fname",
",",
"replacewith",
"=",
"'%s'",
")",
":",
"words",
"=",
"fname",
".",
"split",
"(",
")",
"for",
"i",
",",
"word",
"in",
"enumerate",
"(",
"words",
")",
":",
"try",
":",
"word",
"=",
"int",
"(",
"word",
")",
"wo... | replace int in lst | [
"replace",
"int",
"in",
"lst"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/bunchhelpers.py#L55-L64 |
santoshphilip/eppy | eppy/bunchhelpers.py | cleaniddfield | def cleaniddfield(acomm):
"""make all the keys lower case"""
for key in list(acomm.keys()):
val = acomm[key]
acomm[key.lower()] = val
for key in list(acomm.keys()):
val = acomm[key]
if key != key.lower():
acomm.pop(key)
return acomm | python | def cleaniddfield(acomm):
"""make all the keys lower case"""
for key in list(acomm.keys()):
val = acomm[key]
acomm[key.lower()] = val
for key in list(acomm.keys()):
val = acomm[key]
if key != key.lower():
acomm.pop(key)
return acomm | [
"def",
"cleaniddfield",
"(",
"acomm",
")",
":",
"for",
"key",
"in",
"list",
"(",
"acomm",
".",
"keys",
"(",
")",
")",
":",
"val",
"=",
"acomm",
"[",
"key",
"]",
"acomm",
"[",
"key",
".",
"lower",
"(",
")",
"]",
"=",
"val",
"for",
"key",
"in",
... | make all the keys lower case | [
"make",
"all",
"the",
"keys",
"lower",
"case"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/bunchhelpers.py#L66-L75 |
santoshphilip/eppy | eppy/useful_scripts/idfdiff.py | makecsvdiffs | def makecsvdiffs(thediffs, dtls, n1, n2):
"""return the csv to be displayed"""
def ishere(val):
if val == None:
return "not here"
else:
return "is here"
rows = []
rows.append(['file1 = %s' % (n1, )])
rows.append(['file2 = %s' % (n2, )])
rows.append('')
... | python | def makecsvdiffs(thediffs, dtls, n1, n2):
"""return the csv to be displayed"""
def ishere(val):
if val == None:
return "not here"
else:
return "is here"
rows = []
rows.append(['file1 = %s' % (n1, )])
rows.append(['file2 = %s' % (n2, )])
rows.append('')
... | [
"def",
"makecsvdiffs",
"(",
"thediffs",
",",
"dtls",
",",
"n1",
",",
"n2",
")",
":",
"def",
"ishere",
"(",
"val",
")",
":",
"if",
"val",
"==",
"None",
":",
"return",
"\"not here\"",
"else",
":",
"return",
"\"is here\"",
"rows",
"=",
"[",
"]",
"rows",... | return the csv to be displayed | [
"return",
"the",
"csv",
"to",
"be",
"displayed"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/useful_scripts/idfdiff.py#L71-L95 |
santoshphilip/eppy | eppy/useful_scripts/idfdiff.py | idfdiffs | def idfdiffs(idf1, idf2):
"""return the diffs between the two idfs"""
# for any object type, it is sorted by name
thediffs = {}
keys = idf1.model.dtls # undocumented variable
for akey in keys:
idfobjs1 = idf1.idfobjects[akey]
idfobjs2 = idf2.idfobjects[akey]
names = set([get... | python | def idfdiffs(idf1, idf2):
"""return the diffs between the two idfs"""
# for any object type, it is sorted by name
thediffs = {}
keys = idf1.model.dtls # undocumented variable
for akey in keys:
idfobjs1 = idf1.idfobjects[akey]
idfobjs2 = idf2.idfobjects[akey]
names = set([get... | [
"def",
"idfdiffs",
"(",
"idf1",
",",
"idf2",
")",
":",
"# for any object type, it is sorted by name",
"thediffs",
"=",
"{",
"}",
"keys",
"=",
"idf1",
".",
"model",
".",
"dtls",
"# undocumented variable",
"for",
"akey",
"in",
"keys",
":",
"idfobjs1",
"=",
"idf1... | return the diffs between the two idfs | [
"return",
"the",
"diffs",
"between",
"the",
"two",
"idfs"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/useful_scripts/idfdiff.py#L98-L135 |
santoshphilip/eppy | eppy/useful_scripts/idfdiff.py | printcsv | def printcsv(csvdiffs):
"""print the csv"""
for row in csvdiffs:
print(','.join([str(cell) for cell in row])) | python | def printcsv(csvdiffs):
"""print the csv"""
for row in csvdiffs:
print(','.join([str(cell) for cell in row])) | [
"def",
"printcsv",
"(",
"csvdiffs",
")",
":",
"for",
"row",
"in",
"csvdiffs",
":",
"print",
"(",
"','",
".",
"join",
"(",
"[",
"str",
"(",
"cell",
")",
"for",
"cell",
"in",
"row",
"]",
")",
")"
] | print the csv | [
"print",
"the",
"csv"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/useful_scripts/idfdiff.py#L137-L140 |
santoshphilip/eppy | eppy/useful_scripts/idfdiff.py | heading2table | def heading2table(soup, table, row):
"""add heading row to table"""
tr = Tag(soup, name="tr")
table.append(tr)
for attr in row:
th = Tag(soup, name="th")
tr.append(th)
th.append(attr) | python | def heading2table(soup, table, row):
"""add heading row to table"""
tr = Tag(soup, name="tr")
table.append(tr)
for attr in row:
th = Tag(soup, name="th")
tr.append(th)
th.append(attr) | [
"def",
"heading2table",
"(",
"soup",
",",
"table",
",",
"row",
")",
":",
"tr",
"=",
"Tag",
"(",
"soup",
",",
"name",
"=",
"\"tr\"",
")",
"table",
".",
"append",
"(",
"tr",
")",
"for",
"attr",
"in",
"row",
":",
"th",
"=",
"Tag",
"(",
"soup",
","... | add heading row to table | [
"add",
"heading",
"row",
"to",
"table"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/useful_scripts/idfdiff.py#L142-L149 |
santoshphilip/eppy | eppy/useful_scripts/idfdiff.py | row2table | def row2table(soup, table, row):
"""ad a row to the table"""
tr = Tag(soup, name="tr")
table.append(tr)
for attr in row:
td = Tag(soup, name="td")
tr.append(td)
td.append(attr) | python | def row2table(soup, table, row):
"""ad a row to the table"""
tr = Tag(soup, name="tr")
table.append(tr)
for attr in row:
td = Tag(soup, name="td")
tr.append(td)
td.append(attr) | [
"def",
"row2table",
"(",
"soup",
",",
"table",
",",
"row",
")",
":",
"tr",
"=",
"Tag",
"(",
"soup",
",",
"name",
"=",
"\"tr\"",
")",
"table",
".",
"append",
"(",
"tr",
")",
"for",
"attr",
"in",
"row",
":",
"td",
"=",
"Tag",
"(",
"soup",
",",
... | ad a row to the table | [
"ad",
"a",
"row",
"to",
"the",
"table"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/useful_scripts/idfdiff.py#L151-L158 |
santoshphilip/eppy | eppy/useful_scripts/idfdiff.py | printhtml | def printhtml(csvdiffs):
"""print the html"""
soup = BeautifulSoup()
html = Tag(soup, name="html")
para1 = Tag(soup, name="p")
para1.append(csvdiffs[0][0])
para2 = Tag(soup, name="p")
para2.append(csvdiffs[1][0])
table = Tag(soup, name="table")
table.attrs.update(dict(border="1"))
... | python | def printhtml(csvdiffs):
"""print the html"""
soup = BeautifulSoup()
html = Tag(soup, name="html")
para1 = Tag(soup, name="p")
para1.append(csvdiffs[0][0])
para2 = Tag(soup, name="p")
para2.append(csvdiffs[1][0])
table = Tag(soup, name="table")
table.attrs.update(dict(border="1"))
... | [
"def",
"printhtml",
"(",
"csvdiffs",
")",
":",
"soup",
"=",
"BeautifulSoup",
"(",
")",
"html",
"=",
"Tag",
"(",
"soup",
",",
"name",
"=",
"\"html\"",
")",
"para1",
"=",
"Tag",
"(",
"soup",
",",
"name",
"=",
"\"p\"",
")",
"para1",
".",
"append",
"("... | print the html | [
"print",
"the",
"html"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/useful_scripts/idfdiff.py#L161-L181 |
santoshphilip/eppy | eppy/bunch_subclass.py | extendlist | def extendlist(lst, i, value=''):
"""extend the list so that you have i-th value"""
if i < len(lst):
pass
else:
lst.extend([value, ] * (i - len(lst) + 1)) | python | def extendlist(lst, i, value=''):
"""extend the list so that you have i-th value"""
if i < len(lst):
pass
else:
lst.extend([value, ] * (i - len(lst) + 1)) | [
"def",
"extendlist",
"(",
"lst",
",",
"i",
",",
"value",
"=",
"''",
")",
":",
"if",
"i",
"<",
"len",
"(",
"lst",
")",
":",
"pass",
"else",
":",
"lst",
".",
"extend",
"(",
"[",
"value",
",",
"]",
"*",
"(",
"i",
"-",
"len",
"(",
"lst",
")",
... | extend the list so that you have i-th value | [
"extend",
"the",
"list",
"so",
"that",
"you",
"have",
"i",
"-",
"th",
"value"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/bunch_subclass.py#L56-L61 |
santoshphilip/eppy | eppy/bunch_subclass.py | addfunctions | def addfunctions(abunch):
"""add functions to epbunch"""
key = abunch.obj[0].upper()
#-----------------
# TODO : alternate strategy to avoid listing the objkeys in snames
# check if epbunch has field "Zone_Name" or "Building_Surface_Name"
# and is in group u'Thermal Zones and Surfaces'
# t... | python | def addfunctions(abunch):
"""add functions to epbunch"""
key = abunch.obj[0].upper()
#-----------------
# TODO : alternate strategy to avoid listing the objkeys in snames
# check if epbunch has field "Zone_Name" or "Building_Surface_Name"
# and is in group u'Thermal Zones and Surfaces'
# t... | [
"def",
"addfunctions",
"(",
"abunch",
")",
":",
"key",
"=",
"abunch",
".",
"obj",
"[",
"0",
"]",
".",
"upper",
"(",
")",
"#-----------------",
"# TODO : alternate strategy to avoid listing the objkeys in snames",
"# check if epbunch has field \"Zone_Name\" or \"Building_Surfa... | add functions to epbunch | [
"add",
"functions",
"to",
"epbunch"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/bunch_subclass.py#L69-L171 |
santoshphilip/eppy | eppy/bunch_subclass.py | getrange | def getrange(bch, fieldname):
"""get the ranges for this field"""
keys = ['maximum', 'minimum', 'maximum<', 'minimum>', 'type']
index = bch.objls.index(fieldname)
fielddct_orig = bch.objidd[index]
fielddct = copy.deepcopy(fielddct_orig)
therange = {}
for key in keys:
therange[key] = ... | python | def getrange(bch, fieldname):
"""get the ranges for this field"""
keys = ['maximum', 'minimum', 'maximum<', 'minimum>', 'type']
index = bch.objls.index(fieldname)
fielddct_orig = bch.objidd[index]
fielddct = copy.deepcopy(fielddct_orig)
therange = {}
for key in keys:
therange[key] = ... | [
"def",
"getrange",
"(",
"bch",
",",
"fieldname",
")",
":",
"keys",
"=",
"[",
"'maximum'",
",",
"'minimum'",
",",
"'maximum<'",
",",
"'minimum>'",
",",
"'type'",
"]",
"index",
"=",
"bch",
".",
"objls",
".",
"index",
"(",
"fieldname",
")",
"fielddct_orig",... | get the ranges for this field | [
"get",
"the",
"ranges",
"for",
"this",
"field"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/bunch_subclass.py#L380-L399 |
santoshphilip/eppy | eppy/bunch_subclass.py | checkrange | def checkrange(bch, fieldname):
"""throw exception if the out of range"""
fieldvalue = bch[fieldname]
therange = bch.getrange(fieldname)
if therange['maximum'] != None:
if fieldvalue > therange['maximum']:
astr = "Value %s is not less or equal to the 'maximum' of %s"
astr... | python | def checkrange(bch, fieldname):
"""throw exception if the out of range"""
fieldvalue = bch[fieldname]
therange = bch.getrange(fieldname)
if therange['maximum'] != None:
if fieldvalue > therange['maximum']:
astr = "Value %s is not less or equal to the 'maximum' of %s"
astr... | [
"def",
"checkrange",
"(",
"bch",
",",
"fieldname",
")",
":",
"fieldvalue",
"=",
"bch",
"[",
"fieldname",
"]",
"therange",
"=",
"bch",
".",
"getrange",
"(",
"fieldname",
")",
"if",
"therange",
"[",
"'maximum'",
"]",
"!=",
"None",
":",
"if",
"fieldvalue",
... | throw exception if the out of range | [
"throw",
"exception",
"if",
"the",
"out",
"of",
"range"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/bunch_subclass.py#L402-L428 |
santoshphilip/eppy | eppy/bunch_subclass.py | getfieldidd | def getfieldidd(bch, fieldname):
"""get the idd dict for this field
Will return {} if the fieldname does not exist"""
# print(bch)
try:
fieldindex = bch.objls.index(fieldname)
except ValueError as e:
return {} # the fieldname does not exist
# so there is no idd
... | python | def getfieldidd(bch, fieldname):
"""get the idd dict for this field
Will return {} if the fieldname does not exist"""
# print(bch)
try:
fieldindex = bch.objls.index(fieldname)
except ValueError as e:
return {} # the fieldname does not exist
# so there is no idd
... | [
"def",
"getfieldidd",
"(",
"bch",
",",
"fieldname",
")",
":",
"# print(bch)",
"try",
":",
"fieldindex",
"=",
"bch",
".",
"objls",
".",
"index",
"(",
"fieldname",
")",
"except",
"ValueError",
"as",
"e",
":",
"return",
"{",
"}",
"# the fieldname does not exist... | get the idd dict for this field
Will return {} if the fieldname does not exist | [
"get",
"the",
"idd",
"dict",
"for",
"this",
"field",
"Will",
"return",
"{}",
"if",
"the",
"fieldname",
"does",
"not",
"exist"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/bunch_subclass.py#L430-L440 |
santoshphilip/eppy | eppy/bunch_subclass.py | getfieldidd_item | def getfieldidd_item(bch, fieldname, iddkey):
"""return an item from the fieldidd, given the iddkey
will return and empty list if it does not have the iddkey
or if the fieldname does not exist"""
fieldidd = getfieldidd(bch, fieldname)
try:
return fieldidd[iddkey]
except KeyError as e:
... | python | def getfieldidd_item(bch, fieldname, iddkey):
"""return an item from the fieldidd, given the iddkey
will return and empty list if it does not have the iddkey
or if the fieldname does not exist"""
fieldidd = getfieldidd(bch, fieldname)
try:
return fieldidd[iddkey]
except KeyError as e:
... | [
"def",
"getfieldidd_item",
"(",
"bch",
",",
"fieldname",
",",
"iddkey",
")",
":",
"fieldidd",
"=",
"getfieldidd",
"(",
"bch",
",",
"fieldname",
")",
"try",
":",
"return",
"fieldidd",
"[",
"iddkey",
"]",
"except",
"KeyError",
"as",
"e",
":",
"return",
"["... | return an item from the fieldidd, given the iddkey
will return and empty list if it does not have the iddkey
or if the fieldname does not exist | [
"return",
"an",
"item",
"from",
"the",
"fieldidd",
"given",
"the",
"iddkey",
"will",
"return",
"and",
"empty",
"list",
"if",
"it",
"does",
"not",
"have",
"the",
"iddkey",
"or",
"if",
"the",
"fieldname",
"does",
"not",
"exist"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/bunch_subclass.py#L442-L450 |
santoshphilip/eppy | eppy/bunch_subclass.py | isequal | def isequal(bch, fieldname, value, places=7):
"""return True if the field is equal to value"""
def equalalphanumeric(bch, fieldname, value):
if bch.get_retaincase(fieldname):
return bch[fieldname] == value
else:
return bch[fieldname].upper() == value.upper()
fieldidd... | python | def isequal(bch, fieldname, value, places=7):
"""return True if the field is equal to value"""
def equalalphanumeric(bch, fieldname, value):
if bch.get_retaincase(fieldname):
return bch[fieldname] == value
else:
return bch[fieldname].upper() == value.upper()
fieldidd... | [
"def",
"isequal",
"(",
"bch",
",",
"fieldname",
",",
"value",
",",
"places",
"=",
"7",
")",
":",
"def",
"equalalphanumeric",
"(",
"bch",
",",
"fieldname",
",",
"value",
")",
":",
"if",
"bch",
".",
"get_retaincase",
"(",
"fieldname",
")",
":",
"return",... | return True if the field is equal to value | [
"return",
"True",
"if",
"the",
"field",
"is",
"equal",
"to",
"value"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/bunch_subclass.py#L459-L475 |
santoshphilip/eppy | eppy/bunch_subclass.py | getreferingobjs | def getreferingobjs(referedobj, iddgroups=None, fields=None):
"""Get a list of objects that refer to this object"""
# pseudocode for code below
# referringobjs = []
# referedobj has: -> Name
# -> reference
# for each obj in idf:
# [optional filter -> objects in iddgroup]
... | python | def getreferingobjs(referedobj, iddgroups=None, fields=None):
"""Get a list of objects that refer to this object"""
# pseudocode for code below
# referringobjs = []
# referedobj has: -> Name
# -> reference
# for each obj in idf:
# [optional filter -> objects in iddgroup]
... | [
"def",
"getreferingobjs",
"(",
"referedobj",
",",
"iddgroups",
"=",
"None",
",",
"fields",
"=",
"None",
")",
":",
"# pseudocode for code below",
"# referringobjs = []",
"# referedobj has: -> Name",
"# -> reference",
"# for each obj in idf:",
"# [optional filter ... | Get a list of objects that refer to this object | [
"Get",
"a",
"list",
"of",
"objects",
"that",
"refer",
"to",
"this",
"object"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/bunch_subclass.py#L478-L519 |
santoshphilip/eppy | eppy/bunch_subclass.py | get_referenced_object | def get_referenced_object(referring_object, fieldname):
"""
Get an object referred to by a field in another object.
For example an object of type Construction has fields for each layer, each
of which refers to a Material. This functions allows the object
representing a Material to be fetched using ... | python | def get_referenced_object(referring_object, fieldname):
"""
Get an object referred to by a field in another object.
For example an object of type Construction has fields for each layer, each
of which refers to a Material. This functions allows the object
representing a Material to be fetched using ... | [
"def",
"get_referenced_object",
"(",
"referring_object",
",",
"fieldname",
")",
":",
"idf",
"=",
"referring_object",
".",
"theidf",
"object_list",
"=",
"referring_object",
".",
"getfieldidd_item",
"(",
"fieldname",
",",
"u'object-list'",
")",
"for",
"obj_type",
"in"... | Get an object referred to by a field in another object.
For example an object of type Construction has fields for each layer, each
of which refers to a Material. This functions allows the object
representing a Material to be fetched using the name of the layer.
Returns the first item found since if th... | [
"Get",
"an",
"object",
"referred",
"to",
"by",
"a",
"field",
"in",
"another",
"object",
"."
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/bunch_subclass.py#L522-L554 |
santoshphilip/eppy | eppy/bunch_subclass.py | EpBunch.isequal | def isequal(self, fieldname, value, places=7):
"""return True if the field == value
Will retain case if get_retaincase == True
for real value will compare to decimal 'places'
"""
return isequal(self, fieldname, value, places=places) | python | def isequal(self, fieldname, value, places=7):
"""return True if the field == value
Will retain case if get_retaincase == True
for real value will compare to decimal 'places'
"""
return isequal(self, fieldname, value, places=places) | [
"def",
"isequal",
"(",
"self",
",",
"fieldname",
",",
"value",
",",
"places",
"=",
"7",
")",
":",
"return",
"isequal",
"(",
"self",
",",
"fieldname",
",",
"value",
",",
"places",
"=",
"places",
")"
] | return True if the field == value
Will retain case if get_retaincase == True
for real value will compare to decimal 'places' | [
"return",
"True",
"if",
"the",
"field",
"==",
"value",
"Will",
"retain",
"case",
"if",
"get_retaincase",
"==",
"True",
"for",
"real",
"value",
"will",
"compare",
"to",
"decimal",
"places"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/bunch_subclass.py#L228-L233 |
santoshphilip/eppy | eppy/bunch_subclass.py | EpBunch.getreferingobjs | def getreferingobjs(self, iddgroups=None, fields=None):
"""Get a list of objects that refer to this object"""
return getreferingobjs(self, iddgroups=iddgroups, fields=fields) | python | def getreferingobjs(self, iddgroups=None, fields=None):
"""Get a list of objects that refer to this object"""
return getreferingobjs(self, iddgroups=iddgroups, fields=fields) | [
"def",
"getreferingobjs",
"(",
"self",
",",
"iddgroups",
"=",
"None",
",",
"fields",
"=",
"None",
")",
":",
"return",
"getreferingobjs",
"(",
"self",
",",
"iddgroups",
"=",
"iddgroups",
",",
"fields",
"=",
"fields",
")"
] | Get a list of objects that refer to this object | [
"Get",
"a",
"list",
"of",
"objects",
"that",
"refer",
"to",
"this",
"object"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/bunch_subclass.py#L235-L237 |
santoshphilip/eppy | eppy/geometry/volume_zone.py | vol_tehrahedron | def vol_tehrahedron(poly):
"""volume of a irregular tetrahedron"""
p_a = np.array(poly[0])
p_b = np.array(poly[1])
p_c = np.array(poly[2])
p_d = np.array(poly[3])
return abs(np.dot(
np.subtract(p_a, p_d),
np.cross(
np.subtract(p_b, p_d),
np.subtract(p_c, p... | python | def vol_tehrahedron(poly):
"""volume of a irregular tetrahedron"""
p_a = np.array(poly[0])
p_b = np.array(poly[1])
p_c = np.array(poly[2])
p_d = np.array(poly[3])
return abs(np.dot(
np.subtract(p_a, p_d),
np.cross(
np.subtract(p_b, p_d),
np.subtract(p_c, p... | [
"def",
"vol_tehrahedron",
"(",
"poly",
")",
":",
"p_a",
"=",
"np",
".",
"array",
"(",
"poly",
"[",
"0",
"]",
")",
"p_b",
"=",
"np",
".",
"array",
"(",
"poly",
"[",
"1",
"]",
")",
"p_c",
"=",
"np",
".",
"array",
"(",
"poly",
"[",
"2",
"]",
"... | volume of a irregular tetrahedron | [
"volume",
"of",
"a",
"irregular",
"tetrahedron"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/geometry/volume_zone.py#L24-L34 |
santoshphilip/eppy | eppy/geometry/volume_zone.py | vol | def vol(poly1, poly2):
""""volume of a zone defined by two polygon bases """
c_point = central_p(poly1, poly2)
c_point = (c_point[0], c_point[1], c_point[2])
vol_therah = 0
num = len(poly1)
poly1.append(poly1[0])
poly2.append(poly2[0])
for i in range(num - 2):
# the upper part
... | python | def vol(poly1, poly2):
""""volume of a zone defined by two polygon bases """
c_point = central_p(poly1, poly2)
c_point = (c_point[0], c_point[1], c_point[2])
vol_therah = 0
num = len(poly1)
poly1.append(poly1[0])
poly2.append(poly2[0])
for i in range(num - 2):
# the upper part
... | [
"def",
"vol",
"(",
"poly1",
",",
"poly2",
")",
":",
"c_point",
"=",
"central_p",
"(",
"poly1",
",",
"poly2",
")",
"c_point",
"=",
"(",
"c_point",
"[",
"0",
"]",
",",
"c_point",
"[",
"1",
"]",
",",
"c_point",
"[",
"2",
"]",
")",
"vol_therah",
"=",... | volume of a zone defined by two polygon bases | [
"volume",
"of",
"a",
"zone",
"defined",
"by",
"two",
"polygon",
"bases"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/geometry/volume_zone.py#L42-L63 |
santoshphilip/eppy | eppy/EPlusInterfaceFunctions/iddindex.py | makename2refdct | def makename2refdct(commdct):
"""make the name2refs dict in the idd_index"""
refdct = {}
for comm in commdct: # commdct is a list of dict
try:
idfobj = comm[0]['idfobj'].upper()
field1 = comm[1]
if 'Name' in field1['field']:
references = field1['re... | python | def makename2refdct(commdct):
"""make the name2refs dict in the idd_index"""
refdct = {}
for comm in commdct: # commdct is a list of dict
try:
idfobj = comm[0]['idfobj'].upper()
field1 = comm[1]
if 'Name' in field1['field']:
references = field1['re... | [
"def",
"makename2refdct",
"(",
"commdct",
")",
":",
"refdct",
"=",
"{",
"}",
"for",
"comm",
"in",
"commdct",
":",
"# commdct is a list of dict",
"try",
":",
"idfobj",
"=",
"comm",
"[",
"0",
"]",
"[",
"'idfobj'",
"]",
".",
"upper",
"(",
")",
"field1",
"... | make the name2refs dict in the idd_index | [
"make",
"the",
"name2refs",
"dict",
"in",
"the",
"idd_index"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/iddindex.py#L51-L63 |
santoshphilip/eppy | eppy/EPlusInterfaceFunctions/iddindex.py | makeref2namesdct | def makeref2namesdct(name2refdct):
"""make the ref2namesdct in the idd_index"""
ref2namesdct = {}
for key, values in name2refdct.items():
for value in values:
ref2namesdct.setdefault(value, set()).add(key)
return ref2namesdct | python | def makeref2namesdct(name2refdct):
"""make the ref2namesdct in the idd_index"""
ref2namesdct = {}
for key, values in name2refdct.items():
for value in values:
ref2namesdct.setdefault(value, set()).add(key)
return ref2namesdct | [
"def",
"makeref2namesdct",
"(",
"name2refdct",
")",
":",
"ref2namesdct",
"=",
"{",
"}",
"for",
"key",
",",
"values",
"in",
"name2refdct",
".",
"items",
"(",
")",
":",
"for",
"value",
"in",
"values",
":",
"ref2namesdct",
".",
"setdefault",
"(",
"value",
"... | make the ref2namesdct in the idd_index | [
"make",
"the",
"ref2namesdct",
"in",
"the",
"idd_index"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/iddindex.py#L65-L71 |
santoshphilip/eppy | eppy/EPlusInterfaceFunctions/iddindex.py | ref2names2commdct | def ref2names2commdct(ref2names, commdct):
"""embed ref2names into commdct"""
for comm in commdct:
for cdct in comm:
try:
refs = cdct['object-list'][0]
validobjects = ref2names[refs]
cdct.update({'validobjects':validobjects})
except... | python | def ref2names2commdct(ref2names, commdct):
"""embed ref2names into commdct"""
for comm in commdct:
for cdct in comm:
try:
refs = cdct['object-list'][0]
validobjects = ref2names[refs]
cdct.update({'validobjects':validobjects})
except... | [
"def",
"ref2names2commdct",
"(",
"ref2names",
",",
"commdct",
")",
":",
"for",
"comm",
"in",
"commdct",
":",
"for",
"cdct",
"in",
"comm",
":",
"try",
":",
"refs",
"=",
"cdct",
"[",
"'object-list'",
"]",
"[",
"0",
"]",
"validobjects",
"=",
"ref2names",
... | embed ref2names into commdct | [
"embed",
"ref2names",
"into",
"commdct"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/iddindex.py#L73-L83 |
santoshphilip/eppy | eppy/geometry/area_zone.py | area | def area(poly):
"""Calculation of zone area"""
poly_xy = []
num = len(poly)
for i in range(num):
poly[i] = poly[i][0:2] + (0,)
poly_xy.append(poly[i])
return surface.area(poly) | python | def area(poly):
"""Calculation of zone area"""
poly_xy = []
num = len(poly)
for i in range(num):
poly[i] = poly[i][0:2] + (0,)
poly_xy.append(poly[i])
return surface.area(poly) | [
"def",
"area",
"(",
"poly",
")",
":",
"poly_xy",
"=",
"[",
"]",
"num",
"=",
"len",
"(",
"poly",
")",
"for",
"i",
"in",
"range",
"(",
"num",
")",
":",
"poly",
"[",
"i",
"]",
"=",
"poly",
"[",
"i",
"]",
"[",
"0",
":",
"2",
"]",
"+",
"(",
... | Calculation of zone area | [
"Calculation",
"of",
"zone",
"area"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/geometry/area_zone.py#L19-L26 |
santoshphilip/eppy | eppy/walk_hvac.py | prevnode | def prevnode(edges, component):
"""get the pervious component in the loop"""
e = edges
c = component
n2c = [(a, b) for a, b in e if type(a) == tuple]
c2n = [(a, b) for a, b in e if type(b) == tuple]
node2cs = [(a, b) for a, b in e if b == c]
c2nodes = []
for node2c in node2cs:
c2... | python | def prevnode(edges, component):
"""get the pervious component in the loop"""
e = edges
c = component
n2c = [(a, b) for a, b in e if type(a) == tuple]
c2n = [(a, b) for a, b in e if type(b) == tuple]
node2cs = [(a, b) for a, b in e if b == c]
c2nodes = []
for node2c in node2cs:
c2... | [
"def",
"prevnode",
"(",
"edges",
",",
"component",
")",
":",
"e",
"=",
"edges",
"c",
"=",
"component",
"n2c",
"=",
"[",
"(",
"a",
",",
"b",
")",
"for",
"a",
",",
"b",
"in",
"e",
"if",
"type",
"(",
"a",
")",
"==",
"tuple",
"]",
"c2n",
"=",
"... | get the pervious component in the loop | [
"get",
"the",
"pervious",
"component",
"in",
"the",
"loop"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/walk_hvac.py#L39-L61 |
santoshphilip/eppy | eppy/geometry/height_surface.py | height | def height(poly):
"""height"""
num = len(poly)
hgt = 0.0
for i in range(num):
hgt += (poly[i][2])
return hgt/num | python | def height(poly):
"""height"""
num = len(poly)
hgt = 0.0
for i in range(num):
hgt += (poly[i][2])
return hgt/num | [
"def",
"height",
"(",
"poly",
")",
":",
"num",
"=",
"len",
"(",
"poly",
")",
"hgt",
"=",
"0.0",
"for",
"i",
"in",
"range",
"(",
"num",
")",
":",
"hgt",
"+=",
"(",
"poly",
"[",
"i",
"]",
"[",
"2",
"]",
")",
"return",
"hgt",
"/",
"num"
] | height | [
"height"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/geometry/height_surface.py#L40-L46 |
santoshphilip/eppy | eppy/geometry/height_surface.py | unit_normal | def unit_normal(apnt, bpnt, cpnt):
"""unit normal"""
xvar = np.tinylinalg.det([
[1, apnt[1], apnt[2]], [1, bpnt[1], bpnt[2]], [1, cpnt[1], cpnt[2]]])
yvar = np.tinylinalg.det([
[apnt[0], 1, apnt[2]], [bpnt[0], 1, bpnt[2]], [cpnt[0], 1, cpnt[2]]])
zvar = np.tinylinalg.det([
[apnt[... | python | def unit_normal(apnt, bpnt, cpnt):
"""unit normal"""
xvar = np.tinylinalg.det([
[1, apnt[1], apnt[2]], [1, bpnt[1], bpnt[2]], [1, cpnt[1], cpnt[2]]])
yvar = np.tinylinalg.det([
[apnt[0], 1, apnt[2]], [bpnt[0], 1, bpnt[2]], [cpnt[0], 1, cpnt[2]]])
zvar = np.tinylinalg.det([
[apnt[... | [
"def",
"unit_normal",
"(",
"apnt",
",",
"bpnt",
",",
"cpnt",
")",
":",
"xvar",
"=",
"np",
".",
"tinylinalg",
".",
"det",
"(",
"[",
"[",
"1",
",",
"apnt",
"[",
"1",
"]",
",",
"apnt",
"[",
"2",
"]",
"]",
",",
"[",
"1",
",",
"bpnt",
"[",
"1",
... | unit normal | [
"unit",
"normal"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/geometry/height_surface.py#L49-L61 |
santoshphilip/eppy | eppy/idf_msequence.py | Idf_MSequence.insert | def insert(self, i, v):
"""Insert an idfobject (bunch) to list1 and its object to list2."""
self.list1.insert(i, v)
self.list2.insert(i, v.obj)
if isinstance(v, EpBunch):
v.theidf = self.theidf | python | def insert(self, i, v):
"""Insert an idfobject (bunch) to list1 and its object to list2."""
self.list1.insert(i, v)
self.list2.insert(i, v.obj)
if isinstance(v, EpBunch):
v.theidf = self.theidf | [
"def",
"insert",
"(",
"self",
",",
"i",
",",
"v",
")",
":",
"self",
".",
"list1",
".",
"insert",
"(",
"i",
",",
"v",
")",
"self",
".",
"list2",
".",
"insert",
"(",
"i",
",",
"v",
".",
"obj",
")",
"if",
"isinstance",
"(",
"v",
",",
"EpBunch",
... | Insert an idfobject (bunch) to list1 and its object to list2. | [
"Insert",
"an",
"idfobject",
"(",
"bunch",
")",
"to",
"list1",
"and",
"its",
"object",
"to",
"list2",
"."
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/idf_msequence.py#L71-L76 |
santoshphilip/eppy | eppy/function_helpers.py | grouper | def grouper(num, iterable, fillvalue=None):
"Collect data into fixed-length chunks or blocks"
# grouper(3, 'ABCDEFG', 'x') --> ABC DEF Gxx
args = [iter(iterable)] * num
return zip_longest(fillvalue=fillvalue, *args) | python | def grouper(num, iterable, fillvalue=None):
"Collect data into fixed-length chunks or blocks"
# grouper(3, 'ABCDEFG', 'x') --> ABC DEF Gxx
args = [iter(iterable)] * num
return zip_longest(fillvalue=fillvalue, *args) | [
"def",
"grouper",
"(",
"num",
",",
"iterable",
",",
"fillvalue",
"=",
"None",
")",
":",
"# grouper(3, 'ABCDEFG', 'x') --> ABC DEF Gxx",
"args",
"=",
"[",
"iter",
"(",
"iterable",
")",
"]",
"*",
"num",
"return",
"zip_longest",
"(",
"fillvalue",
"=",
"fillvalue"... | Collect data into fixed-length chunks or blocks | [
"Collect",
"data",
"into",
"fixed",
"-",
"length",
"chunks",
"or",
"blocks"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/function_helpers.py#L21-L25 |
santoshphilip/eppy | eppy/function_helpers.py | getcoords | def getcoords(ddtt):
"""return the coordinates of the surface"""
n_vertices_index = ddtt.objls.index('Number_of_Vertices')
first_x = n_vertices_index + 1 # X of first coordinate
pts = ddtt.obj[first_x:]
return list(grouper(3, pts)) | python | def getcoords(ddtt):
"""return the coordinates of the surface"""
n_vertices_index = ddtt.objls.index('Number_of_Vertices')
first_x = n_vertices_index + 1 # X of first coordinate
pts = ddtt.obj[first_x:]
return list(grouper(3, pts)) | [
"def",
"getcoords",
"(",
"ddtt",
")",
":",
"n_vertices_index",
"=",
"ddtt",
".",
"objls",
".",
"index",
"(",
"'Number_of_Vertices'",
")",
"first_x",
"=",
"n_vertices_index",
"+",
"1",
"# X of first coordinate",
"pts",
"=",
"ddtt",
".",
"obj",
"[",
"first_x",
... | return the coordinates of the surface | [
"return",
"the",
"coordinates",
"of",
"the",
"surface"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/function_helpers.py#L27-L32 |
santoshphilip/eppy | eppy/function_helpers.py | buildingname | def buildingname(ddtt):
"""return building name"""
idf = ddtt.theidf
building = idf.idfobjects['building'.upper()][0]
return building.Name | python | def buildingname(ddtt):
"""return building name"""
idf = ddtt.theidf
building = idf.idfobjects['building'.upper()][0]
return building.Name | [
"def",
"buildingname",
"(",
"ddtt",
")",
":",
"idf",
"=",
"ddtt",
".",
"theidf",
"building",
"=",
"idf",
".",
"idfobjects",
"[",
"'building'",
".",
"upper",
"(",
")",
"]",
"[",
"0",
"]",
"return",
"building",
".",
"Name"
] | return building name | [
"return",
"building",
"name"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/function_helpers.py#L59-L63 |
santoshphilip/eppy | eppy/easyopen.py | cleanupversion | def cleanupversion(ver):
"""massage the version number so it matches the format of install folder"""
lst = ver.split(".")
if len(lst) == 1:
lst.extend(['0', '0'])
elif len(lst) == 2:
lst.extend(['0'])
elif len(lst) > 2:
lst = lst[:3]
lst[2] = '0' # ensure the 3rd number i... | python | def cleanupversion(ver):
"""massage the version number so it matches the format of install folder"""
lst = ver.split(".")
if len(lst) == 1:
lst.extend(['0', '0'])
elif len(lst) == 2:
lst.extend(['0'])
elif len(lst) > 2:
lst = lst[:3]
lst[2] = '0' # ensure the 3rd number i... | [
"def",
"cleanupversion",
"(",
"ver",
")",
":",
"lst",
"=",
"ver",
".",
"split",
"(",
"\".\"",
")",
"if",
"len",
"(",
"lst",
")",
"==",
"1",
":",
"lst",
".",
"extend",
"(",
"[",
"'0'",
",",
"'0'",
"]",
")",
"elif",
"len",
"(",
"lst",
")",
"=="... | massage the version number so it matches the format of install folder | [
"massage",
"the",
"version",
"number",
"so",
"it",
"matches",
"the",
"format",
"of",
"install",
"folder"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/easyopen.py#L32-L43 |
santoshphilip/eppy | eppy/easyopen.py | getiddfile | def getiddfile(versionid):
"""find the IDD file of the E+ installation"""
vlist = versionid.split('.')
if len(vlist) == 1:
vlist = vlist + ['0', '0']
elif len(vlist) == 2:
vlist = vlist + ['0']
ver_str = '-'.join(vlist)
eplus_exe, _ = eppy.runner.run_functions.install_paths(ver... | python | def getiddfile(versionid):
"""find the IDD file of the E+ installation"""
vlist = versionid.split('.')
if len(vlist) == 1:
vlist = vlist + ['0', '0']
elif len(vlist) == 2:
vlist = vlist + ['0']
ver_str = '-'.join(vlist)
eplus_exe, _ = eppy.runner.run_functions.install_paths(ver... | [
"def",
"getiddfile",
"(",
"versionid",
")",
":",
"vlist",
"=",
"versionid",
".",
"split",
"(",
"'.'",
")",
"if",
"len",
"(",
"vlist",
")",
"==",
"1",
":",
"vlist",
"=",
"vlist",
"+",
"[",
"'0'",
",",
"'0'",
"]",
"elif",
"len",
"(",
"vlist",
")",
... | find the IDD file of the E+ installation | [
"find",
"the",
"IDD",
"file",
"of",
"the",
"E",
"+",
"installation"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/easyopen.py#L45-L56 |
santoshphilip/eppy | eppy/easyopen.py | easyopen | def easyopen(fname, idd=None, epw=None):
"""automatically set idd and open idf file. Uses version from idf to set correct idd
It will work under the following circumstances:
- the IDF file should have the VERSION object.
- Needs the version of EnergyPlus installed that matches the IDF version.
... | python | def easyopen(fname, idd=None, epw=None):
"""automatically set idd and open idf file. Uses version from idf to set correct idd
It will work under the following circumstances:
- the IDF file should have the VERSION object.
- Needs the version of EnergyPlus installed that matches the IDF version.
... | [
"def",
"easyopen",
"(",
"fname",
",",
"idd",
"=",
"None",
",",
"epw",
"=",
"None",
")",
":",
"if",
"idd",
":",
"eppy",
".",
"modeleditor",
".",
"IDF",
".",
"setiddname",
"(",
"idd",
")",
"idf",
"=",
"eppy",
".",
"modeleditor",
".",
"IDF",
"(",
"f... | automatically set idd and open idf file. Uses version from idf to set correct idd
It will work under the following circumstances:
- the IDF file should have the VERSION object.
- Needs the version of EnergyPlus installed that matches the IDF version.
- Energyplus should be installed in the default... | [
"automatically",
"set",
"idd",
"and",
"open",
"idf",
"file",
".",
"Uses",
"version",
"from",
"idf",
"to",
"set",
"correct",
"idd",
"It",
"will",
"work",
"under",
"the",
"following",
"circumstances",
":",
"-",
"the",
"IDF",
"file",
"should",
"have",
"the",
... | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/easyopen.py#L72-L143 |
santoshphilip/eppy | eppy/EPlusInterfaceFunctions/eplusdata.py | removecomment | def removecomment(astr, cphrase):
"""
the comment is similar to that in python.
any charachter after the # is treated as a comment
until the end of the line
astr is the string to be de-commented
cphrase is the comment phrase"""
# linesep = mylib3.getlinesep(astr)
alist = astr.splitlines(... | python | def removecomment(astr, cphrase):
"""
the comment is similar to that in python.
any charachter after the # is treated as a comment
until the end of the line
astr is the string to be de-commented
cphrase is the comment phrase"""
# linesep = mylib3.getlinesep(astr)
alist = astr.splitlines(... | [
"def",
"removecomment",
"(",
"astr",
",",
"cphrase",
")",
":",
"# linesep = mylib3.getlinesep(astr)",
"alist",
"=",
"astr",
".",
"splitlines",
"(",
")",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"alist",
")",
")",
":",
"alist1",
"=",
"alist",
"[",
"i",... | the comment is similar to that in python.
any charachter after the # is treated as a comment
until the end of the line
astr is the string to be de-commented
cphrase is the comment phrase | [
"the",
"comment",
"is",
"similar",
"to",
"that",
"in",
"python",
".",
"any",
"charachter",
"after",
"the",
"#",
"is",
"treated",
"as",
"a",
"comment",
"until",
"the",
"end",
"of",
"the",
"line",
"astr",
"is",
"the",
"string",
"to",
"be",
"de",
"-",
"... | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/eplusdata.py#L24-L38 |
santoshphilip/eppy | eppy/EPlusInterfaceFunctions/eplusdata.py | Idd.initdict2 | def initdict2(self, dictfile):
"""initdict2"""
dt = {}
dtls = []
adict = dictfile
for element in adict:
dt[element[0].upper()] = [] # dict keys for objects always in caps
dtls.append(element[0].upper())
return dt, dtls | python | def initdict2(self, dictfile):
"""initdict2"""
dt = {}
dtls = []
adict = dictfile
for element in adict:
dt[element[0].upper()] = [] # dict keys for objects always in caps
dtls.append(element[0].upper())
return dt, dtls | [
"def",
"initdict2",
"(",
"self",
",",
"dictfile",
")",
":",
"dt",
"=",
"{",
"}",
"dtls",
"=",
"[",
"]",
"adict",
"=",
"dictfile",
"for",
"element",
"in",
"adict",
":",
"dt",
"[",
"element",
"[",
"0",
"]",
".",
"upper",
"(",
")",
"]",
"=",
"[",
... | initdict2 | [
"initdict2"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/eplusdata.py#L54-L62 |
santoshphilip/eppy | eppy/EPlusInterfaceFunctions/eplusdata.py | Eplusdata.initdict | def initdict(self, fname):
"""create a blank dictionary"""
if isinstance(fname, Idd):
self.dt, self.dtls = fname.dt, fname.dtls
return self.dt, self.dtls
astr = mylib2.readfile(fname)
nocom = removecomment(astr, '!')
idfst = nocom
alist = idfst.sp... | python | def initdict(self, fname):
"""create a blank dictionary"""
if isinstance(fname, Idd):
self.dt, self.dtls = fname.dt, fname.dtls
return self.dt, self.dtls
astr = mylib2.readfile(fname)
nocom = removecomment(astr, '!')
idfst = nocom
alist = idfst.sp... | [
"def",
"initdict",
"(",
"self",
",",
"fname",
")",
":",
"if",
"isinstance",
"(",
"fname",
",",
"Idd",
")",
":",
"self",
".",
"dt",
",",
"self",
".",
"dtls",
"=",
"fname",
".",
"dt",
",",
"fname",
".",
"dtls",
"return",
"self",
".",
"dt",
",",
"... | create a blank dictionary | [
"create",
"a",
"blank",
"dictionary"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/eplusdata.py#L146-L174 |
santoshphilip/eppy | eppy/EPlusInterfaceFunctions/eplusdata.py | Eplusdata.makedict | def makedict(self, dictfile, fnamefobject):
"""stuff file data into the blank dictionary"""
#fname = './exapmlefiles/5ZoneDD.idf'
#fname = './1ZoneUncontrolled.idf'
if isinstance(dictfile, Idd):
localidd = copy.deepcopy(dictfile)
dt, dtls = localidd.dt, localidd.d... | python | def makedict(self, dictfile, fnamefobject):
"""stuff file data into the blank dictionary"""
#fname = './exapmlefiles/5ZoneDD.idf'
#fname = './1ZoneUncontrolled.idf'
if isinstance(dictfile, Idd):
localidd = copy.deepcopy(dictfile)
dt, dtls = localidd.dt, localidd.d... | [
"def",
"makedict",
"(",
"self",
",",
"dictfile",
",",
"fnamefobject",
")",
":",
"#fname = './exapmlefiles/5ZoneDD.idf'",
"#fname = './1ZoneUncontrolled.idf'",
"if",
"isinstance",
"(",
"dictfile",
",",
"Idd",
")",
":",
"localidd",
"=",
"copy",
".",
"deepcopy",
"(",
... | stuff file data into the blank dictionary | [
"stuff",
"file",
"data",
"into",
"the",
"blank",
"dictionary"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/eplusdata.py#L177-L220 |
santoshphilip/eppy | eppy/EPlusInterfaceFunctions/eplusdata.py | Eplusdata.replacenode | def replacenode(self, othereplus, node):
"""replace the node here with the node from othereplus"""
node = node.upper()
self.dt[node.upper()] = othereplus.dt[node.upper()] | python | def replacenode(self, othereplus, node):
"""replace the node here with the node from othereplus"""
node = node.upper()
self.dt[node.upper()] = othereplus.dt[node.upper()] | [
"def",
"replacenode",
"(",
"self",
",",
"othereplus",
",",
"node",
")",
":",
"node",
"=",
"node",
".",
"upper",
"(",
")",
"self",
".",
"dt",
"[",
"node",
".",
"upper",
"(",
")",
"]",
"=",
"othereplus",
".",
"dt",
"[",
"node",
".",
"upper",
"(",
... | replace the node here with the node from othereplus | [
"replace",
"the",
"node",
"here",
"with",
"the",
"node",
"from",
"othereplus"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/eplusdata.py#L222-L225 |
santoshphilip/eppy | eppy/EPlusInterfaceFunctions/eplusdata.py | Eplusdata.add2node | def add2node(self, othereplus, node):
"""add the node here with the node from othereplus
this will potentially have duplicates"""
node = node.upper()
self.dt[node.upper()] = self.dt[node.upper()] + \
othereplus.dt[node.upper()] | python | def add2node(self, othereplus, node):
"""add the node here with the node from othereplus
this will potentially have duplicates"""
node = node.upper()
self.dt[node.upper()] = self.dt[node.upper()] + \
othereplus.dt[node.upper()] | [
"def",
"add2node",
"(",
"self",
",",
"othereplus",
",",
"node",
")",
":",
"node",
"=",
"node",
".",
"upper",
"(",
")",
"self",
".",
"dt",
"[",
"node",
".",
"upper",
"(",
")",
"]",
"=",
"self",
".",
"dt",
"[",
"node",
".",
"upper",
"(",
")",
"... | add the node here with the node from othereplus
this will potentially have duplicates | [
"add",
"the",
"node",
"here",
"with",
"the",
"node",
"from",
"othereplus",
"this",
"will",
"potentially",
"have",
"duplicates"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/eplusdata.py#L227-L232 |
santoshphilip/eppy | eppy/EPlusInterfaceFunctions/eplusdata.py | Eplusdata.addinnode | def addinnode(self, otherplus, node, objectname):
"""add an item to the node.
example: add a new zone to the element 'ZONE' """
# do a test for unique object here
newelement = otherplus.dt[node.upper()] | python | def addinnode(self, otherplus, node, objectname):
"""add an item to the node.
example: add a new zone to the element 'ZONE' """
# do a test for unique object here
newelement = otherplus.dt[node.upper()] | [
"def",
"addinnode",
"(",
"self",
",",
"otherplus",
",",
"node",
",",
"objectname",
")",
":",
"# do a test for unique object here",
"newelement",
"=",
"otherplus",
".",
"dt",
"[",
"node",
".",
"upper",
"(",
")",
"]"
] | add an item to the node.
example: add a new zone to the element 'ZONE' | [
"add",
"an",
"item",
"to",
"the",
"node",
".",
"example",
":",
"add",
"a",
"new",
"zone",
"to",
"the",
"element",
"ZONE"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/eplusdata.py#L234-L238 |
santoshphilip/eppy | eppy/EPlusInterfaceFunctions/eplusdata.py | Eplusdata.getrefs | def getrefs(self, reflist):
"""
reflist is got from getobjectref in parse_idd.py
getobjectref returns a dictionary.
reflist is an item in the dictionary
getrefs gathers all the fields refered by reflist
"""
alist = []
for element in reflist:
if... | python | def getrefs(self, reflist):
"""
reflist is got from getobjectref in parse_idd.py
getobjectref returns a dictionary.
reflist is an item in the dictionary
getrefs gathers all the fields refered by reflist
"""
alist = []
for element in reflist:
if... | [
"def",
"getrefs",
"(",
"self",
",",
"reflist",
")",
":",
"alist",
"=",
"[",
"]",
"for",
"element",
"in",
"reflist",
":",
"if",
"element",
"[",
"0",
"]",
".",
"upper",
"(",
")",
"in",
"self",
".",
"dt",
":",
"for",
"elm",
"in",
"self",
".",
"dt"... | reflist is got from getobjectref in parse_idd.py
getobjectref returns a dictionary.
reflist is an item in the dictionary
getrefs gathers all the fields refered by reflist | [
"reflist",
"is",
"got",
"from",
"getobjectref",
"in",
"parse_idd",
".",
"py",
"getobjectref",
"returns",
"a",
"dictionary",
".",
"reflist",
"is",
"an",
"item",
"in",
"the",
"dictionary",
"getrefs",
"gathers",
"all",
"the",
"fields",
"refered",
"by",
"reflist"
... | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/eplusdata.py#L240-L252 |
santoshphilip/eppy | eppy/useful_scripts/loopdiagram.py | dropnodes | def dropnodes(edges):
"""draw a graph without the nodes"""
newedges = []
added = False
for edge in edges:
if bothnodes(edge):
newtup = (edge[0][0], edge[1][0])
newedges.append(newtup)
added = True
elif firstisnode(edge):
for edge1 in edges:... | python | def dropnodes(edges):
"""draw a graph without the nodes"""
newedges = []
added = False
for edge in edges:
if bothnodes(edge):
newtup = (edge[0][0], edge[1][0])
newedges.append(newtup)
added = True
elif firstisnode(edge):
for edge1 in edges:... | [
"def",
"dropnodes",
"(",
"edges",
")",
":",
"newedges",
"=",
"[",
"]",
"added",
"=",
"False",
"for",
"edge",
"in",
"edges",
":",
"if",
"bothnodes",
"(",
"edge",
")",
":",
"newtup",
"=",
"(",
"edge",
"[",
"0",
"]",
"[",
"0",
"]",
",",
"edge",
"[... | draw a graph without the nodes | [
"draw",
"a",
"graph",
"without",
"the",
"nodes"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/useful_scripts/loopdiagram.py#L65-L99 |
santoshphilip/eppy | eppy/useful_scripts/loopdiagram.py | edges2nodes | def edges2nodes(edges):
"""gather the nodes from the edges"""
nodes = []
for e1, e2 in edges:
nodes.append(e1)
nodes.append(e2)
nodedict = dict([(n, None) for n in nodes])
justnodes = list(nodedict.keys())
# justnodes.sort()
justnodes = sorted(justnodes, key=lambda x: str(x[0... | python | def edges2nodes(edges):
"""gather the nodes from the edges"""
nodes = []
for e1, e2 in edges:
nodes.append(e1)
nodes.append(e2)
nodedict = dict([(n, None) for n in nodes])
justnodes = list(nodedict.keys())
# justnodes.sort()
justnodes = sorted(justnodes, key=lambda x: str(x[0... | [
"def",
"edges2nodes",
"(",
"edges",
")",
":",
"nodes",
"=",
"[",
"]",
"for",
"e1",
",",
"e2",
"in",
"edges",
":",
"nodes",
".",
"append",
"(",
"e1",
")",
"nodes",
".",
"append",
"(",
"e2",
")",
"nodedict",
"=",
"dict",
"(",
"[",
"(",
"n",
",",
... | gather the nodes from the edges | [
"gather",
"the",
"nodes",
"from",
"the",
"edges"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/useful_scripts/loopdiagram.py#L127-L137 |
santoshphilip/eppy | eppy/useful_scripts/loopdiagram.py | makediagram | def makediagram(edges):
"""make the diagram with the edges"""
graph = pydot.Dot(graph_type='digraph')
nodes = edges2nodes(edges)
epnodes = [(node,
makeanode(node[0])) for node in nodes if nodetype(node)=="epnode"]
endnodes = [(node,
makeendnode(node[0])) for node in nodes if nodety... | python | def makediagram(edges):
"""make the diagram with the edges"""
graph = pydot.Dot(graph_type='digraph')
nodes = edges2nodes(edges)
epnodes = [(node,
makeanode(node[0])) for node in nodes if nodetype(node)=="epnode"]
endnodes = [(node,
makeendnode(node[0])) for node in nodes if nodety... | [
"def",
"makediagram",
"(",
"edges",
")",
":",
"graph",
"=",
"pydot",
".",
"Dot",
"(",
"graph_type",
"=",
"'digraph'",
")",
"nodes",
"=",
"edges2nodes",
"(",
"edges",
")",
"epnodes",
"=",
"[",
"(",
"node",
",",
"makeanode",
"(",
"node",
"[",
"0",
"]",... | make the diagram with the edges | [
"make",
"the",
"diagram",
"with",
"the",
"edges"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/useful_scripts/loopdiagram.py#L140-L154 |
santoshphilip/eppy | eppy/useful_scripts/loopdiagram.py | makebranchcomponents | def makebranchcomponents(data, commdct, anode="epnode"):
"""return the edges jointing the components of a branch"""
alledges = []
objkey = 'BRANCH'
cnamefield = "Component %s Name"
inletfield = "Component %s Inlet Node Name"
outletfield = "Component %s Outlet Node Name"
numobjects = len(da... | python | def makebranchcomponents(data, commdct, anode="epnode"):
"""return the edges jointing the components of a branch"""
alledges = []
objkey = 'BRANCH'
cnamefield = "Component %s Name"
inletfield = "Component %s Inlet Node Name"
outletfield = "Component %s Outlet Node Name"
numobjects = len(da... | [
"def",
"makebranchcomponents",
"(",
"data",
",",
"commdct",
",",
"anode",
"=",
"\"epnode\"",
")",
":",
"alledges",
"=",
"[",
"]",
"objkey",
"=",
"'BRANCH'",
"cnamefield",
"=",
"\"Component %s Name\"",
"inletfield",
"=",
"\"Component %s Inlet Node Name\"",
"outletfie... | return the edges jointing the components of a branch | [
"return",
"the",
"edges",
"jointing",
"the",
"components",
"of",
"a",
"branch"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/useful_scripts/loopdiagram.py#L173-L203 |
santoshphilip/eppy | eppy/useful_scripts/loopdiagram.py | makeairplantloop | def makeairplantloop(data, commdct):
"""make the edges for the airloop and the plantloop"""
anode = "epnode"
endnode = "EndNode"
# in plantloop get:
# demand inlet, outlet, branchlist
# supply inlet, outlet, branchlist
plantloops = loops.plantloopfields(data, commdct)
# splitter... | python | def makeairplantloop(data, commdct):
"""make the edges for the airloop and the plantloop"""
anode = "epnode"
endnode = "EndNode"
# in plantloop get:
# demand inlet, outlet, branchlist
# supply inlet, outlet, branchlist
plantloops = loops.plantloopfields(data, commdct)
# splitter... | [
"def",
"makeairplantloop",
"(",
"data",
",",
"commdct",
")",
":",
"anode",
"=",
"\"epnode\"",
"endnode",
"=",
"\"EndNode\"",
"# in plantloop get:",
"# demand inlet, outlet, branchlist",
"# supply inlet, outlet, branchlist",
"plantloops",
"=",
"loops",
".",
"plantloo... | make the edges for the airloop and the plantloop | [
"make",
"the",
"edges",
"for",
"the",
"airloop",
"and",
"the",
"plantloop"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/useful_scripts/loopdiagram.py#L206-L494 |
santoshphilip/eppy | eppy/useful_scripts/loopdiagram.py | getedges | def getedges(fname, iddfile):
"""return the edges of the idf file fname"""
data, commdct, _idd_index = readidf.readdatacommdct(fname, iddfile=iddfile)
edges = makeairplantloop(data, commdct)
return edges | python | def getedges(fname, iddfile):
"""return the edges of the idf file fname"""
data, commdct, _idd_index = readidf.readdatacommdct(fname, iddfile=iddfile)
edges = makeairplantloop(data, commdct)
return edges | [
"def",
"getedges",
"(",
"fname",
",",
"iddfile",
")",
":",
"data",
",",
"commdct",
",",
"_idd_index",
"=",
"readidf",
".",
"readdatacommdct",
"(",
"fname",
",",
"iddfile",
"=",
"iddfile",
")",
"edges",
"=",
"makeairplantloop",
"(",
"data",
",",
"commdct",
... | return the edges of the idf file fname | [
"return",
"the",
"edges",
"of",
"the",
"idf",
"file",
"fname"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/useful_scripts/loopdiagram.py#L497-L501 |
santoshphilip/eppy | eppy/EPlusInterfaceFunctions/parse_idd.py | get_nocom_vars | def get_nocom_vars(astr):
"""
input 'astr' which is the Energy+.idd file as a string
returns (st1, st2, lss)
st1 = with all the ! comments striped
st2 = strips all comments - both the '!' and '\\'
lss = nested list of all the variables in Energy+.idd file
"""
nocom = nocomment(astr, '!')... | python | def get_nocom_vars(astr):
"""
input 'astr' which is the Energy+.idd file as a string
returns (st1, st2, lss)
st1 = with all the ! comments striped
st2 = strips all comments - both the '!' and '\\'
lss = nested list of all the variables in Energy+.idd file
"""
nocom = nocomment(astr, '!')... | [
"def",
"get_nocom_vars",
"(",
"astr",
")",
":",
"nocom",
"=",
"nocomment",
"(",
"astr",
",",
"'!'",
")",
"# remove '!' comments",
"st1",
"=",
"nocom",
"nocom1",
"=",
"nocomment",
"(",
"st1",
",",
"'\\\\'",
")",
"# remove '\\' comments",
"st1",
"=",
"nocom",
... | input 'astr' which is the Energy+.idd file as a string
returns (st1, st2, lss)
st1 = with all the ! comments striped
st2 = strips all comments - both the '!' and '\\'
lss = nested list of all the variables in Energy+.idd file | [
"input",
"astr",
"which",
"is",
"the",
"Energy",
"+",
".",
"idd",
"file",
"as",
"a",
"string",
"returns",
"(",
"st1",
"st2",
"lss",
")",
"st1",
"=",
"with",
"all",
"the",
"!",
"comments",
"striped",
"st2",
"=",
"strips",
"all",
"comments",
"-",
"both... | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/parse_idd.py#L39-L71 |
santoshphilip/eppy | eppy/EPlusInterfaceFunctions/parse_idd.py | removeblanklines | def removeblanklines(astr):
"""remove the blank lines in astr"""
lines = astr.splitlines()
lines = [line for line in lines if line.strip() != ""]
return "\n".join(lines) | python | def removeblanklines(astr):
"""remove the blank lines in astr"""
lines = astr.splitlines()
lines = [line for line in lines if line.strip() != ""]
return "\n".join(lines) | [
"def",
"removeblanklines",
"(",
"astr",
")",
":",
"lines",
"=",
"astr",
".",
"splitlines",
"(",
")",
"lines",
"=",
"[",
"line",
"for",
"line",
"in",
"lines",
"if",
"line",
".",
"strip",
"(",
")",
"!=",
"\"\"",
"]",
"return",
"\"\\n\"",
".",
"join",
... | remove the blank lines in astr | [
"remove",
"the",
"blank",
"lines",
"in",
"astr"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/parse_idd.py#L74-L78 |
santoshphilip/eppy | eppy/EPlusInterfaceFunctions/parse_idd.py | _readfname | def _readfname(fname):
"""copied from extractidddata below.
It deals with all the types of fnames"""
try:
if isinstance(fname, (file, StringIO)):
astr = fname.read()
else:
astr = open(fname, 'rb').read()
except NameError:
if isinstance(fname, (FileIO, Str... | python | def _readfname(fname):
"""copied from extractidddata below.
It deals with all the types of fnames"""
try:
if isinstance(fname, (file, StringIO)):
astr = fname.read()
else:
astr = open(fname, 'rb').read()
except NameError:
if isinstance(fname, (FileIO, Str... | [
"def",
"_readfname",
"(",
"fname",
")",
":",
"try",
":",
"if",
"isinstance",
"(",
"fname",
",",
"(",
"file",
",",
"StringIO",
")",
")",
":",
"astr",
"=",
"fname",
".",
"read",
"(",
")",
"else",
":",
"astr",
"=",
"open",
"(",
"fname",
",",
"'rb'",... | copied from extractidddata below.
It deals with all the types of fnames | [
"copied",
"from",
"extractidddata",
"below",
".",
"It",
"deals",
"with",
"all",
"the",
"types",
"of",
"fnames"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/parse_idd.py#L80-L93 |
santoshphilip/eppy | eppy/EPlusInterfaceFunctions/parse_idd.py | make_idd_index | def make_idd_index(extract_func, fname, debug):
"""generate the iddindex"""
astr = _readfname(fname)
# fname is exhausted by the above read
# reconstitute fname as a StringIO
fname = StringIO(astr)
# glist = iddgroups.iddtxt2grouplist(astr.decode('ISO-8859-2'))
blocklst, commlst,... | python | def make_idd_index(extract_func, fname, debug):
"""generate the iddindex"""
astr = _readfname(fname)
# fname is exhausted by the above read
# reconstitute fname as a StringIO
fname = StringIO(astr)
# glist = iddgroups.iddtxt2grouplist(astr.decode('ISO-8859-2'))
blocklst, commlst,... | [
"def",
"make_idd_index",
"(",
"extract_func",
",",
"fname",
",",
"debug",
")",
":",
"astr",
"=",
"_readfname",
"(",
"fname",
")",
"# fname is exhausted by the above read",
"# reconstitute fname as a StringIO",
"fname",
"=",
"StringIO",
"(",
"astr",
")",
"# glist = idd... | generate the iddindex | [
"generate",
"the",
"iddindex"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/parse_idd.py#L96-L114 |
santoshphilip/eppy | eppy/EPlusInterfaceFunctions/parse_idd.py | embedgroupdata | def embedgroupdata(extract_func, fname, debug):
"""insert group info into extracted idd"""
astr = _readfname(fname)
# fname is exhausted by the above read
# reconstitute fname as a StringIO
fname = StringIO(astr)
try:
astr = astr.decode('ISO-8859-2')
except Exception as e:... | python | def embedgroupdata(extract_func, fname, debug):
"""insert group info into extracted idd"""
astr = _readfname(fname)
# fname is exhausted by the above read
# reconstitute fname as a StringIO
fname = StringIO(astr)
try:
astr = astr.decode('ISO-8859-2')
except Exception as e:... | [
"def",
"embedgroupdata",
"(",
"extract_func",
",",
"fname",
",",
"debug",
")",
":",
"astr",
"=",
"_readfname",
"(",
"fname",
")",
"# fname is exhausted by the above read",
"# reconstitute fname as a StringIO",
"fname",
"=",
"StringIO",
"(",
"astr",
")",
"try",
":",
... | insert group info into extracted idd | [
"insert",
"group",
"info",
"into",
"extracted",
"idd"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/parse_idd.py#L117-L138 |
santoshphilip/eppy | eppy/EPlusInterfaceFunctions/parse_idd.py | extractidddata | def extractidddata(fname, debug=False):
"""
extracts all the needed information out of the idd file
if debug is True, it generates a series of text files.
Each text file is incrementally different. You can do a diff
see what the change is
-
this code is from 2004.
it works.
I am try... | python | def extractidddata(fname, debug=False):
"""
extracts all the needed information out of the idd file
if debug is True, it generates a series of text files.
Each text file is incrementally different. You can do a diff
see what the change is
-
this code is from 2004.
it works.
I am try... | [
"def",
"extractidddata",
"(",
"fname",
",",
"debug",
"=",
"False",
")",
":",
"try",
":",
"if",
"isinstance",
"(",
"fname",
",",
"(",
"file",
",",
"StringIO",
")",
")",
":",
"astr",
"=",
"fname",
".",
"read",
"(",
")",
"try",
":",
"astr",
"=",
"as... | extracts all the needed information out of the idd file
if debug is True, it generates a series of text files.
Each text file is incrementally different. You can do a diff
see what the change is
-
this code is from 2004.
it works.
I am trying not to change it (until I rewrite the whole thin... | [
"extracts",
"all",
"the",
"needed",
"information",
"out",
"of",
"the",
"idd",
"file",
"if",
"debug",
"is",
"True",
"it",
"generates",
"a",
"series",
"of",
"text",
"files",
".",
"Each",
"text",
"file",
"is",
"incrementally",
"different",
".",
"You",
"can",
... | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/parse_idd.py#L142-L385 |
santoshphilip/eppy | eppy/EPlusInterfaceFunctions/parse_idd.py | getobjectref | def getobjectref(blocklst, commdct):
"""
makes a dictionary of object-lists
each item in the dictionary points to a list of tuples
the tuple is (objectname, fieldindex)
"""
objlst_dct = {}
for eli in commdct:
for elj in eli:
if 'object-list' in elj:
objli... | python | def getobjectref(blocklst, commdct):
"""
makes a dictionary of object-lists
each item in the dictionary points to a list of tuples
the tuple is (objectname, fieldindex)
"""
objlst_dct = {}
for eli in commdct:
for elj in eli:
if 'object-list' in elj:
objli... | [
"def",
"getobjectref",
"(",
"blocklst",
",",
"commdct",
")",
":",
"objlst_dct",
"=",
"{",
"}",
"for",
"eli",
"in",
"commdct",
":",
"for",
"elj",
"in",
"eli",
":",
"if",
"'object-list'",
"in",
"elj",
":",
"objlist",
"=",
"elj",
"[",
"'object-list'",
"]"... | makes a dictionary of object-lists
each item in the dictionary points to a list of tuples
the tuple is (objectname, fieldindex) | [
"makes",
"a",
"dictionary",
"of",
"object",
"-",
"lists",
"each",
"item",
"in",
"the",
"dictionary",
"points",
"to",
"a",
"list",
"of",
"tuples",
"the",
"tuple",
"is",
"(",
"objectname",
"fieldindex",
")"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/parse_idd.py#L388-L408 |
santoshphilip/eppy | eppy/EPlusInterfaceFunctions/readidf.py | readdatacommlst | def readdatacommlst(idfname):
"""read the idf file"""
# iddfile = sys.path[0] + '/EplusCode/Energy+.idd'
iddfile = 'Energy+.idd'
# iddfile = './EPlusInterfaceFunctions/E1.idd' # TODO : can the path name be not hard coded
iddtxt = open(iddfile, 'r').read()
block, commlst, commdct = parse_idd.extr... | python | def readdatacommlst(idfname):
"""read the idf file"""
# iddfile = sys.path[0] + '/EplusCode/Energy+.idd'
iddfile = 'Energy+.idd'
# iddfile = './EPlusInterfaceFunctions/E1.idd' # TODO : can the path name be not hard coded
iddtxt = open(iddfile, 'r').read()
block, commlst, commdct = parse_idd.extr... | [
"def",
"readdatacommlst",
"(",
"idfname",
")",
":",
"# iddfile = sys.path[0] + '/EplusCode/Energy+.idd'",
"iddfile",
"=",
"'Energy+.idd'",
"# iddfile = './EPlusInterfaceFunctions/E1.idd' # TODO : can the path name be not hard coded",
"iddtxt",
"=",
"open",
"(",
"iddfile",
",",
"'r'... | read the idf file | [
"read",
"the",
"idf",
"file"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/readidf.py#L60-L70 |
santoshphilip/eppy | eppy/EPlusInterfaceFunctions/readidf.py | readdatacommdct | def readdatacommdct(idfname, iddfile='Energy+.idd', commdct=None):
"""read the idf file"""
if not commdct:
block, commlst, commdct, idd_index = parse_idd.extractidddata(iddfile)
theidd = eplusdata.Idd(block, 2)
else:
theidd = iddfile
data = eplusdata.Eplusdata(theidd, idfname)
... | python | def readdatacommdct(idfname, iddfile='Energy+.idd', commdct=None):
"""read the idf file"""
if not commdct:
block, commlst, commdct, idd_index = parse_idd.extractidddata(iddfile)
theidd = eplusdata.Idd(block, 2)
else:
theidd = iddfile
data = eplusdata.Eplusdata(theidd, idfname)
... | [
"def",
"readdatacommdct",
"(",
"idfname",
",",
"iddfile",
"=",
"'Energy+.idd'",
",",
"commdct",
"=",
"None",
")",
":",
"if",
"not",
"commdct",
":",
"block",
",",
"commlst",
",",
"commdct",
",",
"idd_index",
"=",
"parse_idd",
".",
"extractidddata",
"(",
"id... | read the idf file | [
"read",
"the",
"idf",
"file"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/readidf.py#L72-L80 |
santoshphilip/eppy | eppy/loops.py | extractfields | def extractfields(data, commdct, objkey, fieldlists):
"""get all the objects of objkey.
fieldlists will have a fieldlist for each of those objects.
return the contents of those fields"""
# TODO : this assumes that the field list identical for
# each instance of the object. This is not true.
# So... | python | def extractfields(data, commdct, objkey, fieldlists):
"""get all the objects of objkey.
fieldlists will have a fieldlist for each of those objects.
return the contents of those fields"""
# TODO : this assumes that the field list identical for
# each instance of the object. This is not true.
# So... | [
"def",
"extractfields",
"(",
"data",
",",
"commdct",
",",
"objkey",
",",
"fieldlists",
")",
":",
"# TODO : this assumes that the field list identical for",
"# each instance of the object. This is not true.",
"# So we should have a field list for each instance of the object",
"# and map... | get all the objects of objkey.
fieldlists will have a fieldlist for each of those objects.
return the contents of those fields | [
"get",
"all",
"the",
"objects",
"of",
"objkey",
".",
"fieldlists",
"will",
"have",
"a",
"fieldlist",
"for",
"each",
"of",
"those",
"objects",
".",
"return",
"the",
"contents",
"of",
"those",
"fields"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/loops.py#L21-L60 |
santoshphilip/eppy | eppy/loops.py | plantloopfieldlists | def plantloopfieldlists(data):
"""return the plantloopfield list"""
objkey = 'plantloop'.upper()
numobjects = len(data.dt[objkey])
return [[
'Name',
'Plant Side Inlet Node Name',
'Plant Side Outlet Node Name',
'Plant Side Branch List Name',
'Demand Side Inlet Node... | python | def plantloopfieldlists(data):
"""return the plantloopfield list"""
objkey = 'plantloop'.upper()
numobjects = len(data.dt[objkey])
return [[
'Name',
'Plant Side Inlet Node Name',
'Plant Side Outlet Node Name',
'Plant Side Branch List Name',
'Demand Side Inlet Node... | [
"def",
"plantloopfieldlists",
"(",
"data",
")",
":",
"objkey",
"=",
"'plantloop'",
".",
"upper",
"(",
")",
"numobjects",
"=",
"len",
"(",
"data",
".",
"dt",
"[",
"objkey",
"]",
")",
"return",
"[",
"[",
"'Name'",
",",
"'Plant Side Inlet Node Name'",
",",
... | return the plantloopfield list | [
"return",
"the",
"plantloopfield",
"list"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/loops.py#L62-L73 |
santoshphilip/eppy | eppy/loops.py | plantloopfields | def plantloopfields(data, commdct):
"""get plantloop fields to diagram it"""
fieldlists = plantloopfieldlists(data)
objkey = 'plantloop'.upper()
return extractfields(data, commdct, objkey, fieldlists) | python | def plantloopfields(data, commdct):
"""get plantloop fields to diagram it"""
fieldlists = plantloopfieldlists(data)
objkey = 'plantloop'.upper()
return extractfields(data, commdct, objkey, fieldlists) | [
"def",
"plantloopfields",
"(",
"data",
",",
"commdct",
")",
":",
"fieldlists",
"=",
"plantloopfieldlists",
"(",
"data",
")",
"objkey",
"=",
"'plantloop'",
".",
"upper",
"(",
")",
"return",
"extractfields",
"(",
"data",
",",
"commdct",
",",
"objkey",
",",
"... | get plantloop fields to diagram it | [
"get",
"plantloop",
"fields",
"to",
"diagram",
"it"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/loops.py#L75-L79 |
santoshphilip/eppy | eppy/loops.py | branchlist2branches | def branchlist2branches(data, commdct, branchlist):
"""get branches from the branchlist"""
objkey = 'BranchList'.upper()
theobjects = data.dt[objkey]
fieldlists = []
objnames = [obj[1] for obj in theobjects]
for theobject in theobjects:
fieldlists.append(list(range(2, len(theobject))))
... | python | def branchlist2branches(data, commdct, branchlist):
"""get branches from the branchlist"""
objkey = 'BranchList'.upper()
theobjects = data.dt[objkey]
fieldlists = []
objnames = [obj[1] for obj in theobjects]
for theobject in theobjects:
fieldlists.append(list(range(2, len(theobject))))
... | [
"def",
"branchlist2branches",
"(",
"data",
",",
"commdct",
",",
"branchlist",
")",
":",
"objkey",
"=",
"'BranchList'",
".",
"upper",
"(",
")",
"theobjects",
"=",
"data",
".",
"dt",
"[",
"objkey",
"]",
"fieldlists",
"=",
"[",
"]",
"objnames",
"=",
"[",
... | get branches from the branchlist | [
"get",
"branches",
"from",
"the",
"branchlist"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/loops.py#L81-L92 |
santoshphilip/eppy | eppy/loops.py | branch_inlet_outlet | def branch_inlet_outlet(data, commdct, branchname):
"""return the inlet and outlet of a branch"""
objkey = 'Branch'.upper()
theobjects = data.dt[objkey]
theobject = [obj for obj in theobjects if obj[1] == branchname]
theobject = theobject[0]
inletindex = 6
outletindex = len(theobject) - 2
... | python | def branch_inlet_outlet(data, commdct, branchname):
"""return the inlet and outlet of a branch"""
objkey = 'Branch'.upper()
theobjects = data.dt[objkey]
theobject = [obj for obj in theobjects if obj[1] == branchname]
theobject = theobject[0]
inletindex = 6
outletindex = len(theobject) - 2
... | [
"def",
"branch_inlet_outlet",
"(",
"data",
",",
"commdct",
",",
"branchname",
")",
":",
"objkey",
"=",
"'Branch'",
".",
"upper",
"(",
")",
"theobjects",
"=",
"data",
".",
"dt",
"[",
"objkey",
"]",
"theobject",
"=",
"[",
"obj",
"for",
"obj",
"in",
"theo... | return the inlet and outlet of a branch | [
"return",
"the",
"inlet",
"and",
"outlet",
"of",
"a",
"branch"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/loops.py#L94-L102 |
santoshphilip/eppy | eppy/loops.py | splittermixerfieldlists | def splittermixerfieldlists(data, commdct, objkey):
"""docstring for splittermixerfieldlists"""
objkey = objkey.upper()
objindex = data.dtls.index(objkey)
objcomms = commdct[objindex]
theobjects = data.dt[objkey]
fieldlists = []
for theobject in theobjects:
fieldlist = list(range(1, ... | python | def splittermixerfieldlists(data, commdct, objkey):
"""docstring for splittermixerfieldlists"""
objkey = objkey.upper()
objindex = data.dtls.index(objkey)
objcomms = commdct[objindex]
theobjects = data.dt[objkey]
fieldlists = []
for theobject in theobjects:
fieldlist = list(range(1, ... | [
"def",
"splittermixerfieldlists",
"(",
"data",
",",
"commdct",
",",
"objkey",
")",
":",
"objkey",
"=",
"objkey",
".",
"upper",
"(",
")",
"objindex",
"=",
"data",
".",
"dtls",
".",
"index",
"(",
"objkey",
")",
"objcomms",
"=",
"commdct",
"[",
"objindex",
... | docstring for splittermixerfieldlists | [
"docstring",
"for",
"splittermixerfieldlists"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/loops.py#L104-L114 |
santoshphilip/eppy | eppy/loops.py | splitterfields | def splitterfields(data, commdct):
"""get splitter fields to diagram it"""
objkey = "Connector:Splitter".upper()
fieldlists = splittermixerfieldlists(data, commdct, objkey)
return extractfields(data, commdct, objkey, fieldlists) | python | def splitterfields(data, commdct):
"""get splitter fields to diagram it"""
objkey = "Connector:Splitter".upper()
fieldlists = splittermixerfieldlists(data, commdct, objkey)
return extractfields(data, commdct, objkey, fieldlists) | [
"def",
"splitterfields",
"(",
"data",
",",
"commdct",
")",
":",
"objkey",
"=",
"\"Connector:Splitter\"",
".",
"upper",
"(",
")",
"fieldlists",
"=",
"splittermixerfieldlists",
"(",
"data",
",",
"commdct",
",",
"objkey",
")",
"return",
"extractfields",
"(",
"dat... | get splitter fields to diagram it | [
"get",
"splitter",
"fields",
"to",
"diagram",
"it"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/loops.py#L116-L120 |
santoshphilip/eppy | eppy/loops.py | mixerfields | def mixerfields(data, commdct):
"""get mixer fields to diagram it"""
objkey = "Connector:Mixer".upper()
fieldlists = splittermixerfieldlists(data, commdct, objkey)
return extractfields(data, commdct, objkey, fieldlists) | python | def mixerfields(data, commdct):
"""get mixer fields to diagram it"""
objkey = "Connector:Mixer".upper()
fieldlists = splittermixerfieldlists(data, commdct, objkey)
return extractfields(data, commdct, objkey, fieldlists) | [
"def",
"mixerfields",
"(",
"data",
",",
"commdct",
")",
":",
"objkey",
"=",
"\"Connector:Mixer\"",
".",
"upper",
"(",
")",
"fieldlists",
"=",
"splittermixerfieldlists",
"(",
"data",
",",
"commdct",
",",
"objkey",
")",
"return",
"extractfields",
"(",
"data",
... | get mixer fields to diagram it | [
"get",
"mixer",
"fields",
"to",
"diagram",
"it"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/loops.py#L122-L126 |
santoshphilip/eppy | eppy/loops.py | repeatingfields | def repeatingfields(theidd, commdct, objkey, flds):
"""return a list of repeating fields
fld is in format 'Component %s Name'
so flds = [fld % (i, ) for i in range(n)]
does not work for 'fields as indicated' """
# TODO : make it work for 'fields as indicated'
if type(flds) != list:
flds ... | python | def repeatingfields(theidd, commdct, objkey, flds):
"""return a list of repeating fields
fld is in format 'Component %s Name'
so flds = [fld % (i, ) for i in range(n)]
does not work for 'fields as indicated' """
# TODO : make it work for 'fields as indicated'
if type(flds) != list:
flds ... | [
"def",
"repeatingfields",
"(",
"theidd",
",",
"commdct",
",",
"objkey",
",",
"flds",
")",
":",
"# TODO : make it work for 'fields as indicated'",
"if",
"type",
"(",
"flds",
")",
"!=",
"list",
":",
"flds",
"=",
"[",
"flds",
"]",
"# for backward compatability",
"o... | return a list of repeating fields
fld is in format 'Component %s Name'
so flds = [fld % (i, ) for i in range(n)]
does not work for 'fields as indicated' | [
"return",
"a",
"list",
"of",
"repeating",
"fields",
"fld",
"is",
"in",
"format",
"Component",
"%s",
"Name",
"so",
"flds",
"=",
"[",
"fld",
"%",
"(",
"i",
")",
"for",
"i",
"in",
"range",
"(",
"n",
")",
"]",
"does",
"not",
"work",
"for",
"fields",
... | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/loops.py#L129-L153 |
santoshphilip/eppy | eppy/loops.py | objectcount | def objectcount(data, key):
"""return the count of objects of key"""
objkey = key.upper()
return len(data.dt[objkey]) | python | def objectcount(data, key):
"""return the count of objects of key"""
objkey = key.upper()
return len(data.dt[objkey]) | [
"def",
"objectcount",
"(",
"data",
",",
"key",
")",
":",
"objkey",
"=",
"key",
".",
"upper",
"(",
")",
"return",
"len",
"(",
"data",
".",
"dt",
"[",
"objkey",
"]",
")"
] | return the count of objects of key | [
"return",
"the",
"count",
"of",
"objects",
"of",
"key"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/loops.py#L155-L158 |
santoshphilip/eppy | eppy/loops.py | getfieldindex | def getfieldindex(data, commdct, objkey, fname):
"""given objkey and fieldname, return its index"""
objindex = data.dtls.index(objkey)
objcomm = commdct[objindex]
for i_index, item in enumerate(objcomm):
try:
if item['field'] == [fname]:
break
except KeyError ... | python | def getfieldindex(data, commdct, objkey, fname):
"""given objkey and fieldname, return its index"""
objindex = data.dtls.index(objkey)
objcomm = commdct[objindex]
for i_index, item in enumerate(objcomm):
try:
if item['field'] == [fname]:
break
except KeyError ... | [
"def",
"getfieldindex",
"(",
"data",
",",
"commdct",
",",
"objkey",
",",
"fname",
")",
":",
"objindex",
"=",
"data",
".",
"dtls",
".",
"index",
"(",
"objkey",
")",
"objcomm",
"=",
"commdct",
"[",
"objindex",
"]",
"for",
"i_index",
",",
"item",
"in",
... | given objkey and fieldname, return its index | [
"given",
"objkey",
"and",
"fieldname",
"return",
"its",
"index"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/loops.py#L160-L170 |
santoshphilip/eppy | eppy/loops.py | getadistus | def getadistus(data, commdct):
"""docstring for fname"""
objkey = "ZoneHVAC:AirDistributionUnit".upper()
objindex = data.dtls.index(objkey)
objcomm = commdct[objindex]
adistutypefield = "Air Terminal Object Type"
ifield = getfieldindex(data, commdct, objkey, adistutypefield)
adistus = objcom... | python | def getadistus(data, commdct):
"""docstring for fname"""
objkey = "ZoneHVAC:AirDistributionUnit".upper()
objindex = data.dtls.index(objkey)
objcomm = commdct[objindex]
adistutypefield = "Air Terminal Object Type"
ifield = getfieldindex(data, commdct, objkey, adistutypefield)
adistus = objcom... | [
"def",
"getadistus",
"(",
"data",
",",
"commdct",
")",
":",
"objkey",
"=",
"\"ZoneHVAC:AirDistributionUnit\"",
".",
"upper",
"(",
")",
"objindex",
"=",
"data",
".",
"dtls",
".",
"index",
"(",
"objkey",
")",
"objcomm",
"=",
"commdct",
"[",
"objindex",
"]",
... | docstring for fname | [
"docstring",
"for",
"fname"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/loops.py#L172-L180 |
santoshphilip/eppy | eppy/loops.py | makeadistu_inlets | def makeadistu_inlets(data, commdct):
"""make the dict adistu_inlets"""
adistus = getadistus(data, commdct)
# assume that the inlet node has the words "Air Inlet Node Name"
airinletnode = "Air Inlet Node Name"
adistu_inlets = {}
for adistu in adistus:
objkey = adistu.upper()
obji... | python | def makeadistu_inlets(data, commdct):
"""make the dict adistu_inlets"""
adistus = getadistus(data, commdct)
# assume that the inlet node has the words "Air Inlet Node Name"
airinletnode = "Air Inlet Node Name"
adistu_inlets = {}
for adistu in adistus:
objkey = adistu.upper()
obji... | [
"def",
"makeadistu_inlets",
"(",
"data",
",",
"commdct",
")",
":",
"adistus",
"=",
"getadistus",
"(",
"data",
",",
"commdct",
")",
"# assume that the inlet node has the words \"Air Inlet Node Name\"",
"airinletnode",
"=",
"\"Air Inlet Node Name\"",
"adistu_inlets",
"=",
"... | make the dict adistu_inlets | [
"make",
"the",
"dict",
"adistu_inlets"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/loops.py#L182-L200 |
santoshphilip/eppy | eppy/idd_helpers.py | folder2ver | def folder2ver(folder):
"""get the version number from the E+ install folder"""
ver = folder.split('EnergyPlus')[-1]
ver = ver[1:]
splitapp = ver.split('-')
ver = '.'.join(splitapp)
return ver | python | def folder2ver(folder):
"""get the version number from the E+ install folder"""
ver = folder.split('EnergyPlus')[-1]
ver = ver[1:]
splitapp = ver.split('-')
ver = '.'.join(splitapp)
return ver | [
"def",
"folder2ver",
"(",
"folder",
")",
":",
"ver",
"=",
"folder",
".",
"split",
"(",
"'EnergyPlus'",
")",
"[",
"-",
"1",
"]",
"ver",
"=",
"ver",
"[",
"1",
":",
"]",
"splitapp",
"=",
"ver",
".",
"split",
"(",
"'-'",
")",
"ver",
"=",
"'.'",
"."... | get the version number from the E+ install folder | [
"get",
"the",
"version",
"number",
"from",
"the",
"E",
"+",
"install",
"folder"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/idd_helpers.py#L29-L35 |
santoshphilip/eppy | eppy/simpleread.py | nocomment | def nocomment(astr, com='!'):
"""
just like the comment in python.
removes any text after the phrase 'com'
"""
alist = astr.splitlines()
for i in range(len(alist)):
element = alist[i]
pnt = element.find(com)
if pnt != -1:
alist[i] = element[:pnt]
return '\... | python | def nocomment(astr, com='!'):
"""
just like the comment in python.
removes any text after the phrase 'com'
"""
alist = astr.splitlines()
for i in range(len(alist)):
element = alist[i]
pnt = element.find(com)
if pnt != -1:
alist[i] = element[:pnt]
return '\... | [
"def",
"nocomment",
"(",
"astr",
",",
"com",
"=",
"'!'",
")",
":",
"alist",
"=",
"astr",
".",
"splitlines",
"(",
")",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"alist",
")",
")",
":",
"element",
"=",
"alist",
"[",
"i",
"]",
"pnt",
"=",
"eleme... | just like the comment in python.
removes any text after the phrase 'com' | [
"just",
"like",
"the",
"comment",
"in",
"python",
".",
"removes",
"any",
"text",
"after",
"the",
"phrase",
"com"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/simpleread.py#L16-L27 |
santoshphilip/eppy | eppy/simpleread.py | idf2txt | def idf2txt(txt):
"""convert the idf text to a simple text"""
astr = nocomment(txt)
objs = astr.split(';')
objs = [obj.split(',') for obj in objs]
objs = [[line.strip() for line in obj] for obj in objs]
objs = [[_tofloat(line) for line in obj] for obj in objs]
objs = [tuple(obj) for obj in o... | python | def idf2txt(txt):
"""convert the idf text to a simple text"""
astr = nocomment(txt)
objs = astr.split(';')
objs = [obj.split(',') for obj in objs]
objs = [[line.strip() for line in obj] for obj in objs]
objs = [[_tofloat(line) for line in obj] for obj in objs]
objs = [tuple(obj) for obj in o... | [
"def",
"idf2txt",
"(",
"txt",
")",
":",
"astr",
"=",
"nocomment",
"(",
"txt",
")",
"objs",
"=",
"astr",
".",
"split",
"(",
"';'",
")",
"objs",
"=",
"[",
"obj",
".",
"split",
"(",
"','",
")",
"for",
"obj",
"in",
"objs",
"]",
"objs",
"=",
"[",
... | convert the idf text to a simple text | [
"convert",
"the",
"idf",
"text",
"to",
"a",
"simple",
"text"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/simpleread.py#L37-L53 |
santoshphilip/eppy | eppy/idfreader.py | iddversiontuple | def iddversiontuple(afile):
"""given the idd file or filehandle, return the version handle"""
def versiontuple(vers):
"""version tuple"""
return tuple([int(num) for num in vers.split(".")])
try:
fhandle = open(afile, 'rb')
except TypeError:
fhandle = afile
line1 = fha... | python | def iddversiontuple(afile):
"""given the idd file or filehandle, return the version handle"""
def versiontuple(vers):
"""version tuple"""
return tuple([int(num) for num in vers.split(".")])
try:
fhandle = open(afile, 'rb')
except TypeError:
fhandle = afile
line1 = fha... | [
"def",
"iddversiontuple",
"(",
"afile",
")",
":",
"def",
"versiontuple",
"(",
"vers",
")",
":",
"\"\"\"version tuple\"\"\"",
"return",
"tuple",
"(",
"[",
"int",
"(",
"num",
")",
"for",
"num",
"in",
"vers",
".",
"split",
"(",
"\".\"",
")",
"]",
")",
"tr... | given the idd file or filehandle, return the version handle | [
"given",
"the",
"idd",
"file",
"or",
"filehandle",
"return",
"the",
"version",
"handle"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/idfreader.py#L23-L41 |
santoshphilip/eppy | eppy/idfreader.py | makeabunch | def makeabunch(commdct, obj, obj_i):
"""make a bunch from the object"""
objidd = commdct[obj_i]
objfields = [comm.get('field') for comm in commdct[obj_i]]
objfields[0] = ['key']
objfields = [field[0] for field in objfields]
obj_fields = [bunchhelpers.makefieldname(field) for field in objfields]
... | python | def makeabunch(commdct, obj, obj_i):
"""make a bunch from the object"""
objidd = commdct[obj_i]
objfields = [comm.get('field') for comm in commdct[obj_i]]
objfields[0] = ['key']
objfields = [field[0] for field in objfields]
obj_fields = [bunchhelpers.makefieldname(field) for field in objfields]
... | [
"def",
"makeabunch",
"(",
"commdct",
",",
"obj",
",",
"obj_i",
")",
":",
"objidd",
"=",
"commdct",
"[",
"obj_i",
"]",
"objfields",
"=",
"[",
"comm",
".",
"get",
"(",
"'field'",
")",
"for",
"comm",
"in",
"commdct",
"[",
"obj_i",
"]",
"]",
"objfields",... | make a bunch from the object | [
"make",
"a",
"bunch",
"from",
"the",
"object"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/idfreader.py#L44-L52 |
santoshphilip/eppy | eppy/idfreader.py | makebunches | def makebunches(data, commdct):
"""make bunches with data"""
bunchdt = {}
ddtt, dtls = data.dt, data.dtls
for obj_i, key in enumerate(dtls):
key = key.upper()
bunchdt[key] = []
objs = ddtt[key]
for obj in objs:
bobj = makeabunch(commdct, obj, obj_i)
... | python | def makebunches(data, commdct):
"""make bunches with data"""
bunchdt = {}
ddtt, dtls = data.dt, data.dtls
for obj_i, key in enumerate(dtls):
key = key.upper()
bunchdt[key] = []
objs = ddtt[key]
for obj in objs:
bobj = makeabunch(commdct, obj, obj_i)
... | [
"def",
"makebunches",
"(",
"data",
",",
"commdct",
")",
":",
"bunchdt",
"=",
"{",
"}",
"ddtt",
",",
"dtls",
"=",
"data",
".",
"dt",
",",
"data",
".",
"dtls",
"for",
"obj_i",
",",
"key",
"in",
"enumerate",
"(",
"dtls",
")",
":",
"key",
"=",
"key",... | make bunches with data | [
"make",
"bunches",
"with",
"data"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/idfreader.py#L55-L66 |
santoshphilip/eppy | eppy/idfreader.py | makebunches_alter | def makebunches_alter(data, commdct, theidf):
"""make bunches with data"""
bunchdt = {}
dt, dtls = data.dt, data.dtls
for obj_i, key in enumerate(dtls):
key = key.upper()
objs = dt[key]
list1 = []
for obj in objs:
bobj = makeabunch(commdct, obj, obj_i)
... | python | def makebunches_alter(data, commdct, theidf):
"""make bunches with data"""
bunchdt = {}
dt, dtls = data.dt, data.dtls
for obj_i, key in enumerate(dtls):
key = key.upper()
objs = dt[key]
list1 = []
for obj in objs:
bobj = makeabunch(commdct, obj, obj_i)
... | [
"def",
"makebunches_alter",
"(",
"data",
",",
"commdct",
",",
"theidf",
")",
":",
"bunchdt",
"=",
"{",
"}",
"dt",
",",
"dtls",
"=",
"data",
".",
"dt",
",",
"data",
".",
"dtls",
"for",
"obj_i",
",",
"key",
"in",
"enumerate",
"(",
"dtls",
")",
":",
... | make bunches with data | [
"make",
"bunches",
"with",
"data"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/idfreader.py#L69-L81 |
santoshphilip/eppy | eppy/idfreader.py | convertfields_old | def convertfields_old(key_comm, obj, inblock=None):
"""convert the float and interger fields"""
convinidd = ConvInIDD()
typefunc = dict(integer=convinidd.integer, real=convinidd.real)
types = []
for comm in key_comm:
types.append(comm.get('type', [None])[0])
convs = [typefunc.get(typ, co... | python | def convertfields_old(key_comm, obj, inblock=None):
"""convert the float and interger fields"""
convinidd = ConvInIDD()
typefunc = dict(integer=convinidd.integer, real=convinidd.real)
types = []
for comm in key_comm:
types.append(comm.get('type', [None])[0])
convs = [typefunc.get(typ, co... | [
"def",
"convertfields_old",
"(",
"key_comm",
",",
"obj",
",",
"inblock",
"=",
"None",
")",
":",
"convinidd",
"=",
"ConvInIDD",
"(",
")",
"typefunc",
"=",
"dict",
"(",
"integer",
"=",
"convinidd",
".",
"integer",
",",
"real",
"=",
"convinidd",
".",
"real"... | convert the float and interger fields | [
"convert",
"the",
"float",
"and",
"interger",
"fields"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/idfreader.py#L110-L129 |
santoshphilip/eppy | eppy/idfreader.py | convertafield | def convertafield(field_comm, field_val, field_iddname):
"""convert field based on field info in IDD"""
convinidd = ConvInIDD()
field_typ = field_comm.get('type', [None])[0]
conv = convinidd.conv_dict().get(field_typ, convinidd.no_type)
return conv(field_val, field_iddname) | python | def convertafield(field_comm, field_val, field_iddname):
"""convert field based on field info in IDD"""
convinidd = ConvInIDD()
field_typ = field_comm.get('type', [None])[0]
conv = convinidd.conv_dict().get(field_typ, convinidd.no_type)
return conv(field_val, field_iddname) | [
"def",
"convertafield",
"(",
"field_comm",
",",
"field_val",
",",
"field_iddname",
")",
":",
"convinidd",
"=",
"ConvInIDD",
"(",
")",
"field_typ",
"=",
"field_comm",
".",
"get",
"(",
"'type'",
",",
"[",
"None",
"]",
")",
"[",
"0",
"]",
"conv",
"=",
"co... | convert field based on field info in IDD | [
"convert",
"field",
"based",
"on",
"field",
"info",
"in",
"IDD"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/idfreader.py#L132-L137 |
santoshphilip/eppy | eppy/idfreader.py | convertfields | def convertfields(key_comm, obj, inblock=None):
"""convert based on float, integer, and A1, N1"""
# f_ stands for field_
convinidd = ConvInIDD()
if not inblock:
inblock = ['does not start with N'] * len(obj)
for i, (f_comm, f_val, f_iddname) in enumerate(zip(key_comm, obj, inblock)):
... | python | def convertfields(key_comm, obj, inblock=None):
"""convert based on float, integer, and A1, N1"""
# f_ stands for field_
convinidd = ConvInIDD()
if not inblock:
inblock = ['does not start with N'] * len(obj)
for i, (f_comm, f_val, f_iddname) in enumerate(zip(key_comm, obj, inblock)):
... | [
"def",
"convertfields",
"(",
"key_comm",
",",
"obj",
",",
"inblock",
"=",
"None",
")",
":",
"# f_ stands for field_",
"convinidd",
"=",
"ConvInIDD",
"(",
")",
"if",
"not",
"inblock",
":",
"inblock",
"=",
"[",
"'does not start with N'",
"]",
"*",
"len",
"(",
... | convert based on float, integer, and A1, N1 | [
"convert",
"based",
"on",
"float",
"integer",
"and",
"A1",
"N1"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/idfreader.py#L139-L151 |
santoshphilip/eppy | eppy/idfreader.py | convertallfields | def convertallfields(data, commdct, block=None):
"""docstring for convertallfields"""
# import pdbdb; pdb.set_trace()
for key in list(data.dt.keys()):
objs = data.dt[key]
for i, obj in enumerate(objs):
key_i = data.dtls.index(key)
key_comm = commdct[key_i]
... | python | def convertallfields(data, commdct, block=None):
"""docstring for convertallfields"""
# import pdbdb; pdb.set_trace()
for key in list(data.dt.keys()):
objs = data.dt[key]
for i, obj in enumerate(objs):
key_i = data.dtls.index(key)
key_comm = commdct[key_i]
... | [
"def",
"convertallfields",
"(",
"data",
",",
"commdct",
",",
"block",
"=",
"None",
")",
":",
"# import pdbdb; pdb.set_trace()",
"for",
"key",
"in",
"list",
"(",
"data",
".",
"dt",
".",
"keys",
"(",
")",
")",
":",
"objs",
"=",
"data",
".",
"dt",
"[",
... | docstring for convertallfields | [
"docstring",
"for",
"convertallfields"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/idfreader.py#L156-L169 |
santoshphilip/eppy | eppy/idfreader.py | addfunctions | def addfunctions(dtls, bunchdt):
"""add functions to the objects"""
snames = [
"BuildingSurface:Detailed",
"Wall:Detailed",
"RoofCeiling:Detailed",
"Floor:Detailed",
"FenestrationSurface:Detailed",
"Shading:Site:Detailed",
"Shading:Building:Detailed",
... | python | def addfunctions(dtls, bunchdt):
"""add functions to the objects"""
snames = [
"BuildingSurface:Detailed",
"Wall:Detailed",
"RoofCeiling:Detailed",
"Floor:Detailed",
"FenestrationSurface:Detailed",
"Shading:Site:Detailed",
"Shading:Building:Detailed",
... | [
"def",
"addfunctions",
"(",
"dtls",
",",
"bunchdt",
")",
":",
"snames",
"=",
"[",
"\"BuildingSurface:Detailed\"",
",",
"\"Wall:Detailed\"",
",",
"\"RoofCeiling:Detailed\"",
",",
"\"Floor:Detailed\"",
",",
"\"FenestrationSurface:Detailed\"",
",",
"\"Shading:Site:Detailed\"",... | add functions to the objects | [
"add",
"functions",
"to",
"the",
"objects"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/idfreader.py#L172-L198 |
santoshphilip/eppy | eppy/idfreader.py | addfunctions2new | def addfunctions2new(abunch, key):
"""add functions to a new bunch/munch object"""
snames = [
"BuildingSurface:Detailed",
"Wall:Detailed",
"RoofCeiling:Detailed",
"Floor:Detailed",
"FenestrationSurface:Detailed",
"Shading:Site:Detailed",
"Shading:Building:... | python | def addfunctions2new(abunch, key):
"""add functions to a new bunch/munch object"""
snames = [
"BuildingSurface:Detailed",
"Wall:Detailed",
"RoofCeiling:Detailed",
"Floor:Detailed",
"FenestrationSurface:Detailed",
"Shading:Site:Detailed",
"Shading:Building:... | [
"def",
"addfunctions2new",
"(",
"abunch",
",",
"key",
")",
":",
"snames",
"=",
"[",
"\"BuildingSurface:Detailed\"",
",",
"\"Wall:Detailed\"",
",",
"\"RoofCeiling:Detailed\"",
",",
"\"Floor:Detailed\"",
",",
"\"FenestrationSurface:Detailed\"",
",",
"\"Shading:Site:Detailed\"... | add functions to a new bunch/munch object | [
"add",
"functions",
"to",
"a",
"new",
"bunch",
"/",
"munch",
"object"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/idfreader.py#L208-L233 |
santoshphilip/eppy | eppy/idfreader.py | idfreader | def idfreader(fname, iddfile, conv=True):
"""read idf file and return bunches"""
data, commdct, idd_index = readidf.readdatacommdct(fname, iddfile=iddfile)
if conv:
convertallfields(data, commdct)
# fill gaps in idd
ddtt, dtls = data.dt, data.dtls
# skiplist = ["TABLE:MULTIVARIABLELOOKUP... | python | def idfreader(fname, iddfile, conv=True):
"""read idf file and return bunches"""
data, commdct, idd_index = readidf.readdatacommdct(fname, iddfile=iddfile)
if conv:
convertallfields(data, commdct)
# fill gaps in idd
ddtt, dtls = data.dt, data.dtls
# skiplist = ["TABLE:MULTIVARIABLELOOKUP... | [
"def",
"idfreader",
"(",
"fname",
",",
"iddfile",
",",
"conv",
"=",
"True",
")",
":",
"data",
",",
"commdct",
",",
"idd_index",
"=",
"readidf",
".",
"readdatacommdct",
"(",
"fname",
",",
"iddfile",
"=",
"iddfile",
")",
"if",
"conv",
":",
"convertallfield... | read idf file and return bunches | [
"read",
"idf",
"file",
"and",
"return",
"bunches"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/idfreader.py#L236-L249 |
santoshphilip/eppy | eppy/idfreader.py | idfreader1 | def idfreader1(fname, iddfile, theidf, conv=True, commdct=None, block=None):
"""read idf file and return bunches"""
versiontuple = iddversiontuple(iddfile)
# import pdb; pdb.set_trace()
block, data, commdct, idd_index = readidf.readdatacommdct1(
fname,
iddfile=iddfile,
commdct=co... | python | def idfreader1(fname, iddfile, theidf, conv=True, commdct=None, block=None):
"""read idf file and return bunches"""
versiontuple = iddversiontuple(iddfile)
# import pdb; pdb.set_trace()
block, data, commdct, idd_index = readidf.readdatacommdct1(
fname,
iddfile=iddfile,
commdct=co... | [
"def",
"idfreader1",
"(",
"fname",
",",
"iddfile",
",",
"theidf",
",",
"conv",
"=",
"True",
",",
"commdct",
"=",
"None",
",",
"block",
"=",
"None",
")",
":",
"versiontuple",
"=",
"iddversiontuple",
"(",
"iddfile",
")",
"# import pdb; pdb.set_trace()",
"block... | read idf file and return bunches | [
"read",
"idf",
"file",
"and",
"return",
"bunches"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/idfreader.py#L252-L275 |
santoshphilip/eppy | eppy/idfreader.py | ConvInIDD.conv_dict | def conv_dict(self):
"""dictionary of conversion"""
return dict(integer=self.integer, real=self.real, no_type=self.no_type) | python | def conv_dict(self):
"""dictionary of conversion"""
return dict(integer=self.integer, real=self.real, no_type=self.no_type) | [
"def",
"conv_dict",
"(",
"self",
")",
":",
"return",
"dict",
"(",
"integer",
"=",
"self",
".",
"integer",
",",
"real",
"=",
"self",
".",
"real",
",",
"no_type",
"=",
"self",
".",
"no_type",
")"
] | dictionary of conversion | [
"dictionary",
"of",
"conversion"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/idfreader.py#L103-L105 |
santoshphilip/eppy | eppy/idf_helpers.py | getanymentions | def getanymentions(idf, anidfobject):
"""Find out if idjobject is mentioned an any object anywhere"""
name = anidfobject.obj[1]
foundobjs = []
keys = idfobjectkeys(idf)
idfkeyobjects = [idf.idfobjects[key.upper()] for key in keys]
for idfobjects in idfkeyobjects:
for idfobject in idfobje... | python | def getanymentions(idf, anidfobject):
"""Find out if idjobject is mentioned an any object anywhere"""
name = anidfobject.obj[1]
foundobjs = []
keys = idfobjectkeys(idf)
idfkeyobjects = [idf.idfobjects[key.upper()] for key in keys]
for idfobjects in idfkeyobjects:
for idfobject in idfobje... | [
"def",
"getanymentions",
"(",
"idf",
",",
"anidfobject",
")",
":",
"name",
"=",
"anidfobject",
".",
"obj",
"[",
"1",
"]",
"foundobjs",
"=",
"[",
"]",
"keys",
"=",
"idfobjectkeys",
"(",
"idf",
")",
"idfkeyobjects",
"=",
"[",
"idf",
".",
"idfobjects",
"[... | Find out if idjobject is mentioned an any object anywhere | [
"Find",
"out",
"if",
"idjobject",
"is",
"mentioned",
"an",
"any",
"object",
"anywhere"
] | train | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/idf_helpers.py#L30-L42 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.