#!/usr/bin/python3
"""This is the state class"""
from models.base_model import BaseModel, Base
from sqlalchemy import Column, String
from sqlalchemy.orm import relationship
from models.city import City
import models
import os


class State(BaseModel, Base):
    """This is the class for State
    Attributes:
        name: input name
    """
    __tablename__ = "states"
    name = Column(String(128), nullable=False)
    if os.getenv("HBNB_TYPE_STORAGE") == "db":
        cities = relationship('City', cascade='all, delete', backref='state')
    else:
        @property
        def cities(self):
            """
            cities
            """
            objects = models.storage.all("City")
            my_cities = []
            for key, obj in objects.items():
                if obj.state_id == self.id:
                    my_cities.append(obj)
            return (my_cities)

00cad56bcf16e5e56be8ef1fdc4f7895847034fe
<mask token>


class State(BaseModel, Base):
    <mask token>
    <mask token>
    <mask token>
    if os.getenv('HBNB_TYPE_STORAGE') == 'db':
        cities = relationship('City', cascade='all, delete', backref='state')
    else:

        @property
        def cities(self):
            """
            cities
            """
            objects = models.storage.all('City')
            my_cities = []
            for key, obj in objects.items():
                if obj.state_id == self.id:
                    my_cities.append(obj)
            return my_cities

<mask token>


class State(BaseModel, Base):
    <mask token>
    __tablename__ = 'states'
    name = Column(String(128), nullable=False)
    if os.getenv('HBNB_TYPE_STORAGE') == 'db':
        cities = relationship('City', cascade='all, delete', backref='state')
    else:

        @property
        def cities(self):
            """
            cities
            """
            objects = models.storage.all('City')
            my_cities = []
            for key, obj in objects.items():
                if obj.state_id == self.id:
                    my_cities.append(obj)
            return my_cities

<mask token>


class State(BaseModel, Base):
    """This is the class for State
    Attributes:
        name: input name
    """
    __tablename__ = 'states'
    name = Column(String(128), nullable=False)
    if os.getenv('HBNB_TYPE_STORAGE') == 'db':
        cities = relationship('City', cascade='all, delete', backref='state')
    else:

        @property
        def cities(self):
            """
            cities
            """
            objects = models.storage.all('City')
            my_cities = []
            for key, obj in objects.items():
                if obj.state_id == self.id:
                    my_cities.append(obj)
            return my_cities

<mask token>
from models.base_model import BaseModel, Base
from sqlalchemy import Column, String
from sqlalchemy.orm import relationship
from models.city import City
import models
import os


class State(BaseModel, Base):
    """This is the class for State
    Attributes:
        name: input name
    """
    __tablename__ = 'states'
    name = Column(String(128), nullable=False)
    if os.getenv('HBNB_TYPE_STORAGE') == 'db':
        cities = relationship('City', cascade='all, delete', backref='state')
    else:

        @property
        def cities(self):
            """
            cities
            """
            objects = models.storage.all('City')
            my_cities = []
            for key, obj in objects.items():
                if obj.state_id == self.id:
                    my_cities.append(obj)
            return my_cities

#!/usr/bin/python3
"""This is the state class"""
from models.base_model import BaseModel, Base
from sqlalchemy import Column, String
from sqlalchemy.orm import relationship
from models.city import City
import models
import os


class State(BaseModel, Base):
    """This is the class for State
    Attributes:
        name: input name
    """
    __tablename__ = "states"
    name = Column(String(128), nullable=False)
    if os.getenv("HBNB_TYPE_STORAGE") == "db":
        cities = relationship('City', cascade='all, delete', backref='state')
    else:
        @property
        def cities(self):
            """
            cities
            """
            objects = models.storage.all("City")
            my_cities = []
            for key, obj in objects.items():
                if obj.state_id == self.id:
                    my_cities.append(obj)
            return (my_cities)
