repo stringlengths 7 55 | path stringlengths 4 223 | func_name stringlengths 1 134 | original_string stringlengths 75 104k | language stringclasses 1
value | code stringlengths 75 104k | code_tokens listlengths 19 28.4k | docstring stringlengths 1 46.9k | docstring_tokens listlengths 1 1.97k | sha stringlengths 40 40 | url stringlengths 87 315 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
santoshphilip/eppy | eppy/fanpower.py | watts2pascal | def watts2pascal(watts, cfm, fan_tot_eff):
"""convert and return inputs for E+ in pascal and m3/s"""
bhp = watts2bhp(watts)
return bhp2pascal(bhp, cfm, fan_tot_eff) | python | def watts2pascal(watts, cfm, fan_tot_eff):
"""convert and return inputs for E+ in pascal and m3/s"""
bhp = watts2bhp(watts)
return bhp2pascal(bhp, cfm, fan_tot_eff) | [
"def",
"watts2pascal",
"(",
"watts",
",",
"cfm",
",",
"fan_tot_eff",
")",
":",
"bhp",
"=",
"watts2bhp",
"(",
"watts",
")",
"return",
"bhp2pascal",
"(",
"bhp",
",",
"cfm",
",",
"fan_tot_eff",
")"
] | convert and return inputs for E+ in pascal and m3/s | [
"convert",
"and",
"return",
"inputs",
"for",
"E",
"+",
"in",
"pascal",
"and",
"m3",
"/",
"s"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/fanpower.py#L67-L70 | train |
santoshphilip/eppy | eppy/fanpower.py | fanpower_bhp | def fanpower_bhp(ddtt):
"""return fan power in bhp given the fan IDF object"""
from eppy.bunch_subclass import BadEPFieldError # here to prevent circular dependency
try:
fan_tot_eff = ddtt.Fan_Total_Efficiency # from V+ V8.7.0 onwards
except BadEPFieldError as e:
fan_tot_eff = ddtt.Fan_E... | python | def fanpower_bhp(ddtt):
"""return fan power in bhp given the fan IDF object"""
from eppy.bunch_subclass import BadEPFieldError # here to prevent circular dependency
try:
fan_tot_eff = ddtt.Fan_Total_Efficiency # from V+ V8.7.0 onwards
except BadEPFieldError as e:
fan_tot_eff = ddtt.Fan_E... | [
"def",
"fanpower_bhp",
"(",
"ddtt",
")",
":",
"from",
"eppy",
".",
"bunch_subclass",
"import",
"BadEPFieldError",
"# here to prevent circular dependency",
"try",
":",
"fan_tot_eff",
"=",
"ddtt",
".",
"Fan_Total_Efficiency",
"# from V+ V8.7.0 onwards",
"except",
"BadEPFiel... | return fan power in bhp given the fan IDF object | [
"return",
"fan",
"power",
"in",
"bhp",
"given",
"the",
"fan",
"IDF",
"object"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/fanpower.py#L72-L85 | train |
santoshphilip/eppy | eppy/fanpower.py | fanpower_watts | def fanpower_watts(ddtt):
"""return fan power in bhp given the fan IDF object"""
from eppy.bunch_subclass import BadEPFieldError # here to prevent circular dependency
try:
fan_tot_eff = ddtt.Fan_Total_Efficiency # from V+ V8.7.0 onwards
except BadEPFieldError as e:
fan_tot_eff = ddtt.Fan... | python | def fanpower_watts(ddtt):
"""return fan power in bhp given the fan IDF object"""
from eppy.bunch_subclass import BadEPFieldError # here to prevent circular dependency
try:
fan_tot_eff = ddtt.Fan_Total_Efficiency # from V+ V8.7.0 onwards
except BadEPFieldError as e:
fan_tot_eff = ddtt.Fan... | [
"def",
"fanpower_watts",
"(",
"ddtt",
")",
":",
"from",
"eppy",
".",
"bunch_subclass",
"import",
"BadEPFieldError",
"# here to prevent circular dependency",
"try",
":",
"fan_tot_eff",
"=",
"ddtt",
".",
"Fan_Total_Efficiency",
"# from V+ V8.7.0 onwards",
"except",
"BadEPFi... | return fan power in bhp given the fan IDF object | [
"return",
"fan",
"power",
"in",
"bhp",
"given",
"the",
"fan",
"IDF",
"object"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/fanpower.py#L87-L100 | train |
santoshphilip/eppy | eppy/fanpower.py | fan_maxcfm | def fan_maxcfm(ddtt):
"""return the fan max cfm"""
if str(ddtt.Maximum_Flow_Rate).lower() == 'autosize':
# str can fail with unicode chars :-(
return 'autosize'
else:
m3s = float(ddtt.Maximum_Flow_Rate)
return m3s2cfm(m3s) | python | def fan_maxcfm(ddtt):
"""return the fan max cfm"""
if str(ddtt.Maximum_Flow_Rate).lower() == 'autosize':
# str can fail with unicode chars :-(
return 'autosize'
else:
m3s = float(ddtt.Maximum_Flow_Rate)
return m3s2cfm(m3s) | [
"def",
"fan_maxcfm",
"(",
"ddtt",
")",
":",
"if",
"str",
"(",
"ddtt",
".",
"Maximum_Flow_Rate",
")",
".",
"lower",
"(",
")",
"==",
"'autosize'",
":",
"# str can fail with unicode chars :-(",
"return",
"'autosize'",
"else",
":",
"m3s",
"=",
"float",
"(",
"ddt... | return the fan max cfm | [
"return",
"the",
"fan",
"max",
"cfm"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/fanpower.py#L102-L109 | train |
santoshphilip/eppy | eppy/runner/run_functions.py | install_paths | def install_paths(version=None, iddname=None):
"""Get the install paths for EnergyPlus executable and weather files.
We prefer to get the install path from the IDD name but fall back to
getting it from the version number for backwards compatibility and to
simplify tests.
Parameters
----------
... | python | def install_paths(version=None, iddname=None):
"""Get the install paths for EnergyPlus executable and weather files.
We prefer to get the install path from the IDD name but fall back to
getting it from the version number for backwards compatibility and to
simplify tests.
Parameters
----------
... | [
"def",
"install_paths",
"(",
"version",
"=",
"None",
",",
"iddname",
"=",
"None",
")",
":",
"try",
":",
"eplus_exe",
",",
"eplus_home",
"=",
"paths_from_iddname",
"(",
"iddname",
")",
"except",
"(",
"AttributeError",
",",
"TypeError",
",",
"ValueError",
")",... | Get the install paths for EnergyPlus executable and weather files.
We prefer to get the install path from the IDD name but fall back to
getting it from the version number for backwards compatibility and to
simplify tests.
Parameters
----------
version : str, optional
EnergyPlus version... | [
"Get",
"the",
"install",
"paths",
"for",
"EnergyPlus",
"executable",
"and",
"weather",
"files",
"."
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/runner/run_functions.py#L29-L57 | train |
santoshphilip/eppy | eppy/runner/run_functions.py | paths_from_iddname | def paths_from_iddname(iddname):
"""Get the EnergyPlus install directory and executable path.
Parameters
----------
iddname : str, optional
File path to the IDD.
Returns
-------
eplus_exe : str
Full path to the EnergyPlus executable.
eplus_home : str
Full path t... | python | def paths_from_iddname(iddname):
"""Get the EnergyPlus install directory and executable path.
Parameters
----------
iddname : str, optional
File path to the IDD.
Returns
-------
eplus_exe : str
Full path to the EnergyPlus executable.
eplus_home : str
Full path t... | [
"def",
"paths_from_iddname",
"(",
"iddname",
")",
":",
"eplus_home",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"iddname",
")",
")",
"if",
"platform",
".",
"system",
"(",
")",
"==",
"'Windows'",
":",
"eplus_exe... | Get the EnergyPlus install directory and executable path.
Parameters
----------
iddname : str, optional
File path to the IDD.
Returns
-------
eplus_exe : str
Full path to the EnergyPlus executable.
eplus_home : str
Full path to the EnergyPlus install directory.
... | [
"Get",
"the",
"EnergyPlus",
"install",
"directory",
"and",
"executable",
"path",
"."
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/runner/run_functions.py#L60-L92 | train |
santoshphilip/eppy | eppy/runner/run_functions.py | paths_from_version | def paths_from_version(version):
"""Get the EnergyPlus install directory and executable path.
Parameters
----------
version : str, optional
EnergyPlus version in the format "X-X-X", e.g. "8-7-0".
Returns
-------
eplus_exe : str
Full path to the EnergyPlus executable.
ep... | python | def paths_from_version(version):
"""Get the EnergyPlus install directory and executable path.
Parameters
----------
version : str, optional
EnergyPlus version in the format "X-X-X", e.g. "8-7-0".
Returns
-------
eplus_exe : str
Full path to the EnergyPlus executable.
ep... | [
"def",
"paths_from_version",
"(",
"version",
")",
":",
"if",
"platform",
".",
"system",
"(",
")",
"==",
"'Windows'",
":",
"eplus_home",
"=",
"\"C:/EnergyPlusV{version}\"",
".",
"format",
"(",
"version",
"=",
"version",
")",
"eplus_exe",
"=",
"os",
".",
"path... | Get the EnergyPlus install directory and executable path.
Parameters
----------
version : str, optional
EnergyPlus version in the format "X-X-X", e.g. "8-7-0".
Returns
-------
eplus_exe : str
Full path to the EnergyPlus executable.
eplus_home : str
Full path to the ... | [
"Get",
"the",
"EnergyPlus",
"install",
"directory",
"and",
"executable",
"path",
"."
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/runner/run_functions.py#L95-L120 | train |
santoshphilip/eppy | eppy/runner/run_functions.py | wrapped_help_text | def wrapped_help_text(wrapped_func):
"""Decorator to pass through the documentation from a wrapped function.
"""
def decorator(wrapper_func):
"""The decorator.
Parameters
----------
f : callable
The wrapped function.
"""
wrapper_func.__doc__ = ('... | python | def wrapped_help_text(wrapped_func):
"""Decorator to pass through the documentation from a wrapped function.
"""
def decorator(wrapper_func):
"""The decorator.
Parameters
----------
f : callable
The wrapped function.
"""
wrapper_func.__doc__ = ('... | [
"def",
"wrapped_help_text",
"(",
"wrapped_func",
")",
":",
"def",
"decorator",
"(",
"wrapper_func",
")",
":",
"\"\"\"The decorator.\n\n Parameters\n ----------\n f : callable\n The wrapped function.\n\n \"\"\"",
"wrapper_func",
".",
"__doc__",
"... | Decorator to pass through the documentation from a wrapped function. | [
"Decorator",
"to",
"pass",
"through",
"the",
"documentation",
"from",
"a",
"wrapped",
"function",
"."
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/runner/run_functions.py#L123-L138 | train |
santoshphilip/eppy | eppy/runner/run_functions.py | runIDFs | def runIDFs(jobs, processors=1):
"""Wrapper for run() to be used when running IDF5 runs in parallel.
Parameters
----------
jobs : iterable
A list or generator made up of an IDF5 object and a kwargs dict
(see `run_functions.run` for valid keywords).
processors : int, optional
... | python | def runIDFs(jobs, processors=1):
"""Wrapper for run() to be used when running IDF5 runs in parallel.
Parameters
----------
jobs : iterable
A list or generator made up of an IDF5 object and a kwargs dict
(see `run_functions.run` for valid keywords).
processors : int, optional
... | [
"def",
"runIDFs",
"(",
"jobs",
",",
"processors",
"=",
"1",
")",
":",
"if",
"processors",
"<=",
"0",
":",
"processors",
"=",
"max",
"(",
"1",
",",
"mp",
".",
"cpu_count",
"(",
")",
"-",
"processors",
")",
"shutil",
".",
"rmtree",
"(",
"\"multi_runs\"... | Wrapper for run() to be used when running IDF5 runs in parallel.
Parameters
----------
jobs : iterable
A list or generator made up of an IDF5 object and a kwargs dict
(see `run_functions.run` for valid keywords).
processors : int, optional
Number of processors to run on (default... | [
"Wrapper",
"for",
"run",
"()",
"to",
"be",
"used",
"when",
"running",
"IDF5",
"runs",
"in",
"parallel",
"."
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/runner/run_functions.py#L141-L169 | train |
santoshphilip/eppy | eppy/runner/run_functions.py | prepare_run | def prepare_run(run_id, run_data):
"""Prepare run inputs for one of multiple EnergyPlus runs.
:param run_id: An ID number for naming the IDF.
:param run_data: Tuple of the IDF and keyword args to pass to EnergyPlus executable.
:return: Tuple of the IDF path and EPW, and the keyword args.
"""
id... | python | def prepare_run(run_id, run_data):
"""Prepare run inputs for one of multiple EnergyPlus runs.
:param run_id: An ID number for naming the IDF.
:param run_data: Tuple of the IDF and keyword args to pass to EnergyPlus executable.
:return: Tuple of the IDF path and EPW, and the keyword args.
"""
id... | [
"def",
"prepare_run",
"(",
"run_id",
",",
"run_data",
")",
":",
"idf",
",",
"kwargs",
"=",
"run_data",
"epw",
"=",
"idf",
".",
"epw",
"idf_dir",
"=",
"os",
".",
"path",
".",
"join",
"(",
"'multi_runs'",
",",
"'idf_%i'",
"%",
"run_id",
")",
"os",
".",... | Prepare run inputs for one of multiple EnergyPlus runs.
:param run_id: An ID number for naming the IDF.
:param run_data: Tuple of the IDF and keyword args to pass to EnergyPlus executable.
:return: Tuple of the IDF path and EPW, and the keyword args. | [
"Prepare",
"run",
"inputs",
"for",
"one",
"of",
"multiple",
"EnergyPlus",
"runs",
"."
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/runner/run_functions.py#L172-L185 | train |
santoshphilip/eppy | eppy/runner/run_functions.py | run | def run(idf=None, weather=None, output_directory='', annual=False,
design_day=False, idd=None, epmacro=False, expandobjects=False,
readvars=False, output_prefix=None, output_suffix=None, version=False,
verbose='v', ep_version=None):
"""
Wrapper around the EnergyPlus command line interfac... | python | def run(idf=None, weather=None, output_directory='', annual=False,
design_day=False, idd=None, epmacro=False, expandobjects=False,
readvars=False, output_prefix=None, output_suffix=None, version=False,
verbose='v', ep_version=None):
"""
Wrapper around the EnergyPlus command line interfac... | [
"def",
"run",
"(",
"idf",
"=",
"None",
",",
"weather",
"=",
"None",
",",
"output_directory",
"=",
"''",
",",
"annual",
"=",
"False",
",",
"design_day",
"=",
"False",
",",
"idd",
"=",
"None",
",",
"epmacro",
"=",
"False",
",",
"expandobjects",
"=",
"F... | Wrapper around the EnergyPlus command line interface.
Parameters
----------
idf : str
Full or relative path to the IDF file to be run, or an IDF object.
weather : str
Full or relative path to the weather file.
output_directory : str, optional
Full or relative path to an ou... | [
"Wrapper",
"around",
"the",
"EnergyPlus",
"command",
"line",
"interface",
"."
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/runner/run_functions.py#L200-L334 | train |
santoshphilip/eppy | eppy/runner/run_functions.py | parse_error | def parse_error(output_dir):
"""Add contents of stderr and eplusout.err and put it in the exception message.
:param output_dir: str
:return: str
"""
sys.stderr.seek(0)
std_err = sys.stderr.read().decode('utf-8')
err_file = os.path.join(output_dir, "eplusout.err")
if os.path.isfile(err_f... | python | def parse_error(output_dir):
"""Add contents of stderr and eplusout.err and put it in the exception message.
:param output_dir: str
:return: str
"""
sys.stderr.seek(0)
std_err = sys.stderr.read().decode('utf-8')
err_file = os.path.join(output_dir, "eplusout.err")
if os.path.isfile(err_f... | [
"def",
"parse_error",
"(",
"output_dir",
")",
":",
"sys",
".",
"stderr",
".",
"seek",
"(",
"0",
")",
"std_err",
"=",
"sys",
".",
"stderr",
".",
"read",
"(",
")",
".",
"decode",
"(",
"'utf-8'",
")",
"err_file",
"=",
"os",
".",
"path",
".",
"join",
... | Add contents of stderr and eplusout.err and put it in the exception message.
:param output_dir: str
:return: str | [
"Add",
"contents",
"of",
"stderr",
"and",
"eplusout",
".",
"err",
"and",
"put",
"it",
"in",
"the",
"exception",
"message",
"."
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/runner/run_functions.py#L337-L352 | train |
santoshphilip/eppy | eppy/constructions/thermal_properties.py | rvalue | def rvalue(ddtt):
"""
R value (W/K) of a construction or material.
thickness (m) / conductivity (W/m-K)
"""
object_type = ddtt.obj[0]
if object_type == 'Construction':
rvalue = INSIDE_FILM_R + OUTSIDE_FILM_R
layers = ddtt.obj[2:]
field_idd = ddtt.getfieldidd('Outside_Laye... | python | def rvalue(ddtt):
"""
R value (W/K) of a construction or material.
thickness (m) / conductivity (W/m-K)
"""
object_type = ddtt.obj[0]
if object_type == 'Construction':
rvalue = INSIDE_FILM_R + OUTSIDE_FILM_R
layers = ddtt.obj[2:]
field_idd = ddtt.getfieldidd('Outside_Laye... | [
"def",
"rvalue",
"(",
"ddtt",
")",
":",
"object_type",
"=",
"ddtt",
".",
"obj",
"[",
"0",
"]",
"if",
"object_type",
"==",
"'Construction'",
":",
"rvalue",
"=",
"INSIDE_FILM_R",
"+",
"OUTSIDE_FILM_R",
"layers",
"=",
"ddtt",
".",
"obj",
"[",
"2",
":",
"]... | R value (W/K) of a construction or material.
thickness (m) / conductivity (W/m-K) | [
"R",
"value",
"(",
"W",
"/",
"K",
")",
"of",
"a",
"construction",
"or",
"material",
".",
"thickness",
"(",
"m",
")",
"/",
"conductivity",
"(",
"W",
"/",
"m",
"-",
"K",
")"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/constructions/thermal_properties.py#L24-L64 | train |
santoshphilip/eppy | eppy/constructions/thermal_properties.py | heatcapacity | def heatcapacity(ddtt):
"""
Heat capacity (kJ/m2-K) of a construction or material.
thickness (m) * density (kg/m3) * specific heat (J/kg-K) * 0.001
"""
object_type = ddtt.obj[0]
if object_type == 'Construction':
heatcapacity = 0
layers = ddtt.obj[2:]
field_idd = ddtt.getf... | python | def heatcapacity(ddtt):
"""
Heat capacity (kJ/m2-K) of a construction or material.
thickness (m) * density (kg/m3) * specific heat (J/kg-K) * 0.001
"""
object_type = ddtt.obj[0]
if object_type == 'Construction':
heatcapacity = 0
layers = ddtt.obj[2:]
field_idd = ddtt.getf... | [
"def",
"heatcapacity",
"(",
"ddtt",
")",
":",
"object_type",
"=",
"ddtt",
".",
"obj",
"[",
"0",
"]",
"if",
"object_type",
"==",
"'Construction'",
":",
"heatcapacity",
"=",
"0",
"layers",
"=",
"ddtt",
".",
"obj",
"[",
"2",
":",
"]",
"field_idd",
"=",
... | Heat capacity (kJ/m2-K) of a construction or material.
thickness (m) * density (kg/m3) * specific heat (J/kg-K) * 0.001 | [
"Heat",
"capacity",
"(",
"kJ",
"/",
"m2",
"-",
"K",
")",
"of",
"a",
"construction",
"or",
"material",
".",
"thickness",
"(",
"m",
")",
"*",
"density",
"(",
"kg",
"/",
"m3",
")",
"*",
"specific",
"heat",
"(",
"J",
"/",
"kg",
"-",
"K",
")",
"*",
... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/constructions/thermal_properties.py#L87-L132 | train |
santoshphilip/eppy | eppy/modeleditor.py | almostequal | def almostequal(first, second, places=7, printit=True):
"""
Test if two values are equal to a given number of places.
This is based on python's unittest so may be covered by Python's
license.
"""
if first == second:
return True
if round(abs(second - first), places) != 0:
if... | python | def almostequal(first, second, places=7, printit=True):
"""
Test if two values are equal to a given number of places.
This is based on python's unittest so may be covered by Python's
license.
"""
if first == second:
return True
if round(abs(second - first), places) != 0:
if... | [
"def",
"almostequal",
"(",
"first",
",",
"second",
",",
"places",
"=",
"7",
",",
"printit",
"=",
"True",
")",
":",
"if",
"first",
"==",
"second",
":",
"return",
"True",
"if",
"round",
"(",
"abs",
"(",
"second",
"-",
"first",
")",
",",
"places",
")"... | Test if two values are equal to a given number of places.
This is based on python's unittest so may be covered by Python's
license. | [
"Test",
"if",
"two",
"values",
"are",
"equal",
"to",
"a",
"given",
"number",
"of",
"places",
".",
"This",
"is",
"based",
"on",
"python",
"s",
"unittest",
"so",
"may",
"be",
"covered",
"by",
"Python",
"s",
"license",
"."
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/modeleditor.py#L58-L74 | train |
santoshphilip/eppy | eppy/modeleditor.py | newrawobject | def newrawobject(data, commdct, key, block=None, defaultvalues=True):
"""Make a new object for the given key.
Parameters
----------
data : Eplusdata object
Data dictionary and list of objects for the entire model.
commdct : list of dicts
Comments from the IDD file describing each it... | python | def newrawobject(data, commdct, key, block=None, defaultvalues=True):
"""Make a new object for the given key.
Parameters
----------
data : Eplusdata object
Data dictionary and list of objects for the entire model.
commdct : list of dicts
Comments from the IDD file describing each it... | [
"def",
"newrawobject",
"(",
"data",
",",
"commdct",
",",
"key",
",",
"block",
"=",
"None",
",",
"defaultvalues",
"=",
"True",
")",
":",
"dtls",
"=",
"data",
".",
"dtls",
"key",
"=",
"key",
".",
"upper",
"(",
")",
"key_i",
"=",
"dtls",
".",
"index",... | Make a new object for the given key.
Parameters
----------
data : Eplusdata object
Data dictionary and list of objects for the entire model.
commdct : list of dicts
Comments from the IDD file describing each item type in `data`.
key : str
Object type of the object to add (in... | [
"Make",
"a",
"new",
"object",
"for",
"the",
"given",
"key",
"."
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/modeleditor.py#L95-L133 | train |
santoshphilip/eppy | eppy/modeleditor.py | addthisbunch | def addthisbunch(bunchdt, data, commdct, thisbunch, theidf):
"""add a bunch to model.
abunch usually comes from another idf file
or it can be used to copy within the idf file"""
key = thisbunch.key.upper()
obj = copy.copy(thisbunch.obj)
abunch = obj2bunch(data, commdct, obj)
bunchdt[key].app... | python | def addthisbunch(bunchdt, data, commdct, thisbunch, theidf):
"""add a bunch to model.
abunch usually comes from another idf file
or it can be used to copy within the idf file"""
key = thisbunch.key.upper()
obj = copy.copy(thisbunch.obj)
abunch = obj2bunch(data, commdct, obj)
bunchdt[key].app... | [
"def",
"addthisbunch",
"(",
"bunchdt",
",",
"data",
",",
"commdct",
",",
"thisbunch",
",",
"theidf",
")",
":",
"key",
"=",
"thisbunch",
".",
"key",
".",
"upper",
"(",
")",
"obj",
"=",
"copy",
".",
"copy",
"(",
"thisbunch",
".",
"obj",
")",
"abunch",
... | add a bunch to model.
abunch usually comes from another idf file
or it can be used to copy within the idf file | [
"add",
"a",
"bunch",
"to",
"model",
".",
"abunch",
"usually",
"comes",
"from",
"another",
"idf",
"file",
"or",
"it",
"can",
"be",
"used",
"to",
"copy",
"within",
"the",
"idf",
"file"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/modeleditor.py#L136-L144 | train |
santoshphilip/eppy | eppy/modeleditor.py | obj2bunch | def obj2bunch(data, commdct, obj):
"""make a new bunch object using the data object"""
dtls = data.dtls
key = obj[0].upper()
key_i = dtls.index(key)
abunch = makeabunch(commdct, obj, key_i)
return abunch | python | def obj2bunch(data, commdct, obj):
"""make a new bunch object using the data object"""
dtls = data.dtls
key = obj[0].upper()
key_i = dtls.index(key)
abunch = makeabunch(commdct, obj, key_i)
return abunch | [
"def",
"obj2bunch",
"(",
"data",
",",
"commdct",
",",
"obj",
")",
":",
"dtls",
"=",
"data",
".",
"dtls",
"key",
"=",
"obj",
"[",
"0",
"]",
".",
"upper",
"(",
")",
"key_i",
"=",
"dtls",
".",
"index",
"(",
"key",
")",
"abunch",
"=",
"makeabunch",
... | make a new bunch object using the data object | [
"make",
"a",
"new",
"bunch",
"object",
"using",
"the",
"data",
"object"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/modeleditor.py#L147-L153 | train |
santoshphilip/eppy | eppy/modeleditor.py | addobject | def addobject(bunchdt, data, commdct, key, theidf, aname=None, **kwargs):
"""add an object to the eplus model"""
obj = newrawobject(data, commdct, key)
abunch = obj2bunch(data, commdct, obj)
if aname:
namebunch(abunch, aname)
data.dt[key].append(obj)
bunchdt[key].append(abunch)
for k... | python | def addobject(bunchdt, data, commdct, key, theidf, aname=None, **kwargs):
"""add an object to the eplus model"""
obj = newrawobject(data, commdct, key)
abunch = obj2bunch(data, commdct, obj)
if aname:
namebunch(abunch, aname)
data.dt[key].append(obj)
bunchdt[key].append(abunch)
for k... | [
"def",
"addobject",
"(",
"bunchdt",
",",
"data",
",",
"commdct",
",",
"key",
",",
"theidf",
",",
"aname",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"obj",
"=",
"newrawobject",
"(",
"data",
",",
"commdct",
",",
"key",
")",
"abunch",
"=",
"obj2... | add an object to the eplus model | [
"add",
"an",
"object",
"to",
"the",
"eplus",
"model"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/modeleditor.py#L165-L175 | train |
santoshphilip/eppy | eppy/modeleditor.py | getnamedargs | def getnamedargs(*args, **kwargs):
"""allows you to pass a dict and named args
so you can pass ({'a':5, 'b':3}, c=8) and get
dict(a=5, b=3, c=8)"""
adict = {}
for arg in args:
if isinstance(arg, dict):
adict.update(arg)
adict.update(kwargs)
return adict | python | def getnamedargs(*args, **kwargs):
"""allows you to pass a dict and named args
so you can pass ({'a':5, 'b':3}, c=8) and get
dict(a=5, b=3, c=8)"""
adict = {}
for arg in args:
if isinstance(arg, dict):
adict.update(arg)
adict.update(kwargs)
return adict | [
"def",
"getnamedargs",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"adict",
"=",
"{",
"}",
"for",
"arg",
"in",
"args",
":",
"if",
"isinstance",
"(",
"arg",
",",
"dict",
")",
":",
"adict",
".",
"update",
"(",
"arg",
")",
"adict",
".",
"... | allows you to pass a dict and named args
so you can pass ({'a':5, 'b':3}, c=8) and get
dict(a=5, b=3, c=8) | [
"allows",
"you",
"to",
"pass",
"a",
"dict",
"and",
"named",
"args",
"so",
"you",
"can",
"pass",
"(",
"{",
"a",
":",
"5",
"b",
":",
"3",
"}",
"c",
"=",
"8",
")",
"and",
"get",
"dict",
"(",
"a",
"=",
"5",
"b",
"=",
"3",
"c",
"=",
"8",
")"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/modeleditor.py#L178-L187 | train |
santoshphilip/eppy | eppy/modeleditor.py | addobject1 | def addobject1(bunchdt, data, commdct, key, **kwargs):
"""add an object to the eplus model"""
obj = newrawobject(data, commdct, key)
abunch = obj2bunch(data, commdct, obj)
data.dt[key].append(obj)
bunchdt[key].append(abunch)
# adict = getnamedargs(*args, **kwargs)
for kkey, value in iteritem... | python | def addobject1(bunchdt, data, commdct, key, **kwargs):
"""add an object to the eplus model"""
obj = newrawobject(data, commdct, key)
abunch = obj2bunch(data, commdct, obj)
data.dt[key].append(obj)
bunchdt[key].append(abunch)
# adict = getnamedargs(*args, **kwargs)
for kkey, value in iteritem... | [
"def",
"addobject1",
"(",
"bunchdt",
",",
"data",
",",
"commdct",
",",
"key",
",",
"*",
"*",
"kwargs",
")",
":",
"obj",
"=",
"newrawobject",
"(",
"data",
",",
"commdct",
",",
"key",
")",
"abunch",
"=",
"obj2bunch",
"(",
"data",
",",
"commdct",
",",
... | add an object to the eplus model | [
"add",
"an",
"object",
"to",
"the",
"eplus",
"model"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/modeleditor.py#L190-L199 | train |
santoshphilip/eppy | eppy/modeleditor.py | getobject | def getobject(bunchdt, key, name):
"""get the object if you have the key and the name
returns a list of objects, in case you have more than one
You should not have more than one"""
# TODO : throw exception if more than one object, or return more objects
idfobjects = bunchdt[key]
if idfobjects:
... | python | def getobject(bunchdt, key, name):
"""get the object if you have the key and the name
returns a list of objects, in case you have more than one
You should not have more than one"""
# TODO : throw exception if more than one object, or return more objects
idfobjects = bunchdt[key]
if idfobjects:
... | [
"def",
"getobject",
"(",
"bunchdt",
",",
"key",
",",
"name",
")",
":",
"# TODO : throw exception if more than one object, or return more objects",
"idfobjects",
"=",
"bunchdt",
"[",
"key",
"]",
"if",
"idfobjects",
":",
"# second item in list is a unique ID",
"unique_id",
... | get the object if you have the key and the name
returns a list of objects, in case you have more than one
You should not have more than one | [
"get",
"the",
"object",
"if",
"you",
"have",
"the",
"key",
"and",
"the",
"name",
"returns",
"a",
"list",
"of",
"objects",
"in",
"case",
"you",
"have",
"more",
"than",
"one",
"You",
"should",
"not",
"have",
"more",
"than",
"one"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/modeleditor.py#L202-L216 | train |
santoshphilip/eppy | eppy/modeleditor.py | __objecthasfields | def __objecthasfields(bunchdt, data, commdct, idfobject, places=7, **kwargs):
"""test if the idf object has the field values in kwargs"""
for key, value in list(kwargs.items()):
if not isfieldvalue(
bunchdt, data, commdct,
idfobject, key, value, places=places):
... | python | def __objecthasfields(bunchdt, data, commdct, idfobject, places=7, **kwargs):
"""test if the idf object has the field values in kwargs"""
for key, value in list(kwargs.items()):
if not isfieldvalue(
bunchdt, data, commdct,
idfobject, key, value, places=places):
... | [
"def",
"__objecthasfields",
"(",
"bunchdt",
",",
"data",
",",
"commdct",
",",
"idfobject",
",",
"places",
"=",
"7",
",",
"*",
"*",
"kwargs",
")",
":",
"for",
"key",
",",
"value",
"in",
"list",
"(",
"kwargs",
".",
"items",
"(",
")",
")",
":",
"if",
... | test if the idf object has the field values in kwargs | [
"test",
"if",
"the",
"idf",
"object",
"has",
"the",
"field",
"values",
"in",
"kwargs"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/modeleditor.py#L219-L226 | train |
santoshphilip/eppy | eppy/modeleditor.py | getobjects | def getobjects(bunchdt, data, commdct, key, places=7, **kwargs):
"""get all the objects of key that matches the fields in **kwargs"""
idfobjects = bunchdt[key]
allobjs = []
for obj in idfobjects:
if __objecthasfields(
bunchdt, data, commdct,
obj, places=places, **... | python | def getobjects(bunchdt, data, commdct, key, places=7, **kwargs):
"""get all the objects of key that matches the fields in **kwargs"""
idfobjects = bunchdt[key]
allobjs = []
for obj in idfobjects:
if __objecthasfields(
bunchdt, data, commdct,
obj, places=places, **... | [
"def",
"getobjects",
"(",
"bunchdt",
",",
"data",
",",
"commdct",
",",
"key",
",",
"places",
"=",
"7",
",",
"*",
"*",
"kwargs",
")",
":",
"idfobjects",
"=",
"bunchdt",
"[",
"key",
"]",
"allobjs",
"=",
"[",
"]",
"for",
"obj",
"in",
"idfobjects",
":"... | get all the objects of key that matches the fields in **kwargs | [
"get",
"all",
"the",
"objects",
"of",
"key",
"that",
"matches",
"the",
"fields",
"in",
"**",
"kwargs"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/modeleditor.py#L229-L238 | train |
santoshphilip/eppy | eppy/modeleditor.py | iddofobject | def iddofobject(data, commdct, key):
"""from commdct, return the idd of the object key"""
dtls = data.dtls
i = dtls.index(key)
return commdct[i] | python | def iddofobject(data, commdct, key):
"""from commdct, return the idd of the object key"""
dtls = data.dtls
i = dtls.index(key)
return commdct[i] | [
"def",
"iddofobject",
"(",
"data",
",",
"commdct",
",",
"key",
")",
":",
"dtls",
"=",
"data",
".",
"dtls",
"i",
"=",
"dtls",
".",
"index",
"(",
"key",
")",
"return",
"commdct",
"[",
"i",
"]"
] | from commdct, return the idd of the object key | [
"from",
"commdct",
"return",
"the",
"idd",
"of",
"the",
"object",
"key"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/modeleditor.py#L241-L245 | train |
santoshphilip/eppy | eppy/modeleditor.py | getextensibleindex | def getextensibleindex(bunchdt, data, commdct, key, objname):
"""get the index of the first extensible item"""
theobject = getobject(bunchdt, key, objname)
if theobject == None:
return None
theidd = iddofobject(data, commdct, key)
extensible_i = [
i for i in range(len(theidd)) if 'be... | python | def getextensibleindex(bunchdt, data, commdct, key, objname):
"""get the index of the first extensible item"""
theobject = getobject(bunchdt, key, objname)
if theobject == None:
return None
theidd = iddofobject(data, commdct, key)
extensible_i = [
i for i in range(len(theidd)) if 'be... | [
"def",
"getextensibleindex",
"(",
"bunchdt",
",",
"data",
",",
"commdct",
",",
"key",
",",
"objname",
")",
":",
"theobject",
"=",
"getobject",
"(",
"bunchdt",
",",
"key",
",",
"objname",
")",
"if",
"theobject",
"==",
"None",
":",
"return",
"None",
"theid... | get the index of the first extensible item | [
"get",
"the",
"index",
"of",
"the",
"first",
"extensible",
"item"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/modeleditor.py#L248-L259 | train |
santoshphilip/eppy | eppy/modeleditor.py | removeextensibles | def removeextensibles(bunchdt, data, commdct, key, objname):
"""remove the extensible items in the object"""
theobject = getobject(bunchdt, key, objname)
if theobject == None:
return theobject
theidd = iddofobject(data, commdct, key)
extensible_i = [
i for i in range(len(theidd)) if ... | python | def removeextensibles(bunchdt, data, commdct, key, objname):
"""remove the extensible items in the object"""
theobject = getobject(bunchdt, key, objname)
if theobject == None:
return theobject
theidd = iddofobject(data, commdct, key)
extensible_i = [
i for i in range(len(theidd)) if ... | [
"def",
"removeextensibles",
"(",
"bunchdt",
",",
"data",
",",
"commdct",
",",
"key",
",",
"objname",
")",
":",
"theobject",
"=",
"getobject",
"(",
"bunchdt",
",",
"key",
",",
"objname",
")",
"if",
"theobject",
"==",
"None",
":",
"return",
"theobject",
"t... | remove the extensible items in the object | [
"remove",
"the",
"extensible",
"items",
"in",
"the",
"object"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/modeleditor.py#L262-L279 | train |
santoshphilip/eppy | eppy/modeleditor.py | getfieldcomm | def getfieldcomm(bunchdt, data, commdct, idfobject, fieldname):
"""get the idd comment for the field"""
key = idfobject.obj[0].upper()
keyi = data.dtls.index(key)
fieldi = idfobject.objls.index(fieldname)
thiscommdct = commdct[keyi][fieldi]
return thiscommdct | python | def getfieldcomm(bunchdt, data, commdct, idfobject, fieldname):
"""get the idd comment for the field"""
key = idfobject.obj[0].upper()
keyi = data.dtls.index(key)
fieldi = idfobject.objls.index(fieldname)
thiscommdct = commdct[keyi][fieldi]
return thiscommdct | [
"def",
"getfieldcomm",
"(",
"bunchdt",
",",
"data",
",",
"commdct",
",",
"idfobject",
",",
"fieldname",
")",
":",
"key",
"=",
"idfobject",
".",
"obj",
"[",
"0",
"]",
".",
"upper",
"(",
")",
"keyi",
"=",
"data",
".",
"dtls",
".",
"index",
"(",
"key"... | get the idd comment for the field | [
"get",
"the",
"idd",
"comment",
"for",
"the",
"field"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/modeleditor.py#L282-L288 | train |
santoshphilip/eppy | eppy/modeleditor.py | is_retaincase | def is_retaincase(bunchdt, data, commdct, idfobject, fieldname):
"""test if case has to be retained for that field"""
thiscommdct = getfieldcomm(bunchdt, data, commdct, idfobject, fieldname)
return 'retaincase' in thiscommdct | python | def is_retaincase(bunchdt, data, commdct, idfobject, fieldname):
"""test if case has to be retained for that field"""
thiscommdct = getfieldcomm(bunchdt, data, commdct, idfobject, fieldname)
return 'retaincase' in thiscommdct | [
"def",
"is_retaincase",
"(",
"bunchdt",
",",
"data",
",",
"commdct",
",",
"idfobject",
",",
"fieldname",
")",
":",
"thiscommdct",
"=",
"getfieldcomm",
"(",
"bunchdt",
",",
"data",
",",
"commdct",
",",
"idfobject",
",",
"fieldname",
")",
"return",
"'retaincas... | test if case has to be retained for that field | [
"test",
"if",
"case",
"has",
"to",
"be",
"retained",
"for",
"that",
"field"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/modeleditor.py#L291-L294 | train |
santoshphilip/eppy | eppy/modeleditor.py | isfieldvalue | def isfieldvalue(bunchdt, data, commdct, idfobj, fieldname, value, places=7):
"""test if idfobj.field == value"""
# do a quick type check
# if type(idfobj[fieldname]) != type(value):
# return False # takes care of autocalculate and real
# check float
thiscommdct = getfieldcomm(bunchdt, data, com... | python | def isfieldvalue(bunchdt, data, commdct, idfobj, fieldname, value, places=7):
"""test if idfobj.field == value"""
# do a quick type check
# if type(idfobj[fieldname]) != type(value):
# return False # takes care of autocalculate and real
# check float
thiscommdct = getfieldcomm(bunchdt, data, com... | [
"def",
"isfieldvalue",
"(",
"bunchdt",
",",
"data",
",",
"commdct",
",",
"idfobj",
",",
"fieldname",
",",
"value",
",",
"places",
"=",
"7",
")",
":",
"# do a quick type check",
"# if type(idfobj[fieldname]) != type(value):",
"# return False # takes care of autocalculate a... | test if idfobj.field == value | [
"test",
"if",
"idfobj",
".",
"field",
"==",
"value"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/modeleditor.py#L297-L318 | train |
santoshphilip/eppy | eppy/modeleditor.py | equalfield | def equalfield(bunchdt, data, commdct, idfobj1, idfobj2, fieldname, places=7):
"""returns true if the two fields are equal
will test for retaincase
places is used if the field is float/real"""
# TODO test if both objects are of same type
key1 = idfobj1.obj[0].upper()
key2 = idfobj2.obj[0].upper(... | python | def equalfield(bunchdt, data, commdct, idfobj1, idfobj2, fieldname, places=7):
"""returns true if the two fields are equal
will test for retaincase
places is used if the field is float/real"""
# TODO test if both objects are of same type
key1 = idfobj1.obj[0].upper()
key2 = idfobj2.obj[0].upper(... | [
"def",
"equalfield",
"(",
"bunchdt",
",",
"data",
",",
"commdct",
",",
"idfobj1",
",",
"idfobj2",
",",
"fieldname",
",",
"places",
"=",
"7",
")",
":",
"# TODO test if both objects are of same type",
"key1",
"=",
"idfobj1",
".",
"obj",
"[",
"0",
"]",
".",
"... | returns true if the two fields are equal
will test for retaincase
places is used if the field is float/real | [
"returns",
"true",
"if",
"the",
"two",
"fields",
"are",
"equal",
"will",
"test",
"for",
"retaincase",
"places",
"is",
"used",
"if",
"the",
"field",
"is",
"float",
"/",
"real"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/modeleditor.py#L321-L333 | train |
santoshphilip/eppy | eppy/modeleditor.py | getrefnames | def getrefnames(idf, objname):
"""get the reference names for this object"""
iddinfo = idf.idd_info
dtls = idf.model.dtls
index = dtls.index(objname)
fieldidds = iddinfo[index]
for fieldidd in fieldidds:
if 'field' in fieldidd:
if fieldidd['field'][0].endswith('Name'):
... | python | def getrefnames(idf, objname):
"""get the reference names for this object"""
iddinfo = idf.idd_info
dtls = idf.model.dtls
index = dtls.index(objname)
fieldidds = iddinfo[index]
for fieldidd in fieldidds:
if 'field' in fieldidd:
if fieldidd['field'][0].endswith('Name'):
... | [
"def",
"getrefnames",
"(",
"idf",
",",
"objname",
")",
":",
"iddinfo",
"=",
"idf",
".",
"idd_info",
"dtls",
"=",
"idf",
".",
"model",
".",
"dtls",
"index",
"=",
"dtls",
".",
"index",
"(",
"objname",
")",
"fieldidds",
"=",
"iddinfo",
"[",
"index",
"]"... | get the reference names for this object | [
"get",
"the",
"reference",
"names",
"for",
"this",
"object"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/modeleditor.py#L336-L348 | train |
santoshphilip/eppy | eppy/modeleditor.py | getallobjlists | def getallobjlists(idf, refname):
"""get all object-list fields for refname
return a list:
[('OBJKEY', refname, fieldindexlist), ...] where
fieldindexlist = index of the field where the object-list = refname
"""
dtls = idf.model.dtls
objlists = []
for i, fieldidds in enumerate(idf.idd_in... | python | def getallobjlists(idf, refname):
"""get all object-list fields for refname
return a list:
[('OBJKEY', refname, fieldindexlist), ...] where
fieldindexlist = index of the field where the object-list = refname
"""
dtls = idf.model.dtls
objlists = []
for i, fieldidds in enumerate(idf.idd_in... | [
"def",
"getallobjlists",
"(",
"idf",
",",
"refname",
")",
":",
"dtls",
"=",
"idf",
".",
"model",
".",
"dtls",
"objlists",
"=",
"[",
"]",
"for",
"i",
",",
"fieldidds",
"in",
"enumerate",
"(",
"idf",
".",
"idd_info",
")",
":",
"indexlist",
"=",
"[",
... | get all object-list fields for refname
return a list:
[('OBJKEY', refname, fieldindexlist), ...] where
fieldindexlist = index of the field where the object-list = refname | [
"get",
"all",
"object",
"-",
"list",
"fields",
"for",
"refname",
"return",
"a",
"list",
":",
"[",
"(",
"OBJKEY",
"refname",
"fieldindexlist",
")",
"...",
"]",
"where",
"fieldindexlist",
"=",
"index",
"of",
"the",
"field",
"where",
"the",
"object",
"-",
"... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/modeleditor.py#L351-L368 | train |
santoshphilip/eppy | eppy/modeleditor.py | rename | def rename(idf, objkey, objname, newname):
"""rename all the refrences to this objname"""
refnames = getrefnames(idf, objkey)
for refname in refnames:
objlists = getallobjlists(idf, refname)
# [('OBJKEY', refname, fieldindexlist), ...]
for refname in refnames:
# TODO : there ... | python | def rename(idf, objkey, objname, newname):
"""rename all the refrences to this objname"""
refnames = getrefnames(idf, objkey)
for refname in refnames:
objlists = getallobjlists(idf, refname)
# [('OBJKEY', refname, fieldindexlist), ...]
for refname in refnames:
# TODO : there ... | [
"def",
"rename",
"(",
"idf",
",",
"objkey",
",",
"objname",
",",
"newname",
")",
":",
"refnames",
"=",
"getrefnames",
"(",
"idf",
",",
"objkey",
")",
"for",
"refname",
"in",
"refnames",
":",
"objlists",
"=",
"getallobjlists",
"(",
"idf",
",",
"refname",
... | rename all the refrences to this objname | [
"rename",
"all",
"the",
"refrences",
"to",
"this",
"objname"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/modeleditor.py#L371-L389 | train |
santoshphilip/eppy | eppy/modeleditor.py | zonearea | def zonearea(idf, zonename, debug=False):
"""zone area"""
zone = idf.getobject('ZONE', zonename)
surfs = idf.idfobjects['BuildingSurface:Detailed'.upper()]
zone_surfs = [s for s in surfs if s.Zone_Name == zone.Name]
floors = [s for s in zone_surfs if s.Surface_Type.upper() == 'FLOOR']
if debug:
... | python | def zonearea(idf, zonename, debug=False):
"""zone area"""
zone = idf.getobject('ZONE', zonename)
surfs = idf.idfobjects['BuildingSurface:Detailed'.upper()]
zone_surfs = [s for s in surfs if s.Zone_Name == zone.Name]
floors = [s for s in zone_surfs if s.Surface_Type.upper() == 'FLOOR']
if debug:
... | [
"def",
"zonearea",
"(",
"idf",
",",
"zonename",
",",
"debug",
"=",
"False",
")",
":",
"zone",
"=",
"idf",
".",
"getobject",
"(",
"'ZONE'",
",",
"zonename",
")",
"surfs",
"=",
"idf",
".",
"idfobjects",
"[",
"'BuildingSurface:Detailed'",
".",
"upper",
"(",... | zone area | [
"zone",
"area"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/modeleditor.py#L392-L406 | train |
santoshphilip/eppy | eppy/modeleditor.py | zone_height_min2max | def zone_height_min2max(idf, zonename, debug=False):
"""zone height = max-min"""
zone = idf.getobject('ZONE', zonename)
surfs = idf.idfobjects['BuildingSurface:Detailed'.upper()]
zone_surfs = [s for s in surfs if s.Zone_Name == zone.Name]
surf_xyzs = [eppy.function_helpers.getcoords(s) for s in zone... | python | def zone_height_min2max(idf, zonename, debug=False):
"""zone height = max-min"""
zone = idf.getobject('ZONE', zonename)
surfs = idf.idfobjects['BuildingSurface:Detailed'.upper()]
zone_surfs = [s for s in surfs if s.Zone_Name == zone.Name]
surf_xyzs = [eppy.function_helpers.getcoords(s) for s in zone... | [
"def",
"zone_height_min2max",
"(",
"idf",
",",
"zonename",
",",
"debug",
"=",
"False",
")",
":",
"zone",
"=",
"idf",
".",
"getobject",
"(",
"'ZONE'",
",",
"zonename",
")",
"surfs",
"=",
"idf",
".",
"idfobjects",
"[",
"'BuildingSurface:Detailed'",
".",
"upp... | zone height = max-min | [
"zone",
"height",
"=",
"max",
"-",
"min"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/modeleditor.py#L436-L447 | train |
santoshphilip/eppy | eppy/modeleditor.py | zoneheight | def zoneheight(idf, zonename, debug=False):
"""zone height"""
zone = idf.getobject('ZONE', zonename)
surfs = idf.idfobjects['BuildingSurface:Detailed'.upper()]
zone_surfs = [s for s in surfs if s.Zone_Name == zone.Name]
floors = [s for s in zone_surfs if s.Surface_Type.upper() == 'FLOOR']
roofs ... | python | def zoneheight(idf, zonename, debug=False):
"""zone height"""
zone = idf.getobject('ZONE', zonename)
surfs = idf.idfobjects['BuildingSurface:Detailed'.upper()]
zone_surfs = [s for s in surfs if s.Zone_Name == zone.Name]
floors = [s for s in zone_surfs if s.Surface_Type.upper() == 'FLOOR']
roofs ... | [
"def",
"zoneheight",
"(",
"idf",
",",
"zonename",
",",
"debug",
"=",
"False",
")",
":",
"zone",
"=",
"idf",
".",
"getobject",
"(",
"'ZONE'",
",",
"zonename",
")",
"surfs",
"=",
"idf",
".",
"idfobjects",
"[",
"'BuildingSurface:Detailed'",
".",
"upper",
"(... | zone height | [
"zone",
"height"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/modeleditor.py#L450-L461 | train |
santoshphilip/eppy | eppy/modeleditor.py | zone_floor2roofheight | def zone_floor2roofheight(idf, zonename, debug=False):
"""zone floor to roof height"""
zone = idf.getobject('ZONE', zonename)
surfs = idf.idfobjects['BuildingSurface:Detailed'.upper()]
zone_surfs = [s for s in surfs if s.Zone_Name == zone.Name]
floors = [s for s in zone_surfs if s.Surface_Type.upper... | python | def zone_floor2roofheight(idf, zonename, debug=False):
"""zone floor to roof height"""
zone = idf.getobject('ZONE', zonename)
surfs = idf.idfobjects['BuildingSurface:Detailed'.upper()]
zone_surfs = [s for s in surfs if s.Zone_Name == zone.Name]
floors = [s for s in zone_surfs if s.Surface_Type.upper... | [
"def",
"zone_floor2roofheight",
"(",
"idf",
",",
"zonename",
",",
"debug",
"=",
"False",
")",
":",
"zone",
"=",
"idf",
".",
"getobject",
"(",
"'ZONE'",
",",
"zonename",
")",
"surfs",
"=",
"idf",
".",
"idfobjects",
"[",
"'BuildingSurface:Detailed'",
".",
"u... | zone floor to roof height | [
"zone",
"floor",
"to",
"roof",
"height"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/modeleditor.py#L464-L487 | train |
santoshphilip/eppy | eppy/modeleditor.py | zonevolume | def zonevolume(idf, zonename):
"""zone volume"""
area = zonearea(idf, zonename)
height = zoneheight(idf, zonename)
volume = area * height
return volume | python | def zonevolume(idf, zonename):
"""zone volume"""
area = zonearea(idf, zonename)
height = zoneheight(idf, zonename)
volume = area * height
return volume | [
"def",
"zonevolume",
"(",
"idf",
",",
"zonename",
")",
":",
"area",
"=",
"zonearea",
"(",
"idf",
",",
"zonename",
")",
"height",
"=",
"zoneheight",
"(",
"idf",
",",
"zonename",
")",
"volume",
"=",
"area",
"*",
"height",
"return",
"volume"
] | zone volume | [
"zone",
"volume"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/modeleditor.py#L490-L496 | train |
santoshphilip/eppy | eppy/modeleditor.py | IDF.setiddname | def setiddname(cls, iddname, testing=False):
"""
Set the path to the EnergyPlus IDD for the version of EnergyPlus which
is to be used by eppy.
Parameters
----------
iddname : str
Path to the IDD file.
testing : bool
Flag to use if running ... | python | def setiddname(cls, iddname, testing=False):
"""
Set the path to the EnergyPlus IDD for the version of EnergyPlus which
is to be used by eppy.
Parameters
----------
iddname : str
Path to the IDD file.
testing : bool
Flag to use if running ... | [
"def",
"setiddname",
"(",
"cls",
",",
"iddname",
",",
"testing",
"=",
"False",
")",
":",
"if",
"cls",
".",
"iddname",
"==",
"None",
":",
"cls",
".",
"iddname",
"=",
"iddname",
"cls",
".",
"idd_info",
"=",
"None",
"cls",
".",
"block",
"=",
"None",
"... | Set the path to the EnergyPlus IDD for the version of EnergyPlus which
is to be used by eppy.
Parameters
----------
iddname : str
Path to the IDD file.
testing : bool
Flag to use if running tests since we may want to ignore the
`IDDAlreadySetE... | [
"Set",
"the",
"path",
"to",
"the",
"EnergyPlus",
"IDD",
"for",
"the",
"version",
"of",
"EnergyPlus",
"which",
"is",
"to",
"be",
"used",
"by",
"eppy",
"."
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/modeleditor.py#L557-L584 | train |
santoshphilip/eppy | eppy/modeleditor.py | IDF.setidd | def setidd(cls, iddinfo, iddindex, block, idd_version):
"""Set the IDD to be used by eppy.
Parameters
----------
iddinfo : list
Comments and metadata about fields in the IDD.
block : list
Field names in the IDD.
"""
cls.idd_info = iddinfo... | python | def setidd(cls, iddinfo, iddindex, block, idd_version):
"""Set the IDD to be used by eppy.
Parameters
----------
iddinfo : list
Comments and metadata about fields in the IDD.
block : list
Field names in the IDD.
"""
cls.idd_info = iddinfo... | [
"def",
"setidd",
"(",
"cls",
",",
"iddinfo",
",",
"iddindex",
",",
"block",
",",
"idd_version",
")",
":",
"cls",
".",
"idd_info",
"=",
"iddinfo",
"cls",
".",
"block",
"=",
"block",
"cls",
".",
"idd_index",
"=",
"iddindex",
"cls",
".",
"idd_version",
"=... | Set the IDD to be used by eppy.
Parameters
----------
iddinfo : list
Comments and metadata about fields in the IDD.
block : list
Field names in the IDD. | [
"Set",
"the",
"IDD",
"to",
"be",
"used",
"by",
"eppy",
"."
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/modeleditor.py#L598-L612 | train |
santoshphilip/eppy | eppy/modeleditor.py | IDF.initread | def initread(self, idfname):
"""
Use the current IDD and read an IDF from file. If the IDD has not yet
been initialised then this is done first.
Parameters
----------
idf_name : str
Path to an IDF file.
"""
with open(idfname, 'r') as _:
... | python | def initread(self, idfname):
"""
Use the current IDD and read an IDF from file. If the IDD has not yet
been initialised then this is done first.
Parameters
----------
idf_name : str
Path to an IDF file.
"""
with open(idfname, 'r') as _:
... | [
"def",
"initread",
"(",
"self",
",",
"idfname",
")",
":",
"with",
"open",
"(",
"idfname",
",",
"'r'",
")",
"as",
"_",
":",
"# raise nonexistent file error early if idfname doesn't exist",
"pass",
"iddfhandle",
"=",
"StringIO",
"(",
"iddcurrent",
".",
"iddtxt",
"... | Use the current IDD and read an IDF from file. If the IDD has not yet
been initialised then this is done first.
Parameters
----------
idf_name : str
Path to an IDF file. | [
"Use",
"the",
"current",
"IDD",
"and",
"read",
"an",
"IDF",
"from",
"file",
".",
"If",
"the",
"IDD",
"has",
"not",
"yet",
"been",
"initialised",
"then",
"this",
"is",
"done",
"first",
"."
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/modeleditor.py#L616-L634 | train |
santoshphilip/eppy | eppy/modeleditor.py | IDF.initreadtxt | def initreadtxt(self, idftxt):
"""
Use the current IDD and read an IDF from text data. If the IDD has not
yet been initialised then this is done first.
Parameters
----------
idftxt : str
Text representing an IDF file.
"""
iddfhandle = StringI... | python | def initreadtxt(self, idftxt):
"""
Use the current IDD and read an IDF from text data. If the IDD has not
yet been initialised then this is done first.
Parameters
----------
idftxt : str
Text representing an IDF file.
"""
iddfhandle = StringI... | [
"def",
"initreadtxt",
"(",
"self",
",",
"idftxt",
")",
":",
"iddfhandle",
"=",
"StringIO",
"(",
"iddcurrent",
".",
"iddtxt",
")",
"if",
"self",
".",
"getiddname",
"(",
")",
"==",
"None",
":",
"self",
".",
"setiddname",
"(",
"iddfhandle",
")",
"idfhandle"... | Use the current IDD and read an IDF from text data. If the IDD has not
yet been initialised then this is done first.
Parameters
----------
idftxt : str
Text representing an IDF file. | [
"Use",
"the",
"current",
"IDD",
"and",
"read",
"an",
"IDF",
"from",
"text",
"data",
".",
"If",
"the",
"IDD",
"has",
"not",
"yet",
"been",
"initialised",
"then",
"this",
"is",
"done",
"first",
"."
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/modeleditor.py#L636-L652 | train |
santoshphilip/eppy | eppy/modeleditor.py | IDF.read | def read(self):
"""
Read the IDF file and the IDD file. If the IDD file had already been
read, it will not be read again.
Read populates the following data structures:
- idfobjects : list
- model : list
- idd_info : list
- idd_index : dict
"""
... | python | def read(self):
"""
Read the IDF file and the IDD file. If the IDD file had already been
read, it will not be read again.
Read populates the following data structures:
- idfobjects : list
- model : list
- idd_info : list
- idd_index : dict
"""
... | [
"def",
"read",
"(",
"self",
")",
":",
"if",
"self",
".",
"getiddname",
"(",
")",
"==",
"None",
":",
"errortxt",
"=",
"(",
"\"IDD file needed to read the idf file. \"",
"\"Set it using IDF.setiddname(iddfile)\"",
")",
"raise",
"IDDNotSetError",
"(",
"errortxt",
")",
... | Read the IDF file and the IDD file. If the IDD file had already been
read, it will not be read again.
Read populates the following data structures:
- idfobjects : list
- model : list
- idd_info : list
- idd_index : dict | [
"Read",
"the",
"IDF",
"file",
"and",
"the",
"IDD",
"file",
".",
"If",
"the",
"IDD",
"file",
"had",
"already",
"been",
"read",
"it",
"will",
"not",
"be",
"read",
"again",
"."
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/modeleditor.py#L654-L676 | train |
santoshphilip/eppy | eppy/modeleditor.py | IDF.initnew | def initnew(self, fname):
"""
Use the current IDD and create a new empty IDF. If the IDD has not yet
been initialised then this is done first.
Parameters
----------
fname : str, optional
Path to an IDF. This does not need to be set at this point.
"""... | python | def initnew(self, fname):
"""
Use the current IDD and create a new empty IDF. If the IDD has not yet
been initialised then this is done first.
Parameters
----------
fname : str, optional
Path to an IDF. This does not need to be set at this point.
"""... | [
"def",
"initnew",
"(",
"self",
",",
"fname",
")",
":",
"iddfhandle",
"=",
"StringIO",
"(",
"iddcurrent",
".",
"iddtxt",
")",
"if",
"self",
".",
"getiddname",
"(",
")",
"==",
"None",
":",
"self",
".",
"setiddname",
"(",
"iddfhandle",
")",
"idfhandle",
"... | Use the current IDD and create a new empty IDF. If the IDD has not yet
been initialised then this is done first.
Parameters
----------
fname : str, optional
Path to an IDF. This does not need to be set at this point. | [
"Use",
"the",
"current",
"IDD",
"and",
"create",
"a",
"new",
"empty",
"IDF",
".",
"If",
"the",
"IDD",
"has",
"not",
"yet",
"been",
"initialised",
"then",
"this",
"is",
"done",
"first",
"."
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/modeleditor.py#L691-L709 | train |
santoshphilip/eppy | eppy/modeleditor.py | IDF.newidfobject | def newidfobject(self, key, aname='', defaultvalues=True, **kwargs):
"""
Add a new idfobject to the model. If you don't specify a value for a
field, the default value will be set.
For example ::
newidfobject("CONSTRUCTION")
newidfobject("CONSTRUCTION",
... | python | def newidfobject(self, key, aname='', defaultvalues=True, **kwargs):
"""
Add a new idfobject to the model. If you don't specify a value for a
field, the default value will be set.
For example ::
newidfobject("CONSTRUCTION")
newidfobject("CONSTRUCTION",
... | [
"def",
"newidfobject",
"(",
"self",
",",
"key",
",",
"aname",
"=",
"''",
",",
"defaultvalues",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"obj",
"=",
"newrawobject",
"(",
"self",
".",
"model",
",",
"self",
".",
"idd_info",
",",
"key",
",",
"bl... | Add a new idfobject to the model. If you don't specify a value for a
field, the default value will be set.
For example ::
newidfobject("CONSTRUCTION")
newidfobject("CONSTRUCTION",
Name='Interior Ceiling_class',
Outside_Layer='LW Concrete',
... | [
"Add",
"a",
"new",
"idfobject",
"to",
"the",
"model",
".",
"If",
"you",
"don",
"t",
"specify",
"a",
"value",
"for",
"a",
"field",
"the",
"default",
"value",
"will",
"be",
"set",
"."
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/modeleditor.py#L713-L755 | train |
santoshphilip/eppy | eppy/modeleditor.py | IDF.removeidfobject | def removeidfobject(self, idfobject):
"""Remove an IDF object from the IDF.
Parameters
----------
idfobject : EpBunch object
The IDF object to remove.
"""
key = idfobject.key.upper()
self.idfobjects[key].remove(idfobject) | python | def removeidfobject(self, idfobject):
"""Remove an IDF object from the IDF.
Parameters
----------
idfobject : EpBunch object
The IDF object to remove.
"""
key = idfobject.key.upper()
self.idfobjects[key].remove(idfobject) | [
"def",
"removeidfobject",
"(",
"self",
",",
"idfobject",
")",
":",
"key",
"=",
"idfobject",
".",
"key",
".",
"upper",
"(",
")",
"self",
".",
"idfobjects",
"[",
"key",
"]",
".",
"remove",
"(",
"idfobject",
")"
] | Remove an IDF object from the IDF.
Parameters
----------
idfobject : EpBunch object
The IDF object to remove. | [
"Remove",
"an",
"IDF",
"object",
"from",
"the",
"IDF",
"."
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/modeleditor.py#L774-L784 | train |
santoshphilip/eppy | eppy/modeleditor.py | IDF.copyidfobject | def copyidfobject(self, idfobject):
"""Add an IDF object to the IDF.
Parameters
----------
idfobject : EpBunch object
The IDF object to remove. This usually comes from another idf file,
or it can be used to copy within this idf file.
"""
return a... | python | def copyidfobject(self, idfobject):
"""Add an IDF object to the IDF.
Parameters
----------
idfobject : EpBunch object
The IDF object to remove. This usually comes from another idf file,
or it can be used to copy within this idf file.
"""
return a... | [
"def",
"copyidfobject",
"(",
"self",
",",
"idfobject",
")",
":",
"return",
"addthisbunch",
"(",
"self",
".",
"idfobjects",
",",
"self",
".",
"model",
",",
"self",
".",
"idd_info",
",",
"idfobject",
",",
"self",
")"
] | Add an IDF object to the IDF.
Parameters
----------
idfobject : EpBunch object
The IDF object to remove. This usually comes from another idf file,
or it can be used to copy within this idf file. | [
"Add",
"an",
"IDF",
"object",
"to",
"the",
"IDF",
"."
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/modeleditor.py#L786-L799 | train |
santoshphilip/eppy | eppy/modeleditor.py | IDF.getextensibleindex | def getextensibleindex(self, key, name):
"""
Get the index of the first extensible item.
Only for internal use. # TODO : hide this
Parameters
----------
key : str
The type of IDF object. This must be in ALL_CAPS.
name : str
The name of th... | python | def getextensibleindex(self, key, name):
"""
Get the index of the first extensible item.
Only for internal use. # TODO : hide this
Parameters
----------
key : str
The type of IDF object. This must be in ALL_CAPS.
name : str
The name of th... | [
"def",
"getextensibleindex",
"(",
"self",
",",
"key",
",",
"name",
")",
":",
"return",
"getextensibleindex",
"(",
"self",
".",
"idfobjects",
",",
"self",
".",
"model",
",",
"self",
".",
"idd_info",
",",
"key",
",",
"name",
")"
] | Get the index of the first extensible item.
Only for internal use. # TODO : hide this
Parameters
----------
key : str
The type of IDF object. This must be in ALL_CAPS.
name : str
The name of the object to fetch.
Returns
-------
i... | [
"Get",
"the",
"index",
"of",
"the",
"first",
"extensible",
"item",
"."
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/modeleditor.py#L818-L838 | train |
santoshphilip/eppy | eppy/modeleditor.py | IDF.removeextensibles | def removeextensibles(self, key, name):
"""
Remove extensible items in the object of key and name.
Only for internal use. # TODO : hide this
Parameters
----------
key : str
The type of IDF object. This must be in ALL_CAPS.
name : str
The ... | python | def removeextensibles(self, key, name):
"""
Remove extensible items in the object of key and name.
Only for internal use. # TODO : hide this
Parameters
----------
key : str
The type of IDF object. This must be in ALL_CAPS.
name : str
The ... | [
"def",
"removeextensibles",
"(",
"self",
",",
"key",
",",
"name",
")",
":",
"return",
"removeextensibles",
"(",
"self",
".",
"idfobjects",
",",
"self",
".",
"model",
",",
"self",
".",
"idd_info",
",",
"key",
",",
"name",
")"
] | Remove extensible items in the object of key and name.
Only for internal use. # TODO : hide this
Parameters
----------
key : str
The type of IDF object. This must be in ALL_CAPS.
name : str
The name of the object to fetch.
Returns
------... | [
"Remove",
"extensible",
"items",
"in",
"the",
"object",
"of",
"key",
"and",
"name",
"."
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/modeleditor.py#L840-L860 | train |
santoshphilip/eppy | eppy/modeleditor.py | IDF.idfstr | def idfstr(self):
"""String representation of the IDF.
Returns
-------
str
"""
if self.outputtype == 'standard':
astr = ''
else:
astr = self.model.__repr__()
if self.outputtype == 'standard':
astr = ''
dtl... | python | def idfstr(self):
"""String representation of the IDF.
Returns
-------
str
"""
if self.outputtype == 'standard':
astr = ''
else:
astr = self.model.__repr__()
if self.outputtype == 'standard':
astr = ''
dtl... | [
"def",
"idfstr",
"(",
"self",
")",
":",
"if",
"self",
".",
"outputtype",
"==",
"'standard'",
":",
"astr",
"=",
"''",
"else",
":",
"astr",
"=",
"self",
".",
"model",
".",
"__repr__",
"(",
")",
"if",
"self",
".",
"outputtype",
"==",
"'standard'",
":",
... | String representation of the IDF.
Returns
-------
str | [
"String",
"representation",
"of",
"the",
"IDF",
"."
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/modeleditor.py#L869-L905 | train |
santoshphilip/eppy | eppy/modeleditor.py | IDF.save | def save(self, filename=None, lineendings='default', encoding='latin-1'):
"""
Save the IDF as a text file with the optional filename passed, or with
the current idfname of the IDF.
Parameters
----------
filename : str, optional
Filepath to save the file. If N... | python | def save(self, filename=None, lineendings='default', encoding='latin-1'):
"""
Save the IDF as a text file with the optional filename passed, or with
the current idfname of the IDF.
Parameters
----------
filename : str, optional
Filepath to save the file. If N... | [
"def",
"save",
"(",
"self",
",",
"filename",
"=",
"None",
",",
"lineendings",
"=",
"'default'",
",",
"encoding",
"=",
"'latin-1'",
")",
":",
"if",
"filename",
"is",
"None",
":",
"filename",
"=",
"self",
".",
"idfname",
"s",
"=",
"self",
".",
"idfstr",
... | Save the IDF as a text file with the optional filename passed, or with
the current idfname of the IDF.
Parameters
----------
filename : str, optional
Filepath to save the file. If None then use the IDF.idfname
parameter. Also accepts a file handle.
linee... | [
"Save",
"the",
"IDF",
"as",
"a",
"text",
"file",
"with",
"the",
"optional",
"filename",
"passed",
"or",
"with",
"the",
"current",
"idfname",
"of",
"the",
"IDF",
"."
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/modeleditor.py#L907-L953 | train |
santoshphilip/eppy | eppy/modeleditor.py | IDF.saveas | def saveas(self, filename, lineendings='default', encoding='latin-1'):
""" Save the IDF as a text file with the filename passed.
Parameters
----------
filename : str
Filepath to to set the idfname attribute to and save the file as.
lineendings : str, optional
... | python | def saveas(self, filename, lineendings='default', encoding='latin-1'):
""" Save the IDF as a text file with the filename passed.
Parameters
----------
filename : str
Filepath to to set the idfname attribute to and save the file as.
lineendings : str, optional
... | [
"def",
"saveas",
"(",
"self",
",",
"filename",
",",
"lineendings",
"=",
"'default'",
",",
"encoding",
"=",
"'latin-1'",
")",
":",
"self",
".",
"idfname",
"=",
"filename",
"self",
".",
"save",
"(",
"filename",
",",
"lineendings",
",",
"encoding",
")"
] | Save the IDF as a text file with the filename passed.
Parameters
----------
filename : str
Filepath to to set the idfname attribute to and save the file as.
lineendings : str, optional
Line endings to use in the saved file. Options are 'default',
'wi... | [
"Save",
"the",
"IDF",
"as",
"a",
"text",
"file",
"with",
"the",
"filename",
"passed",
"."
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/modeleditor.py#L955-L974 | train |
santoshphilip/eppy | eppy/modeleditor.py | IDF.savecopy | def savecopy(self, filename, lineendings='default', encoding='latin-1'):
"""Save a copy of the file with the filename passed.
Parameters
----------
filename : str
Filepath to save the file.
lineendings : str, optional
Line endings to use in the saved fil... | python | def savecopy(self, filename, lineendings='default', encoding='latin-1'):
"""Save a copy of the file with the filename passed.
Parameters
----------
filename : str
Filepath to save the file.
lineendings : str, optional
Line endings to use in the saved fil... | [
"def",
"savecopy",
"(",
"self",
",",
"filename",
",",
"lineendings",
"=",
"'default'",
",",
"encoding",
"=",
"'latin-1'",
")",
":",
"self",
".",
"save",
"(",
"filename",
",",
"lineendings",
",",
"encoding",
")"
] | Save a copy of the file with the filename passed.
Parameters
----------
filename : str
Filepath to save the file.
lineendings : str, optional
Line endings to use in the saved file. Options are 'default',
'windows' and 'unix' the default is 'default' ... | [
"Save",
"a",
"copy",
"of",
"the",
"file",
"with",
"the",
"filename",
"passed",
"."
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/modeleditor.py#L976-L994 | train |
santoshphilip/eppy | eppy/modeleditor.py | IDF.run | def run(self, **kwargs):
"""
Run an IDF file with a given EnergyPlus weather file. This is a
wrapper for the EnergyPlus command line interface.
Parameters
----------
**kwargs
See eppy.runner.functions.run()
"""
# write the IDF to the current ... | python | def run(self, **kwargs):
"""
Run an IDF file with a given EnergyPlus weather file. This is a
wrapper for the EnergyPlus command line interface.
Parameters
----------
**kwargs
See eppy.runner.functions.run()
"""
# write the IDF to the current ... | [
"def",
"run",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"# write the IDF to the current directory",
"self",
".",
"saveas",
"(",
"'in.idf'",
")",
"# if `idd` is not passed explicitly, use the IDF.iddname",
"idd",
"=",
"kwargs",
".",
"pop",
"(",
"'idd'",
",",
... | Run an IDF file with a given EnergyPlus weather file. This is a
wrapper for the EnergyPlus command line interface.
Parameters
----------
**kwargs
See eppy.runner.functions.run() | [
"Run",
"an",
"IDF",
"file",
"with",
"a",
"given",
"EnergyPlus",
"weather",
"file",
".",
"This",
"is",
"a",
"wrapper",
"for",
"the",
"EnergyPlus",
"command",
"line",
"interface",
"."
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/modeleditor.py#L997-L1016 | train |
santoshphilip/eppy | eppy/EPlusInterfaceFunctions/mylib2.py | readfile | def readfile(filename):
"""readfile"""
fhandle = open(filename, 'rb')
data = fhandle.read()
try:
data = data.decode('ISO-8859-2')
except AttributeError:
pass
fhandle.close()
return data | python | def readfile(filename):
"""readfile"""
fhandle = open(filename, 'rb')
data = fhandle.read()
try:
data = data.decode('ISO-8859-2')
except AttributeError:
pass
fhandle.close()
return data | [
"def",
"readfile",
"(",
"filename",
")",
":",
"fhandle",
"=",
"open",
"(",
"filename",
",",
"'rb'",
")",
"data",
"=",
"fhandle",
".",
"read",
"(",
")",
"try",
":",
"data",
"=",
"data",
".",
"decode",
"(",
"'ISO-8859-2'",
")",
"except",
"AttributeError"... | readfile | [
"readfile"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/mylib2.py#L22-L31 | train |
santoshphilip/eppy | eppy/EPlusInterfaceFunctions/mylib2.py | printdict | def printdict(adict):
"""printdict"""
dlist = list(adict.keys())
dlist.sort()
for i in range(0, len(dlist)):
print(dlist[i], adict[dlist[i]]) | python | def printdict(adict):
"""printdict"""
dlist = list(adict.keys())
dlist.sort()
for i in range(0, len(dlist)):
print(dlist[i], adict[dlist[i]]) | [
"def",
"printdict",
"(",
"adict",
")",
":",
"dlist",
"=",
"list",
"(",
"adict",
".",
"keys",
"(",
")",
")",
"dlist",
".",
"sort",
"(",
")",
"for",
"i",
"in",
"range",
"(",
"0",
",",
"len",
"(",
"dlist",
")",
")",
":",
"print",
"(",
"dlist",
"... | printdict | [
"printdict"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/mylib2.py#L38-L43 | train |
santoshphilip/eppy | eppy/EPlusInterfaceFunctions/mylib2.py | tabfile2list | def tabfile2list(fname):
"tabfile2list"
#dat = mylib1.readfileasmac(fname)
#data = string.strip(dat)
data = mylib1.readfileasmac(fname)
#data = data[:-2]#remove the last return
alist = data.split('\r')#since I read it as a mac file
blist = alist[1].split('\t')
clist = []
for num in ... | python | def tabfile2list(fname):
"tabfile2list"
#dat = mylib1.readfileasmac(fname)
#data = string.strip(dat)
data = mylib1.readfileasmac(fname)
#data = data[:-2]#remove the last return
alist = data.split('\r')#since I read it as a mac file
blist = alist[1].split('\t')
clist = []
for num in ... | [
"def",
"tabfile2list",
"(",
"fname",
")",
":",
"#dat = mylib1.readfileasmac(fname)",
"#data = string.strip(dat)",
"data",
"=",
"mylib1",
".",
"readfileasmac",
"(",
"fname",
")",
"#data = data[:-2]#remove the last return",
"alist",
"=",
"data",
".",
"split",
"(",
"'\\r'"... | tabfile2list | [
"tabfile2list"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/mylib2.py#L45-L59 | train |
santoshphilip/eppy | eppy/EPlusInterfaceFunctions/mylib2.py | tabstr2list | def tabstr2list(data):
"""tabstr2list"""
alist = data.split(os.linesep)
blist = alist[1].split('\t')
clist = []
for num in range(0, len(alist)):
ilist = alist[num].split('\t')
clist = clist+[ilist]
cclist = clist[:-1]
#the last element is turning out to be empty
#thi... | python | def tabstr2list(data):
"""tabstr2list"""
alist = data.split(os.linesep)
blist = alist[1].split('\t')
clist = []
for num in range(0, len(alist)):
ilist = alist[num].split('\t')
clist = clist+[ilist]
cclist = clist[:-1]
#the last element is turning out to be empty
#thi... | [
"def",
"tabstr2list",
"(",
"data",
")",
":",
"alist",
"=",
"data",
".",
"split",
"(",
"os",
".",
"linesep",
")",
"blist",
"=",
"alist",
"[",
"1",
"]",
".",
"split",
"(",
"'\\t'",
")",
"clist",
"=",
"[",
"]",
"for",
"num",
"in",
"range",
"(",
"0... | tabstr2list | [
"tabstr2list"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/mylib2.py#L61-L73 | train |
santoshphilip/eppy | eppy/EPlusInterfaceFunctions/mylib2.py | list2doe | def list2doe(alist):
"""list2doe"""
theequal = ''
astr = ''
lenj = len(alist)
leni = len(alist[0])
for i in range(0, leni-1):
for j in range(0, lenj):
if j == 0:
astr = astr + alist[j][i + 1] + theequal + alist[j][0] + RET
else:
ast... | python | def list2doe(alist):
"""list2doe"""
theequal = ''
astr = ''
lenj = len(alist)
leni = len(alist[0])
for i in range(0, leni-1):
for j in range(0, lenj):
if j == 0:
astr = astr + alist[j][i + 1] + theequal + alist[j][0] + RET
else:
ast... | [
"def",
"list2doe",
"(",
"alist",
")",
":",
"theequal",
"=",
"''",
"astr",
"=",
"''",
"lenj",
"=",
"len",
"(",
"alist",
")",
"leni",
"=",
"len",
"(",
"alist",
"[",
"0",
"]",
")",
"for",
"i",
"in",
"range",
"(",
"0",
",",
"leni",
"-",
"1",
")",... | list2doe | [
"list2doe"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/mylib2.py#L75-L88 | train |
santoshphilip/eppy | eppy/EPlusInterfaceFunctions/mylib2.py | tabfile2doefile | def tabfile2doefile(tabfile, doefile):
"""tabfile2doefile"""
alist = tabfile2list(tabfile)
astr = list2doe(alist)
mylib1.write_str2file(doefile, astr) | python | def tabfile2doefile(tabfile, doefile):
"""tabfile2doefile"""
alist = tabfile2list(tabfile)
astr = list2doe(alist)
mylib1.write_str2file(doefile, astr) | [
"def",
"tabfile2doefile",
"(",
"tabfile",
",",
"doefile",
")",
":",
"alist",
"=",
"tabfile2list",
"(",
"tabfile",
")",
"astr",
"=",
"list2doe",
"(",
"alist",
")",
"mylib1",
".",
"write_str2file",
"(",
"doefile",
",",
"astr",
")"
] | tabfile2doefile | [
"tabfile2doefile"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/mylib2.py#L90-L94 | train |
santoshphilip/eppy | eppy/EPlusInterfaceFunctions/mylib2.py | makedoedict | def makedoedict(str1):
"""makedoedict"""
blocklist = str1.split('..')
blocklist = blocklist[:-1]#remove empty item after last '..'
blockdict = {}
belongsdict = {}
for num in range(0, len(blocklist)):
blocklist[num] = blocklist[num].strip()
linelist = blocklist[num].split(os.lines... | python | def makedoedict(str1):
"""makedoedict"""
blocklist = str1.split('..')
blocklist = blocklist[:-1]#remove empty item after last '..'
blockdict = {}
belongsdict = {}
for num in range(0, len(blocklist)):
blocklist[num] = blocklist[num].strip()
linelist = blocklist[num].split(os.lines... | [
"def",
"makedoedict",
"(",
"str1",
")",
":",
"blocklist",
"=",
"str1",
".",
"split",
"(",
"'..'",
")",
"blocklist",
"=",
"blocklist",
"[",
":",
"-",
"1",
"]",
"#remove empty item after last '..'",
"blockdict",
"=",
"{",
"}",
"belongsdict",
"=",
"{",
"}",
... | makedoedict | [
"makedoedict"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/mylib2.py#L102-L121 | train |
santoshphilip/eppy | eppy/EPlusInterfaceFunctions/mylib2.py | makedoetree | def makedoetree(ddict, bdict):
"""makedoetree"""
dlist = list(ddict.keys())
blist = list(bdict.keys())
dlist.sort()
blist.sort()
#make space dict
doesnot = 'DOES NOT'
lst = []
for num in range(0, len(blist)):
if bdict[blist[num]] == doesnot:#belong
lst = lst + [bl... | python | def makedoetree(ddict, bdict):
"""makedoetree"""
dlist = list(ddict.keys())
blist = list(bdict.keys())
dlist.sort()
blist.sort()
#make space dict
doesnot = 'DOES NOT'
lst = []
for num in range(0, len(blist)):
if bdict[blist[num]] == doesnot:#belong
lst = lst + [bl... | [
"def",
"makedoetree",
"(",
"ddict",
",",
"bdict",
")",
":",
"dlist",
"=",
"list",
"(",
"ddict",
".",
"keys",
"(",
")",
")",
"blist",
"=",
"list",
"(",
"bdict",
".",
"keys",
"(",
")",
")",
"dlist",
".",
"sort",
"(",
")",
"blist",
".",
"sort",
"(... | makedoetree | [
"makedoetree"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/mylib2.py#L123-L173 | train |
santoshphilip/eppy | eppy/EPlusInterfaceFunctions/mylib2.py | tree2doe | def tree2doe(str1):
"""tree2doe"""
retstuff = makedoedict(str1)
ddict = makedoetree(retstuff[0], retstuff[1])
ddict = retstuff[0]
retstuff[1] = {}# don't need it anymore
str1 = ''#just re-using it
l1list = list(ddict.keys())
l1list.sort()
for i in range(0, len(l1list)):
str1... | python | def tree2doe(str1):
"""tree2doe"""
retstuff = makedoedict(str1)
ddict = makedoetree(retstuff[0], retstuff[1])
ddict = retstuff[0]
retstuff[1] = {}# don't need it anymore
str1 = ''#just re-using it
l1list = list(ddict.keys())
l1list.sort()
for i in range(0, len(l1list)):
str1... | [
"def",
"tree2doe",
"(",
"str1",
")",
":",
"retstuff",
"=",
"makedoedict",
"(",
"str1",
")",
"ddict",
"=",
"makedoetree",
"(",
"retstuff",
"[",
"0",
"]",
",",
"retstuff",
"[",
"1",
"]",
")",
"ddict",
"=",
"retstuff",
"[",
"0",
"]",
"retstuff",
"[",
... | tree2doe | [
"tree2doe"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/mylib2.py#L175-L195 | train |
santoshphilip/eppy | eppy/EPlusInterfaceFunctions/mylib2.py | mtabstr2doestr | def mtabstr2doestr(st1):
"""mtabstr2doestr"""
seperator = '$ =============='
alist = st1.split(seperator)
#this removes all the tabs that excel
#puts after the seperator and before the next line
for num in range(0, len(alist)):
alist[num] = alist[num].lstrip()
st2 = ''
for num i... | python | def mtabstr2doestr(st1):
"""mtabstr2doestr"""
seperator = '$ =============='
alist = st1.split(seperator)
#this removes all the tabs that excel
#puts after the seperator and before the next line
for num in range(0, len(alist)):
alist[num] = alist[num].lstrip()
st2 = ''
for num i... | [
"def",
"mtabstr2doestr",
"(",
"st1",
")",
":",
"seperator",
"=",
"'$ =============='",
"alist",
"=",
"st1",
".",
"split",
"(",
"seperator",
")",
"#this removes all the tabs that excel",
"#puts after the seperator and before the next line",
"for",
"num",
"in",
"range",
"... | mtabstr2doestr | [
"mtabstr2doestr"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/mylib2.py#L197-L219 | train |
santoshphilip/eppy | eppy/EPlusInterfaceFunctions/mylib2.py | getoneblock | def getoneblock(astr, start, end):
"""get the block bounded by start and end
doesn't work for multiple blocks"""
alist = astr.split(start)
astr = alist[-1]
alist = astr.split(end)
astr = alist[0]
return astr | python | def getoneblock(astr, start, end):
"""get the block bounded by start and end
doesn't work for multiple blocks"""
alist = astr.split(start)
astr = alist[-1]
alist = astr.split(end)
astr = alist[0]
return astr | [
"def",
"getoneblock",
"(",
"astr",
",",
"start",
",",
"end",
")",
":",
"alist",
"=",
"astr",
".",
"split",
"(",
"start",
")",
"astr",
"=",
"alist",
"[",
"-",
"1",
"]",
"alist",
"=",
"astr",
".",
"split",
"(",
"end",
")",
"astr",
"=",
"alist",
"... | get the block bounded by start and end
doesn't work for multiple blocks | [
"get",
"the",
"block",
"bounded",
"by",
"start",
"and",
"end",
"doesn",
"t",
"work",
"for",
"multiple",
"blocks"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/mylib2.py#L221-L228 | train |
santoshphilip/eppy | eppy/EPlusInterfaceFunctions/mylib2.py | doestr2tabstr | def doestr2tabstr(astr, kword):
"""doestr2tabstr"""
alist = astr.split('..')
del astr
#strip junk put .. back
for num in range(0, len(alist)):
alist[num] = alist[num].strip()
alist[num] = alist[num] + os.linesep + '..' + os.linesep
alist.pop()
lblock = []
for num in rang... | python | def doestr2tabstr(astr, kword):
"""doestr2tabstr"""
alist = astr.split('..')
del astr
#strip junk put .. back
for num in range(0, len(alist)):
alist[num] = alist[num].strip()
alist[num] = alist[num] + os.linesep + '..' + os.linesep
alist.pop()
lblock = []
for num in rang... | [
"def",
"doestr2tabstr",
"(",
"astr",
",",
"kword",
")",
":",
"alist",
"=",
"astr",
".",
"split",
"(",
"'..'",
")",
"del",
"astr",
"#strip junk put .. back",
"for",
"num",
"in",
"range",
"(",
"0",
",",
"len",
"(",
"alist",
")",
")",
":",
"alist",
"[",... | doestr2tabstr | [
"doestr2tabstr"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/mylib2.py#L230-L294 | train |
santoshphilip/eppy | eppy/EPlusInterfaceFunctions/mylib2.py | myreplace | def myreplace(astr, thefind, thereplace):
"""in string astr replace all occurences of thefind with thereplace"""
alist = astr.split(thefind)
new_s = alist.split(thereplace)
return new_s | python | def myreplace(astr, thefind, thereplace):
"""in string astr replace all occurences of thefind with thereplace"""
alist = astr.split(thefind)
new_s = alist.split(thereplace)
return new_s | [
"def",
"myreplace",
"(",
"astr",
",",
"thefind",
",",
"thereplace",
")",
":",
"alist",
"=",
"astr",
".",
"split",
"(",
"thefind",
")",
"new_s",
"=",
"alist",
".",
"split",
"(",
"thereplace",
")",
"return",
"new_s"
] | in string astr replace all occurences of thefind with thereplace | [
"in",
"string",
"astr",
"replace",
"all",
"occurences",
"of",
"thefind",
"with",
"thereplace"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/mylib2.py#L296-L300 | train |
santoshphilip/eppy | eppy/EPlusInterfaceFunctions/mylib2.py | fsliceafter | def fsliceafter(astr, sub):
"""Return the slice after at sub in string astr"""
findex = astr.find(sub)
return astr[findex + len(sub):] | python | def fsliceafter(astr, sub):
"""Return the slice after at sub in string astr"""
findex = astr.find(sub)
return astr[findex + len(sub):] | [
"def",
"fsliceafter",
"(",
"astr",
",",
"sub",
")",
":",
"findex",
"=",
"astr",
".",
"find",
"(",
"sub",
")",
"return",
"astr",
"[",
"findex",
"+",
"len",
"(",
"sub",
")",
":",
"]"
] | Return the slice after at sub in string astr | [
"Return",
"the",
"slice",
"after",
"at",
"sub",
"in",
"string",
"astr"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/mylib2.py#L307-L310 | train |
santoshphilip/eppy | eppy/EPlusInterfaceFunctions/mylib2.py | pickledump | def pickledump(theobject, fname):
"""same as pickle.dump(theobject, fhandle).takes filename as parameter"""
fhandle = open(fname, 'wb')
pickle.dump(theobject, fhandle) | python | def pickledump(theobject, fname):
"""same as pickle.dump(theobject, fhandle).takes filename as parameter"""
fhandle = open(fname, 'wb')
pickle.dump(theobject, fhandle) | [
"def",
"pickledump",
"(",
"theobject",
",",
"fname",
")",
":",
"fhandle",
"=",
"open",
"(",
"fname",
",",
"'wb'",
")",
"pickle",
".",
"dump",
"(",
"theobject",
",",
"fhandle",
")"
] | same as pickle.dump(theobject, fhandle).takes filename as parameter | [
"same",
"as",
"pickle",
".",
"dump",
"(",
"theobject",
"fhandle",
")",
".",
"takes",
"filename",
"as",
"parameter"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/mylib2.py#L317-L320 | train |
santoshphilip/eppy | eppy/EPlusInterfaceFunctions/mylib1.py | write_str2file | def write_str2file(pathname, astr):
"""writes a string to file"""
fname = pathname
fhandle = open(fname, 'wb')
fhandle.write(astr)
fhandle.close() | python | def write_str2file(pathname, astr):
"""writes a string to file"""
fname = pathname
fhandle = open(fname, 'wb')
fhandle.write(astr)
fhandle.close() | [
"def",
"write_str2file",
"(",
"pathname",
",",
"astr",
")",
":",
"fname",
"=",
"pathname",
"fhandle",
"=",
"open",
"(",
"fname",
",",
"'wb'",
")",
"fhandle",
".",
"write",
"(",
"astr",
")",
"fhandle",
".",
"close",
"(",
")"
] | writes a string to file | [
"writes",
"a",
"string",
"to",
"file"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/mylib1.py#L14-L19 | train |
santoshphilip/eppy | eppy/geometry/int2lines.py | vol_tehrahedron | def vol_tehrahedron(poly):
"""volume of a irregular tetrahedron"""
a_pnt = np.array(poly[0])
b_pnt = np.array(poly[1])
c_pnt = np.array(poly[2])
d_pnt = np.array(poly[3])
return abs(np.dot(
(a_pnt-d_pnt), np.cross((b_pnt-d_pnt), (c_pnt-d_pnt))) / 6) | python | def vol_tehrahedron(poly):
"""volume of a irregular tetrahedron"""
a_pnt = np.array(poly[0])
b_pnt = np.array(poly[1])
c_pnt = np.array(poly[2])
d_pnt = np.array(poly[3])
return abs(np.dot(
(a_pnt-d_pnt), np.cross((b_pnt-d_pnt), (c_pnt-d_pnt))) / 6) | [
"def",
"vol_tehrahedron",
"(",
"poly",
")",
":",
"a_pnt",
"=",
"np",
".",
"array",
"(",
"poly",
"[",
"0",
"]",
")",
"b_pnt",
"=",
"np",
".",
"array",
"(",
"poly",
"[",
"1",
"]",
")",
"c_pnt",
"=",
"np",
".",
"array",
"(",
"poly",
"[",
"2",
"]... | volume of a irregular tetrahedron | [
"volume",
"of",
"a",
"irregular",
"tetrahedron"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/geometry/int2lines.py#L22-L29 | train |
santoshphilip/eppy | eppy/geometry/int2lines.py | vol_zone | def vol_zone(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)
for i in range(num-2):
# the upper part
tehrahedron = [c_point, poly1[0], poly1[i+1],... | python | def vol_zone(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)
for i in range(num-2):
# the upper part
tehrahedron = [c_point, poly1[0], poly1[i+1],... | [
"def",
"vol_zone",
"(",
"poly1",
",",
"poly2",
")",
":",
"c_point",
"=",
"central_p",
"(",
"poly1",
",",
"poly2",
")",
"c_point",
"=",
"(",
"c_point",
"[",
"0",
"]",
",",
"c_point",
"[",
"1",
"]",
",",
"c_point",
"[",
"2",
"]",
")",
"vol_therah",
... | volume of a zone defined by two polygon bases | [
"volume",
"of",
"a",
"zone",
"defined",
"by",
"two",
"polygon",
"bases"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/geometry/int2lines.py#L43-L66 | train |
santoshphilip/eppy | eppy/__init__.py | newidf | def newidf(version=None):
"""open a new idf file
easy way to open a new idf file for particular version. Works only id Energyplus of that version is installed.
Parameters
----------
version: string
version of the new file you want to create. Will work only if this version of Energ... | python | def newidf(version=None):
"""open a new idf file
easy way to open a new idf file for particular version. Works only id Energyplus of that version is installed.
Parameters
----------
version: string
version of the new file you want to create. Will work only if this version of Energ... | [
"def",
"newidf",
"(",
"version",
"=",
"None",
")",
":",
"# noqa: E501",
"if",
"not",
"version",
":",
"version",
"=",
"\"8.9\"",
"import",
"eppy",
".",
"easyopen",
"as",
"easyopen",
"idfstring",
"=",
"\" Version,{};\"",
".",
"format",
"(",
"str",
"(",
"ver... | open a new idf file
easy way to open a new idf file for particular version. Works only id Energyplus of that version is installed.
Parameters
----------
version: string
version of the new file you want to create. Will work only if this version of Energyplus has been installed.
R... | [
"open",
"a",
"new",
"idf",
"file",
"easy",
"way",
"to",
"open",
"a",
"new",
"idf",
"file",
"for",
"particular",
"version",
".",
"Works",
"only",
"id",
"Energyplus",
"of",
"that",
"version",
"is",
"installed",
".",
"Parameters",
"----------",
"version",
":"... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/__init__.py#L25-L45 | train |
santoshphilip/eppy | eppy/__init__.py | openidf | def openidf(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 openidf(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",
"openidf",
"(",
"fname",
",",
"idd",
"=",
"None",
",",
"epw",
"=",
"None",
")",
":",
"import",
"eppy",
".",
"easyopen",
"as",
"easyopen",
"return",
"easyopen",
".",
"easyopen",
"(",
"fname",
",",
"idd",
"=",
"idd",
",",
"epw",
"=",
"epw",
")... | automatically set idd and open idf file. Uses version from idf to set correct idd
It will work under the following circumstances:
- the IDF file should have the VERSION object.
- Needs the version of EnergyPlus installed that matches the IDF version.
- Energyplus should be installed in the default... | [
"automatically",
"set",
"idd",
"and",
"open",
"idf",
"file",
".",
"Uses",
"version",
"from",
"idf",
"to",
"set",
"correct",
"idd",
"It",
"will",
"work",
"under",
"the",
"following",
"circumstances",
":",
"-",
"the",
"IDF",
"file",
"should",
"have",
"the",
... | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/__init__.py#L47-L70 | train |
santoshphilip/eppy | eppy/simplesurface.py | wallinterzone | def wallinterzone(idf, bsdobject, deletebsd=True, setto000=False):
"""return an wall:interzone object if the bsd (buildingsurface:detailed)
is an interaone wall"""
# ('WALL:INTERZONE', Wall, Surface OR Zone OR OtherSideCoefficients)
# test if it is an exterior wall
if bsdobject.Surface_Type.upper()... | python | def wallinterzone(idf, bsdobject, deletebsd=True, setto000=False):
"""return an wall:interzone object if the bsd (buildingsurface:detailed)
is an interaone wall"""
# ('WALL:INTERZONE', Wall, Surface OR Zone OR OtherSideCoefficients)
# test if it is an exterior wall
if bsdobject.Surface_Type.upper()... | [
"def",
"wallinterzone",
"(",
"idf",
",",
"bsdobject",
",",
"deletebsd",
"=",
"True",
",",
"setto000",
"=",
"False",
")",
":",
"# ('WALL:INTERZONE', Wall, Surface OR Zone OR OtherSideCoefficients)",
"# test if it is an exterior wall",
"if",
"bsdobject",
".",
"Surface_Type",
... | return an wall:interzone object if the bsd (buildingsurface:detailed)
is an interaone wall | [
"return",
"an",
"wall",
":",
"interzone",
"object",
"if",
"the",
"bsd",
"(",
"buildingsurface",
":",
"detailed",
")",
"is",
"an",
"interaone",
"wall"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/simplesurface.py#L168-L192 | train |
santoshphilip/eppy | eppy/simplesurface.py | door | def door(idf, fsdobject, deletebsd=True, setto000=False):
"""return an door object if the fsd (fenestrationsurface:detailed) is
a door"""
# ('DOOR', Door, None)
# test if it is aroof
if fsdobject.Surface_Type.upper() == 'DOOR': # Surface_Type == w
simpleobject = idf.newidfobject('DOOR')
... | python | def door(idf, fsdobject, deletebsd=True, setto000=False):
"""return an door object if the fsd (fenestrationsurface:detailed) is
a door"""
# ('DOOR', Door, None)
# test if it is aroof
if fsdobject.Surface_Type.upper() == 'DOOR': # Surface_Type == w
simpleobject = idf.newidfobject('DOOR')
... | [
"def",
"door",
"(",
"idf",
",",
"fsdobject",
",",
"deletebsd",
"=",
"True",
",",
"setto000",
"=",
"False",
")",
":",
"# ('DOOR', Door, None)",
"# test if it is aroof",
"if",
"fsdobject",
".",
"Surface_Type",
".",
"upper",
"(",
")",
"==",
"'DOOR'",
":",
"# Su... | return an door object if the fsd (fenestrationsurface:detailed) is
a door | [
"return",
"an",
"door",
"object",
"if",
"the",
"fsd",
"(",
"fenestrationsurface",
":",
"detailed",
")",
"is",
"a",
"door"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/simplesurface.py#L365-L384 | train |
santoshphilip/eppy | eppy/simplesurface.py | simplesurface | def simplesurface(idf, bsd, deletebsd=True, setto000=False):
"""convert a bsd (buildingsurface:detailed) into a simple surface"""
funcs = (wallexterior,
walladiabatic,
wallunderground,
wallinterzone,
roof,
ceilingadiabatic,
ceilinginterzone,
floorgroundcon... | python | def simplesurface(idf, bsd, deletebsd=True, setto000=False):
"""convert a bsd (buildingsurface:detailed) into a simple surface"""
funcs = (wallexterior,
walladiabatic,
wallunderground,
wallinterzone,
roof,
ceilingadiabatic,
ceilinginterzone,
floorgroundcon... | [
"def",
"simplesurface",
"(",
"idf",
",",
"bsd",
",",
"deletebsd",
"=",
"True",
",",
"setto000",
"=",
"False",
")",
":",
"funcs",
"=",
"(",
"wallexterior",
",",
"walladiabatic",
",",
"wallunderground",
",",
"wallinterzone",
",",
"roof",
",",
"ceilingadiabatic... | convert a bsd (buildingsurface:detailed) into a simple surface | [
"convert",
"a",
"bsd",
"(",
"buildingsurface",
":",
"detailed",
")",
"into",
"a",
"simple",
"surface"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/simplesurface.py#L409-L425 | train |
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"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/simplesurface.py#L427-L437 | train |
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",
")"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/results/readhtml.py#L24-L33 | train |
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"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/results/readhtml.py#L35-L47 | train |
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"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/results/readhtml.py#L49-L64 | train |
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"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/results/readhtml.py#L66-L87 | train |
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",
")",
".....",
"]"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/results/readhtml.py#L90-L109 | train |
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"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/results/readhtml.py#L111-L120 | train |
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",
")",
".....",
"]"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/results/readhtml.py#L122-L162 | train |
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"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/results/readhtml.py#L179-L199 | train |
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"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/bunchhelpers.py#L16-L19 | train |
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"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/bunchhelpers.py#L27-L43 | train |
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"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/bunchhelpers.py#L45-L53 | train |
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"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/bunchhelpers.py#L55-L64 | train |
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"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/bunchhelpers.py#L66-L75 | train |
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"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/useful_scripts/idfdiff.py#L71-L95 | train |
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"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/useful_scripts/idfdiff.py#L98-L135 | train |
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"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/useful_scripts/idfdiff.py#L137-L140 | train |
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"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/useful_scripts/idfdiff.py#L142-L149 | train |
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"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/useful_scripts/idfdiff.py#L151-L158 | train |
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"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/useful_scripts/idfdiff.py#L161-L181 | train |
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"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/bunch_subclass.py#L56-L61 | train |
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"
] | 55410ff7c11722f35bc4331ff5e00a0b86f787e1 | https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/bunch_subclass.py#L69-L171 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.