예제 #1
0
def likeIncrimination():
    likeButton = chromeBrowser.find_element_by_id('like-4983e4426918150342349d2f8dbc5de7')
    likeButton.click()

    sleep(0.5)

    name = chromeBrowser.find_element_by_name('name')
    company = chromeBrowser.find_element_by_name('company')
    phone = chromeBrowser.find_element_by_name('phone')
    email = chromeBrowser.find_element_by_name('email')

    person = RussianNames(patronymic=False).get_person()
    personSurname = person.split()[1]
    personSurnameEng = pytils.translit.translify(personSurname.replace('\'', '').lower())


    samplePhone = phoneCreator()
    name.send_keys(person)
    company.send_keys('РГУПС')
    phone.send_keys(samplePhone)
    email.send_keys(personSurnameEng + '@mail.ru')

    submit = chromeBrowser.find_element_by_css_selector('button.button')
    submit.click()

    sleep(0.5)

    likeButton = chromeBrowser.find_element_by_id('like-4983e4426918150342349d2f8dbc5de7')
    likeButton.click()
    print(f'Лайкнул: {person}, РГУПС, {samplePhone}, {personSurnameEng}@mail.ru')
    chromeBrowser.delete_all_cookies()
    chromeBrowser.refresh()
예제 #2
0
def test_formats():
    for out_format in ('dict', 'list', 'tuple', 'str'):
        names = RussianNames(count=10,
                             transliterate=True,
                             name_max_len=10,
                             output_type=out_format,
                             name_reduction=True)
        batch = names.get_batch()
        assert len(batch) == 10
예제 #3
0
def test_error_output_type():
    with pytest.raises(ValueError):
        names = RussianNames(count=10,
                             transliterate=True,
                             name_max_len=10,
                             output_type='file',
                             surname=False,
                             name_reduction=True)
        batch = names.get_batch()
        name, patronym = batch[0].split(' ')
        assert len(name) == 10
        assert len(batch) == 10
예제 #4
0
    def sportsman(self, locale=None):
        gender_dict = {"name_female": 0., "name_male": 1.}
        gender = choice(["name_female", "name_male"])
        season = choice(["summer", "winter"])
        if locale in [None, "en_US"]:
            locale = "en_US"
            name = getattr(self.fake, gender)()
        elif locale == 'ru_TL':
            name = RussianNames(count=1,
                                gender=gender_dict[gender],
                                transliterate=True).get_batch()[0]
        if gender == "name_female":
            height = self.fake.random_int(145, 200)
            weight = self.fake.random_int(45, 85)
        else:
            height = self.fake.random_int(160, 215)
            weight = self.fake.random_int(60, 120)

        return {
            "Name": name,
            "Age": self.fake.random_int(18, 40),
            "Height": height,
            "Weight": weight,
            "Sport": choice(self.sports[season]),
            "Season": season
        }
예제 #5
0
def test_batch():
    batch_size = 10
    batch = RussianNames(gender=0.9,
                         name_max_len=10,
                         count=batch_size,
                         transliterate=True,
                         patronymic_max_len=10,
                         patronymic_reduction=True).get_batch()
    assert len(batch) == batch_size
예제 #6
0
def gen_file(count):
    from russian_names import RussianNames
    from random import randrange

    with open("task3_1.txt", "w") as my_file:
        rn = RussianNames(
            count=count,
            name=False,
            patronymic=False,
        )
        for person in rn:
            print(f"{person} {randrange(10000, 50000)}", file=my_file)
예제 #7
0
    def teacher(self, locale='en_US'):
        if locale in [None, "en_US"]:
            locale = "en_US"
            name = self.fake.name()
        elif locale == 'ru_TL':
            name = RussianNames(count=1, gender=0.5,
                                transliterate=True).get_batch()[0]

        return {
            "Name": name,
            "Faculty": choice(self.faculties),
            "Rank": choice(self.ranks[locale]),
            "Degree": choice(self.degrees[locale])
        }
예제 #8
0
    def student(self, locale='en_US'):
        if locale in [None, "en_US"]:
            locale = "en_US"
            name = self.fake.name()
        elif locale == 'ru_TL':
            name = RussianNames(count=1, gender=0.5,
                                transliterate=True).get_batch()[0]

        return {
            "Name": name,
            "Faculty": choice(self.faculties),
            "Group": self.fake.random_number(digits=3, fix_len=True),
            "AvgScore": self.fake.random_int(1, 10)
        }
예제 #9
0
def test_generator():
    batch_size = 10
    names = RussianNames(count=batch_size,
                         gender=0.2,
                         transliterate=True,
                         surname_max_len=10,
                         patronymic=False,
                         surname_reduction=True,
                         seed=2324)
    names_len = len(names)
    x = 0
    for _ in names:
        x += 1
    assert x == batch_size
    assert names_len == batch_size
예제 #10
0
    def book(self, locale=None, word_list=None):
        if locale in [None, "en_US"]:
            locale = "en_US"
            author = self.fake.name()
        elif locale == 'ru_TL':
            author = RussianNames(count=1, gender=0.5,
                                  transliterate=True).get_batch()[0]
        word_list = word_list if word_list is not None else self.word_list

        return {
            "Author": author,
            "Name": self.fake.sentence(nb_words=3, ext_word_list=word_list),
            "Year": self.fake.random_int(1700, 2020),
            "Pages": self.fake.random_int(50, 5000)
        }
예제 #11
0
    def soldier(self, locale='en_US'):
        if locale in [None, "en_US"]:
            locale = "en_US"
            name = self.fake.name()
        elif locale == 'ru_TL':
            name = RussianNames(count=1, gender=0.9,
                                transliterate=True).get_batch()[0]
        rank_type = choice(["non_officer", "officer"])

        return {
            "Name": name,
            "Rank": choice(self.ranks[locale][rank_type]),
            "Company": self.fake.random_number(digits=5, fix_len=True),
            "Age": self.fake.random_int(18, 55)
        }
예제 #12
0
파일: main.py 프로젝트: atem11/CosmoStars
def main():
    config = configparser.ConfigParser()
    config.read('../../resources/config.ini')
    login = config['DEFAULT']['personal_login']
    password = config['DEFAULT']['personal_password']

    vk_session = vk_api.VkApi(login, password)
    vk_session.auth(token_only=True)
    vk = vk_session.get_api()

    rn = RussianNames(count=10000, patronymic=False, surname=False)
    names_with_repeats = rn.get_batch()
    unique_names = sorted(set(names_with_repeats))

    with open("../../resources/celebrities_id.txt", "w") as file:
        for name in unique_names:
            result = vk.users.search(q=name, sort=0, fields=['verified', 'followers_count'], count=1000)
            for person in result['items']:
                if 'verified' in person and 'followers_count' in person:
                    if person['verified'] == 1 and person['followers_count'] > 100000:
                        file.write(str(person['id']))
                        file.write("\n")
                        print(person['first_name'] + " " + person['last_name'] + " " + str(person['id']))
            print("###########")
예제 #13
0
    def record(self, locale=None):
        if locale in [None, "en_US"]:
            locale = "en_US"
            name = self.fake.name()
            salary = self.fake.random_number(digits=4, fix_len=True)
        elif locale == 'ru_TL':
            name = RussianNames(count=1, gender=0.5,
                                transliterate=True).get_batch()[0]
            salary = self.fake.random_number(digits=5, fix_len=True)

        return {
            "Name": name,
            "Job": self.fake.job(),
            "Project": self.fake.catch_phrase(),
            "Salary": salary
        }
예제 #14
0
    def vehicle(self, locale=None):
        if locale in [None, "en_US"]:
            locale = "en_US"
            name = self.fake.name()
            plate = self.fake.license_plate()
        elif locale == 'ru_TL':
            name = RussianNames(count=1, gender=0.5,
                                transliterate=True).get_batch()[0]
            plate = rstr.xeger(r'[АВЕКМНОРСТУХ]{2}\d{3}[АВЕКМНОРСТУХ]')

        return {
            **self.fake.vehicle_object(),
            **{
                "Plate": plate,
                "Owner": name
            }
        }
예제 #15
0
#!/usr/bin/env python3
from xml.etree import ElementTree
from datetime import datetime, timedelta, date
from russian_names import RussianNames
import random
import math

PEOPLE_COUNT = 500
full_names = tuple(
    map(
        lambda s: s.lower().replace(' ', ''),
        RussianNames(count=PEOPLE_COUNT,
                     name_reduction=True,
                     patronymic=False,
                     transliterate=True)))

INTERVAL_DATES = timedelta(days=365 * 3)
interval_end = date.today()
interval_start = interval_end - INTERVAL_DATES

HEADER = """<?xml version="1.0" encoding="UTF-8"?>
<people>""".encode('utf-8')
FOOTER = """
</people>
""".encode('utf-8')
RECORD = """
    <person full_name="{full_name}">
        <start>{start}</start>
        <end>{end}</end>
    </person>"""
DATETIME_FORMAT = '%d-%m-%Y %H:%M:%S'
예제 #16
0
import faker
from russian_names import RussianNames
fake = faker.Faker()
name = RussianNames()

import qrookDB.DB as db
DB = db.DB('postgres', 'qrook_db_new', 'kurush', 'pondoxo', format_type='dict')
DB.create_data(__name__, in_module=True)


def create_users(n):
    data = []
    for i in range(n):
        d = dict()
        x = fake.profile()
        d['avatar'] = fake.image_url()
        d['email'] = x['mail']
        d['password'] = fake.password()
        d['login'] = x['username']

        x = name.get_person()
        d['name'], _, d['surname'] = x.split(' ')
        data.append(d)

    data = [[
        d['name'], d['surname'], d['email'], d['login'], d['password'],
        d['avatar']
    ] for d in data]
    ok = DB.insert(DB.users, DB.users.name, DB.users.surname,
                   DB.users.email, DB.users.login, DB.users.password,
                   DB.users.avatar) \
예제 #17
0
def name_generator():
    name_list = RussianNames().get_person().split()
    name_list[0], name_list[1], name_list[2] = name_list[2], name_list[
        0], name_list[1]
    name = (' '.join(name_list))
    return name