formatize 1.0.4__tar.gz → 1.0.5__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.4
3
+ Version: 1.0.5
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.4
3
+ version = 1.0.5
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.4"
4
+ __version__ = "1.0.5"
@@ -3,15 +3,18 @@ from typing import List, Dict, Optional
3
3
  from importlib import import_module
4
4
  from bs4 import BeautifulSoup
5
5
 
6
- import datetime
7
- import hashlib
8
- import json
9
- import math
10
6
  import re
11
- import inspect
7
+ import sys
8
+ import types
12
9
  import string
10
+ import inspect
11
+
12
+ import json
13
+ import math
13
14
  import uuid
14
15
  import yaml
16
+ import hashlib
17
+ import datetime
15
18
 
16
19
  import socket
17
20
  import smtplib
@@ -620,6 +623,35 @@ def update_module(Module, vals: dict) -> bool:
620
623
  except:
621
624
  return False
622
625
 
626
+ def create_nested_module (nested_module_name: str) -> types.ModuleType:
627
+ parts = nested_module_name.split('.')
628
+ module = None
629
+ parent = None
630
+ full_name = ''
631
+ for part in parts:
632
+ full_name = f'{full_name}.{part}' if full_name else part
633
+ if full_name in sys.modules:
634
+ module = sys.modules[full_name]
635
+ else:
636
+ module = types.ModuleType(full_name)
637
+ sys.modules[full_name] = module
638
+ if parent:
639
+ setattr(parent, part, module)
640
+ parent = module
641
+ return module
642
+
643
+ def add_function_to_nested_module (module, func_name, func):
644
+ setattr(module, func_name, func)
645
+
646
+ def add_class_to_nested_module (module, class_name, cls):
647
+ setattr(module, class_name, cls)
648
+
649
+ def frender (non_f_str: str):
650
+ return eval(f'f"""{non_f_str}"""')
651
+
652
+ def punctescape (text: str) -> str:
653
+ return re.compile(f'[{re.escape(string.punctuation)}]').sub('', text)
654
+
623
655
  ## FRONTEND FORMATTINGS
624
656
 
625
657
  def load_yaml_temp (filepath):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: formatize
3
- Version: 1.0.4
3
+ Version: 1.0.5
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