mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
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:
parent
90eba4c3ca
commit
a882d67962
19 changed files with 76 additions and 82 deletions
|
|
@ -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"]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue