pokequiz/Question.py
def randomRegion():
    """Creates and returns a random Region object."""
    # Establish connection to SQLite database
    conn = sqlite3.connect(db, detect_types=sqlite3.PARSE_DECLTYPES)
    cur = conn.cursor()

    # Get random Region
    cur.execute('SELECT * FROM regions ORDER BY RANDOM() LIMIT 1;')
    sel = list(cur.fetchone())
    # Parse towns list
    sel[2] = json.loads(sel[2])
    # Parse landmarks list
    sel[3] = json.loads(sel[3])

    # Close connection
    conn.close()

    return Region(*sel)
Creates and returns a random Region object.
Creates and returns a random Region object.
Creates and returns a random Region object .
def randomRegion():
    conn = sqlite3.connect(db, detect_types=sqlite3.PARSE_DECLTYPES)
    cur = conn.cursor()
    cur.execute('SELECT * FROM regions ORDER BY RANDOM() LIMIT 1;')
    sel = list(cur.fetchone())
    sel[2] = json.loads(sel[2])
    sel[3] = json.loads(sel[3])
    conn.close()
    return Region(*sel)
def randomRegion ( ) : conn = sqlite3 . connect ( db , detect_types = sqlite3 . PARSE_DECLTYPES ) cur = conn . cursor ( ) cur . execute ( 'SELECT * FROM regions ORDER BY RANDOM() LIMIT 1;' ) sel = list ( cur . fetchone ( ) ) sel [ 2 ] = json . loads ( sel [ 2 ] ) sel [ 3 ] = json . loads ( sel [ 3 ] ) conn . close ( ) return Region ( * sel )
Creates and returns a random Region object.
Creates and returns a random Region object .
"""Creates and returns a random Region object.""" # Establish connection to SQLite database # Get random Region # Parse towns list # Parse landmarks list # Close connection