[Solved] Nested Classes Python and Indentation errors


I just looked at your code, you are using spaces and lines 23, 33, 172 should all be spaces instead of tabs. Lines 69-118 should all be indented with spaces. Ok, so your comments on the return statements were messing things up, this code compile fine. Also you didn’t initialize middleName to anything so I initialized it to “”.

firstname = ""
middlename = ""
Surname = ""
title = ""
ppsno = ""
gender = ""
testID = ""
birthDate = ""
address1 = ""
address2 = ""
address3 = ""
address4 = ""
town = ""
county = ""
country = ""
email = ""
mobile = ""

#Default Constructor for the class patient
def __init__(
    self,
    testID,
    firstname = None,
    surname = None,
    gender = None,
    birthDate = None):


    self.testID = testID
    if (firstname is None):
        firstname = "Test"
        self.firstname = firstname
    if (surname is None):
        surname = "Patient"
        self.surname = surname
    if (gender is None):
        gender = "Male"
        self.gender = gender
    if (birthDate is None):
        birthDate = "08081988"
        self.birthDate = birthDatename

#Use this to create a patient with more detailed information

def __init__(
    self,
    testID,
    firstname = None,
    middlename = None,
    surname = None,
    gender = None,
    birthDate = None,
    title = None,
    ppsno = None,
    address1 = None,
    address2 = None,
    address3 = None,
    address4 = None,
    town = None,
    county = None,
    country = None,
    email = None,
    mobile = None):

    self.testID = testID

    if (firstname is None):
        firstname = "Sample"
        self.firstname = firstname
    if (surname is None):
        surname = "Patient"
        self.surname = surname
    if (middlename is None):
        middlename = "Mary"
        self.middlename = middlename
    if (gender is None):
        gender = "Female"
        self.gender = gender
    if (birthDate is None):
        birthDate = "03091959"
        self.birthDate = birthDatename
    if (title is None):
        title = "Mrs"
        self.title = title
    if (ppsno is None):
        ppsno = "7445213P"
        self.ppsno = ppsno
    if (address1 is None):
        address1 = "100"
        self.address1 = address1
    if (address2 is None):
        address2 = "Green Glade"
        self.address1 = address1
    if (address3 is None):
        address3 = "Pleasent Way"
        self.address3 = address3
    if (address4 is None):
        address4 = "Ballybehy"
        self.address4 = address4
    if (town is None):
        town = "Abbeyfeale"
        self.town = town
    if (county is None):
        county = "Limerick"
        self.county = county
    if (country is None):
        country = "Ireland"
        self.country = country
    if (email is None):
        email = "[email protected]"
        self.email = email
    if (mobile is None):
        mobile = "0870563229"
        self.mobile = mobile

def getStuff(self):
     return self.stuff

class schemeDetails():
    cardNumber = ""
    scheme = ""
    cardNumber = ""
    month = ""
    year = ""
    setSchemeAsDefault = ""

    def __init__(
        self,
        scheme = None,
        cardNumber = None,
        month = None,
        year = None,
        setSchemeAsDefault = None ):

        if (scheme is None):
            scheme = "GM"
            self.scheme = scheme
        if (cardNumber is None):
            month = "1231456A"
            self.cardNumber = cardNumber
        if (month is None):
            month = "September"
            self.month = month
        if (year is None):
            year = "2015"
            self.year = year
        if (setSchemeAsDefault is None):
            setSchemeAsDefault = "true"
            self.setSchemeAsDefault = setSchemeAsDefault

    def getStuff(self):
        return self.stuff

#Inner class for creating basic dispenses
class basicDispense():
    drug = ""
    packSize = ""
    dosageSystem = ""
    scheme = ""
    #Constructor for the class basicDispense
    def __init__(
        self,
        drug = None,
        packSize = None,
        dosageSystem = None,
        scheme = None):

        if (drug is None):
            drug = "ABBOTT THIN LANCET TYPE C GMS"
            self.drug = drug
        if (packSize is None):
            packSize = "28"
            self.packSize = packSize
        if (dosageSystem is None):
            dosageSystem = "MD"
            self.dosageSystem = dosageSystem
        if (scheme is None):
            scheme = "GM"
            self.scheme = scheme

        def getStuff(self):
            return self.stuff


    #Inner class of basicDispenses for printing Labels
    #Constructor for the class Labels
    class labels():
        def __init__(
            self,
            testID,
            printBagLabel = None,
            printDrugLabel = None):

            self.testID = testID
            if (printBagLabel is None):
                printBagLabel = "false"
                self.drug = drug
            if (printDrugLabel is None):
                printDrugLabel = "false"
                self.printDrugLabel = printDrugLabel

2

solved Nested Classes Python and Indentation errors