Questions tagged [inspect]

DO NOT USE! THIS IS AMBIGUOUS. You might be looking for [web-inspector].

562 questions
6
votes
4 answers

How to prevent decompilation or inspecting python code?

let us assume that there is a big, commercial project (a.k.a Project), which uses Python under the hood to manage plugins for configuring new control surfaces which can be attached and used by Project. There was a small information leak, some part…
Helbreder
  • 802
  • 1
  • 13
  • 24
6
votes
3 answers

How to find out if (the source code of) a function contains a call to a method from a specific module?

Let's say, I have a bunch of functions a, b, c, d and e and I want to find out if they call any method from the random module: def a(): pass def b(): import random def c(): import random random.randint(0, 1) def d(): import…
finefoot
  • 7,307
  • 6
  • 35
  • 69
6
votes
1 answer

Why does inspect return different line for class inheriting from superclass?

While trying to figure out if a function is called with the @decorator syntax, we realized that inspect has a different behaviour when looking at a decorated class that inherits from a superclass. The following behaviour was found with CPython 3.6.2…
Olivier Melançon
  • 19,112
  • 3
  • 34
  • 61
6
votes
1 answer

Python how to get the calling function (not just its name)?

I want to write a function which returns the calling function: def foo(): return get_calling_function() #should return 'foo' function object There's numerous examples online how to get the calling function's name, but not how to get the actual…
marius
  • 1,090
  • 9
  • 26
6
votes
2 answers

Proving `T b` when `b` is already matched on

I am trying to prove something simple: open import Data.List open import Data.Nat open import Data.Bool open import Data.Bool.Properties open import Relation.Binary.PropositionalEquality open import Data.Unit repeat : ∀ {a} {A : Set a} → ℕ → A →…
Cactus
  • 25,576
  • 9
  • 60
  • 130
6
votes
1 answer

Listing all class members with Python `inspect` module

What is the "optimal" way to list all class methods of a given class using inspect? It works if I use the inspect.isfunction as predicate in getmembers like so class MyClass(object): def __init(self, a=1): pass def somemethod(self,…
user2489252
6
votes
2 answers

Adding items to a list if it's not a function

I'm trying to write a function right now, and its purpose is to go through an object's __dict__ and add an item to a dictionary if the item is not a function. Here is my code: def dict_into_list(self): result = {} for each_key,each_item in…
Tyler
  • 305
  • 2
  • 4
  • 13
6
votes
3 answers

Google Chrome Inspecting Issue. Not showing CSS paths for local files

I am having very unexpected problem on my Google Chrome inspector today. When I was inspecting my local HTML files I noticed I was unable to see from which css file, my classes were coming from. It's very strange because it's always showed it…
Raihan
  • 2,491
  • 3
  • 19
  • 34
6
votes
2 answers

Python inspect.getargspec with built-in function

I'm trying to figure out the arguments of a method retrieved from a module. I found an inspect module with a handy function, getargspec. It works for a function that I define, but won't work for functions from an imported module. import math,…
PeetWc
  • 124
  • 2
  • 4
5
votes
2 answers

Python inspect.getmembers does not return the actual function when used with decorators

I have three python functions: def decorator_function(func) def wrapper(..) return func(*args, **kwargs) return wrapper def plain_func(...) @decorator_func def wrapped_func(....) inside a module A. Now I want to get all the functions…
Rajat
  • 1,576
  • 1
  • 16
  • 40
5
votes
3 answers

Inspect element without right clicking in Chrome

When I inspect html/css on a website, I usually open the chrome developers panel ctrl+shift+I → right click context menu "inspect" so I can highlight that class however, sometimes I'm trying to inspect an element that is sensitive to "right…
Vincent Tang
  • 2,648
  • 3
  • 28
  • 49
5
votes
1 answer

Inspect InAppBrowser from Chrome devTools

Inside my Cordova mobile app i'm using inAppBrowser to open an external link. From chrome devTools I can open and inspect my app but there's no reference to the new inAppBrowser window. I've tried on safari (for the iOS version of the app) and i…
6160
  • 956
  • 5
  • 14
5
votes
2 answers

How to obtain an array of subclasses in Rails

I have a model object which subclasses ActiveRecord. Additionally, using STI, I have defined subclasses of this object, which define different types and behaviors. The structure looks something like this: class AppModule < ActiveRecord::Base …
Engin Kurutepe
  • 6,604
  • 3
  • 32
  • 63
5
votes
0 answers

What is the difference between stack frame and execution frame?

I'm having trouble understanding the differences between stack frames and execution frames, mostly with respect to the traceback and inspect modules (in Python 3). I thought they were the same but the docs imply they are not as methods of the…
Michael B
  • 259
  • 3
  • 8
5
votes
2 answers

Force show a record in PureScript

Is it possible to force-show (i.e., create a string representation) an arbitrary record in PureScript for debugging purpose regardless of it having a type-class instance for Show? I would like to show the contents of the Pux Event object but it…
Sridhar Ratnakumar
  • 68,948
  • 61
  • 139
  • 172