summaryrefslogtreecommitdiffstats
path: root/activities/models/hashtag.py
diff options
context:
space:
mode:
authorPaolo Melchiorre2022-12-05 18:38:37 +0100
committerGitHub2022-12-05 10:38:37 -0700
commita9bb4a7122df6d9d4a764de52244c6ec75789ead (patch)
tree14ba582f72ac5e3b133b3644ca03e0f027e7c2ef /activities/models/hashtag.py
parentdd8e823d2f3ef22fcaa1e43e74f11f7e49eff9e7 (diff)
downloadtakahe-a9bb4a7122df6d9d4a764de52244c6ec75789ead.tar.gz
takahe-a9bb4a7122df6d9d4a764de52244c6ec75789ead.tar.bz2
takahe-a9bb4a7122df6d9d4a764de52244c6ec75789ead.zip
Add pyupgrade with --py310-plus in pre-commit (#103)
Diffstat (limited to 'activities/models/hashtag.py')
-rw-r--r--activities/models/hashtag.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/activities/models/hashtag.py b/activities/models/hashtag.py
index b7f0832..162f8b4 100644
--- a/activities/models/hashtag.py
+++ b/activities/models/hashtag.py
@@ -1,6 +1,5 @@
import re
from datetime import date, timedelta
-from typing import Dict, List
import urlman
from asgiref.sync import sync_to_async
@@ -138,7 +137,7 @@ class Hashtag(StatorModel):
def __str__(self):
return self.display_name
- def usage_months(self, num: int = 12) -> Dict[date, int]:
+ def usage_months(self, num: int = 12) -> dict[date, int]:
"""
Return the most recent num months of stats
"""
@@ -153,7 +152,7 @@ class Hashtag(StatorModel):
results[date(year, month, 1)] = val
return dict(sorted(results.items(), reverse=True)[:num])
- def usage_days(self, num: int = 7) -> Dict[date, int]:
+ def usage_days(self, num: int = 7) -> dict[date, int]:
"""
Return the most recent num days of stats
"""
@@ -170,7 +169,7 @@ class Hashtag(StatorModel):
return dict(sorted(results.items(), reverse=True)[:num])
@classmethod
- def hashtags_from_content(cls, content) -> List[str]:
+ def hashtags_from_content(cls, content) -> list[str]:
"""
Return a parsed and sanitized of hashtags found in content without
leading '#'.