File: example_data.py

package info (click to toggle)
python-pyface 8.0.0-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 13,944 kB
  • sloc: python: 54,107; makefile: 82
file content (98 lines) | stat: -rw-r--r-- 3,266 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# (C) Copyright 2005-2023 Enthought, Inc., Austin, TX
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in LICENSE.txt and may be redistributed only under
# the conditions described in the aforementioned license. The license
# is also available online at http://www.enthought.com/licenses/BSD.txt
#
# Thanks for using Enthought open source!

""" Example data generation functions

This module provides some routines for randomly generating data for use
in examples.
"""

from random import choice, randint

from pyface.color import Color


male_names = [
    'Michael', 'Edward', 'Timothy', 'James', 'George', 'Ralph', 'David',
    'Martin', 'Bryce', 'Richard', 'Eric', 'Travis', 'Robert', 'Bryan',
    'Alan', 'Harold', 'John', 'Stephen', 'Gael', 'Frederic', 'Eli', 'Scott',
    'Samuel', 'Alexander', 'Tobias', 'Sven', 'Peter', 'Albert', 'Thomas',
    'Horatio', 'Julius', 'Henry', 'Walter', 'Woodrow', 'Dylan', 'Elmer',
]

female_names = [
    'Leah', 'Jaya', 'Katrina', 'Vibha', 'Diane', 'Lisa', 'Jean', 'Alice',
    'Rebecca', 'Delia', 'Christine', 'Marie', 'Dorothy', 'Ellen', 'Victoria',
    'Elizabeth', 'Margaret', 'Joyce', 'Sally', 'Ethel', 'Esther', 'Suzanne',
    'Monica', 'Hortense', 'Samantha', 'Tabitha', 'Judith', 'Ariel', 'Helen',
    'Mary', 'Jane', 'Janet', 'Jennifer', 'Rita', 'Rena', 'Rianna',
]

all_names = male_names + female_names

family_names = [
    'Jones', 'Smith', 'Thompson', 'Hayes', 'Thomas', 'Boyle', "O'Reilly",
    'Lebowski', 'Lennon', 'Starr', 'McCartney', 'Harrison', 'Harrelson',
    'Steinbeck', 'Rand', 'Hemingway', 'Zhivago', 'Clemens', 'Heinlien',
    'Farmer', 'Niven', 'Van Vogt', 'Sturbridge', 'Washington', 'Adams',
    'Bush', 'Kennedy', 'Ford', 'Lincoln', 'Jackson', 'Johnson',
    'Eisenhower', 'Truman', 'Roosevelt', 'Wilson', 'Coolidge', 'Mack',
    'Moon', 'Monroe', 'Springsteen', 'Rigby', "O'Neil", 'Philips',
    'Clinton', 'Clapton', 'Santana', 'Midler', 'Flack', 'Conner', 'Bond',
    'Seinfeld', 'Costanza', 'Kramer', 'Falk', 'Moore', 'Cramdon', 'Baird',
    'Baer', 'Spears', 'Simmons', 'Roberts', 'Michaels', 'Stuart',
    'Montague', 'Miller',
]

favorite_colors = [
    Color(hsv=(hue/100, 1.0, 1.0))
    for hue in range(100)
]


def any_name():
    return choice(all_names)


def family_name():
    return choice(family_names)


def age():
    return randint(15, 72)


def favorite_color():
    return choice(favorite_colors)


def street():
    number = randint(11, 999)
    text_1 = choice([
        'Spring', 'Summer', 'Moonlight', 'Winding', 'Windy', 'Whispering',
        'Falling', 'Roaring', 'Hummingbird', 'Mockingbird', 'Bluebird',
        'Robin', 'Babbling', 'Cedar', 'Pine', 'Ash', 'Maple', 'Oak', 'Birch',
        'Cherry', 'Blossom', 'Rosewood', 'Apple', 'Peach', 'Blackberry',
        'Strawberry', 'Starlight', 'Wilderness', 'Dappled', 'Beaver', 'Acorn',
        'Pecan', 'Pheasant', 'Owl'
    ])
    text_2 = choice([
        'Way', 'Lane', 'Boulevard', 'Street', 'Drive', 'Circle', 'Avenue',
        'Trail',
    ])
    return '%d %s %s' % (number, text_1, text_2)


def city():
    return choice(['Boston', 'Bristol', 'Cambridge', 'Newcastle', 'York'])


def country():
    return choice(['Canada', 'USA', 'UK'])