|
27 | 27 | :target: https://img.shields.io/github/workflow/status/pwwang/python-varname/Build%20Docs?label=docs&style=flat-square |
28 | 28 | :alt: Docs and API |
29 | 29 | <https://pwwang.github.io/python-varname/api/varname>`_ ` |
30 | | -.. image:: https://img.shields.io/codacy/grade/ed851ff47b194e3e9389b2a44d6f21da?style=flat-square |
31 | | - :target: https://img.shields.io/codacy/grade/ed851ff47b194e3e9389b2a44d6f21da?style=flat-square |
| 30 | +.. image:: https://img.shields.io/codacy/grade/6fdb19c845f74c5c92056e88d44154f7?style=flat-square |
| 31 | + :target: https://img.shields.io/codacy/grade/6fdb19c845f74c5c92056e88d44154f7?style=flat-square |
32 | 32 | :alt: Codacy |
33 | | - <https://app.codacy.com/manual/pwwang/python-varname/dashboard>`_ ` |
34 | | -.. image:: https://img.shields.io/codacy/coverage/ed851ff47b194e3e9389b2a44d6f21da?style=flat-square |
35 | | - :target: https://img.shields.io/codacy/coverage/ed851ff47b194e3e9389b2a44d6f21da?style=flat-square |
| 33 | + <https://app.codacy.com/gh/pwwang/python-varname/dashboard>`_ ` |
| 34 | +.. image:: https://img.shields.io/codacy/coverage/6fdb19c845f74c5c92056e88d44154f7?style=flat-square |
| 35 | + :target: https://img.shields.io/codacy/coverage/6fdb19c845f74c5c92056e88d44154f7?style=flat-square |
36 | 36 | :alt: Codacy coverage |
37 | | - <https://app.codacy.com/manual/pwwang/python-varname/dashboard>`_ |
| 37 | + <https://app.codacy.com/gh/pwwang/python-varname/dashboard>`_ |
38 | 38 | ` |
39 | 39 | .. image:: https://img.shields.io/gitter/room/pwwang/python-varname?style=flat-square |
40 | 40 | :target: https://img.shields.io/gitter/room/pwwang/python-varname?style=flat-square |
@@ -63,7 +63,8 @@ Features |
63 | 63 | * Retrieving names of variables a function/class call is assigned to from inside it, using ``varname``. |
64 | 64 | * Retrieving variable names directly, using ``nameof`` |
65 | 65 | * Detecting next immediate attribute name, using ``will`` |
66 | | - * Fetching argument names/sources passed to a function using ``argname`` |
| 66 | + * Fetching argument names/sources passed to a function using ``argname2`` |
| 67 | + (\ ``argname`` is superseded by ``argname2``\ ) |
67 | 68 |
|
68 | 69 | * |
69 | 70 | Other helper APIs (built based on core features): |
@@ -324,31 +325,31 @@ Detecting next immediate attribute name |
324 | 325 | awesome.permit() # AttributeError: Should do something with AwesomeClass object |
325 | 326 | awesome.permit().do() == 'I am doing!' |
326 | 327 |
|
327 | | -Fetching argument names/sources using ``argname`` |
328 | | -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 328 | +Fetching argument names/sources using ``argname2`` |
| 329 | +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
329 | 330 |
|
330 | 331 | .. code-block:: python |
331 | 332 |
|
332 | | - from varname import argname |
| 333 | + from varname import argname2 |
333 | 334 |
|
334 | 335 | def func(a, b=1): |
335 | | - print(argname(a)) |
| 336 | + print(argname2('a')) |
336 | 337 |
|
337 | 338 | x = y = z = 2 |
338 | 339 | func(x) # prints: x |
339 | 340 |
|
340 | 341 | def func2(a, b=1): |
341 | | - print(argname(a, b)) |
| 342 | + print(argname2('a', 'b')) |
342 | 343 | func2(y, b=x) # prints: ('y', 'x') |
343 | 344 |
|
344 | 345 | # allow expressions |
345 | 346 | def func3(a, b=1): |
346 | | - print(argname(a, b, vars_only=False)) |
| 347 | + print(argname2('a', 'b', vars_only=False)) |
347 | 348 | func3(x+y, y+x) # prints: ('x+y', 'y+x') |
348 | 349 |
|
349 | 350 | # positional and keyword arguments |
350 | 351 | def func4(*args, **kwargs): |
351 | | - print(argname(args[1], kwargs['c'])) |
| 352 | + print(argname2('args[1]', 'kwargs["c"]')) |
352 | 353 | func4(y, x, c=z) # prints: ('x', 'z') |
353 | 354 |
|
354 | 355 | Value wrapper |
|
0 commit comments