Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StorageDirのリファクタリング #96

Open
sonoh5n opened this issue Dec 8, 2024 · 1 comment
Open

StorageDirのリファクタリング #96

sonoh5n opened this issue Dec 8, 2024 · 1 comment
Assignees
Labels
🛠️ improvement Improve features which are working ♻️ refactor refactoring
Milestone

Comments

@sonoh5n
Copy link
Collaborator

sonoh5n commented Dec 8, 2024

現在実装されているクラスがPythonicではなく使いづらい。

@sonoh5n sonoh5n added 🛠️ improvement Improve features which are working ♻️ refactor refactoring labels Dec 8, 2024
@sonoh5n sonoh5n added this to the Version 1.1.0 milestone Dec 8, 2024
@sonoh5n sonoh5n self-assigned this Dec 8, 2024
@sonoh5n
Copy link
Collaborator Author

sonoh5n commented Dec 16, 2024

# example.py
from directory_manager import DirectoryManager

def main():
    # DirectoryManagerを初期化
    dir_manager = DirectoryManager('/tmp/base_directory') 

    # 1. 通常のディレクトリアクセス
    inputdata_dir = dir_manager.inputdata
    print(f"InputData Path: {inputdata_dir}")  
    # このタイミングで'/tmp/base_directory/inputdata'が存在しない場合は作成される

    # ディレクトリ内のファイル一覧を取得
    inputdata_files = inputdata_dir.list()
    print("InputData Files:", inputdata_files)

    # 2. 分割ディレクトリアクセス(idx=1など)
    inputdata_divided_dir = dir_manager.inputdata(1)
    print(f"Divided InputData Path: {inputdata_divided_dir}")  
    # このタイミングで'/tmp/base_directory/divided/0001/inputdata'が存在しない場合は作成される

    divided_files = inputdata_divided_dir.list()
    print("Divided InputData Files:", divided_files)

    # 3. サポートされていないディレクトリにもアクセス可能
    custom_dir = dir_manager.customdir
    print(f"CustomDir Path: {custom_dir}")  
    custom_files = custom_dir.list()
    print("CustomDir Files:", custom_files)

    # 4. サポートディレクトリをまとめて作成・取得する例
    all_dirs = dir_manager.all()
    print("All Supported Directories:")
    for d in all_dirs:
        print(d)

if __name__ == "__main__":
    main()

@sonoh5n sonoh5n mentioned this issue Jan 14, 2025
2 tasks
sonoh5n added a commit that referenced this issue Jan 14, 2025
sonoh5n added a commit that referenced this issue Jan 14, 2025
- Add ManagedDirectory support for creating divided subdirectories
- Separate base-only and divided-supported directories
- Implement index-based directory creation in divided folders
- Handle directory creation errors with proper error mapping
sonoh5n added a commit that referenced this issue Jan 14, 2025
…d subdirectories and improve documentation
sonoh5n added a commit that referenced this issue Jan 14, 2025
sonoh5n added a commit that referenced this issue Jan 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🛠️ improvement Improve features which are working ♻️ refactor refactoring
Projects
None yet
Development

No branches or pull requests

1 participant