Skip to content

Commit 33e202b

Browse files
Merge pull request #25 from justatrade/fix_none_width
Fix none width
2 parents 99ac5fa + 47f67b3 commit 33e202b

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

for_dict_challenges_bonus.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@
3939

4040
def generate_chat_history():
4141
messages_amount = random.randint(200, 1000)
42-
users_ids = list({random.randint(1, 10000) for _ in range(random.randint(5, 20))})
42+
users_ids = list(
43+
{random.randint(1, 10000) for _ in range(random.randint(5, 20))}
44+
)
4345
sent_at = datetime.datetime.now() - datetime.timedelta(days=100)
4446
messages = []
4547
for _ in range(messages_amount):
@@ -48,8 +50,17 @@ def generate_chat_history():
4850
"id": uuid.uuid4(),
4951
"sent_at": sent_at,
5052
"sent_by": random.choice(users_ids),
51-
"reply_for": random.choice([None, random.choice([m["id"] for m in messages]) if messages else []]),
52-
"seen_by": random.sample(users_ids, random.randint(1, len(users_ids))),
53+
"reply_for": random.choice(
54+
[
55+
None,
56+
(
57+
random.choice([m["id"] for m in messages])
58+
if messages else None
59+
),
60+
],
61+
),
62+
"seen_by": random.sample(users_ids,
63+
random.randint(1, len(users_ids))),
5364
"text": lorem.sentence(),
5465
})
5566
return messages

0 commit comments

Comments
 (0)