This commit is contained in:
parent
cc4b666011
commit
6e6e5e63be
|
@ -1,15 +1,13 @@
|
||||||
"""Small utility for detecting social websites."""
|
"""Small utility for detecting social websites."""
|
||||||
|
|
||||||
import datetime
|
|
||||||
import re
|
import re
|
||||||
import urllib.parse
|
import urllib.parse
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from typing import List, Optional, Set, Union
|
|
||||||
|
|
||||||
import aenum
|
import aenum
|
||||||
from enforce_typing import enforce_types
|
from enforce_typing import enforce_types
|
||||||
|
|
||||||
from socials_util._version import __version__
|
from socials_util._version import __version__ # noqa: F401
|
||||||
|
|
||||||
|
|
||||||
class SocialSiteId(aenum.Enum):
|
class SocialSiteId(aenum.Enum):
|
||||||
|
@ -408,7 +406,9 @@ WELL_KNOWN_MASTODON_INSTANCES: frozenset[str] = frozenset(
|
||||||
def determine_social_from_url_internally(
|
def determine_social_from_url_internally(
|
||||||
url: str,
|
url: str,
|
||||||
) -> tuple[SocialSiteId | None, str | None]:
|
) -> tuple[SocialSiteId | None, str | None]:
|
||||||
assert isinstance(url, str)
|
if not isinstance(url, str):
|
||||||
|
msg = f'Url must be {str}'
|
||||||
|
raise TypeError(msg)
|
||||||
|
|
||||||
# Regexes
|
# Regexes
|
||||||
for social_site_url_regex, social_site_id in REGEXES:
|
for social_site_url_regex, social_site_id in REGEXES:
|
||||||
|
|
0
test/__init__.py
Normal file
0
test/__init__.py
Normal file
Loading…
Reference in New Issue
Block a user