C0103 - PyLint Messages - Wikidot
Message
Invalid %s name "%s" Invalid constant name "newline" Invalid variable name "MyVar" Invalid class name "myClass" ...Description
Verbose name: invalid-name
Used when a name doesn't doesn't fit the naming convention associated to its type (constant, variable, class…). This message belongs to the basic checker.
Explanation
PyLint raises this message when an object has a name that doesn't fit the naming convention associated to its object type.
The naming convention is defined with a regular expression, and the naming convention is satisfied if the name matches the regular expression. The regular expression syntax is the normal Python regular expression syntax, as used in Python raw strings (e.g. r"abc").
Options can be used to override the default regular expression associated to each type. The table below lists the types, their associated options, and their default regular expressions.
| Type | Option | Default regular expression |
|---|---|---|
| Argument | argument-rgx | [a-z_][a-z0-9_]{2,30}$ |
| Attribute | attr-rgx | [a-z_][a-z0-9_]{2,30}$ |
| Class | class-rgx | [A-Z_][a-zA-Z0-9]+$ |
| Constant | const-rgx | (([A-Z_][A-Z0-9_]*)|(__.*__))$ |
| Function | function-rgx | [a-z_][a-z0-9_]{2,30}$ |
| Method | method-rgx | [a-z_][a-z0-9_]{2,30}$ |
| Module | module-rgx | (([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$ |
| Variable | variable-rgx | [a-z_][a-z0-9_]{2,30}$ |
| Variable, inline1 | inlinevar-rgx | [A-Za-z_][A-Za-z0-9_]*$ |
In addition, the following options are related to naming conventions:
- The good-names option defines names that are always accepted, even if the regular expression associated to its type does not match.
- The bad-names option defines names that are always rejected (see C0102), even if the regular expression associated to its type matches.
Options that are not really related to naming conventions, but to names:
- The bad-functions option defines the names of built-in functions that should not be used (see W0141).
Being new to pylint, I have a lot to learn.
Please can someone with more experience give me some guidance?
I have a line of code which sets a string variable from a call to a class method. The string is not intended to be modified within the scope of the function.
PRIKEY = p_database.get_key()
I made it upper case because it won't be changed.
C0103 says it doesn't comply with snake_case.
Do I really have to make it PRI_KEY to be snaky enough?
Options Unfold what about simple string variables not intended to be changed byIn Vscode I had the case that this was highlighted for the a perforce connection instance named p4 As this is all over the place and not questioned by anybody I was looking up ways to add this to the accepted names. In the Pylint Args one can add a line like:
--good-names=i,j,p4 Voilà! Options Unfold If you want to add to the good-names byTừ khóa » C0103
-
Error Message "python-pylint 'C0103:Invalid Constant Name"
-
Invalid-name / C0103 - Pylint 2.15.0-dev0 Documentation
-
C0103 Invalid-name — PyCodeQual Documentation
-
C0103 (invalid-name) | Pylint-errors - GitHub Pages
-
PyLint: C0103 (invalid-name) — Ben Horsburgh
-
TotalSeq™-C0103 Anti-mouse/human CD45R/B220 Antibody
-
C0103: Liquid Standard Bag - Picarro, Inc.
-
Cloverpet C0103 Innovative Fashion Bubble Pet Travel Carrier ...
-
MOEA|19900-65-3 - Luminescence Technology Corp.
-
C0103-Jaltest Expert Mode. Calibrations And Modification Of ...
-
C0103 Compressor-HeadSealing - PK-PRO
-
Pylint Report - Silx
-
Error Message "Python-Pylint 'C0103:Invalid Constant ... - ADocLib