Esempio n. 1
0
 def setUp(self):
     self.new_user = User('Vikki', 'Ireri', '*****@*****.**',
                          'akisijui', [])
     self.new_account = Account('Instagram', 'https://www.instagram.com/',
                                '*****@*****.**', '12345')
     self.new_account1 = Account('Facebook', 'https://www.facebook.com/',
                                 '*****@*****.**', '67890')
Esempio n. 2
0
 def __init__(self):
     
     self.chart_of_accounts = [  # Default Chart
         Account(acc_num=int(1000), acc_name="Cash", acc_type="Asset"),
         Account(acc_num=int(2000), acc_name="Accounts Payable", acc_type="Liability"),
         Account(acc_num=int(3000), acc_name="Retained Earnings", acc_type="Equity"),
         Account(acc_num=int(4000), acc_name="Sales Revenue", acc_type="Income"),
         Account(acc_num=int(5000), acc_name="Cost of Goods Sold", acc_type="Expense"),
     ]
Esempio n. 3
0
def addDefaultAccounts():
    if accountsTable.count() > 0:
        return

    checking = Account(name='Checking', currentAmount=123)
    savings = Account(name='Savings', currentAmount=123)

    accountsTable.addNew(checking)
    accountsTable.addNew(savings)
Esempio n. 4
0
    def option_six(self):
        self.chart_of_accounts = [  # Default Chart
            Account(acc_num=int(1000), acc_name="Cash", acc_type="Asset"),
            Account(acc_num=int(2000), acc_name="Accounts Payable", acc_type="Liability"),
            Account(acc_num=int(3000), acc_name="Retained Earnings", acc_type="Equity"),
            Account(acc_num=int(4000), acc_name="Sales Revenue", acc_type="Income"),
            Account(acc_num=int(5000), acc_name="Cost of Goods Sold", acc_type="Expense"),
        ]

        print("Default Chart of accounts has been restored.")
 def test_find_accounts_by_name(self):
     """
     test to check if accounts by the  account name and can display information
     """
     self.new_accounts.save_accounts()
     test_accounts = Account("facebook", "1234")
     test_accounts.save_accounts()
Esempio n. 6
0
 def generate_accounts(self) -> None:
     short_names: Set[str] = set()
     long_names: Set[str] = set()
     limitsets: Set[LimitSet] = set()
     allhosts: Set[str] = set()
     routers: Set[str] = set()
     letters = string.ascii_lowercase
     while len(short_names) < 8:
         short_names.add(''.join(random.choice(letters) for _ in range(2)))
     while len(long_names) < 8:
         long_names.add(''.join(random.choice(letters) for _ in range(random.randint(5, 9))))
     while len(routers) < 3:
         routers.add(''.join(random.choice(letters) for _ in range(random.randint(5, 9))))
     while len(limitsets) < 3:
         limitsets.add(self.generate_limitset())
     accounts = []
     for sn, name in zip(short_names, long_names):
         generated_hosts: Set[str] = set()
         while len(generated_hosts) < random.randint(2, 7):
             new_host = ''.join(random.choice(letters) for _ in range(random.randint(3, 8)))
             if new_host in allhosts: continue
             generated_hosts.add(new_host)
             allhosts.add(new_host)
         hosts: Tuple[Host, ...] = tuple(Host(x) for x in generated_hosts)
         mark = random.choice(list(Mark))
         limit = random.choice(list(limitsets))
         acc = Account(sn, name, hosts, limit, mark)
         accounts.append(acc)
     self.accounts = {o.short: o for o in accounts}
     self.hosts = tuple(allhosts)
     self.limits = tuple(limitsets)
     self.routers = tuple(routers)
     self.config['test_host'] = random.choice(self.hosts)
     self.config['test_router'] = random.choice(self.routers)
Esempio n. 7
0
    def _quit(self):
        print("\nThank you for playing Blackjack!\n")

        if self.quit_without_save is False:
            Account().save(self.player)

        exit()
 def test_delete_accounts(self):
     """
     testcase to delete account
     """
     self.new_accounts.save_accounts()
     test_accounts = Account("facebook", "1234")
     test_accounts.save_accounts()
     self.new_accounts.delete_accounts()  #to delete an account object
     self.assertEqual(len(Account.account_list), 1)
Esempio n. 9
0
def main(stdscr):
    ''' Main function of the program '''
    output = ''
    file_path = fileopenbox('Open account data csv')
    if file_path is None:
        terminate()
        return

    account_list = AccountList()
    with open(file_path, newline='') as csvfile:
        dialect = csv.Sniffer().sniff(csvfile.read(1024),
                                      delimiters=CSV_DELIMITERS)
        csvfile.seek(0)
        reader = csv.DictReader(csvfile, dialect=dialect)
        for row in reader:
            account_list.append(Account(row['username'], row['password']))

    connection = Connection()
    while True:
        current = account_list.current()
        if current is None:
            terminate()
            return
        start_time = time.time()
        stdscr.clear()
        status = []
        macro = None
        try:
            status = get_status(connection, current)
            try:
                macro = get_macro(status)
                output = do_macro(connection, macro, current)
            except CompletedAccount:
                account_list.complete()
                output = {'description': 'Completed'}
        except RequestException as err:
            output = {'error': 'RequestException: {0}'.format(err)}
        except BadResponseException:
            output = {'error': 'BadResponseException'}
        except LootRetrieveException:
            output = {'error': 'LootRetrieveException'}

        process_time = time.time() - start_time
        stdscr.addstr('{:<30}{:.5f}s\n'.format('Process time', process_time))
        display_status(stdscr, status)
        stdscr.addstr('\n{:<30}{}\n'.format('Username', current.username))
        stdscr.addstr('{:<30}{}\n'.format('Password', current.password))
        stdscr.addstr('{:<30}{}\n'.format('Macro', macro))
        stdscr.addstr('{:<30}{}\n'.format('Ouptut', output))
        stdscr.addstr('\nctrl+shift+q to exit')
        stdscr.refresh()
        time.sleep(ACTION_INTERVAL)
Esempio n. 10
0
    def load_accounts(self, accounts_filepath):
        self._accounts_filepath = accounts_filepath

        try:
            with open(accounts_filepath, "r") as stream:
                data = json.load(stream)
        except FileNotFoundError:
            return

        account_list = []
        for account in data:
            account_list.append(Account(account_dict=account))
        self._handler.bind_accounts(account_list)
Esempio n. 11
0
    def option_two(self):
        
        while True:
            while True:
                account_num = 0
                try:
                    account_num = int(input("Account Number"))
                except ValueError:
                    print("Account # cannot contain letters")
                    break
                num_in_use = 0
                for account in self.chart_of_accounts:
                    if account.acc_num == account_num:
                        print("Account # already in use. Try again")
                        num_in_use = 1
                if num_in_use == 0:
                    break
            if account_num == 0:
                break
            account_name = input("Account Name")
            account_type = input("Account Type")
            i = 0
            num_of_accounts = len(self.chart_of_accounts)

            while num_of_accounts > i:
                if account_num < self.chart_of_accounts[i].acc_num:
                    self.chart_of_accounts.insert(i, (
                        Account(acc_num=int(account_num), acc_name=account_name, acc_type=account_type)))
                    break
                i += 1
            else:
                self.chart_of_accounts.append(
                    Account(acc_num=int(account_num), acc_name=account_name, acc_type=account_type))
            add_more = input("Type \"Y\" to enter another account, otherwise click anything else")
            if add_more.upper() != "Y":
                break
Esempio n. 12
0
def load_all_projects(wf):
    log.debug('start updating the cache')
    wf = Workflow3()

    all_accounts = None
    try:
        all_accounts = Accounts(get_accounts(wf))
    except PasswordNotFound:  # API key has not yet been set
        notify("WARNING", "No API key saved")

        log.error('No API key saved')

    log.debug('loading accounts...')

    if not all_accounts:
        # just paste gitlab url to the variables page and token to the keychain and start using the workflow
        url = get_wf_variable(wf, "gitlab_url")
        token = get_wf_variable(wf, "gitlab_token")
        all_accounts = Account({
            "simple_account": {
                "url": url,
                "token": token,
                "project_membership": "true",
                "project_visibility": "internal",
            }
        })

    log.info('Removing cache: {}'.format(DATA_FILE))
    # if os.path.exists(DATA_FILE):
    #     return
    try:
        os.remove(DATA_FILE)
    except:
        pass

    result = []
    for acc_name, acc_settings in all_accounts.dict.items():
        log.info('base api url is: {url}; api token is: {token_name}'.format(
            url=acc_settings.url, token_name=acc_settings.token))
        result.extend(get_all_pages(wf, account=acc_settings))

    with open(DATA_FILE, 'w+') as fp:
        json.dump(result, fp)

    notify(
        "Cache was updated",
        "Was loaded {projects} projects from all gitlab instances".format(
            projects=len(result)))
Esempio n. 13
0
    def load_data(self):
        """Read data from json file."""
        data = {}
        with open(AccountManager.filename, "r") as f:
            try:
                data = json.load(f)
            except json.JSONDecodeError:
                print("Empty file")

        if data:
            for account in data["Accounts"]:
                if account["type"] == "Account":
                    account_from_json = Account(account["balance"])
                else:
                    account_from_json = SavingsAccount(account["balance"])
                self.add_account(account_from_json)
Esempio n. 14
0
File: main.py Progetto: simonfl/fp
    def setup(self):

        self.JASON_RETIREMENT = 2035
        self.SELENE_RETIREMENT = 2038

        self.income(
            'Jason paycheck',
            Income(annually=150000, increase=Dist(0.03, 0.02),
                   bonus=0.10).end(self.JASON_RETIREMENT))
        self.income(
            'Selene paycheck',
            Income(annually=130000, increase=Dist(0.03, 0.005),
                   bonus=0.05).end(self.SELENE_RETIREMENT))

        stock_price = Account(total=42.0, beta=0.1, alpha=Dist(0.02, 0.1))
        self.income('Stock', stock_price)

        self.income('RSU 1',
                    RSU(quarterly_qty=200, price=stock_price).end(2022, 4))
        self.income('RSU 2',
                    RSU(quarterly_qty=120, price=stock_price).end(2023, 4))

        self.account('Income', Account())
        self.account('RSUs', Account())

        self.account('Checking', Account(total=26000, category='Investments'))
        self.account(
            'Merrill',
            Account(total=210000,
                    basis=150000,
                    beta=0.2,
                    alpha=Dist(0.01, 0.005),
                    tax_rate=0.2,
                    category='Investments'))
        self.account(
            'ETrade',
            Account(total=82000,
                    basis=51000,
                    beta=1.5,
                    alpha=Dist(0.0, 0.03),
                    tax_rate=0.2,
                    category='Investments'))

        self.account(
            'Jason 401k',
            Account(total=148000,
                    beta=0.8,
                    alpha=Dist(0.01, 0.005),
                    category='Retirement').start(2040))
        self.account(
            'Jason IRA',
            Account(total=230000,
                    beta=0.8,
                    alpha=Dist(0.00, 0.005),
                    category='Retirement').start(2040))
        self.account(
            'Jason Roth',
            Account(total=57000,
                    beta=0.8,
                    alpha=Dist(0.00, 0.005),
                    category='Retirement').start(2040))

        self.account(
            'Selene 401k',
            Account(total=230000,
                    beta=0.8,
                    alpha=Dist(0.00, 0.005),
                    category='Retirement').start(2043))
        self.account(
            'Selene IRA',
            Account(total=98000,
                    beta=0.8,
                    alpha=Dist(0.00, 0.005),
                    category='Retirement').start(2043))
        self.account(
            'Selene Roth',
            Account(total=157000,
                    beta=0.8,
                    alpha=Dist(0.00, 0.005),
                    category='Retirement').start(2043))

        self.account('College 529',
                     Account(total=98000, beta=0.6, alpha=Dist(0.00, 0.005)))

        self.account(
            'Mortgage 1A',
            Mortgage(balance=612800,
                     payment=2421.30,
                     rate=0.025,
                     category='Real estate').end(2051))
        self.account(
            'Apt 1A',
            Account(total=945000,
                    alpha=Dist(0.02, 0.005),
                    category='Real estate'))

        self.expense(
            'Credit card',
            Expense(monthly=3500, variation=800, increase=Dist(0.03, 0.005)))
        self.expense(
            'Nanny',
            Expense(monthly=2500, variation=200, increase=Dist(0.05,
                                                               0)).end(2026))

        self.expense('Anna college',
                     Expense(annually=50000).start(2030).end(2034))
        self.expense('Mara college',
                     Expense(annually=60000).start(2034).end(2038))
        self.expense('Wally college',
                     Expense(annually=65000).start(2036).end(2040))
        self.expense(
            'Travel',
            Expense(annually=2000, variation=500, increase=Dist(0.03, 0)))

        self.transfer(
            'Jason 401k',
            Transfer(annually=19500,
                     increase=Dist(0.03, 0)).end(self.JASON_RETIREMENT))
        self.transfer(
            'Selene 401k',
            Transfer(annually=19500,
                     increase=Dist(0.03, 0)).end(self.SELENE_RETIREMENT))
        self.transfer('Pre-tax retirement income',
                      Transfer(annually=120000, increase=Dist(0.03, 0)))
        self.transfer('Post-tax retirement income',
                      Transfer(annually=60000, increase=Dist(0.03, 0)))
        self.transfer('College savings',
                      Transfer(annually=10000, increase=Dist(0, 0)).end(2025))
Esempio n. 15
0
 def setUp(self):
     '''
     Set up method to run before each test cases.
     '''
     self.new_accounts = Account("facebook", "1234")
Esempio n. 16
0
def account_options(new_user, user_acc, full_name):

    print(
        's: save an existing account\nc: create a new account\nd: delete an account\nx: log out from your account\n'
    )

    option = input('Enter your choice here:___')

    if option == 's':
        ac_name = input('Enter account name:___')
        ac_url = input('Enter account url:___')
        ac_email = input('Enter account email:___')
        ac_password = input('Enter account password:___')

        new_acc = Account(ac_name, ac_url, ac_email,
                          ac_password).save_account()

        new_user.add_acc_to_user(new_acc, user_acc)

        print('\n\nWhat else would you like to do?\n')

        account_options(new_user, user_acc, full_name)

        print('\n\n')

    elif option == 'c':
        cac_name = input('Enter account name:___')
        cac_url = input('Enter account url:___')
        cac_email = input('Enter account email:___')
        cac_pass_length = int(input('Enter length of password'))

        acc_ = Account(cac_name, cac_url, cac_email, '')

        new_acc = acc_.new_account(cac_pass_length)

        new_user.add_acc_to_user(new_acc, user_acc)

        print(
            f'Your new login credentials are:\n\nEmail:  {new_acc["name"]}\npassword  {new_acc["password"]}\n\n'
        )

        print(
            'Would you like to copy your new credentials to clipboard? \n\n e: to copy email\n p: to copy password\n x: to continue\n'
        )

        desition = input().lower()

        if desition == 'e':
            email = acc_.copy_email(new_acc, 'email')

            print(f'Your Email {email} has been copied to clipboard\n\n')
        elif desition == 'p':
            new_pass = acc_.copy_password(new_acc, 'password')

            print(f'Your Password {new_pass} has been copied to clipboard\n\n')

        print('\n\nWhat else would you like to do?\n')

        account_options(new_user, user_acc, full_name)

        print('\n\n')

    elif option == 'd':
        name_delete = input('Enter name of account to delete:___')
        new_user.delete_account(name_delete, user_acc)

        print('\n\nWhat else would you like to do?\n')

        account_options(new_user, user_acc, full_name)

    elif option == 'x':
        print('You have logged out of your account')

        print('\n\nWhat else would you like to do?\n\n')
        user_options()
        print('\n\n')
        pass
Esempio n. 17
0
 def _sign_in(self):
     self.quit_without_save = False
     self.player = Account().make_sign_in()
Esempio n. 18
0
 def _registration(self):
     self.quit_without_save = False
     self.player = Account().make_registration()
Esempio n. 19
0
 def _delete_account(self):
     self.quit_without_save = True
     Account().delete(self.player.username)
     self.BJ.restart()
Esempio n. 20
0
from accounts import Account
Account.x
Account.x =1
Account.x 
Account.accno
Account.tye
Account.type
Account.type = "LIABILITY"
Account.type
Account.__doc__
s = "test"
s1 = "hello"
s.upper()
s1.upper()
str.upper()
check = Account()
check.x
check.type
check.balance=100
Account.balance
card = Account
card = Account()
card.x
card.balance
Account.__dict__
Account.__dict__['x']
card.__dict__
check
check.__dict__
card.__dict__.get('balance',0)
import sys; print('%s %s' % (sys.executable or sys.platform, sys.version))
Esempio n. 21
0
Person({
    "f_name": "John",
    "s_name": "Smith",
    "zip": 99999,
    "country": "United States",
    "industry": "Computers",
    "description": "test_description LinkedIn"
})
print(Person.persons)

Account.get_all_from_db()
print(Account.accounts)

Account({
    "login": "******",
    "password": "******",
    "id_service": 1,
    "id_person": None
})
# menu
print(Account.accounts)


def new_function():
    print("New test function!")


print(Menu.menus['main'].start())

Menu.menus["main"].update_action("8", new_function)

Menu.menus["main"].add_item("3", {
Esempio n. 22
0
from clients import Client
from accounts import Account, SpecialAccount
from banks import Bank

joao = Client('Joao da Silva', '777-1234')
maria = Client('Maria da Silva', '555-4321')
contam = Account(maria, 99)
contaj = Account(joao, 100)
tatu = Bank("Tatú")
tatu.abre_conta(contaj)
tatu.abre_conta(contam)
tatu.lista_contas()
contaJoao = SpecialAccount(joao, 2, 500, 1000)
contaJoao.deposito(1000)
contaJoao.deposito(3000)
contaJoao.deposito(95.15)
contaJoao.saque(1500)
contaJoao.extrato()
Esempio n. 23
0
import os
import sys
from accounts import Account

acc = Account()


#displayed on initialization
def initial_start():
    clear_screen()
    print(
        "Welcome to IDENTITY\n1.Add new data\n2.List all data\n3.Search for data\n4.Delete data\n5.Exit"
    )


def clear_screen():
    os.system('cls')


#get the user option of operation
def get_user_option():
    user_opt = int(input("Select your option:\t"))
    if (user_opt == 1):
        add_new_data()
    elif (user_opt == 2):
        list_data()
    elif (user_opt == 3):
        search_data()
    elif (user_opt == 4):
        delete_data()
    else:
Esempio n. 24
0
 def test_add_account(self):
     """ Test add account. """
     new_account = Account(5000, [])
     self.bank.add_account(new_account)
     self.assertEqual(new_account, self.bank.accounts[-1])
Esempio n. 25
0
                for account in list_of_accounts:
                    if account.acc_num == account_num:
                        print("Account # already in use. Try again")
                        num_in_use = 1
                if num_in_use == 0:
                    break
            if account_num == 0:
                break
            account_name = input("Account Name")
            account_type = input("Account Type")
            i = 0
            num_of_accounts = len(list_of_accounts)

            while num_of_accounts > i:
                if account_num < list_of_accounts[i].acc_num:
                    list_of_accounts.insert(i, (Account(acc_num=int(account_num), acc_name=account_name, acc_type=account_type)))
                    break
                i += 1
            else:
                list_of_accounts.append(Account(acc_num=int(account_num), acc_name=account_name, acc_type=account_type))
            add_more = input("Type \"Y\" to enter another account, otherwise click anything else")
            if add_more.upper() != "Y":
                break
    elif user_input == "3":
        removed = 0
        delete_num = 0
        try:
            delete_num = int(input("Which account would you like to delete? Please Enter an Acc #"))
        except ValueError:
            print("Account # cannot contain letters")
        if delete_num != 0:
Esempio n. 26
0
from accounts import Account 
from accounts import AccountRollup
from accounts import AccountType
from accounts import AmountType
from accounts import JournalEntry
from accounts import JournalEntryLeg

# Setup chart of accounts
cash_account = Account(1, "Cash", AccountType.Asset)
mortgage_account = Account(2, "Mortgage", AccountType.Liability)
revenue_account = Account(3, "Revenues", AccountType.Income)

balance_sheet = AccountRollup([cash_account, mortgage_account])

income_statement = AccountRollup(revenue_account)
chart_of_accounts = AccountRollup([balance_sheet, income_statement])


def test_journal_entry_balance():
    # Journal entry is balanced if Debit == Credit
    jnl = JournalEntry(
        [
            JournalEntryLeg(cash_account, 50, AmountType.Debit),
            JournalEntryLeg(cash_account, 50, AmountType.Debit),
            JournalEntryLeg(mortgage_account, 100, AmountType.Credit),
        ]
    )

    assert jnl.is_balanced()

    # Journal entry is not balanced if Debit != Credit
Esempio n. 27
0
from accounts import Account
from commands.account_creator.creator import AccountsCreatorCommand

data = {"accounts":[Account(["ABACO", "Nombre", "puesto", "sucursal", "*****@*****.**", "-"])]}
cmd = AccountsCreatorCommand()
cmd.execute(data)

print data["accounts"][0].password

Esempio n. 28
0
 def setUp(self):
     self.new_account = Account('Instagram', 'https://www.instagram.com/',
                                '*****@*****.**', '12345')
Esempio n. 29
0
from accounts import Account

if __name__ == "__main__":
    myAccount = Account('database/HL.npy')
    myAccount.clear_database()
    myAccount.read_database()
    result = 'Y'
    while (result == 'Y' or result == 'y'):
        store = raw_input('Store: ')
        time = raw_input('Time: ')
        myAccount.add_receipt(store, time)
        save_bool = raw_input('Save(Y/n): ')
        if save_bool == 'y' or save_bool == 'Y':
            myAccount.save_database()
            myAccount.read_database()
        result = raw_input('Another bill? (Y/n): ')
    # myAccount.read_database()
    # print myAccount
    myAccount.return_total()
    # myAccount.clear_database()
    # myAccount.save_database()
Esempio n. 30
0
def create_new_account(account_name, account_password):
    '''
    Function to create a new account
    '''
    new_account = Account(account_name, account_password)
    return new_account