def datastream(): record = { "customer": str(barnum.create_name()[0]), "saleid": str(uuid.uuid4())[24:], "timestamp": str(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time.time()))), "coffee": random.choice(["Flat White","Americano","Macchiato","Cappuccino","Latte","Mocha","Cold Brew"]), "milk": random.choice(["Full Cream","Skinny","Soy","Almond","Oat"]), "size":random.choice(["Small","Regular","Large"]), "qty": random.choice([1, 1, 2, 2, 3, 4]) } print("Sales Id:", record["saleid"], " Timestamp :", record["timestamp"], " Customer:",record["customer"], " Coffee:", record["coffee"], " Milk:", record["milk"], " Size:",record["size"], "Qty:", record["qty"]) return record
def test_register(self): allow_flash(self.driver, yaml_utils.get("constant.yaml", "host")) username = barnum.create_name(False).lower() email = barnum.create_email() self.register_page.get(url_regerister) self.register_page.read_law() self.register_page.input_info(username, "123456", email) self.register_page.submit() self.register_page.upload_icon(autoitExe_file) self.register_page.skip() self.register_page.skip() self.register_page.skip() self.register_page.toProfile() result = self.register_page.get_name() self.assertEqual(result, username)
def generate(): record_list = [] meter_list = load_db() if len(meter_list) == 0: print('ERROR - empty file!!!!!!!') else: for meter in meter_list: # Fullname name_tuple = barnum.create_name() fullname = name_tuple[0] + ' ' + name_tuple[1] # Zip, city, state zip_tuple = barnum.create_city_state_zip() zipcode = zip_tuple[0] city = zip_tuple[1] state = zip_tuple[2] # House no. and street street = barnum.create_street() # Phone no. phone = barnum.create_phone() # create and print cis data record cis_data_row = [ str(uuid.uuid4()), fullname, zipcode, city, state, street, phone, meter ] print(cis_data_row) record_list.append(cis_data_row) write('cis_data.csv', record_list)
try: (zipcode, city, state) = barnum.create_city_state_zip() for j in range(0, 5): location = geolocator.geocode("%s, %s %s, USA" % (city, state, zipcode)) if location != None: rlocation = geolocator.reverse( "%s, %s" % (location.latitude, location.longitude)) print rlocation.address[-3:] if rlocation.address[-3:] == "USA": break print ': %s, %s, %s' % (zipcode, city, state) print ': %s' % rlocation print "." if location != None: name = barnum.create_name() now = datetime.utcnow() then = now - timedelta(2 * 365) when = random_date(then, now) birthday = barnum.create_birthday() document = { "_id": create_object_id(when), "Name": ' '.join(name), "Address": { "Street": barnum.create_street(), "City": city, "State": state, "Zip": zipcode, "Location": { "type": "Point",
def generate_patients(count=1): random.seed() patients = [] for x in range(0, count): sex = 'Male' if random.randint(0, 1) % 2 else 'Female' fname, lname = barnum.create_name(gender=sex) mname = barnum.create_name(False, sex) if random_truth(0.27) == 1 else '' street, city, state, postal_code = generate_address() dob = barnum.create_birthday(1, 100) patient = { 'title': generate_title(sex), 'language': '', 'financial': '', 'fname': fname, 'lname': lname, 'mname': mname, 'DOB': dob.strftime("%Y-%m-%d"), 'street': street, 'postal_code': postal_code, 'city': city, 'state': state, 'country_code': 'US', 'drivers_license': random_drivers_license(lname[0], int(dob.strftime("%y"))), 'ss': random.randint(100000000, 999999999), 'occupation': barnum.create_job_title(), 'phone_home': barnum.create_phone(postal_code), 'phone_biz': barnum.create_phone(postal_code), 'phone_contact': barnum.create_phone(postal_code), 'phone_cell': barnum.create_phone(postal_code), 'pharmacy_id': 1, 'status': '', 'contact_relationship': '', 'date': barnum.create_date(past=True).strftime("%Y-%m-%d"), 'sex': sex, 'referrer': '', 'referrerID': '', 'providerID': 0, 'ref_providerID': 0, 'email': barnum.create_email(name=(fname, lname)), 'email_direct': '', 'ethnoracial': '', 'race': '', 'ethnicity': '', 'religion': '', 'interpretter': '', 'migrantseasonal': '', 'family_size': random.randint(1, 8), 'monthly_income': '', 'billing_note': '', 'homeless': '', 'financial_review': barnum.create_date(past=True).strftime("%Y-%m-%d"), 'pubpid': '', 'pid': str(random.randint(1, 99999999999)), 'hipaa_mail': 'yes' if random_truth(0.90) == 1 else 'no', 'hipaa_voice': 'yes' if random_truth(0.75) == 1 else 'no', 'hipaa_notice': 'yes' if random_truth(0.93) == 1 else 'no', 'hipaa_message': 'yes' if random_truth(0.90) == 1 else 'no', 'hipaa_allowsms': 'yes' if random_truth(0.50) == 1 else 'no', 'hipaa_allowemail': 'yes' if random_truth(0.70) == 1 else 'no', } patients.append(patient) return patients
business_accounts.append(account) current_time = date_bank_created accounts = [] transactions = [] compromised_indexes = [] compromiseable_attributes = ['identification', 'phone', 'location'] while len(transactions) < T: current_time += random.random() * date_bank_created / T # ######################### Personal Accounts ######################## if len(accounts) < P and random.random() < 0.1: try: account = Account( type_='personal', created=current_time, name=' '.join(barnum.create_name()), coordinates=coordinates, ) except Exception: # barnum has internal bugs continue account.location = random.choice(business_accounts).location d = 0.4 # geographical coordinates maximal offset account.location[-1] += random.random() * d - d / 2 account.location[-2] += random.random() * d - d / 2 # modify created account with a compromised field if compromised_indexes and random.random() < 0.05: attribute = random.choice(compromiseable_attributes) compromised_index = random.choice(compromised_indexes) compromised_account = accounts[compromised_index]
into = 30000 city = [] name = [] surname = [] df = pd.DataFrame({ 'ID': [], 'IDbussines': [], 'Name': [], 'Surname': [], 'Age': [], 'Fanpages': [], 'Origin': [] }) for i in range(viewers): zip, city, state = barnum.create_city_state_zip() name, surname = barnum.create_name() df = df.append( { 'ID': '%.12g' % i, 'IDbussines': '%.12g' % rnd.randint(10000000000, 99999999999), 'Name': name, 'Surname': surname, 'Age': barnum.create_birthday(10, 80), 'Fanpages': '%.12g' % rnd.randint(0, 5), 'Origin': city }, ignore_index=True) df.to_csv("viewers.csv", index=False) '''df = pd.DataFrame({'ID': [], 'ViewerID': [], 'PostID': [], 'Like': [], 'Comment':[], 'Share': []}) for i in range(activities):