Skip to content

Commit

Permalink
Default version without installed package. (#314)
Browse files Browse the repository at this point in the history
  • Loading branch information
steve-bate authored Aug 15, 2024
1 parent fff2a20 commit e79eed6
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/feditest/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,19 @@
import pkgutil
import re
import sys
from importlib.metadata import version
import importlib.metadata
from types import ModuleType
from typing import List, Optional
from urllib.parse import ParseResult, parse_qs, urlparse
from langcodes import Language

FEDITEST_VERSION = version('feditest')
def _version(default_version="0.0.0"):
try:
return importlib.metadata.version("feditest")
except importlib.metadata.PackageNotFoundError:
return default_version

FEDITEST_VERSION = _version('feditest')

# From https://datatracker.ietf.org/doc/html/rfc7565#section-7, but simplified
ACCT_REGEX = re.compile(r"acct:([-a-zA-Z0-9\._~][-a-zA-Z0-9\._~!$&'\(\)\*\+,;=%]*)@([-a-zA-Z0-9\.:]+)")
Expand Down

0 comments on commit e79eed6

Please sign in to comment.