Modernize code to Python 3.6+ (#1158)

* Compact dict and set building
* Remove redundant parentheses
* Simplify chained conditions
* Change method name to lowercase
* Use triple double quotes for docstrings

Thanks, @eumiro!
This commit is contained in:
Miroslav Šedivý 2020-12-23 18:04:32 +01:00 committed by GitHub
commit a882d67962
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 76 additions and 82 deletions

View file

@ -15,7 +15,7 @@ HASH_BLOCK_SIZE = 1024 * 1024
def inspect_hash(path):
" Calculate the hash of a database, efficiently. "
"""Calculate the hash of a database, efficiently."""
m = hashlib.sha256()
with path.open("rb") as fp:
while True:
@ -28,14 +28,14 @@ def inspect_hash(path):
def inspect_views(conn):
" List views in a database. "
"""List views in a database."""
return [
v[0] for v in conn.execute('select name from sqlite_master where type = "view"')
]
def inspect_tables(conn, database_metadata):
" List tables and their row counts, excluding uninteresting tables. "
"""List tables and their row counts, excluding uninteresting tables."""
tables = {}
table_names = [
r["name"]