|
@@ -6,7 +6,6 @@ from typing import List
|
|
|
|
|
|
import requests
|
|
import requests
|
|
from bs4 import BeautifulSoup
|
|
from bs4 import BeautifulSoup
|
|
-from secure import SecurePath
|
|
|
|
|
|
|
|
|
|
|
|
@dataclass
|
|
@dataclass
|
|
@@ -53,7 +52,8 @@ properties: List[Property] = []
|
|
|
|
|
|
|
|
|
|
def get_soup(url: str) -> BeautifulSoup:
|
|
def get_soup(url: str) -> BeautifulSoup:
|
|
- path = Path('/tmp') / url.split('/')[-1]
|
|
|
|
|
|
+ path = Path('/tmp/nicegui_tailwind') / url.split('/')[-1]
|
|
|
|
+ path.parent.mkdir(parents=True, exist_ok=True)
|
|
if path.exists():
|
|
if path.exists():
|
|
html = path.read_text()
|
|
html = path.read_text()
|
|
else:
|
|
else:
|
|
@@ -83,7 +83,7 @@ for file in (Path(__file__).parent / 'nicegui' / 'tailwind_types').glob('*.py'):
|
|
for property in properties:
|
|
for property in properties:
|
|
if not property.members:
|
|
if not property.members:
|
|
continue
|
|
continue
|
|
- with SecurePath(open(Path(__file__).parent / 'nicegui' / 'tailwind_types' / f'{property.snake_title}.py', 'w')) as f:
|
|
|
|
|
|
+ with (Path(__file__).parent / 'nicegui' / 'tailwind_types' / f'{property.snake_title}.py').open('w') as f:
|
|
f.write('from typing_extensions import Literal\n')
|
|
f.write('from typing_extensions import Literal\n')
|
|
f.write('\n')
|
|
f.write('\n')
|
|
f.write(f'{property.pascal_title} = Literal[\n')
|
|
f.write(f'{property.pascal_title} = Literal[\n')
|
|
@@ -91,7 +91,7 @@ for property in properties:
|
|
f.write(f" '{short_member}',\n")
|
|
f.write(f" '{short_member}',\n")
|
|
f.write(']\n')
|
|
f.write(']\n')
|
|
|
|
|
|
-with open(Path(__file__).parent / 'nicegui' / 'tailwind.py', 'w') as f:
|
|
|
|
|
|
+with (Path(__file__).parent / 'nicegui' / 'tailwind.py').open('w') as f:
|
|
f.write('from __future__ import annotations\n')
|
|
f.write('from __future__ import annotations\n')
|
|
f.write('\n')
|
|
f.write('\n')
|
|
f.write('from typing import TYPE_CHECKING, List, Optional, Union, overload\n')
|
|
f.write('from typing import TYPE_CHECKING, List, Optional, Union, overload\n')
|
|
@@ -128,7 +128,7 @@ with open(Path(__file__).parent / 'nicegui' / 'tailwind.py', 'w') as f:
|
|
f.write('\n')
|
|
f.write('\n')
|
|
f.write(' def __call__(self, *args) -> Tailwind:\n')
|
|
f.write(' def __call__(self, *args) -> Tailwind:\n')
|
|
f.write(' if not args:\n')
|
|
f.write(' if not args:\n')
|
|
- f.write(' return self\n')
|
|
|
|
|
|
+ f.write(' return self\n')
|
|
f.write(' if isinstance(args[0], Tailwind):\n')
|
|
f.write(' if isinstance(args[0], Tailwind):\n')
|
|
f.write(' args[0].apply(self.element)\n')
|
|
f.write(' args[0].apply(self.element)\n')
|
|
f.write(' else:\n')
|
|
f.write(' else:\n')
|