DO NOT USE! THIS IS AMBIGUOUS. You might be looking for [web-inspector].
Questions tagged [inspect]
610 questions
4
votes
1 answer
Inspect lambda code from Python interpreter
this simple python program that is extracted from more complex codebase:
#insp.py
import inspect
L = lambda x: x+1
print("L(10)=" + str(L(10)))
code = inspect.getsource(L)
print(code)
works if i run it from the command line as:
$ python insp.py
If…

Charlie
- 1,750
- 15
- 20
4
votes
1 answer
Android Studio + NDK: C++ Editor does not work
I am using Android studio 2.0 on Window with NDK.
I can build and run project successfully but C++ editor does not work.
It cannot find includes file, so also cannot suggest API.
On Eclipse, we can easily add include path, but not Android…

Karoshi Nguyen
- 41
- 2
4
votes
1 answer
How can I force update the Python locals() dictionary of a different stack frame?
In Python 2 (not sure about 3), the locals dictionary only gets updated when you actually call locals(). So e.g.
l=locals()
x=2
l['x']
fails because l doesn't have the key "x" in it, but
l=locals()
x=2
locals()
l['x']
returns 2.
I'm looking for a…

marius
- 1,352
- 1
- 13
- 29
4
votes
1 answer
Getting all functions of python package
I have a multimodule Python package which has one file with class MyClass and few files with functions (one file can contain more than 1 function).
I tried to get all functions in this package.
Firstly, using the following:
modules = []
for…

VeLKerr
- 2,995
- 3
- 24
- 47
4
votes
3 answers
Mocking function argument names to work with inspect.getargspec
I'm trying to mock a function for a test that eventually passes the mock through the inspect.getargspec function. I'd like to use some specific names as argument names of the mocked function.
As far as I know, there's no specific way to mock…

liori
- 40,917
- 13
- 78
- 105
4
votes
3 answers
Python: put all function arguments into **kwargs automatically
Description
Say I have the following function, which makes a call to another function:
def f1(arg1, arg2, arg3):
f2(...)
The arguments of f1 and f2 are the same, or f2 might look like this:
def f2(**kwargs)
pass # whatever
The client code…

bagrat
- 7,158
- 6
- 29
- 47
4
votes
2 answers
In Scala/Java, how to inspect where a method is defined?
For example, I saw a Scala expression like this:
objX.methodY
There seems no way to see where methodY came from, it may came from:
(1) the class of objX, let's call it ClassX
(2) the super class of objX (ClassX), let's call it SuperClassX
(3) a…

Hanfei Sun
- 45,281
- 39
- 129
- 237
4
votes
2 answers
Does dict.update affect a function's argspec?
import inspect
class Test:
def test(self, p, d={}):
d.update(p)
return d
print inspect.getargspec(getattr(Test, 'test'))[3]
print Test().test({'1':True})
print inspect.getargspec(getattr(Test, 'test'))[3]
I would expect the argspec for…

Russell
- 2,692
- 5
- 23
- 24
4
votes
2 answers
Netbeans: Navigate-> Go To Declaration/Definition BROKEN with "Cannot Open Element" on C++ 64-bit Ubuntu
My Netbeans right-click Navigate -> Go to Declaration/Definition is broken, it refuses to go anywhere. Instead, in the lower left-hand corner, a message pops up: 'Cannot open element: "myvariablename".' It does not matter if the variable or…

DragonLord
- 6,395
- 4
- 36
- 38
4
votes
2 answers
Is it possible to "inspect in browser and jump to that element in WebStorm(or PhpStorm)"
In chrome-devtools to inspect a element, what you need to do is just click the element and then chrome will find you that element in html-code automatically.
On the other hand, editing in the IDE (PhpStorm), you have to find the element yourself,…

yaquawa
- 6,690
- 8
- 35
- 48
4
votes
2 answers
How do you silently save an inspect object in R's tm package?
When I save the inspect() object in R's tm package it prints to screen. It does save the data that I want in the data.frame, but I have thousands of documents to analyze and the printing to screen is eating up my memory.…

Jim Crozier
- 1,378
- 2
- 16
- 28
4
votes
2 answers
Getting class reference from function in Python
I'm writing a python (3.2+) plugin library and I want to create a function which will create some variables automatically handled from config files.
The use case is as follows (class variable):
class X:
option(y=0)
def __init__(self):
…

Wojciech Danilo
- 11,573
- 17
- 66
- 132
3
votes
2 answers
using python inspect to view local variables in a function
I can't figure out how to inspect a currently executing function using inspect / inspect_shell
I'm guessing it involves walking the frame hierarchy using getinnerframe and getouterframe, but I'm confused on several issues.
Given this…

Paul
- 2,973
- 6
- 31
- 40
3
votes
3 answers
Is there a way to inspect incoming args from within __getattr__ or to somehow otherwise redirect a call based upon incoming arguments?
Some background:
We have a system for transactions where we devide the flow based upon the country the transaction bills to. We have a logging table that exists in 2 instances, one DB logging transactions to the EU, the other to anywhere else. We…

Silas Ray
- 25,682
- 5
- 48
- 63
3
votes
1 answer
What is a standard way to save a location in a list between application runs?
I’d like to make a simple application which shows one element from a list on screen at a time (using curses). The user navigates left and right with keys. They can close the application with q.
The application should remember where they were when…

hmltn
- 224
- 3
- 14