Next / Previous / Contents / Shipman's homepage

7. Imported modules

deduper
# - - - - -   I m p o r t s

We'll use the Python-3.x-style print() function. Imports from the __future__ module must be done before any other executable statement.

deduper
from __future__ import print_function

The sys module supplies us with command line arguments.

deduper
import sys

We use the standard argparse module to check the command line and print the usage message.

deduper
import argparse

We use the os module for various file system functions.

deduper
import os

The stat module supplies functions used to interpret file information.

deduper
import stat

We use the re (regular expression) module for syntax-checking command line arguments.

deduper
import re

Our cryptographic hash function comes from the hashlib module.

deduper
import hashlib

We use the standard tempfile module to create a named temporary file where the SQLite database will live.

deduper
import tempfile

From the SQLAlchemy package we need several modules: engine to handle database engine connections; schema and types to define our table; orm to define the object-relational mapping; and exc for exception handling.

deduper
from sqlalchemy import engine, schema, types, orm, exc