本文整理汇总了Python中rmtoo.lib.configuration.Cfg.Cfg.get_rvalue方法的典型用法代码示例。如果您正苦于以下问题:Python Cfg.get_rvalue方法的具体用法?Python Cfg.get_rvalue怎么用?Python Cfg.get_rvalue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rmtoo.lib.configuration.Cfg.Cfg
的用法示例。
在下文中一共展示了Cfg.get_rvalue方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from rmtoo.lib.configuration.Cfg import Cfg [as 别名]
# 或者: from rmtoo.lib.configuration.Cfg.Cfg import get_rvalue [as 别名]
def __init__(self, config):
cfg = Cfg(config)
Interface.__init__(self, cfg)
tracer.info("called")
self.__topic_root_node = cfg.get_rvalue("topic_root_node")
self.__dirs = {}
self.__setup_directories(cfg)
示例2: __init__
# 需要导入模块: from rmtoo.lib.configuration.Cfg import Cfg [as 别名]
# 或者: from rmtoo.lib.configuration.Cfg.Cfg import get_rvalue [as 别名]
def __init__(self, config):
tracer.info("called")
cfg = Cfg(config)
FileInterface.__init__(self, cfg)
self.__start_vers = cfg.get_rvalue("start_vers")
self.__end_vers = cfg.get_rvalue("end_vers")
self.__topic_root_node = cfg.get_rvalue("topic_root_node")
tracer.debug("start version [%s] end version [%s] "
"topic root node [%s]",
self.__start_vers, self.__end_vers,
self.__topic_root_node)
# When the directory is not absolute, convert it to an
# absolute path that it can be compared to the outcome of the
# git.Repo.
self.__dirs = {}
self.__repo_base_dir = None
self.__repo = None
self.__dirs = self._setup_directories(cfg)
示例3: html
# 需要导入模块: from rmtoo.lib.configuration.Cfg import Cfg [as 别名]
# 或者: from rmtoo.lib.configuration.Cfg.Cfg import get_rvalue [as 别名]
class html(ExecutorTopicContinuum, CreateMakeDependencies):
def __init__(self, oconfig):
'''Create a graph output object.'''
tracer.debug("Called: html ouput module constructed.")
self._config = Cfg(oconfig)
CreateMakeDependencies.__init__(self)
self.__fd_stack = []
self.__topic_name_set = []
# Take care about the openess of the ul.
self.__ul_open_stack = []
self.__output_directory = self._config.get_rvalue('output_directory')
self.html_header_filename = self._config.get_rvalue('header')
self.html_footer_filename = self._config.get_rvalue('footer')
self.read_html_arts()
def __ouput_html_topic_mkdirs(self):
'''If not already there, create the directory.'''
try:
os.makedirs(self.__output_directory)
except OSError, ose:
# It's ok if already there
pass
示例4: __init__
# 需要导入模块: from rmtoo.lib.configuration.Cfg import Cfg [as 别名]
# 或者: from rmtoo.lib.configuration.Cfg.Cfg import get_rvalue [as 别名]
class StdOutputParams:
'''Handles the standard output parameters and sets the values
in the self object provided.'''
def __init__(self, config):
'''Constructs the standard output parameters based on the
provided config.'''
self._output_filename = None
self._start_date = None
self._end_date = None
self._config = Cfg(config)
self.__parse()
def __parse_output_filename(self):
'''Sets the output filename.'''
self._output_filename = self._config.get_rvalue('output_filename')
@staticmethod
def __parse_date(cfg, name, default_value):
'''If name is in params, the value is converted to a date
and returned. If name is not in params, the default_value
is returned.'''
pname = cfg.get_value_wo_throw(name)
if pname == None:
return default_value
return parse_date(name, pname)
def __parse_start_and_end_date(self):
'''Extracts the start and the end date from the params.'''
today = datetime.date.today()
yesterday = today - datetime.timedelta(1)
self._start_date = self.__parse_date(
self._config, 'start_date', yesterday)
tracer.debug("Start date [%s]" % self._start_date)
self._end_date = self.__parse_date(self._config, 'end_date', today)
tracer.debug("End date [%s]" % self._end_date)
def __parse(self):
'''Parses the standard parameters.'''
self.__parse_output_filename()
self.__parse_start_and_end_date()
示例5: Html
# 需要导入模块: from rmtoo.lib.configuration.Cfg import Cfg [as 别名]
# 或者: from rmtoo.lib.configuration.Cfg.Cfg import get_rvalue [as 别名]
class Html(ExecutorTopicContinuum, CreateMakeDependencies):
"""HTML output module"""
def __init__(self, oconfig):
'''Create a graph output object.'''
tracer.debug("Called: html ouput module constructed.")
self._config = Cfg(oconfig)
CreateMakeDependencies.__init__(self)
self.__fd_stack = []
self.__topic_name_set = []
# Take care about the openess of the ul.
self.__ul_open_stack = []
self.__output_directory = self._config.get_rvalue('output_directory')
self.__markup = Markup("html")
self.__tc_name = None
self.__topic_set = None
self.html_header_filename = self._config.get_rvalue('header')
self.html_footer_filename = self._config.get_rvalue('footer')
self.read_html_arts()
def __ouput_html_topic_mkdirs(self):
'''If not already there, create the directory.'''
try:
os.makedirs(self.__output_directory)
except OSError:
# It's ok if already there
pass
def topic_continuum_sort(self, vcs_commit_ids, topic_sets):
'''Because graph2 can only one topic continuum,
the latest (newest) is used.'''
return [topic_sets[vcs_commit_ids[-1].get_commit()]]
def topic_set_pre(self, _topics_set):
'''Do all the file and directory preparation.'''
self.__ouput_html_topic_mkdirs()
def __output_html_topic_write_header(self, out_fd):
'''Write the html header.'''
out_fd.write(self.html_header)
def topic_pre(self, topic):
'''Output one topic.
This method is called once for each topic and subtopic.'''
tracer.debug("Called: topic name [%s]", topic.name)
filename = os.path.join(self.__output_directory, topic.name + ".html")
out_fd = io.open(filename, "w", encoding="utf-8")
self.__output_html_topic_write_header(out_fd)
self.__fd_stack.append(out_fd)
self.__ul_open_stack.append(False)
# self.output_html_topic_output_content(fd, topic)
def topic_post(self, topic):
'''Write out the footer and do clean ups.'''
out_fd = self.__fd_stack.pop()
self.__ul_open_stack.pop()
self.output_html_topic_write_footer(out_fd)
out_fd.close()
tracer.debug("Finished: topic name [%s]", topic.name)
def topic_name(self, name):
'''Set the name.'''
out_fd = self.__fd_stack[-1]
level = len(self.__fd_stack)
out_fd.write(u"<h%d>%s</h%d>\n" % (level, name, level))
def topic_text(self, text):
'''Called when there is text to be outputted.'''
out_fd = self.__fd_stack[-1]
out_fd.write(u'<p><span class="fltext">%s</span></p>\n'
% self.__markup.replace(text))
def topic_sub_pre(self, subtopic):
'''Prepares a new subtopic output.'''
out_fd = self.__fd_stack[-1]
if not self.__ul_open_stack[-1]:
out_fd.write(u'<span class="subtopiclist"><ul>')
self.__ul_open_stack[-1] = True
out_fd.write(u'<li><a href="%s.html">%s</a></li>\n' %
(subtopic.get_id(), subtopic.get_topic_name()))
def topic_sub_post(self, _subtopic):
'''Write the header for subtopic.'''
if self.__ul_open_stack[-1]:
out_fd = self.__fd_stack[-1]
out_fd.write(u"</ul></span>")
self.__ul_open_stack[-1] = False
def requirement_set_sort(self, list_to_sort):
'''Sort by id.'''
return sorted(list_to_sort, key=lambda r: r.get_id())
def requirement(self, req):
'''Output one requirement.'''
out_fd = self.__fd_stack[-1]
level = len(self.__fd_stack)
out_fd.write(u"\n<!-- REQ '%s' -->\n" % req.get_id())
out_fd.write(u'<h%d><a id="%s">%s</a></h%d>\n' %
(level + 1, req.get_id(),
#.........这里部分代码省略.........