diff options
Diffstat (limited to 'coverage')
-rw-r--r-- | coverage/annotate.py | 2 | ||||
-rw-r--r-- | coverage/inorout.py | 2 | ||||
-rw-r--r-- | coverage/misc.py | 6 | ||||
-rw-r--r-- | coverage/phystokens.py | 4 | ||||
-rw-r--r-- | coverage/plugin.py | 4 | ||||
-rw-r--r-- | coverage/sqldata.py | 4 |
6 files changed, 11 insertions, 11 deletions
diff --git a/coverage/annotate.py b/coverage/annotate.py index a6ee4636..9ca1b80a 100644 --- a/coverage/annotate.py +++ b/coverage/annotate.py @@ -73,7 +73,7 @@ class AnnotateReporter: else: dest_file = fr.filename + ",cover" - with open(dest_file, 'w', encoding='utf8') as dest: + with open(dest_file, 'w', encoding='utf-8') as dest: i = 0 j = 0 covered = True diff --git a/coverage/inorout.py b/coverage/inorout.py index 75b0a9cc..496ced35 100644 --- a/coverage/inorout.py +++ b/coverage/inorout.py @@ -432,7 +432,7 @@ class InOrOut: # No point tracing a file we can't later write to SQLite. try: - filename.encode("utf8") + filename.encode("utf-8") except UnicodeEncodeError: return "non-encodable filename" diff --git a/coverage/misc.py b/coverage/misc.py index 30b75744..9c414d88 100644 --- a/coverage/misc.py +++ b/coverage/misc.py @@ -236,15 +236,15 @@ class Hasher: def update(self, v): """Add `v` to the hash, recursively if needed.""" - self.hash.update(str(type(v)).encode("utf8")) + self.hash.update(str(type(v)).encode("utf-8")) if isinstance(v, str): - self.hash.update(v.encode('utf8')) + self.hash.update(v.encode("utf-8")) elif isinstance(v, bytes): self.hash.update(v) elif v is None: pass elif isinstance(v, (int, float)): - self.hash.update(str(v).encode("utf8")) + self.hash.update(str(v).encode("utf-8")) elif isinstance(v, (tuple, list)): for e in v: self.update(e) diff --git a/coverage/phystokens.py b/coverage/phystokens.py index f06c0c27..b6b08d00 100644 --- a/coverage/phystokens.py +++ b/coverage/phystokens.py @@ -201,8 +201,8 @@ def compile_unicode(source, filename, mode): Python 2's compile() builtin has a stupid restriction: if the source string is Unicode, then it may not have a encoding declaration in it. Why not? - Who knows! It also decodes to utf8, and then tries to interpret those utf8 - bytes according to the encoding declaration. Why? Who knows! + Who knows! It also decodes to utf-8, and then tries to interpret those + utf-8 bytes according to the encoding declaration. Why? Who knows! This function neuters the coding declaration, and compiles it. diff --git a/coverage/plugin.py b/coverage/plugin.py index 5b38e336..8d149af9 100644 --- a/coverage/plugin.py +++ b/coverage/plugin.py @@ -359,12 +359,12 @@ class FileReporter: Returns a Unicode string. The base implementation simply reads the `self.filename` file and - decodes it as UTF8. Override this method if your file isn't readable + decodes it as UTF-8. Override this method if your file isn't readable as a text file, or if you need other encoding support. """ with open(self.filename, "rb") as f: - return f.read().decode("utf8") + return f.read().decode("utf-8") def lines(self): """Get the executable lines in this file. diff --git a/coverage/sqldata.py b/coverage/sqldata.py index 108a25ef..c4e950d3 100644 --- a/coverage/sqldata.py +++ b/coverage/sqldata.py @@ -349,7 +349,7 @@ class CoverageData(SimpleReprMixin): if self._debug.should("dataio"): self._debug.write(f"Dumping data from data file {self._filename!r}") with self._connect() as con: - return b"z" + zlib.compress(con.dump().encode("utf8")) + return b"z" + zlib.compress(con.dump().encode("utf-8")) @contract(data="bytes") def loads(self, data): @@ -373,7 +373,7 @@ class CoverageData(SimpleReprMixin): raise CoverageException( f"Unrecognized serialization: {data[:40]!r} (head of {len(data)} bytes)" ) - script = zlib.decompress(data[1:]).decode("utf8") + script = zlib.decompress(data[1:]).decode("utf-8") self._dbs[threading.get_ident()] = db = SqliteDb(self._filename, self._debug) with db: db.executescript(script) |