Data.AccountSystem
index
/home/flempriere/personal_projects/Languages/Python/BeginToCodeWithPython/03_UsefulPython/13_PythonAndGraphicalUserInterfaces/Exercises/03_GraphicalBankingApplication/Data/AccountSystem.py

Exercise 13.3c Account System
 
Provides implementations for a handling a collection of Accounts
 
Classes
-------
AccountSystem
    Collection class for handling a collection of `Account` classes
 
See Also
--------
Data.Account : Module containing implementation of classes representing a bank account

 
Modules
       
datetime
pickle

 
Classes
       
builtins.object
AccountSystem

 
class AccountSystem(builtins.object)
    Represents the account management system of a bank
 
  Methods defined here:
__init__(self)
Create a new `AccountSystem` instance
__str__(self)
Return str(self).
add_new_account(self, account)
Store a new account in the reference system
 
The provided `account` can be indexed by it's `account_number` parameter
 
Parameters
----------
account : Account
    account to add to the inventory system
 
Returns
-------
None
 
Raises
------
KeyError
    Raised if the accounts's `account_number` is already registered as a key
apply_interest(self)
Applies interest to all accounts in the system
 
Returns
-------
None
find_users_accounts(self, name)
Find the accounts associated with a given user
 
Parameters
----------
name : str
    account holder to search for
 
Returns
-------
List[Account]
    list of accounts held by the given name, if there are no matches the list is empty
get_account(self, account_number)
Get the account with the corresponding account number
 
Parameters
----------
account_number : str
    account_number of the account to find
 
Returns
-------
Account | None
    Returns an `Account` with a matching `account_number` if it exists, else `None`
save(self, filename)
Save the `AccountSystem` to a given file
 
`AccountSystem` is saved as a pickled binary file in the file given
by `filename`. The file is created if it doesn't exist. If the file
already exists it is overwritten
 
Parameters
----------
filename : str
    path to the file to save
 
Returns
-------
None
 
Raises
------
Exceptions
    raised if the file fails to save
 
See Also
--------
AccountSystem.load : load a `AccountSystemobject from a file
update_date_last_loaded(self)
Updates the date the account was last loaded to the current date
 
Returns
-------
None

Static methods defined here:
load(filename)
Create an `AccountSystem` instance from a pickled binary file
 
Parameters
----------
filename : str
    path to a file containing pickled `FashionShop` data
 
Returns
-------
AccountSystem
    the loaded `AccountSystem` instance
 
Raises
------
Exceptions
    raised if the file fails to load
 
See Also
--------
AccountSystem.save : saves an `AccountSystem` instance

Readonly properties defined here:
date_last_loaded
date_last_loaded : datetime.date
    The time this account system was last loaded. Used to apply interest

Data descriptors defined here:
__dict__
dictionary for instance variables
__weakref__
list of weak references to the object