A Flake8 plugin to check for files opened without an explicit encoding
Project description
flake8-file-encoding
A Flake8 plugin to check for files opened without an explicit encoding.
Why check for encoding arguments?
If you don't specify an encoding
argument to the
open function, then
Python will use a platform-dependent default encoding—whatever
locale.getpreferredencoding
returns. On many platforms this is
UTF-8, but on a significant minority it
is something different. For example, the default encoding on Japanese Windows
machines is cp932 (Microsoft's version of
Shift-JIS). If you open a UTF-8 file
on such a system but do not specify an encoding, then attempting to read any
multi-byte characters in the file will cause a UnicodeDecodeError.
Installation
pip install flake8-file-encoding
Usage
Once this plugin is installed, Flake8 will check for missing encoding
arguments along with its other checks. No special activation for this plugin is
necessary. For more details on running Flake8, see the
Flake8 documentation.
Errors
Code | Message |
---|---|
FEN001 | open() call has no encoding argument |
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file flake8-file-encoding-0.1.0.tar.gz
.
File metadata
- Download URL: flake8-file-encoding-0.1.0.tar.gz
- Upload date:
- Size: 2.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/0.12.16 CPython/3.7.3 Linux/4.15.0-51-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e35eb7b1497f5ee980a75031fadf566b1c026f9160643ff0e1c43341ccb7908d |
|
MD5 | d1e8ebe461625bf1305d7e080dacc4cb |
|
BLAKE2b-256 | 5130de7e57357f5db90ac2f872021825527cc30ada8d96b830486649c5725ee3 |
File details
Details for the file flake8_file_encoding-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: flake8_file_encoding-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/0.12.16 CPython/3.7.3 Linux/4.15.0-51-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9106c9cc50c200ffc52621325f9463ebac6ee7320fcd3e954c9009e0bd92bcd0 |
|
MD5 | cb5c1ecfe7c29d3171a41244225901bd |
|
BLAKE2b-256 | ccfc19f814ce3d20878d7b951c732d9d0a379a1cea24a87a76ca713909192821 |