本文整理匯總了Python中fmt_template.Formatter.__init__方法的典型用法代碼示例。如果您正苦於以下問題:Python Formatter.__init__方法的具體用法?Python Formatter.__init__怎麽用?Python Formatter.__init__使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類fmt_template.Formatter
的用法示例。
在下文中一共展示了Formatter.__init__方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: from fmt_template import Formatter [as 別名]
# 或者: from fmt_template.Formatter import __init__ [as 別名]
def __init__ (self, out, template, time_control_default):
Formatter.__init__(self, out, template)
self.current_item = None
self.time_control_default = time_control_default
# Start and due dates are formated differently for all day tasks, need different types
template.attrib_map_builder.type_fns['ics.date_due'] = lambda x: format_date(self.current_item, x, True)
template.attrib_map_builder.type_fns['ics.date_to_start'] = lambda x: format_date(self.current_item, x, False)
template.attrib_map_builder.type_fns['ics.note'] = lambda x: '\\r'.join(x.get_note_lines ())
示例2: __init__
# 需要導入模塊: from fmt_template import Formatter [as 別名]
# 或者: from fmt_template.Formatter import __init__ [as 別名]
def __init__ (self, out, template):
attrib_conversions = {
'name' : lambda x: remove_trailing_colon(x),
'link' : lambda x: x,
'status' : lambda x: x,
'flagged' : lambda x: str(x) if x else None,
'context' : lambda x: strip_brackets(''.join (x.name.split ())),
'project' : lambda x: strip_brackets(''.join (x.name.split ())),
'date_to_start' : lambda x: x.strftime(template.date_format),
'date_due' : lambda x: x.strftime(template.date_format),
'date_completed' : lambda x: x.strftime(template.date_format),
'note' : lambda x: ''.join([line+'\n' for line in x.get_note_lines ()])
}
Formatter.__init__(self, out, template, attrib_conversions=attrib_conversions)
示例3: __init__
# 需要導入模塊: from fmt_template import Formatter [as 別名]
# 或者: from fmt_template.Formatter import __init__ [as 別名]
def __init__ (self, out, template):
attrib_conversions = {
'id' : lambda x: escape(x),
'name' : lambda x: escape(x),
'link' : lambda x: x,
'status' : lambda x: x,
'flagged' : lambda x: str(x) if x else None,
'context' : lambda x: escape(''.join (x.name.split ())),
'project' : lambda x: escape(''.join (x.name.split ())),
'date_to_start' : lambda x: x.strftime(template.date_format),
'date_due' : lambda x: x.strftime(template.date_format),
'date_completed' : lambda x: x.strftime(template.date_format),
'note' : lambda x: format_note (x.get_note_lines ())
}
Formatter.__init__(self, out, template, attrib_conversions = attrib_conversions)
示例4: __init__
# 需要導入模塊: from fmt_template import Formatter [as 別名]
# 或者: from fmt_template.Formatter import __init__ [as 別名]
def __init__ (self, out, template):
self.current_item = None
attrib_conversions = {
'id' : lambda x: x,
'name' : lambda x: x,
'link' : lambda x: x,
'status' : lambda x: x,
'flagged' : lambda x: str(x) if x else None,
'context' : lambda x: x.name,
'project' : lambda x: x.name,
'date_to_start' : lambda x: format_date(self.current_item,x, False),
'date_due' : lambda x: format_date(self.current_item, x, True),
'date_completed' : lambda x: x.strftime(DATE_FORMAT_LONG),
'note' : lambda x: '\\r'.join(x.get_note_lines ())
}
Formatter.__init__(self, out, template, attrib_conversions = attrib_conversions)
示例5: __init__
# 需要導入模塊: from fmt_template import Formatter [as 別名]
# 或者: from fmt_template.Formatter import __init__ [as 別名]
def __init__ (self, out, template):
Formatter.__init__(self, out, template)
示例6: __init__
# 需要導入模塊: from fmt_template import Formatter [as 別名]
# 或者: from fmt_template.Formatter import __init__ [as 別名]
def __init__ (self, out, template):
Formatter.__init__(self, out, template)
self.header_depth = 0
self.depth = 0
self.out = out
self.last_line_was_text = False
示例7: __init__
# 需要導入模塊: from fmt_template import Formatter [as 別名]
# 或者: from fmt_template.Formatter import __init__ [as 別名]
def __init__ (self, out, template):
self.current_item = None
Formatter.__init__(self, out, template)
template.attrib_map_builder.type_fns['ics.date'] = lambda x: format_date(self.current_item, x, True)
template.attrib_map_builder.type_fns['ics.note'] = lambda x: '\\r'.join(x.get_note_lines ())