tagged_directory¶
外部参照用のモジュール
- class tagged_directory.TaggedDirectory(path: str | Path, *, json_filename: str = 'tagudu.json', result_directory_name: str = 'tagudu_result')[ソース]¶
ディレクトリ内のファイルに対してタグ管理するためのクラス
- path¶
対象ディレクトリのパス
- Type:
pathlib.Path
- json_path¶
jsonファイルのパス
- Type:
pathlib.Path
- result_path¶
フィルター結果フォルダのパス
- Type:
pathlib.Path
- data¶
タグのデータ。キーがファイル名で、値がタグのリスト
- Type:
dict[str, list[str]]
- count_tags(search_word: str = '') dict[str, int] [ソース]¶
タグ数を集計
- パラメータ:
search_word (str, optional) -- 検索ワード
- 戻り値:
集計結果
- 戻り値の型:
dict[str, int]
- filter_by_partial_tags(tags: list[str], *, file_operation: bool = True) list[str] [ソース]¶
部分一致のタグによりファイルを絞り込み
- パラメータ:
tags (list[str]) -- タグのリスト
file_operation (bool) -- 絞り込み結果を結果ディレクトリに反映させるか。初期値は「True」
- 戻り値:
絞り込み結果
- 戻り値の型:
list[str]
- filter_by_regular_expression(pattern: str, *, file_operation: bool = True) list[str] [ソース]¶
正規表現によりファイルを絞り込み
- パラメータ:
pattern (str) -- 正規表現
file_operation (bool) -- 絞り込み結果を結果ディレクトリに反映させるか。初期値は「True」
- 戻り値:
絞り込み結果
- 戻り値の型:
list[str]
- filter_by_tags(tags: list[str], *, mode: str = 'or', file_operation: bool = True) list[str] [ソース]¶
完全一致のタグによりファイルを絞り込み
- パラメータ:
tags (list[str]) -- タグのリスト
mode (str, optional) -- 絞り込みモード。「or」か「and」。初期値は「or」
file_operation (bool) -- 絞り込み結果を結果ディレクトリに反映させるか。初期値は「True」
- 戻り値:
絞り込み結果
- 戻り値の型:
list[str]
- get_nonexisting_file_list() list[str] [ソース]¶
タグが付けられているが実在しないファイルのリストを取得
- 戻り値:
ファイルのリスト
- 戻り値の型:
list[str]
- get_tag_list(filename: str) list[str] [ソース]¶
ファイルに設定されているタグのリストを取得
- パラメータ:
filename (str) -- ファイル名
- 戻り値:
タグのリスト
- 戻り値の型:
list[str]