Coder Social home page Coder Social logo

offermann / elizabeth Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lk-geimfari/mimesis

0.0 1.0 0.0 3.38 MB

Elizabeth is a library to generate dummy data. It's very useful when you need to bootstrap your database.

License: MIT License

Python 99.96% Shell 0.04%

elizabeth's Introduction

Elizabeth

Build Status Documentation Status PyPI version HitCount Code Health Codacy Badge


Elizabeth is a library to generate dummy data. It's very useful when you need to bootstrap your database. Elizabeth doesn't have any dependencies.

At this moment a library has 15 supported locales:

F ๐Ÿ‡ฉ๐Ÿ‡ฐ ๐Ÿ‡ฉ๐Ÿ‡ช ๐Ÿ‡บ๐Ÿ‡ธ ๐Ÿ‡ช๐Ÿ‡ธ ๐Ÿ‡ซ๐Ÿ‡ฎ ๐Ÿ‡ซ๐Ÿ‡ท ๐Ÿ‡ฎ๐Ÿ‡ธ ๐Ÿ‡ฎ๐Ÿ‡น ๐Ÿ‡ณ๐Ÿ‡ฑ ๐Ÿ‡ณ๐Ÿ‡ด ๐Ÿ‡ธ๐Ÿ‡ช ๐Ÿ‡ท๐Ÿ‡บ ๐Ÿ‡ต๐Ÿ‡น ๐Ÿ‡ง๐Ÿ‡ท ๐Ÿ‡ต๐Ÿ‡ฑ
Code da de en es* fi* fr is* it nl* no sv ru pt* pt-br pl

* - not completely

Documentation

Elizabeth is a pretty simple library and all you need to start is the small documentation. See Elizabeth's Sphinx-generated documentation here: http://elizabeth.readthedocs.io/en/latest/

Installation

โžœ  ~ git clone https://github.com/lk-geimfari/elizabeth.git
โžœ  ~ cd elizabeth/
โžœ  ~ python3 setup.py install

# or

โžœ  ~ pip install elizabeth

Testing

โžœ  ~ cd elizabeth/
โžœ  ~ python3 -m unittest discover tests

# or
โžœ  ~ ./run_tests.sh

Usage

# ...
# Model from some Flask project.

class Patient(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    email = db.Column(db.String(120), unique=True)
    phone_number = db.Column(db.String(25))
    full_name = db.Column(db.String(100))
    gender = db.Column(db.String(64))
    nationality = db.Column(db.String(64))
    weight = db.Column(db.String(64))
    height = db.Column(db.String(64))
    blood_type = db.Column(db.String(64))

    def __init__(self, **kwargs):
        super(Patient, self).__init__(**kwargs)

    @staticmethod
    def _bootstrap(count=2000):
        from elizabeth import Personal

        person = Personal('en')
        for _ in range(count):
            patient = Patient(email=person.email(),
                              phone_number=person.telephone(),
                              full_name=person.full_name(gender='female'),
                              gender=person.gender(),
                              nationality=person.nationality(),
                              weight=person.weight(),
                              height=person.height(),
                              blood_type=person.blood_type()
                              )
        try:
            db.session.add(patient)
        except Exception:
            db.session.commit()

When you use only one locale, then you can use the Generic class.

from elizabeth import Generic

el = Generic('en')


def patient(gender='female'):
    patient_card = {
        'full_name': el.personal.full_name(sex),
        'gender': el.personal.gender(gender=gender),
        'blood_type': el.person.blood_type(),
        'birthday': el.datetime.birthday()
    }
return patient_card

Available data providers

Provider Description
Address Address data (street name, street suffix etc.)
Business Business data (company, company_type, copyright etc.)
Code Codes (ISBN, EAN, IMEI etc.).
ClothingSizes Clothing sizes (international sizes, european etc.)
Datetime Datetime (day_of_week, month, year etc.)
Development Data for developers (version, programming language etc.)
File File data (extension etc.)
Food Information on food (vegetables, fruits, measurements etc.)
Personal Personal data (name, surname, age, email etc.)
Text Text data (sentence, title etc.)
Transport Dummy data about transport (truck model, car etc.)
Network Network data (IPv4, IPv6, MAC address) etc
Science Scientific data (scientist, math_formula etc.)
Internet Dummy internet data (facebook, twitter etc.)
Hardware The data about the hardware (resolution, cpu, graphics etc.)
Numbers Numerical data (floats, primes, digit etc.)
Generic All at one

Examples

  • flask_church - An extension for Flask based on Elizabeth.
  • presturinn - This is a fake API based on Falcon and Elizabeth v0.2.0 .

Contributing

Your contributions are always welcome! Please take a look at the contribution guidelines first. Here you can look a list of contributors

Disclaimer

The author does not assume any responsibility for how you will use this library and how you will use data generated with this library. This library is designed only for developers and only with good intentions. Do not use the data generated with elizabeth for illegal purposes.

Licence

MIT License

elizabeth's People

Contributors

lk-geimfari avatar battleroid avatar sobolevn avatar auyer avatar bderusha avatar fliegendewurst avatar costava avatar jeromechrist avatar mrcrilly avatar sambuddhabasu avatar ranwise avatar

Watchers

Philipp Offermann avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.