title: How to run code at static-type checking time
body: <p>I wish to run code at the time code is inspected by the interpreter (preferably PyCharm but mypy related answers or others are also fine). The code I want to run is a signature-altering code such that the IDE will better show dynamically added members, or signatures.</p>
  <p>In other words, is there some reserved keyword, or <code>__name__</code> that allows something like the following:</p>
  <pre class="lang-py prettyprint-override"><code># &lt;code&gt;
  
  if __name__ == 'inspection':
      function.__signature__ = ...
  
  # &lt;code&gt;
  </code></pre>
  <p><strong>Edit:</strong> More specifically, given a function <code>f(a, b)</code>, I wish to have it wrapped with a wrapper function</p>
  <pre><code>def g(*args, **kwargs):
      print(args)
      f(*args, **kwargs)
  </code></pre>
  <p>such that <code>g</code> will have the same signature in PyCharm. <code>functools.wraps</code> doesn't work.</p>