python-fasthtml 0.12.44__tar.gz → 0.12.46__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.
Files changed (39) hide show
  1. {python_fasthtml-0.12.44/python_fasthtml.egg-info → python_fasthtml-0.12.46}/PKG-INFO +1 -1
  2. python_fasthtml-0.12.46/fasthtml/__init__.py +2 -0
  3. {python_fasthtml-0.12.44 → python_fasthtml-0.12.46}/fasthtml/_modidx.py +1 -0
  4. {python_fasthtml-0.12.44 → python_fasthtml-0.12.46}/fasthtml/core.py +3 -4
  5. {python_fasthtml-0.12.44 → python_fasthtml-0.12.46/python_fasthtml.egg-info}/PKG-INFO +1 -1
  6. python_fasthtml-0.12.44/fasthtml/__init__.py +0 -2
  7. {python_fasthtml-0.12.44 → python_fasthtml-0.12.46}/CONTRIBUTING.md +0 -0
  8. {python_fasthtml-0.12.44 → python_fasthtml-0.12.46}/LICENSE +0 -0
  9. {python_fasthtml-0.12.44 → python_fasthtml-0.12.46}/MANIFEST.in +0 -0
  10. {python_fasthtml-0.12.44 → python_fasthtml-0.12.46}/README.md +0 -0
  11. {python_fasthtml-0.12.44 → python_fasthtml-0.12.46}/fasthtml/authmw.py +0 -0
  12. {python_fasthtml-0.12.44 → python_fasthtml-0.12.46}/fasthtml/basics.py +0 -0
  13. {python_fasthtml-0.12.44 → python_fasthtml-0.12.46}/fasthtml/cli.py +0 -0
  14. {python_fasthtml-0.12.44 → python_fasthtml-0.12.46}/fasthtml/common.py +0 -0
  15. {python_fasthtml-0.12.44 → python_fasthtml-0.12.46}/fasthtml/components.py +0 -0
  16. {python_fasthtml-0.12.44 → python_fasthtml-0.12.46}/fasthtml/components.pyi +0 -0
  17. {python_fasthtml-0.12.44 → python_fasthtml-0.12.46}/fasthtml/core.pyi +0 -0
  18. {python_fasthtml-0.12.44 → python_fasthtml-0.12.46}/fasthtml/fastapp.py +0 -0
  19. {python_fasthtml-0.12.44 → python_fasthtml-0.12.46}/fasthtml/ft.py +0 -0
  20. {python_fasthtml-0.12.44 → python_fasthtml-0.12.46}/fasthtml/js.py +0 -0
  21. {python_fasthtml-0.12.44 → python_fasthtml-0.12.46}/fasthtml/jupyter.py +0 -0
  22. {python_fasthtml-0.12.44 → python_fasthtml-0.12.46}/fasthtml/katex.js +0 -0
  23. {python_fasthtml-0.12.44 → python_fasthtml-0.12.46}/fasthtml/live_reload.py +0 -0
  24. {python_fasthtml-0.12.44 → python_fasthtml-0.12.46}/fasthtml/oauth.py +0 -0
  25. {python_fasthtml-0.12.44 → python_fasthtml-0.12.46}/fasthtml/pico.py +0 -0
  26. {python_fasthtml-0.12.44 → python_fasthtml-0.12.46}/fasthtml/starlette.py +0 -0
  27. {python_fasthtml-0.12.44 → python_fasthtml-0.12.46}/fasthtml/stripe_otp.py +0 -0
  28. {python_fasthtml-0.12.44 → python_fasthtml-0.12.46}/fasthtml/svg.py +0 -0
  29. {python_fasthtml-0.12.44 → python_fasthtml-0.12.46}/fasthtml/toaster.py +0 -0
  30. {python_fasthtml-0.12.44 → python_fasthtml-0.12.46}/fasthtml/xtend.py +0 -0
  31. {python_fasthtml-0.12.44 → python_fasthtml-0.12.46}/fasthtml/xtend.pyi +0 -0
  32. {python_fasthtml-0.12.44 → python_fasthtml-0.12.46}/pyproject.toml +0 -0
  33. {python_fasthtml-0.12.44 → python_fasthtml-0.12.46}/python_fasthtml.egg-info/SOURCES.txt +0 -0
  34. {python_fasthtml-0.12.44 → python_fasthtml-0.12.46}/python_fasthtml.egg-info/dependency_links.txt +0 -0
  35. {python_fasthtml-0.12.44 → python_fasthtml-0.12.46}/python_fasthtml.egg-info/entry_points.txt +0 -0
  36. {python_fasthtml-0.12.44 → python_fasthtml-0.12.46}/python_fasthtml.egg-info/requires.txt +0 -0
  37. {python_fasthtml-0.12.44 → python_fasthtml-0.12.46}/python_fasthtml.egg-info/top_level.txt +0 -0
  38. {python_fasthtml-0.12.44 → python_fasthtml-0.12.46}/setup.cfg +0 -0
  39. {python_fasthtml-0.12.44 → python_fasthtml-0.12.46}/tests/test_toaster.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-fasthtml
3
- Version: 0.12.44
3
+ Version: 0.12.46
4
4
  Summary: The fastest way to create an HTML app
5
5
  Author-email: Jeremy Howard and contributors <github@jhoward.fastmail.fm>
6
6
  License: Apache-2.0
@@ -0,0 +1,2 @@
1
+ __version__ = "0.12.46"
2
+ from .core import *
@@ -34,6 +34,7 @@ d = { 'settings': { 'branch': 'main',
34
34
  'fasthtml.core.APIRouter.to_app': ('api/core.html#apirouter.to_app', 'fasthtml/core.py'),
35
35
  'fasthtml.core.APIRouter.ws': ('api/core.html#apirouter.ws', 'fasthtml/core.py'),
36
36
  'fasthtml.core.ApiReturn': ('api/core.html#apireturn', 'fasthtml/core.py'),
37
+ 'fasthtml.core.ApiReturn.__bool__': ('api/core.html#apireturn.__bool__', 'fasthtml/core.py'),
37
38
  'fasthtml.core.ApiReturn.__call__': ('api/core.html#apireturn.__call__', 'fasthtml/core.py'),
38
39
  'fasthtml.core.ApiReturn.__from_request__': ('api/core.html#apireturn.__from_request__', 'fasthtml/core.py'),
39
40
  'fasthtml.core.ApiReturn.__init__': ('api/core.html#apireturn.__init__', 'fasthtml/core.py'),
@@ -170,6 +170,7 @@ class ApiReturn:
170
170
  async def __from_request__(cls, data, req): return cls(req.headers.get('accept')=='application/json')
171
171
  def __init__(self, isapi=False): self.isapi = isapi
172
172
  def __call__(self, norm, **kw): return kw if self.isapi else norm
173
+ def __bool__(self): return bool(self.isapi)
173
174
 
174
175
  # %% ../nbs/api/00_core.ipynb #7cc39ba9
175
176
  class JSONResponse(JSONResponseOrig):
@@ -188,7 +189,7 @@ async def _find_p(conn, data, hdrs, arg:str, p:Parameter):
188
189
  if issubclass(anno, Starlette): return conn.scope['app']
189
190
  if issubclass(anno, HTTPConnection): return conn
190
191
  if issubclass(anno, State): return conn.scope['app'].state
191
- if issubclass(anno, dict): return data
192
+ if anno is dict: return data
192
193
  if _is_body(anno):
193
194
  if 'session'.startswith(arg.lower()): return conn.scope.get('session', {})
194
195
  return await _from_body(conn, p, data)
@@ -222,14 +223,12 @@ async def _find_p(conn, data, hdrs, arg:str, p:Parameter):
222
223
  if isinstance(conn, Request): raise HTTPException(400, f"Missing required field: {arg}")
223
224
  raise ValueError(f"Missing required field: {arg}")
224
225
  res = p.default
225
- # We can cast str and list[str] to types; otherwise just return what we have
226
- if not isinstance(res, (list,str)) or anno is empty: return res
226
+ if anno is empty: return res
227
227
  try: return _fix_anno(anno, res)
228
228
  except ValueError as e:
229
229
  if isinstance(conn, Request): raise HTTPException(404, f"{conn.url.path}: {e}") from None
230
230
  raise
231
231
 
232
-
233
232
  # %% ../nbs/api/00_core.ipynb #bf42edad
234
233
  async def _find_ps(conn, data, hdrs, params):
235
234
  if conn.query_params: data |= dict(conn.query_params)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-fasthtml
3
- Version: 0.12.44
3
+ Version: 0.12.46
4
4
  Summary: The fastest way to create an HTML app
5
5
  Author-email: Jeremy Howard and contributors <github@jhoward.fastmail.fm>
6
6
  License: Apache-2.0
@@ -1,2 +0,0 @@
1
- __version__ = "0.12.44"
2
- from .core import *