def create_one(self):
		palindrome = ""
		for i in range(self.generated_chars_num):
			palindrome = palindrome + random.choice(letters.lower())
		for i in reversed(range(self.duplicated_chars_num)):
			palindrome = palindrome + palindrome[i]
		return palindrome
fake = Faker()

fixtures_dir = here(__file__, 'fixtures')
thumbnail = open('{}/thumbnail.txt'.format(fixtures_dir)).read()
IMG_URL = 'https://www.propublica.org/images/ngen/gypsy_og_image/20150520-group-home-hearing-1200x630.jpg'

IMPACT_TAG_NAMES = [
    'Media pickup', 'Media social share', 'Indv. social share',
    'Comm. social share'
]
SUBJECT_TAG_NAMES = ['Environment', 'Money & politics', 'Government', 'Health']

AUTHORS = ['Michael Keller', 'Brian Abelson', 'Merlynne Jones']

# a lookup of letters to their number
letters_to_int = dict(zip(list(set(letters.lower())), range(1, 27)))


def random_date(n1, n2):
    dt = datetime.utcnow() - timedelta(days=choice(range(n1, n2)))
    dt += timedelta(hours=random_int(0, 24))
    return dt


def random_color():
    r = lambda: random.randint(0, 255)
    return '#%02X%02X%02X' % (r(), r(), r())


def random_authors(n):
    return [fake.name() for _ in range(1, choice(range(2, n)))]
Exemple #3
0
 def __init__(self):
     with open(filename, 'r') as f:
         self.names = sorted(i.strip('"').lower()
                             for i in f.read().split(','))
     self.letters = sorted(list(set(letters.lower())))
# fake factory
fake = Faker()

fixtures_dir = here(__file__, 'fixtures')
thumbnail = open('{}/thumbnail.txt'.format(fixtures_dir)).read()
IMG_URL = 'https://www.propublica.org/images/ngen/gypsy_og_image/20150520-group-home-hearing-1200x630.jpg'

IMPACT_TAG_NAMES = ['Media pickup', 'Media social share',
                    'Indv. social share', 'Comm. social share']
SUBJECT_TAG_NAMES = ['Environment', 'Money & politics', 'Government', 'Health']


AUTHORS = ['Michael Keller', 'Brian Abelson', 'Merlynne Jones']

# a lookup of letters to their number
letters_to_int = dict(zip(list(set(letters.lower())), range(1, 27)))


def random_date(n1, n2):
    dt = datetime.utcnow() - timedelta(days=choice(range(n1, n2)))
    dt += timedelta(hours=random_int(0, 24))
    return dt


def random_color():
    r = lambda: random.randint(0, 255)
    return '#%02X%02X%02X' % (r(), r(), r())


def random_authors(n):
    return [fake.name() for _ in range(1, choice(range(2, n)))]
Exemple #5
0
def genstr(n):
    s = ''
    for i in range(n):
        s += random.choice(letters.lower())
    return s
	def create_random_string(self):
		string = ""
		for i in range(self.length):
			string = string + random.choice(letters.lower())
		return string