Hide warning in PyCharm

Aug. 9, 2016, 12:43 a.m.

Warning: might be referenced before assignment

Use # noinspection PyUnboundLocalVariable, for example:

def get_rate(self, rates, amount):
    for rate_item in rates:
        if amount <= rate_item.amount:
            return rate_item.rate

    # noinspection PyUnboundLocalVariable
    return rate_item.rate

Warning: unexpected argument

Use # noinspection PyArgumentList, for example:

# noinspection PyArgumentList
product = Cloth(product_name='title',product_code='xxx', unit_price=120)

Available identifiers for hiding of warning in PyCharm

In common case, write down # noinspection [warning identifier] before warning row.

# noinspection PyAbstractClass
# noinspection PyArgumentEqualDefault
# noinspection PyArgumentList  # unexpected argument
# noinspection PyAssignmentToLoopOrWithParameter
# noinspection PyAttributeOutsideInit
# noinspection PyAugmentAssignment
# noinspection PyBroadException
# noinspection PyByteLiteral
# noinspection PyCallByClass
# noinspection PyCallingNonCallable
# noinspection PyChainedComparisons
# noinspection PyClassHasNoInit
# noinspection PyClassicStyleClass
# noinspection PyComparisonWithNone
# noinspection PyCompatibility
# noinspection PyDecorator
# noinspection PyDefaultArgument
# noinspection PyDeprecatedModules
# noinspection PyDeprecation
# noinspection PyDictCreation
# noinspection PyDictDuplicateKeys
# noinspection PyDocstring
# noinspection PyDocstringTypes
# noinspection PyExceptClausesOrder
# noinspection PyExceptionInherit
# noinspection PyFromFutureImport
# noinspection PyGlobalUndefined
# noinspection PyInconsistentIndentation
# noinspection PyInitNewSignature
# noinspection PyInterpreter
# noinspection PyListCreation
# noinspection PyMandatoryEncoding
# noinspection PyMethodFirstArgAssignment
# noinspection PyMethodMayBeStatic
# noinspection PyMethodOverriding
# noinspection PyMethodParameters
# noinspection PyMissingConstructor
# noinspection PyNestedDecorators
# noinspection PyNonAsciiChar
# noinspection PyNoneFunctionAssignment
# noinspection PyOldStyleClasses
# noinspection PyPackageRequirements
# noinspection PyPep8
# noinspection PyPep8Naming
# noinspection PyPropertyAccess
# noinspection PyPropertyDefinition
# noinspection PyProtectedMember
# noinspection PyRaisingNewStyleClass
# noinspection PyRedeclaration
# noinspection PyRedundantParentheses
# noinspection PyReturnFromInit
# noinspection PySetFunctionToLiteral
# noinspection PyShadowingBuiltins
# noinspection PyShadowingNames
# noinspection PySimplifyBooleanCheck
# noinspection PySingleQuotedDocstring
# noinspection PyStatementEffect
# noinspection PyStringException
# noinspection PyStringFormat
# noinspection PySuperArguments
# noinspection PyTrailingSemicolon
# noinspection PyTupleAssignmentBalance
# noinspection PyTupleItemAssignment
# noinspection PyTypeChecker
# noinspection PyUnboundLocalVariable  # might be referenced before assignment
# noinspection PyUnnecessaryBackslash
# noinspection PyUnreachableCode
# noinspection PyUnresolvedReferences  # in try block with 'except ImportError' should also be defined in except block
# noinspection PyUnsupportedFeatures
# noinspection PyUnusedLocal

Rate this article

5 from 5 (total 1 rating)

You can send feedback, suggestions or comments on this article using this form:

Fields marked by star ( * ) is required.

Thank you for yor feedback!

Author of Article

The right to use content on this page http://vivazzi.ru/en/it/hide-warning-in-pycharm/:

Permission is granted to copy an content with its author and reference to the original without using the parameter rel="nofollow" in tag <a>. Usage:

Author of Article: Maltsev Artem
Link to article: <a href="http://vivazzi.ru/en/it/hide-warning-in-pycharm/">http://vivazzi.ru/en/it/hide-warning-in-pycharm/</a>

More: Terms of site usage

Related Posts:

Comments: 2

Z
Z

13.01.2018 16:42 #

А как скрыть предупреждения сразу ко всем строкам в модуле?

Reply

Артём Мальцев
Артём Мальцев author

13.01.2018 20:43 #

Здравствуйте, вы можете зайти в меню: File -> Settings и в открывшимся окне перейти на вкладку Editor -> Inspections и снять галочки в нужных пунктах.

Reply

You can leave a comment as an unregistered user. But by registering, you will be able to receive notifications of replies, and also have access to your personal account to view your comments.

To comment in one's own name you should log in or sign up in the usual way or through social networks:

Send

There is no search on this site, so I offer to use usual search engine, for example, Google, adding "vivazzi" after your request.

Try it