Backwards compatibility is strictly preserved in `__init__`, including parameter names, defaults and position. Whenever that's difficult using `attrs`, the custom `__init__` is kept instead (for the time being). `__repr__` methods have changed to the format `attrs` use, but people don't rely on this for anything other than debug output, so it shouldn't be a problem.
29 lines
912 B
Python
29 lines
912 B
Python
# -*- coding: UTF-8 -*-
|
|
from __future__ import unicode_literals
|
|
|
|
import attr
|
|
|
|
|
|
@attr.s(cmp=False)
|
|
class Plan(object):
|
|
"""Represents a plan"""
|
|
|
|
#: ID of the plan
|
|
uid = attr.ib(None, init=False)
|
|
#: Plan time (unix time stamp), only precise down to the minute
|
|
time = attr.ib(converter=int)
|
|
#: Plan title
|
|
title = attr.ib()
|
|
#: Plan location name
|
|
location = attr.ib(None, converter=lambda x: x or "")
|
|
#: Plan location ID
|
|
location_id = attr.ib(None, converter=lambda x: x or "")
|
|
#: ID of the plan creator
|
|
author_id = attr.ib(None, init=False)
|
|
#: List of the people IDs who will take part in the plan
|
|
going = attr.ib(factory=list, init=False)
|
|
#: List of the people IDs who won't take part in the plan
|
|
declined = attr.ib(factory=list, init=False)
|
|
#: List of the people IDs who are invited to the plan
|
|
invited = attr.ib(factory=list, init=False)
|