py2api 0.0.4__tar.gz → 0.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.
Files changed (40) hide show
  1. {py2api-0.0.4 → py2api-0.0.5}/PKG-INFO +1 -1
  2. {py2api-0.0.4 → py2api-0.0.5}/py2api/util.py +15 -3
  3. {py2api-0.0.4 → py2api-0.0.5}/pyproject.toml +1 -1
  4. {py2api-0.0.4 → py2api-0.0.5}/.editorconfig +0 -0
  5. {py2api-0.0.4 → py2api-0.0.5}/.github/workflows/ci.yml +0 -0
  6. {py2api-0.0.4 → py2api-0.0.5}/.gitignore +0 -0
  7. {py2api-0.0.4 → py2api-0.0.5}/.idea/inspectionProfiles/profiles_settings.xml +0 -0
  8. {py2api-0.0.4 → py2api-0.0.5}/.idea/misc.xml +0 -0
  9. {py2api-0.0.4 → py2api-0.0.5}/.idea/modules.xml +0 -0
  10. {py2api-0.0.4 → py2api-0.0.5}/.idea/py2api.iml +0 -0
  11. {py2api-0.0.4 → py2api-0.0.5}/.idea/vcs.xml +0 -0
  12. {py2api-0.0.4 → py2api-0.0.5}/.idea/workspace.xml +0 -0
  13. {py2api-0.0.4 → py2api-0.0.5}/LICENSE +0 -0
  14. {py2api-0.0.4 → py2api-0.0.5}/README.md +0 -0
  15. {py2api-0.0.4 → py2api-0.0.5}/docsrc/.gitignore +0 -0
  16. {py2api-0.0.4 → py2api-0.0.5}/docsrc/Makefile +0 -0
  17. {py2api-0.0.4 → py2api-0.0.5}/docsrc/conf.py +0 -0
  18. {py2api-0.0.4 → py2api-0.0.5}/docsrc/index.rst +0 -0
  19. {py2api-0.0.4 → py2api-0.0.5}/docsrc/make.bat +0 -0
  20. {py2api-0.0.4 → py2api-0.0.5}/py2api/.gitignore +0 -0
  21. {py2api-0.0.4 → py2api-0.0.5}/py2api/__init__.py +0 -0
  22. {py2api-0.0.4 → py2api-0.0.5}/py2api/constants.py +0 -0
  23. {py2api-0.0.4 → py2api-0.0.5}/py2api/defaults.py +0 -0
  24. {py2api-0.0.4 → py2api-0.0.5}/py2api/errors.py +0 -0
  25. {py2api-0.0.4 → py2api-0.0.5}/py2api/examples/__init__.py +0 -0
  26. {py2api-0.0.4 → py2api-0.0.5}/py2api/examples/pong.py +0 -0
  27. {py2api-0.0.4 → py2api-0.0.5}/py2api/examples/streaming_sine.py +0 -0
  28. {py2api-0.0.4 → py2api-0.0.5}/py2api/examples/wrapping_a_class.py +0 -0
  29. {py2api-0.0.4 → py2api-0.0.5}/py2api/examples/wrapping_a_module.py +0 -0
  30. {py2api-0.0.4 → py2api-0.0.5}/py2api/obj_wrap.py +0 -0
  31. {py2api-0.0.4 → py2api-0.0.5}/py2api/output_trans.py +0 -0
  32. {py2api-0.0.4 → py2api-0.0.5}/py2api/py2rest/__init__.py +0 -0
  33. {py2api-0.0.4 → py2api-0.0.5}/py2api/py2rest/app_maker.py +0 -0
  34. {py2api-0.0.4 → py2api-0.0.5}/py2api/py2rest/constants.py +0 -0
  35. {py2api-0.0.4 → py2api-0.0.5}/py2api/py2rest/input_trans.py +0 -0
  36. {py2api-0.0.4 → py2api-0.0.5}/py2api/py2rest/obj_wrap.py +0 -0
  37. {py2api-0.0.4 → py2api-0.0.5}/py2api/py2rest/old/old_input_trans_with_val_type.py +0 -0
  38. {py2api-0.0.4 → py2api-0.0.5}/py2api/py2rest/rest2py.py +0 -0
  39. {py2api-0.0.4 → py2api-0.0.5}/py2api/scrap_obj_wrap.py +0 -0
  40. {py2api-0.0.4 → py2api-0.0.5}/py2api/tests/wrapping_a_class.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: py2api
3
- Version: 0.0.4
3
+ Version: 0.0.5
4
4
  Summary: Declarative API entry point
5
5
  Project-URL: Homepage, https://github.com/thorwhalen/py2api
6
6
  Author: Thor Whalen
@@ -45,7 +45,15 @@ def enhanced_docstr(func):
45
45
  >>> print(enhanced_docstr(foo))
46
46
  foo(a, b=3, c="as", d=SomeClass, dd=some_function, ddd=None, *args, **kwargs)
47
47
  some documentation...
48
- >>>
48
+
49
+ A function with no default arguments keeps all of its positional args
50
+ (regression: ``args[:-len(dflts)]`` used to drop them all when ``dflts`` was empty):
51
+
52
+ >>> def no_defaults(a, b, c):
53
+ ... '''some docs'''
54
+ >>> print(enhanced_docstr(no_defaults))
55
+ no_defaults(a, b, c)
56
+ some docs
49
57
  """
50
58
  argspec = getfullargspec(func)
51
59
 
@@ -53,9 +61,13 @@ def enhanced_docstr(func):
53
61
  dflts = list(map(_strigify_val, dflts))
54
62
 
55
63
  args_strings = list()
56
- args_strings += argspec.args[: -len(dflts)]
64
+ # Number of positional (non-default) args. Computed as a length so that the
65
+ # no-defaults case works: with len(dflts)==0, args[:-0] would wrongly be []
66
+ # (since -0 == 0), dropping every positional arg.
67
+ n_positional = len(argspec.args) - len(dflts)
68
+ args_strings += argspec.args[:n_positional]
57
69
  args_strings += [
58
- "{}={}".format(*x) for x in zip(argspec.args[-len(dflts) :], dflts)
70
+ "{}={}".format(*x) for x in zip(argspec.args[n_positional:], dflts)
59
71
  ]
60
72
  if argspec.varargs is not None:
61
73
  args_strings += [f"*{argspec.varargs}"]
@@ -6,7 +6,7 @@ build-backend = "hatchling.build"
6
6
 
7
7
  [project]
8
8
  name = "py2api"
9
- version = "0.0.4"
9
+ version = "0.0.5"
10
10
  description = "Declarative API entry point"
11
11
  readme = "README.md"
12
12
  requires-python = ">=3.10"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes