DO NOT USE! THIS IS AMBIGUOUS. You might be looking for [web-inspector].
Questions tagged [inspect]
562 questions
467
votes
20 answers
How to list all functions in a Python module?
I have a Python module installed on my system and I'd like to be able to see what functions/classes/methods are available in it.
I want to call the help function on each one. In Ruby I can do something like ClassName.methods to get a list of all the…
Chris Gow
- 6,284
- 4
- 21
- 18
342
votes
12 answers
How can I get a list of all classes within current module in Python?
I've seen plenty of examples of people extracting all of the classes from a module, usually something like:
# foo.py
class Foo:
pass
# test.py
import inspect
import foo
for name, obj in inspect.getmembers(foo):
if inspect.isclass(obj):
…
mcccclean
- 6,951
- 10
- 29
- 36
145
votes
8 answers
How can I read a function's signature including default argument values?
Given a function object, how can I get its signature? For example, for:
def myMethod(firt, second, third='something'):
pass
I would like to get "myMethod(firt, second, third='something')".
Spì
- 1,715
- 2
- 13
- 10
102
votes
8 answers
How to inspect Javascript Objects
How can I inspect an Object in an alert box? Normally alerting an Object just throws the nodename:
alert(document);
But I want to get the properties and methods of the object in the alert box. How can I achieve this functionality, if possible? Or…
Valentina
- 1,023
- 2
- 8
- 5
81
votes
6 answers
How to get all methods of a python class with given decorator
How to get all methods of a given class A that are decorated with the @decorator2?
class A():
def method_a(self):
pass
@decorator1
def method_b(self, b):
pass
@decorator2
def method_c(self, t=5):
pass
kraiz
- 1,968
- 1
- 19
- 22
81
votes
4 answers
How to use inspect to get the caller's info from callee in Python?
I need to get the caller info (what file/what line) from callee. I learned that I can use inpect module for that for purposes, but not exactly how.
How to get those info with inspect? Or is there any other way to get the info?
import inspect
print…
prosseek
- 155,475
- 189
- 518
- 818
60
votes
11 answers
Using a dictionary to select function to execute
I am trying to use functional programming to create a dictionary containing a key and a function to execute:
myDict={}
myItems=("P1","P2","P3",...."Pn")
def myMain(key):
def ExecP1():
pass
def ExecP2():
pass
def…
JohnnyDH
- 1,396
- 2
- 13
- 12
50
votes
5 answers
Python debugging: get filename and line number from which a function is called?
I'm currently building quite a complex system in Python, and when I'm debugging I often put simple print statements in several scripts. To keep an overview I often also want to print out the file name and line number where the print statement is…
kramer65
- 39,074
- 90
- 255
- 436
50
votes
2 answers
What is the difference between a stack and a frame?
Under what situations would I want to use one over the other?
What is the difference between:
>>> import inspect
>>> print(inspect.getouterframes(inspect.currentframe()))
[(, '', 1, '', None,…
jmunsch
- 16,405
- 6
- 74
- 87
36
votes
6 answers
Inspect python class attributes
I need a way to inspect a class so I can safely identify which attributes are user-defined class attributes. The problem is that functions like dir(), inspect.getmembers() and friends return all class attributes including the pre-defined ones like:…
Jakob Simon-Gaarde
- 393
- 1
- 3
- 6
33
votes
6 answers
How to debug webview remotely?
How can I do debug/inspect element of apk webview.
I have tried this but it is helpful only for chrome not for apk.
Please suggest me
Kundan Atre
- 3,449
- 5
- 21
- 38
32
votes
3 answers
Get full package module name
For verbose debug messages in my application I'm using a function that returns a helpful prefix. Consider the following example:
import inspect
def get_verbose_prefix():
"""Returns an informative prefix for verbose debug output messages"""
…
Hubro
- 48,322
- 60
- 196
- 344
24
votes
5 answers
Can't see my device of chrome://inspect/#devices
I've followed the instructions at google: https://developer.chrome.com/devtools/docs/remote-debugging. I've also went over the troubleshooting section - but nothing seems to work.
I have samsung galaxy 3 (android 4.1.2, chrome 42.0.2311.111). USB…
yccteam
- 1,819
- 3
- 19
- 42
23
votes
7 answers
Chrome 84 Inspect element, find results not highlighted in yellow like before
As per usual when making automated tests I use "Inspect"(CTRL+SHIFT+I) in Chrome to find element by xpath, id, CSS selector etc.
For example:
//li/a[contains(text(), "Products")]
Above is an xpath from this page. In previous versions of Chrome in…
DespotAuto
- 239
- 1
- 1
- 5
19
votes
4 answers
How to list Docker mounted volumes from within the container
I want to list all container directories that are mounted volumes.
I.e. to be able to get similar info I get from
docker inspect --format "{{ .Volumes }}"
But from within the container and without having docker installed in there.
I tried…
Leo Gallucci
- 15,165
- 11
- 66
- 103