add twocolon_list()
This commit is contained in:
parent
18b31c9889
commit
2c52f9b561
3 changed files with 15 additions and 5 deletions
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
+ `sqlalchemy`: add `unbound_fk()`, `bound_fk()`
|
+ `sqlalchemy`: add `unbound_fk()`, `bound_fk()`
|
||||||
+ Add `sqlalchemy_async` module with `SQLAlchemy()`
|
+ Add `sqlalchemy_async` module with `SQLAlchemy()`
|
||||||
+ Add `timed_cache()`, `TimedDict()`, `none_pass`
|
+ Add `timed_cache()`, `TimedDict()`, `none_pass()`, `twocolon_list()`
|
||||||
+ Add module `calendar` with `want_*` date type conversion utilities and `age_and_days()`
|
+ Add module `calendar` with `want_*` date type conversion utilities and `age_and_days()`
|
||||||
+ Move obsolete stuff to `obsolete` package (includes configparse 0.3 as of now)
|
+ Move obsolete stuff to `obsolete` package (includes configparse 0.3 as of now)
|
||||||
+ Add `redact` module with `redact_url_password()`
|
+ Add `redact` module with `redact_url_password()`
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
|
||||||
from .iding import Siq, SiqCache, SiqType, SiqGen
|
from .iding import Siq, SiqCache, SiqType, SiqGen
|
||||||
from .codecs import (StringCase, cb32encode, cb32decode, b32lencode, b32ldecode, b64encode, b64decode, b2048encode, b2048decode,
|
from .codecs import (StringCase, cb32encode, cb32decode, b32lencode, b32ldecode, b64encode, b64decode, b2048encode, b2048decode,
|
||||||
jsonencode, want_bytes, want_str, ssv_list, want_urlsafe, want_urlsafe_bytes)
|
jsonencode, twocolon_list, want_bytes, want_str, ssv_list, want_urlsafe, want_urlsafe_bytes)
|
||||||
from .bits import count_ones, mask_shift, split_bits, join_bits, mod_ceil, mod_floor
|
from .bits import count_ones, mask_shift, split_bits, join_bits, mod_ceil, mod_floor
|
||||||
from .calendar import want_datetime, want_isodate, want_timestamp, age_and_days
|
from .calendar import want_datetime, want_isodate, want_timestamp, age_and_days
|
||||||
from .configparse import MissingConfigError, MissingConfigWarning, ConfigOptions, ConfigParserConfigSource, ConfigSource, DictConfigSource, ConfigValue, EnvConfigSource
|
from .configparse import MissingConfigError, MissingConfigWarning, ConfigOptions, ConfigParserConfigSource, ConfigSource, DictConfigSource, ConfigValue, EnvConfigSource
|
||||||
|
|
@ -47,6 +47,6 @@ __all__ = (
|
||||||
'jsonencode', 'kwargs_prefix', 'lex', 'ltuple', 'makelist', 'mask_shift',
|
'jsonencode', 'kwargs_prefix', 'lex', 'ltuple', 'makelist', 'mask_shift',
|
||||||
'matches', 'mod_ceil', 'mod_floor', 'none_pass', 'not_implemented',
|
'matches', 'mod_ceil', 'mod_floor', 'none_pass', 'not_implemented',
|
||||||
'redact_url_password', 'rtuple', 'split_bits', 'ssv_list', 'symbol_table',
|
'redact_url_password', 'rtuple', 'split_bits', 'ssv_list', 'symbol_table',
|
||||||
'timed_cache', 'want_bytes', 'want_datetime', 'want_isodate', 'want_str',
|
'timed_cache', 'twocolon_list', 'want_bytes', 'want_datetime', 'want_isodate',
|
||||||
'want_timestamp', 'want_urlsafe', 'want_urlsafe_bytes'
|
'want_str', 'want_timestamp', 'want_urlsafe', 'want_urlsafe_bytes'
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -294,6 +294,16 @@ def ssv_list(s: str, *, sep_chars = ',;') -> list[str]:
|
||||||
l.pop()
|
l.pop()
|
||||||
return l
|
return l
|
||||||
|
|
||||||
|
def twocolon_list(s: str | None) -> list[str]:
|
||||||
|
"""
|
||||||
|
Parse a string on a single line as multiple lines, each line separated by double colon (::).
|
||||||
|
|
||||||
|
Returns a list.
|
||||||
|
"""
|
||||||
|
if not s:
|
||||||
|
return []
|
||||||
|
return [x.strip() for x in s.split('::')]
|
||||||
|
|
||||||
class StringCase(enum.Enum):
|
class StringCase(enum.Enum):
|
||||||
"""
|
"""
|
||||||
Enum values used by regex validators and storage converters.
|
Enum values used by regex validators and storage converters.
|
||||||
|
|
@ -329,5 +339,5 @@ class StringCase(enum.Enum):
|
||||||
|
|
||||||
__all__ = (
|
__all__ = (
|
||||||
'cb32encode', 'cb32decode', 'b32lencode', 'b32ldecode', 'b64encode', 'b64decode', 'jsonencode'
|
'cb32encode', 'cb32decode', 'b32lencode', 'b32ldecode', 'b64encode', 'b64decode', 'jsonencode'
|
||||||
'StringCase', 'want_bytes', 'want_str', 'jsondecode', 'ssv_list', 'want_urlsafe', 'want_urlsafe_bytes'
|
'StringCase', 'want_bytes', 'want_str', 'jsondecode', 'ssv_list', 'twocolon_list', 'want_urlsafe', 'want_urlsafe_bytes'
|
||||||
)
|
)
|
||||||
Loading…
Add table
Add a link
Reference in a new issue