Skip to content

Commit 655925d

Browse files
Added docs for get_classes_info
1 parent 06956b4 commit 655925d

1 file changed

Lines changed: 33 additions & 1 deletion

File tree

README.md

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,4 +118,36 @@ print(m.get_funcs_info(only_func_name=True))
118118
# output
119119
{'foo': {'args': [], 'defaults': [], 'arg_count': 0, 'calls': ['load', 'open', 'pprint', 'print']}}
120120

121-
```
121+
```
122+
123+
### Get info about the classes in a module
124+
```python
125+
# test.py
126+
class Foo(A.Test):
127+
128+
def __init__(self, name):
129+
self.name = name
130+
131+
def n():
132+
pass
133+
134+
135+
class Bar():
136+
137+
def a():
138+
print('Hello')
139+
140+
```
141+
To get meta info about the classes in the module use
142+
```python
143+
from py_module_info import ModuleInfo
144+
145+
m = ModuleInfo("test.py")
146+
print(m.get_classes_info())
147+
148+
# output
149+
{'Foo': {'bases': ['A.Test'], 'methods': {'__init__': {'args': ['self', 'name'], 'defaults': [], 'arg_count': 2, 'calls': []}, 'n': {'args': [], 'defaults': [], 'arg_count': 0,
150+
'calls': []}}}, 'Bar': {'bases': [], 'methods': {'a': {'args': [], 'defaults': [], 'arg_count': 0, 'calls': ["print('Hello')"]}}}}
151+
```
152+
153+
Currently the output includes the information about the base classes and the info about different methods in the class.

0 commit comments

Comments
 (0)