Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.11/site-packages/prison/constants.py: 100%
Shortcuts on this page
r m x toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
Shortcuts on this page
r m x toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1import re
4WHITESPACE = ''
6IDCHAR_PUNCTUATION = '_-./~%+'
8NOT_IDCHAR = ''.join([c for c in (chr(i) for i in range(127))
9 if not (c.isalnum()
10 or c in IDCHAR_PUNCTUATION)])
12# Additionally, we need to distinguish ids and numbers by first char.
13NOT_IDSTART = '-0123456789'
15# Regexp string matching a valid id.
16IDRX = ('[^' + NOT_IDSTART + NOT_IDCHAR + '][^' + NOT_IDCHAR + ']*')
18# Regexp to check for valid rison ids.
19ID_OK_RE = re.compile('^' + IDRX + '$', re.M)
21# Regexp to find the end of an id when parsing.
22NEXT_ID_RE = re.compile(IDRX, re.M)