Questions tagged [inspection]

111 questions
78
votes
1 answer

What is the meaning of a forward slash "/" in a Python method signature, as shown by help(foo)?

In the signature returned interactively by help(foo), what is the meaning of a /? In [37]: help(object.__eq__) Help on wrapper_descriptor: __eq__(self, value, /) Return self==value. In [55]: help(object.__init__) Help on…
gerrit
  • 24,025
  • 17
  • 97
  • 170
60
votes
9 answers

Ruby equivalent of Python's "dir"?

In Python we can "dir" a module, like this: >>> import re >>> dir(re) And it lists all functions in the module. Is there a similar way to do this in Ruby?
HelpMe
51
votes
5 answers

What does "Can be package local" mean? (IDEA Inspection)

I used IntelliJ for "Inspect Code", and one of its results is:   Problem synopsis      Can be package local (at line 18(public class HeartBeat)) What does it mean, how can I fix it? it whole class is like this: package…
Jerry Z.
  • 2,031
  • 3
  • 22
  • 28
37
votes
6 answers

Google-guava checkNotNull and IntelliJ IDEA's "may produce java.lang.NullPointerException"

Is there any way to suppress this warning: MyClass object = null; /*Some code that 'might' set this object but I know it will*/ Preconditions.checkNotNull(object); //when "assert object != null" is used here no warning is…
Sebastian
  • 663
  • 1
  • 7
  • 20
34
votes
3 answers

How do I get the value and type of the current exception in C++ using gdb?

gdb allows one to catch exceptions when they're thrown, and when they're caught. But sometimes the line an exception is thrown has no symbols, or a breakpoint is triggered during exception handling. How do I inspect the value of the current…
Matt Joiner
  • 112,946
  • 110
  • 377
  • 526
32
votes
2 answers

hide Intellij Idea yellow light bulb

Is there a way to hide yellow light bulb, which greatly annoys me showing on every line. I don't want to disable any inspections. I just want to hide yellow light bulb. I'm trying to switch from eclipse (not the first time) and this is one of the…
user1194528
  • 395
  • 1
  • 4
  • 10
30
votes
4 answers

Is it possible to recover the name of the function from within the function in scala?

I'd like to do something like def getMeASammy() {println "getMeASammy"} def getMeADrink() {println "getMeADrink"} def getMeASub() {println "getMeASub"} But, I don't want to explicitly type out the name of the function.
Jija
  • 995
  • 8
  • 13
20
votes
5 answers

Inspect the names/values of arguments in the definition/execution of a JavaScript function

I'm looking to do the equivalent of Python's inspect.getargspec() in Javascript. I do know that you can get the arguments list from a Javascript function, but what I'm really looking for is the names of the arguments from the originally defined…
clemesha
  • 1,908
  • 2
  • 12
  • 12
20
votes
6 answers

Python: determine actual current module (not __main__)

I'm trying to determine the actual current module of a function (as seen if imported from elsewhere), even if the current module is the "top level scripting environment" __main__. It may sound like a weird thing to do, but the background is that I…
soramimo
  • 1,296
  • 1
  • 13
  • 17
17
votes
5 answers

In Python, how do I get the list of classes defined within a particular file?

If a file myfile.py contains: class A(object): # Some implementation class B (object): # Some implementation How can I define a method so that, given myfile.py, it returns [A, B]? Here, the returned values for A and B can be either the name of…
Eric McLachlan
  • 3,132
  • 2
  • 25
  • 37
15
votes
3 answers

Can't get argspec for Python callables?

I'm playing with Python callable. Basically you can define a python class and implement __call__ method to make the instance of this class callable. e.g., class AwesomeFunction(object): def __call__(self, a, b): return a+b Module…
EnToutCas
  • 1,297
  • 2
  • 15
  • 20
14
votes
3 answers

Using opencv matchtemplate for blister pack inspection

I am doing a project in which I have to inspect pharmaceutical blister pack for missing tablets. I am trying to use opencv's matchTemplate function. Let me show the code and then some results. int match(string filename, string templatename) { …
vuanhtung2004
  • 171
  • 1
  • 1
  • 7
13
votes
3 answers

Django: inspect queryset to get applied filters

Is there a way to inspect a queryset and get info about which filters/exclude have been applied? I need it for debugging: I cannot understand why my queryset excludes some data...
Don
  • 16,928
  • 12
  • 63
  • 101
12
votes
2 answers

How to get arguments list of a built-in Python class constructor?

I'm trying to use the inspect module, however it seems I can't use it on a built-in (native?) class, or else I misunderstood. I'm using Python 2.7 and tried with Python 3.2. This is working: >>> import inspect >>> class C: ... def…
Julian Bilcke
  • 309
  • 1
  • 4
  • 15
12
votes
3 answers

Turn off unused code warning for public functions in IntelliJ

Eclipse was smart about this; IntelliJ not yet. Of course if a function is unused (and untested, I guess I should feel bad for that - even if it's just returning a simple variable, or implementing someone else's interface) but public, it may be used…
djechlin
  • 59,258
  • 35
  • 162
  • 290
1
2 3 4 5 6 7 8