Browse Source
Merge pull request #98 from weskerfoot/fix-attrs-default
Avoid using `default` for attrs classes with mutable objects
pull/100/head
Wesley Kerfoot
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
3 additions and
3 deletions
-
deletefb/types.py
|
@ -22,7 +22,7 @@ def convert_date(text): |
|
|
@attr.s |
|
|
@attr.s |
|
|
class Post: |
|
|
class Post: |
|
|
content = attr.ib() |
|
|
content = attr.ib() |
|
|
comments = attr.ib(default=[]) |
|
|
comments = attr.ib(factory=list) |
|
|
date = attr.ib(factory=pendulum.now) |
|
|
date = attr.ib(factory=pendulum.now) |
|
|
name = attr.ib(factory=lambda: uuid.uuid4().hex) |
|
|
name = attr.ib(factory=lambda: uuid.uuid4().hex) |
|
|
|
|
|
|
|
@ -38,8 +38,8 @@ class Conversation: |
|
|
url = attr.ib() |
|
|
url = attr.ib() |
|
|
name = attr.ib() |
|
|
name = attr.ib() |
|
|
date : datetime = attr.ib(converter=convert_date) |
|
|
date : datetime = attr.ib(converter=convert_date) |
|
|
messages = attr.ib(default=[]) |
|
|
messages = attr.ib(factory=list) |
|
|
image_links = attr.ib(default=[]) |
|
|
image_links = attr.ib(factory=list) |
|
|
|
|
|
|
|
|
@attr.s |
|
|
@attr.s |
|
|
class Message: |
|
|
class Message: |
|
|