本文整理汇总了Python中common.Common.dump_mld_files方法的典型用法代码示例。如果您正苦于以下问题:Python Common.dump_mld_files方法的具体用法?Python Common.dump_mld_files怎么用?Python Common.dump_mld_files使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common.Common
的用法示例。
在下文中一共展示了Common.dump_mld_files方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from common import Common [as 别名]
# 或者: from common.Common import dump_mld_files [as 别名]
def main():
try:
params = parsed_arguments()
common = Common(params)
clauses = common.load_input_file()
if params["restore"]:
import shutil
shutil.copyfile(os.path.join(params["script_directory"], "pristine_sandbox.mcd"), "sandbox.mcd")
return open("params.json", "w").write("{}")
if params["print_params"]:
import json
for added_key in params["added_keys"][:]:
del params[added_key]
params["print_params"] = False
params_contents = json.dumps(params, ensure_ascii=False, indent=2, sort_keys=True)
return safe_print_for_PHP(params_contents)
if params["obfuscate"]:
from obfuscate import obfuscate
return safe_print_for_PHP(obfuscate(clauses, params))
mcd = Mcd(clauses, params)
if params["flip"]:
return safe_print_for_PHP(
{
"v": mcd.get_clauses_vertical_mirror,
"h": mcd.get_clauses_horizontal_mirror,
"d": mcd.get_clauses_diagonal_mirror,
}[params["flip"]]()
)
if params["arrange"]:
params.update(mcd.get_layout_data())
if params["arrange"] == "ga":
from arrange_ga import arrange
elif params["arrange"] == "bb":
from arrange_bb import arrange
result = arrange(**params)
if result:
return safe_print_for_PHP(mcd.get_clauses_from_layout(**result))
raise RuntimeError(("Mocodo Err.9 - " + _("Failed to calculate a planar layout.")).encode("utf8"))
relations = Relations(mcd, params)
common.dump_mld_files(relations)
if params["image_format"] == "svg":
from mcd_to_svg import main
import runpy
main(mcd, common)
runpy.run_path(u"%(output_name)s_svg.py" % params)
return
if params["image_format"] == "nodebox":
from mcd_to_nodebox import main
main(mcd, common)
return os.system(u"""open -a NodeBox "%(output_name)s_nodebox.py" """ % params)
raise RuntimeError(("Mocodo Err.13 - " + _("Should never happen.")).encode("utf8"))
except RuntimeError, err:
msg = str(err)
if msg.startswith("Mocodo Err."):
print >> sys.stderr, msg
else:
raise