Use aenum to allow for third party extensions.
All checks were successful
Python Package / Package (push) Has been skipped
All checks were successful
Python Package / Package (push) Has been skipped
This commit is contained in:
parent
55989ec085
commit
1d04d84788
2
setup.py
2
setup.py
|
@ -8,7 +8,7 @@ setup(
|
||||||
author_email='jonjmaa@gmail.com',
|
author_email='jonjmaa@gmail.com',
|
||||||
url='https://gitfub.space/Jmaa/socials-util',
|
url='https://gitfub.space/Jmaa/socials-util',
|
||||||
packages=['socials_util'],
|
packages=['socials_util'],
|
||||||
install_requires=['enforce-typing'],
|
install_requires=['enforce-typing', 'aenum'],
|
||||||
keywords=[],
|
keywords=[],
|
||||||
classifiers=[],
|
classifiers=[],
|
||||||
include_package_data=True,
|
include_package_data=True,
|
||||||
|
|
|
@ -5,12 +5,12 @@ Small utility for detecting social websites.
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from enforce_typing import enforce_types
|
from enforce_typing import enforce_types
|
||||||
from typing import List, Set, Optional, Union
|
from typing import List, Set, Optional, Union
|
||||||
import enum
|
import aenum
|
||||||
import datetime
|
import datetime
|
||||||
import re
|
import re
|
||||||
import urllib.parse
|
import urllib.parse
|
||||||
|
|
||||||
class SocialSiteId(enum.Enum):
|
class SocialSiteId(aenum.Enum):
|
||||||
'''
|
'''
|
||||||
The great social website enum.
|
The great social website enum.
|
||||||
'''
|
'''
|
||||||
|
|
11
test/test_extension.py
Normal file
11
test/test_extension.py
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
|
||||||
|
from socials_util import *
|
||||||
|
import aenum
|
||||||
|
|
||||||
|
def test_extension():
|
||||||
|
MY_SECRET_SITE = aenum.extend_enum(SocialSiteId, 'MY_SECRET_SITE', 666)
|
||||||
|
assert MY_SECRET_SITE
|
||||||
|
assert SocialSiteId.MY_SECRET_SITE
|
||||||
|
|
||||||
|
REGEXES.append(('test', MY_SECRET_SITE))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user