cfel-pylint-checkers
Installation
Just pip install cfel-pylint-checkers should suffice. Then you can enable the appropriate checkers as plugins by editing your .pylintrc file, extending the load-plugins line. For example:
load-plugins=cfel_pylint_checkers.no_direct_dict_access,cfel_pylint_checkers.tango_command_dtype
Checkers
no-direct-dict-access
Enable with:
load-plugins=cfel_pylint_checkers.no_direct_dict_access
This disallows the use of dictionary access using the [] operator for reading. Meaning, this is no longer allowed:
mydict = { "foo": 3 }
print(mydict["bar"])
As you can see, this code produces an error, since we’re accessing "bar" but the mydict dictionary only contains the key "foo". You have to use .get to make this safe:
mydict = { "foo": 3 }
print(mydict.get("bar"))
Which produces None if the key doesn’t exist. You can even specify a default value:
mydict = { "foo": 3 }
print(mydict.get("bar", 0))
Mutating use of operator[] is, of course, still possible. This is fine:
mydict = { "foo": 3 }
mydict["bar"] = 4
tango-command-dtype
Enable with:
load-plugins=cfel_pylint_checkers.tango_command_dtype
This checker tests for various error conditions related to the hardware controls system Tango, specifically its Python adaptation PyTango.
For instance, the following mismatch between the dtype_in of a command and its actual type annotation is caught:
from tango.server import Device, command
class MyDevice(Device):
@command(dtype_in=int)
def mycommand(self, argument: str) -> None:
pass
Metadata
Release files for cfel-pylint-checkers 1.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| cfel_pylint_checkers-1.1.4.tar.gz | 16.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| cfel_pylint_checkers-1.1.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 33.2 kB
Release files / cfel_pylint_checkers-1.1.4.tar.gz
| Download URL | cfel_pylint_checkers-1.1.4.tar.gz |
|---|---|
| Size | 16.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2e00a43e2e1c0eb3b9f0f8db8ff9b078e301334dfb01db9cb25c853133170e2c
|
|
BLAKE2b-256 checksum How to use checksums |
72f1fdc84c844a2844c9d617e07db0a4dab2ded480c644211baa3e2390ae3fd6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.3.2 CPython/3.10.9 Linux/6.1.20
|
Release files / cfel_pylint_checkers-1.1.4-py3-none-any.whl
| Download URL | cfel_pylint_checkers-1.1.4-py3-none-any.whl |
|---|---|
| Size | 17.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
42c692d37b9065f39dd317a258b83a81729da89e3e6e60bdc0ca808387e24550
|
|
BLAKE2b-256 checksum How to use checksums |
41365b9539975d9804abaa7a7cd620f42cbfc064dca0ccb2bdb7de603f8c5f65
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.3.2 CPython/3.10.9 Linux/6.1.20
|