0

Throughout my code I have numerous places where I want to disable PyCharm code inspection for this one instance. How to do it in code instead of in IDE as answer to similar question suggests?

sophros
  • 14,672
  • 11
  • 46
  • 75
  • 1
    Do you [always](https://stackoverflow.com/questions/54009778/what-does-underscore-in-a-number-mean) post a [question](https://stackoverflow.com/questions/48440063/an-issue-with-kiwi-tcms) then immediately [answer](https://stackoverflow.com/questions/46099857/numpy-std-on-memmapped-ndarray-fails-with-memoryerror) it yourself and [accept](https://stackoverflow.com/questions/54314661/how-to-avoid-line-continuations-in-python-imports) as the [answer](https://stackoverflow.com/questions/53584341/len-throws-with-dict-keyiterator-has-no-len-when-calculating-outgoing-and-in) seconds later?? – Nordle Jan 29 '19 at 14:41
  • No. Just sharing the knowledge which appeared to me to be missing on SO. – sophros Jan 29 '19 at 14:42
  • 1
    Possible duplicate of [Dismiss PyCharm code inspection warning for particular line of code](https://stackoverflow.com/questions/20787218/dismiss-pycharm-code-inspection-warning-for-particular-line-of-code) – Eskapp Jan 30 '19 at 13:56
  • Not missing: https://stackoverflow.com/questions/20787218/dismiss-pycharm-code-inspection-warning-for-particular-line-of-code which you knew as you edited the question yourself. It has an accepted answer and a comment to it that is the answer you wrote. Not sure that this is fair behavior. – Eskapp Jan 30 '19 at 13:59
  • I can't see any comment of mine under the accepted answer of the question you referenced. Also, even though the answer was accepted it was missing information that I am providing in my answer below about types of inspections that the other answer is missing. What do you see as unfair? What would your recommend to do in such a case? – sophros Jan 30 '19 at 14:42

1 Answers1

0

To suppress PyCharm code inspections for a particular line of code you can use the following construct:

# noinspection INSPECTION_NAME
your_line_of_code_to_suppress

where the name of the inspection you can take from the list of inspection names (they are pretty descriptive).

sophros
  • 14,672
  • 11
  • 46
  • 75