backrefs 5.7.post1__tar.gz → 5.8__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {backrefs-5.7.post1 → backrefs-5.8}/PKG-INFO +3 -4
- {backrefs-5.7.post1 → backrefs-5.8}/backrefs/__meta__.py +1 -1
- {backrefs-5.7.post1 → backrefs-5.8}/backrefs/_bre_parse.py +1 -1
- backrefs-5.8/backrefs/_bregex_typing.py +6 -0
- {backrefs-5.7.post1 → backrefs-5.8}/backrefs/bre.py +19 -26
- {backrefs-5.7.post1 → backrefs-5.8}/docs/src/markdown/about/changelog.md +8 -3
- {backrefs-5.7.post1 → backrefs-5.8}/docs/src/markdown/refs.md +2 -2
- {backrefs-5.7.post1 → backrefs-5.8}/docs/src/markdown/usage.md +1 -1
- {backrefs-5.7.post1 → backrefs-5.8}/hatch_build.py +0 -1
- {backrefs-5.7.post1 → backrefs-5.8}/pyproject.toml +4 -2
- {backrefs-5.7.post1 → backrefs-5.8}/tests/test_bre.py +6 -6
- {backrefs-5.7.post1 → backrefs-5.8}/tests/test_bregex.py +10 -6
- backrefs-5.8/tools/unicodedata/16.0.0.zip +0 -0
- {backrefs-5.7.post1 → backrefs-5.8}/tools/unipropgen.py +3 -3
- backrefs-5.7.post1/backrefs/_bregex_typing.py +0 -13
- backrefs-5.7.post1/tools/unicodedata/12.1.0.zip +0 -0
- {backrefs-5.7.post1 → backrefs-5.8}/.coveragerc +0 -0
- {backrefs-5.7.post1 → backrefs-5.8}/.gitignore +0 -0
- {backrefs-5.7.post1 → backrefs-5.8}/.pyspelling.yml +0 -0
- {backrefs-5.7.post1 → backrefs-5.8}/LICENSE.md +0 -0
- {backrefs-5.7.post1 → backrefs-5.8}/README.md +0 -0
- {backrefs-5.7.post1 → backrefs-5.8}/backrefs/__init__.py +0 -0
- {backrefs-5.7.post1 → backrefs-5.8}/backrefs/_bregex_parse.py +0 -0
- {backrefs-5.7.post1 → backrefs-5.8}/backrefs/bregex.py +0 -0
- {backrefs-5.7.post1 → backrefs-5.8}/backrefs/py.typed +0 -0
- {backrefs-5.7.post1 → backrefs-5.8}/backrefs/uniprops/__init__.py +0 -0
- {backrefs-5.7.post1 → backrefs-5.8}/backrefs/util.py +0 -0
- {backrefs-5.7.post1 → backrefs-5.8}/docs/src/markdown/.snippets/links.md +0 -0
- {backrefs-5.7.post1 → backrefs-5.8}/docs/src/markdown/about/contributing.md +0 -0
- {backrefs-5.7.post1 → backrefs-5.8}/docs/src/markdown/about/license.md +0 -0
- {backrefs-5.7.post1 → backrefs-5.8}/docs/src/markdown/about/security.md +0 -0
- {backrefs-5.7.post1 → backrefs-5.8}/docs/src/markdown/index.md +0 -0
- {backrefs-5.7.post1 → backrefs-5.8}/docs/theme/announce.html +0 -0
- {backrefs-5.7.post1 → backrefs-5.8}/mkdocs.yml +0 -0
- {backrefs-5.7.post1 → backrefs-5.8}/requirements/docs.txt +0 -0
- {backrefs-5.7.post1 → backrefs-5.8}/requirements/lint.txt +0 -0
- {backrefs-5.7.post1 → backrefs-5.8}/requirements/test.txt +0 -0
- {backrefs-5.7.post1 → backrefs-5.8}/tests/__init__.py +0 -0
- {backrefs-5.7.post1 → backrefs-5.8}/tests/test_age.py +0 -0
- {backrefs-5.7.post1 → backrefs-5.8}/tests/test_bidiclass.py +0 -0
- {backrefs-5.7.post1 → backrefs-5.8}/tests/test_bidipairedbrackettype.py +0 -0
- {backrefs-5.7.post1 → backrefs-5.8}/tests/test_binary.py +0 -0
- {backrefs-5.7.post1 → backrefs-5.8}/tests/test_block.py +0 -0
- {backrefs-5.7.post1 → backrefs-5.8}/tests/test_canonicalcombiningclass.py +0 -0
- {backrefs-5.7.post1 → backrefs-5.8}/tests/test_decompositiontype.py +0 -0
- {backrefs-5.7.post1 → backrefs-5.8}/tests/test_eastasianwidth.py +0 -0
- {backrefs-5.7.post1 → backrefs-5.8}/tests/test_generalcategory.py +0 -0
- {backrefs-5.7.post1 → backrefs-5.8}/tests/test_graphemeclusterbreak.py +0 -0
- {backrefs-5.7.post1 → backrefs-5.8}/tests/test_hangulsyllabletype.py +0 -0
- {backrefs-5.7.post1 → backrefs-5.8}/tests/test_indicpositionalcategory.py +0 -0
- {backrefs-5.7.post1 → backrefs-5.8}/tests/test_indicsylabiccategory.py +0 -0
- {backrefs-5.7.post1 → backrefs-5.8}/tests/test_joininggroup.py +0 -0
- {backrefs-5.7.post1 → backrefs-5.8}/tests/test_joiningtype.py +0 -0
- {backrefs-5.7.post1 → backrefs-5.8}/tests/test_linebreak.py +0 -0
- {backrefs-5.7.post1 → backrefs-5.8}/tests/test_numerictype.py +0 -0
- {backrefs-5.7.post1 → backrefs-5.8}/tests/test_numericvalue.py +0 -0
- {backrefs-5.7.post1 → backrefs-5.8}/tests/test_quickcheck.py +0 -0
- {backrefs-5.7.post1 → backrefs-5.8}/tests/test_script.py +0 -0
- {backrefs-5.7.post1 → backrefs-5.8}/tests/test_scriptextensions.py +0 -0
- {backrefs-5.7.post1 → backrefs-5.8}/tests/test_sentencebreak.py +0 -0
- {backrefs-5.7.post1 → backrefs-5.8}/tests/test_uniprops.py +0 -0
- {backrefs-5.7.post1 → backrefs-5.8}/tests/test_versions.py +0 -0
- {backrefs-5.7.post1 → backrefs-5.8}/tests/test_verticalorientation.py +0 -0
- {backrefs-5.7.post1 → backrefs-5.8}/tests/test_wordbreak.py +0 -0
- {backrefs-5.7.post1 → backrefs-5.8}/tools/__init__.py +0 -0
- {backrefs-5.7.post1 → backrefs-5.8}/tools/unicodedata/11.0.0.zip +0 -0
- {backrefs-5.7.post1 → backrefs-5.8}/tools/unicodedata/13.0.0.zip +0 -0
- {backrefs-5.7.post1 → backrefs-5.8}/tools/unicodedata/14.0.0.zip +0 -0
- {backrefs-5.7.post1 → backrefs-5.8}/tools/unicodedata/15.0.0.zip +0 -0
- {backrefs-5.7.post1 → backrefs-5.8}/tools/unicodedata/15.1.0.zip +0 -0
- {backrefs-5.7.post1 → backrefs-5.8}/tools/unicodedata/LICENSE +0 -0
- {backrefs-5.7.post1 → backrefs-5.8}/tools/unidatadownload.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: backrefs
|
|
3
|
-
Version: 5.
|
|
3
|
+
Version: 5.8
|
|
4
4
|
Summary: A wrapper around re and regex that adds additional back references.
|
|
5
5
|
Project-URL: Homepage, https://github.com/facelessuser/backrefs
|
|
6
6
|
Author-email: Isaac Muse <Isaac.Muse@gmail.com>
|
|
@@ -13,7 +13,6 @@ Classifier: Intended Audience :: Developers
|
|
|
13
13
|
Classifier: License :: OSI Approved :: MIT License
|
|
14
14
|
Classifier: Operating System :: OS Independent
|
|
15
15
|
Classifier: Programming Language :: Python :: 3
|
|
16
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
17
16
|
Classifier: Programming Language :: Python :: 3.9
|
|
18
17
|
Classifier: Programming Language :: Python :: 3.10
|
|
19
18
|
Classifier: Programming Language :: Python :: 3.11
|
|
@@ -21,7 +20,7 @@ Classifier: Programming Language :: Python :: 3.12
|
|
|
21
20
|
Classifier: Programming Language :: Python :: 3.13
|
|
22
21
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
23
22
|
Classifier: Typing :: Typed
|
|
24
|
-
Requires-Python: >=3.
|
|
23
|
+
Requires-Python: >=3.9
|
|
25
24
|
Provides-Extra: extras
|
|
26
25
|
Requires-Dist: regex; extra == 'extras'
|
|
27
26
|
Description-Content-Type: text/markdown
|
|
@@ -193,5 +193,5 @@ def parse_version(ver: str) -> Version:
|
|
|
193
193
|
return Version(major, minor, micro, release, pre, post, dev)
|
|
194
194
|
|
|
195
195
|
|
|
196
|
-
__version_info__ = Version(5,
|
|
196
|
+
__version_info__ = Version(5, 8, 0, "final")
|
|
197
197
|
__version__ = __version_info__._get_canonical()
|
|
@@ -204,7 +204,7 @@ class _SearchParser(Generic[AnyStr]):
|
|
|
204
204
|
c = next(i)
|
|
205
205
|
if c.upper() in _ASCII_LETTERS:
|
|
206
206
|
prop.append(c)
|
|
207
|
-
elif not brackets and c != '{' or brackets and c != ':':
|
|
207
|
+
elif (not brackets and c != '{') or (brackets and c != ':'):
|
|
208
208
|
raise SyntaxError(f"Unicode property missing '{{' at {i.index - 1}!")
|
|
209
209
|
else:
|
|
210
210
|
c = next(i)
|
|
@@ -481,24 +481,22 @@ def match(
|
|
|
481
481
|
pattern: AnyStr | Pattern[AnyStr] | Bre[AnyStr],
|
|
482
482
|
string: AnyStr,
|
|
483
483
|
flags: int | _re.RegexFlag = 0,
|
|
484
|
-
*args: Any,
|
|
485
484
|
**kwargs: Any
|
|
486
485
|
) -> Match[AnyStr] | None:
|
|
487
486
|
"""Apply `match` after applying backrefs."""
|
|
488
487
|
|
|
489
|
-
return _re.match(_apply_search_backrefs(pattern, flags), string, flags,
|
|
488
|
+
return _re.match(_apply_search_backrefs(pattern, flags), string, flags=flags, **kwargs)
|
|
490
489
|
|
|
491
490
|
|
|
492
491
|
def fullmatch(
|
|
493
492
|
pattern: AnyStr | Pattern[AnyStr] | Bre[AnyStr],
|
|
494
493
|
string: AnyStr,
|
|
495
494
|
flags: int | _re.RegexFlag = 0,
|
|
496
|
-
*args: Any,
|
|
497
495
|
**kwargs: Any
|
|
498
496
|
) -> Match[AnyStr] | None:
|
|
499
497
|
"""Apply `fullmatch` after applying backrefs."""
|
|
500
498
|
|
|
501
|
-
return _re.fullmatch(_apply_search_backrefs(pattern, flags), string, flags,
|
|
499
|
+
return _re.fullmatch(_apply_search_backrefs(pattern, flags), string, flags=flags, **kwargs)
|
|
502
500
|
|
|
503
501
|
|
|
504
502
|
def split(
|
|
@@ -506,36 +504,39 @@ def split(
|
|
|
506
504
|
string: AnyStr,
|
|
507
505
|
maxsplit: int = 0,
|
|
508
506
|
flags: int | _re.RegexFlag = 0,
|
|
509
|
-
*args: Any,
|
|
510
507
|
**kwargs: Any
|
|
511
508
|
) -> list[AnyStr]:
|
|
512
509
|
"""Apply `split` after applying backrefs."""
|
|
513
510
|
|
|
514
|
-
return _re.split(
|
|
511
|
+
return _re.split(
|
|
512
|
+
_apply_search_backrefs(pattern, flags),
|
|
513
|
+
string,
|
|
514
|
+
maxsplit=maxsplit,
|
|
515
|
+
flags=flags,
|
|
516
|
+
**kwargs
|
|
517
|
+
)
|
|
515
518
|
|
|
516
519
|
|
|
517
520
|
def findall(
|
|
518
521
|
pattern: AnyStr | Pattern[AnyStr] | Bre[AnyStr],
|
|
519
522
|
string: AnyStr,
|
|
520
523
|
flags: int | _re.RegexFlag = 0,
|
|
521
|
-
*args: Any,
|
|
522
524
|
**kwargs: Any
|
|
523
525
|
) -> list[AnyStr] | list[tuple[AnyStr, ...]]:
|
|
524
526
|
"""Apply `findall` after applying backrefs."""
|
|
525
527
|
|
|
526
|
-
return _re.findall(_apply_search_backrefs(pattern, flags), string, flags,
|
|
528
|
+
return _re.findall(_apply_search_backrefs(pattern, flags), string, flags=flags, **kwargs)
|
|
527
529
|
|
|
528
530
|
|
|
529
531
|
def finditer(
|
|
530
532
|
pattern: AnyStr | Pattern[AnyStr] | Bre[AnyStr],
|
|
531
533
|
string: AnyStr,
|
|
532
534
|
flags: int | _re.RegexFlag = 0,
|
|
533
|
-
*args: Any,
|
|
534
535
|
**kwargs: Any
|
|
535
536
|
) -> Iterator[Match[AnyStr]]:
|
|
536
537
|
"""Apply `finditer` after applying backrefs."""
|
|
537
538
|
|
|
538
|
-
return _re.finditer(_apply_search_backrefs(pattern, flags), string, flags,
|
|
539
|
+
return _re.finditer(_apply_search_backrefs(pattern, flags), string, flags=flags, **kwargs)
|
|
539
540
|
|
|
540
541
|
|
|
541
542
|
def sub(
|
|
@@ -544,7 +545,6 @@ def sub(
|
|
|
544
545
|
string: AnyStr,
|
|
545
546
|
count: int = 0,
|
|
546
547
|
flags: int | _re.RegexFlag = 0,
|
|
547
|
-
*args: Any,
|
|
548
548
|
**kwargs: Any
|
|
549
549
|
) -> AnyStr:
|
|
550
550
|
"""Apply `sub` after applying backrefs."""
|
|
@@ -559,9 +559,8 @@ def sub(
|
|
|
559
559
|
pattern,
|
|
560
560
|
(compile_replace(pattern, repl) if is_replace or is_string else repl),
|
|
561
561
|
string,
|
|
562
|
-
count,
|
|
563
|
-
0,
|
|
564
|
-
*args,
|
|
562
|
+
count=count,
|
|
563
|
+
flags=0,
|
|
565
564
|
**kwargs
|
|
566
565
|
)
|
|
567
566
|
|
|
@@ -572,7 +571,6 @@ def subf(
|
|
|
572
571
|
string: AnyStr,
|
|
573
572
|
count: int = 0,
|
|
574
573
|
flags: int | _re.RegexFlag = 0,
|
|
575
|
-
*args: Any,
|
|
576
574
|
**kwargs: Any
|
|
577
575
|
) -> AnyStr:
|
|
578
576
|
"""Apply `sub` with format style replace."""
|
|
@@ -588,9 +586,8 @@ def subf(
|
|
|
588
586
|
pattern,
|
|
589
587
|
(compile_replace(pattern, repl, flags=rflags) if is_replace or is_string else repl),
|
|
590
588
|
string,
|
|
591
|
-
count,
|
|
592
|
-
0,
|
|
593
|
-
*args,
|
|
589
|
+
count=count,
|
|
590
|
+
flags=0,
|
|
594
591
|
**kwargs
|
|
595
592
|
)
|
|
596
593
|
|
|
@@ -601,7 +598,6 @@ def subn(
|
|
|
601
598
|
string: AnyStr,
|
|
602
599
|
count: int = 0,
|
|
603
600
|
flags: int | _re.RegexFlag = 0,
|
|
604
|
-
*args: Any,
|
|
605
601
|
**kwargs: Any
|
|
606
602
|
) -> tuple[AnyStr, int]:
|
|
607
603
|
"""Apply `subn` with format style replace."""
|
|
@@ -616,9 +612,8 @@ def subn(
|
|
|
616
612
|
pattern,
|
|
617
613
|
(compile_replace(pattern, repl) if is_replace or is_string else repl),
|
|
618
614
|
string,
|
|
619
|
-
count,
|
|
620
|
-
0,
|
|
621
|
-
*args,
|
|
615
|
+
count=count,
|
|
616
|
+
flags=0,
|
|
622
617
|
**kwargs
|
|
623
618
|
)
|
|
624
619
|
|
|
@@ -629,7 +624,6 @@ def subfn(
|
|
|
629
624
|
string: AnyStr,
|
|
630
625
|
count: int = 0,
|
|
631
626
|
flags: int | _re.RegexFlag = 0,
|
|
632
|
-
*args: Any,
|
|
633
627
|
**kwargs: Any
|
|
634
628
|
) -> tuple[AnyStr, int]:
|
|
635
629
|
"""Apply `subn` after applying backrefs."""
|
|
@@ -645,9 +639,8 @@ def subfn(
|
|
|
645
639
|
pattern,
|
|
646
640
|
(compile_replace(pattern, repl, flags=rflags) if is_replace or is_string else repl),
|
|
647
641
|
string,
|
|
648
|
-
count,
|
|
649
|
-
0,
|
|
650
|
-
*args,
|
|
642
|
+
count=count,
|
|
643
|
+
flags=0,
|
|
651
644
|
**kwargs
|
|
652
645
|
)
|
|
653
646
|
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 5.8
|
|
4
|
+
|
|
5
|
+
- **NEW**: Drop Python 3.8.
|
|
6
|
+
- **FIX**: Deprecation warnings.
|
|
7
|
+
|
|
3
8
|
## 5.7
|
|
4
9
|
|
|
5
10
|
- **NEW**: Add support for Python 3.13 beta.
|
|
@@ -46,9 +51,9 @@
|
|
|
46
51
|
- **FIX**: Match Re and Regex handling when doing a non-format replacement that references a group that is present in
|
|
47
52
|
the search pattern but has no actual captures. Such a case should not fail, but simply return an empty string for
|
|
48
53
|
the group.
|
|
49
|
-
- **FIX**: Format replacements that
|
|
50
|
-
|
|
51
|
-
|
|
54
|
+
- **FIX**: Format replacements that have groups with no captures will yield an empty string as the only capture as
|
|
55
|
+
long as the user does not try to index into any captures as there are no actual captures. This behavior was a bug in
|
|
56
|
+
Regex that we duplicated and should now be fixed in the latest Regex (mrabarnett/mrab-regex#439) as well as in
|
|
52
57
|
Backrefs.
|
|
53
58
|
|
|
54
59
|
## 5.1
|
|
@@ -23,7 +23,7 @@ Back\ References | Description
|
|
|
23
23
|
`\P{UnicodeProperty}` | Inverse Unicode property character class. Can be used in character classes `[]`. See [Unicode Properties](#unicode-properties) for more info.
|
|
24
24
|
`\PX` | Inverse Unicode property character class where `X` is the uppercase letter that represents the General Category property. For instance, `\PL` would be equivalent to `\P{L}` or `\P{Letter}`.
|
|
25
25
|
`[[:alnum:]]` | Though not really a back reference, support for POSIX style character classes is available. See [POSIX Style Properties](#posix-style-properties) for more info.
|
|
26
|
-
`\N{UnicodeName}` | Named characters are
|
|
26
|
+
`\N{UnicodeName}` | Named characters are normally ignored in Re, but Backrefs adds support for them.
|
|
27
27
|
`\m` | Start word boundary. Translates to `\b(?=\w)`.
|
|
28
28
|
`\M` | End word boundary. Translates to `\b(?<=\w)`.
|
|
29
29
|
`\h` | **Deprecated: Use `\p{Horiz_Space}` instead.** Horizontal whitespace. Equivalent to using `[[:blank:]]` or `[\t\p{Zs}]`.
|
|
@@ -73,7 +73,7 @@ Back\ References | Description
|
|
|
73
73
|
`\U` | Wide Unicode character `\U00000057`. Re doesn't translate this notation in raw strings (`#!py3 r"..."`), and Regex doesn't in format templates in raw strings (`#!py3 r"{} {}"`). This adds support for them.
|
|
74
74
|
`\u` | Narrow Unicode character `\u0057`. Re doesn't translate this notation in raw strings (`#!py3 r"..."`), and Regex doesn't in format templates in raw strings (`#!py3 r"{} {}"`). This adds support for them.
|
|
75
75
|
`\x` | Byte character `\x57`. Re doesn't translate this notation in raw strings (`#!py3 r"..."`), and Regex doesn't in format templates in raw strings (`#!py3 r"{} {}"`). This adds support for them.
|
|
76
|
-
`\N{UnicodeName}` | Named characters are
|
|
76
|
+
`\N{UnicodeName}` | Named characters are normally ignored in Re, but Backrefs adds support for them.
|
|
77
77
|
|
|
78
78
|
/// tip
|
|
79
79
|
Complex configurations of casing should work fine.
|
|
@@ -135,7 +135,7 @@ why.
|
|
|
135
135
|
1. Regex's original implementation is very much like it's non-format style replacement accept for two differences: you
|
|
136
136
|
can access individual captures and you cannot use Python string back references such as specifying Unicode via
|
|
137
137
|
`\u<code>`, etc. In Backrefs, we've enhanced the syntax -- for both Re and Regex -- to allow back references to work
|
|
138
|
-
along side brace replacements. This means you can use string back references and
|
|
138
|
+
along side brace replacements. This means you can use string back references and built-in Backrefs features like
|
|
139
139
|
`\C...\E` or `\L...\E`.
|
|
140
140
|
|
|
141
141
|
```pycon3
|
|
@@ -74,7 +74,6 @@ class CustomMetadataHook(MetadataHookInterface):
|
|
|
74
74
|
'License :: OSI Approved :: MIT License',
|
|
75
75
|
'Operating System :: OS Independent',
|
|
76
76
|
'Programming Language :: Python :: 3',
|
|
77
|
-
'Programming Language :: Python :: 3.8',
|
|
78
77
|
'Programming Language :: Python :: 3.9',
|
|
79
78
|
'Programming Language :: Python :: 3.10',
|
|
80
79
|
'Programming Language :: Python :: 3.11',
|
|
@@ -9,7 +9,7 @@ name = "backrefs"
|
|
|
9
9
|
description = "A wrapper around re and regex that adds additional back references."
|
|
10
10
|
readme = "README.md"
|
|
11
11
|
license = "MIT"
|
|
12
|
-
requires-python = ">=3.
|
|
12
|
+
requires-python = ">=3.9"
|
|
13
13
|
authors = [
|
|
14
14
|
{ name = "Isaac Muse", email = "Isaac.Muse@gmail.com" },
|
|
15
15
|
]
|
|
@@ -125,6 +125,8 @@ lint.ignore = [
|
|
|
125
125
|
"RUF012",
|
|
126
126
|
"RUF005",
|
|
127
127
|
"PGH004",
|
|
128
|
+
"RUF022",
|
|
129
|
+
"RUF023",
|
|
128
130
|
"RUF100"
|
|
129
131
|
]
|
|
130
132
|
|
|
@@ -133,7 +135,7 @@ legacy_tox_ini = """
|
|
|
133
135
|
[tox]
|
|
134
136
|
isolated_build = true
|
|
135
137
|
envlist =
|
|
136
|
-
|
|
138
|
+
py39,py310,py311,py312,py313,
|
|
137
139
|
lint
|
|
138
140
|
|
|
139
141
|
[testenv]
|
|
@@ -947,17 +947,17 @@ class TestReplaceTemplate(unittest.TestCase):
|
|
|
947
947
|
def test_format_conversions(self):
|
|
948
948
|
"""Test string format conversion paths."""
|
|
949
949
|
|
|
950
|
-
self.assertTrue(bre.subf('test', r'{0.index}', 'test').startswith('<built-in method'))
|
|
950
|
+
self.assertTrue(bre.subf('test', r'{0.index}', 'test').startswith(('<built-in method', '<bound method')))
|
|
951
951
|
self.assertEqual(bre.subf('test', r'{0.__class__.__name__}', 'test'), 'str')
|
|
952
|
-
self.assertTrue(bre.subf('test', r'{0.index!s}', 'test').startswith('<built-in method'))
|
|
952
|
+
self.assertTrue(bre.subf('test', r'{0.index!s}', 'test').startswith(('<built-in method', '<bound method')))
|
|
953
953
|
self.assertEqual(bre.subf('test', r'{0.__class__.__name__!s}', 'test'), 'str')
|
|
954
|
-
self.assertTrue(bre.subf('test', r'{0.index!a}', 'test').startswith('<built-in method'))
|
|
954
|
+
self.assertTrue(bre.subf('test', r'{0.index!a}', 'test').startswith(('<built-in method', '<bound method')))
|
|
955
955
|
|
|
956
|
-
self.assertTrue(bre.subf(b'test', br'{0.index}', b'test').startswith(b'<built-in method'))
|
|
956
|
+
self.assertTrue(bre.subf(b'test', br'{0.index}', b'test').startswith((b'<built-in method', b'<bound method')))
|
|
957
957
|
self.assertEqual(bre.subf(b'test', br'{0.__class__.__name__}', b'test'), b'bytes')
|
|
958
|
-
self.assertTrue(bre.subf(b'test', br'{0.index!s}', b'test').startswith(b'<built-in method'))
|
|
958
|
+
self.assertTrue(bre.subf(b'test', br'{0.index!s}', b'test').startswith((b'<built-in method', b'<bound method')))
|
|
959
959
|
self.assertEqual(bre.subf(b'test', br'{0.__class__.__name__!s}', b'test'), b'bytes')
|
|
960
|
-
self.assertTrue(bre.subf('test', r'{0.index!a}', 'test').startswith('<built-in method'))
|
|
960
|
+
self.assertTrue(bre.subf('test', r'{0.index!a}', 'test').startswith(('<built-in method', '<bound method')))
|
|
961
961
|
|
|
962
962
|
def test_incompatible_strings(self):
|
|
963
963
|
"""Test incompatible string types."""
|
|
@@ -693,17 +693,21 @@ class TestReplaceTemplate(unittest.TestCase):
|
|
|
693
693
|
def test_format_conversions(self):
|
|
694
694
|
"""Test string format conversion paths."""
|
|
695
695
|
|
|
696
|
-
self.assertTrue(bregex.subf('test', r'{0.index}', 'test').startswith('<built-in method'))
|
|
696
|
+
self.assertTrue(bregex.subf('test', r'{0.index}', 'test').startswith(('<built-in method', '<bound method')))
|
|
697
697
|
self.assertEqual(bregex.subf('test', r'{0.__class__.__name__}', 'test'), 'str')
|
|
698
|
-
self.assertTrue(bregex.subf('test', r'{0.index!s}', 'test').startswith('<built-in method'))
|
|
698
|
+
self.assertTrue(bregex.subf('test', r'{0.index!s}', 'test').startswith(('<built-in method', '<bound method')))
|
|
699
699
|
self.assertEqual(bregex.subf('test', r'{0.__class__.__name__!s}', 'test'), 'str')
|
|
700
|
-
self.assertTrue(bregex.subf('test', r'{0.index!a}', 'test').startswith('<built-in method'))
|
|
700
|
+
self.assertTrue(bregex.subf('test', r'{0.index!a}', 'test').startswith(('<built-in method', '<bound method')))
|
|
701
701
|
|
|
702
|
-
self.assertTrue(bregex.subf(
|
|
702
|
+
self.assertTrue(bregex.subf(
|
|
703
|
+
b'test', br'{0.index}', b'test').startswith((b'<built-in method', b'<bound method'))
|
|
704
|
+
)
|
|
703
705
|
self.assertEqual(bregex.subf(b'test', br'{0.__class__.__name__}', b'test'), b'bytes')
|
|
704
|
-
self.assertTrue(
|
|
706
|
+
self.assertTrue(
|
|
707
|
+
bregex.subf(b'test', br'{0.index!s}', b'test').startswith((b'<built-in method', b'<bound method'))
|
|
708
|
+
)
|
|
705
709
|
self.assertEqual(bregex.subf(b'test', br'{0.__class__.__name__!s}', b'test'), b'bytes')
|
|
706
|
-
self.assertTrue(bregex.subf('test', r'{0.index!a}', 'test').startswith('<built-in method'))
|
|
710
|
+
self.assertTrue(bregex.subf('test', r'{0.index!a}', 'test').startswith(('<built-in method', '<bound method')))
|
|
707
711
|
|
|
708
712
|
def test_incompatible_strings(self):
|
|
709
713
|
"""Test incompatible string types."""
|
|
Binary file
|
|
@@ -744,9 +744,9 @@ def gen_binary(table, output, ascii_props=False, append=False, prefix="", aliase
|
|
|
744
744
|
# One off Unicode property found under https://unicode.org/reports/tr18/#Compatibility_Properties
|
|
745
745
|
# `Word: [\p{alnum}\p{M}\p{Pc}\p{JoinControl}]`
|
|
746
746
|
s = set(binary["alnum"])
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
747
|
+
for k, v in table['m'].items():
|
|
748
|
+
if not k.startswith('^'):
|
|
749
|
+
s |= set(v)
|
|
750
750
|
s |= set(table["p"]["c"])
|
|
751
751
|
s |= set(binary["joincontrol"])
|
|
752
752
|
binary["word"] = list(s)
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"""Typing objects for the Regex library."""
|
|
2
|
-
from typing import AnyStr
|
|
3
|
-
import regex # type: ignore[import]
|
|
4
|
-
import sys
|
|
5
|
-
|
|
6
|
-
from typing import _alias # type: ignore[attr-defined]
|
|
7
|
-
|
|
8
|
-
if sys.version_info >= (3, 9):
|
|
9
|
-
Pattern = _alias(type(regex.compile('')), 1)
|
|
10
|
-
Match = _alias(type(regex.compile('').match('')), 1)
|
|
11
|
-
else:
|
|
12
|
-
Pattern = _alias(type(regex.compile('')), AnyStr)
|
|
13
|
-
Match = _alias(type(regex.compile('').match('')), AnyStr)
|
|
Binary file
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|