commonutil.filetimetag

基於檔案的時戳衍生 / Time-stamp from file attributes

class FileTimeBuilder(filetime_rule, min_period, base_offset, label_offset, *args, **kwds)[source]

利用檔案修改時間產生 TimeTag / Build time-tag with file modification time

build(current_filepath, *args, **kwds)[source]

依據設定值取出 TimeTag / Build time tag according to configuration

Parameters:- 目前檔案路徑 (current_filepath) –
Returns:表示 TimeTag 的 datetime.datetime 物件 / Result datetime.datetime object representing time-tag
class NoopBuilder[source]

總是傳回預設的 TimeTag / Always result in default time-tag

build(current_filepath, filename_regxmobj, pathname_regxmobj, *args, **kwds)[source]

依據設定值取出 TimeTag / Build time tag according to configuration

Parameters:
  • - 目前檔案路徑 (current_filepath) –
  • filename_regxmobj – 比對狀況物件,檔案部份 (re.MatchObject) / Match object of file name
  • pathname_regxmobj – 比對狀況物件,路徑部份 (re.MatchObject) / Match object of path (folder) name
Returns:

表示 TimeTag 的 datetime.datetime 物件 / Result datetime.datetime object representing time-tag

class PathTagBuilder(year_4d_rule=None, year_2d_rule=None, month_rule=None, day_rule=None, hour_rule=None, minute_rule=None, second_rule=None, baseoffset_sec=None, labeloffset_sec=None, period_sec=None, timezone_feedback=False, *args, **kwds)[source]

基於 Path Tag 產生 TimeTag / Build time-tag based on path-tag

build(current_filepath, filename_regxmobj, pathname_regxmobj, *args, **kwds)[source]

依據設定值取出 TimeTag / Build time tag according to configuration

Parameters:
  • - 目前檔案路徑 (current_filepath) –
  • filename_regxmobj – 比對狀況物件,檔案部份 (re.MatchObject) / Match object of file name
  • pathname_regxmobj – 比對狀況物件,路徑部份 (re.MatchObject) / Match object of path (folder) name
Returns:

表示 TimeTag 的 datetime.datetime 物件 / Result datetime.datetime object representing time-tag

parse_build_rule(cmap)[source]

解析建立 Time-tag 的規則

Parse time-tag build rule from dictionary

Parameters:cmap – dict object contains build rule configuration
Returns:從檔案屬性建立 Time-tag 的 Builder 物件 / Object to build time-tag from file attributes