formatize 1.0.5__tar.gz → 1.0.7__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: formatize
3
- Version: 1.0.5
3
+ Version: 1.0.7
4
4
  Summary: Literp Formatting Lib
5
5
  Home-page: https://github.com/asinerum/formatize
6
6
  Author: Asinerum Conlang Project
@@ -1,6 +1,6 @@
1
1
  [metadata]
2
2
  name = formatize
3
- version = 1.0.5
3
+ version = 1.0.7
4
4
  author = Asinerum Conlang Project
5
5
  author_email = asinerum.com@gmail.com
6
6
  description = Literp Formatting Lib
@@ -1,4 +1,4 @@
1
1
  from .form import *
2
2
  from .const import *
3
3
 
4
- __version__ = "1.0.5"
4
+ __version__ = "1.0.7"
@@ -647,7 +647,7 @@ def add_class_to_nested_module (module, class_name, cls):
647
647
  setattr(module, class_name, cls)
648
648
 
649
649
  def frender (non_f_str: str):
650
- return eval(f'f"""{non_f_str}"""')
650
+ return eval(f'f"""{non_f_str}"""', globals())
651
651
 
652
652
  def punctescape (text: str) -> str:
653
653
  return re.compile(f'[{re.escape(string.punctuation)}]').sub('', text)
@@ -849,3 +849,32 @@ def window_image(filepath: str, title: str='Image Window'):
849
849
  label = tk.Label(root, image=tkimg)
850
850
  label.pack()
851
851
  root.mainloop()
852
+
853
+ ## <1.0.7>
854
+
855
+ def get_directory_tree (root_dir: str) -> list:
856
+ def build_tree(dir_path, prefix=''):
857
+ entries = []
858
+ items = sorted(os.listdir(dir_path))
859
+ for i, item in enumerate(items):
860
+ path = os.path.join(dir_path, item)
861
+ connector = '├── ' if i < len(items) - 1 else '└── '
862
+ entries.append(f'{prefix}{connector}{item}')
863
+ if os.path.isdir(path):
864
+ extension = '│ ' if i < len(items) - 1 else ' '
865
+ entries.extend(build_tree(path, prefix + extension))
866
+ return entries
867
+ tree_lines = [root_dir] + build_tree(root_dir)
868
+ return tree_lines
869
+
870
+ def save_directory_tree_to_md (root_dir: str, output_file: str='directory_structure.md'):
871
+ tree_lines = get_directory_tree(root_dir)
872
+ md_content = '\n'.join(tree_lines)
873
+ if output_file:
874
+ with open(output_file, 'w', encoding='utf-8') as f:
875
+ f.write('# Directory Structure\n\n')
876
+ f.write('```\n')
877
+ f.write(md_content)
878
+ f.write('\n```\n')
879
+ return print(f'Directory structure saved to {output_file}')
880
+ return md_content
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: formatize
3
- Version: 1.0.5
3
+ Version: 1.0.7
4
4
  Summary: Literp Formatting Lib
5
5
  Home-page: https://github.com/asinerum/formatize
6
6
  Author: Asinerum Conlang Project
File without changes
File without changes
File without changes