Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
news
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Sartika Aritonang
news
Commits
ec12b859
Commit
ec12b859
authored
May 29, 2020
by
Sartika Aritonang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upload New File
parent
d42fd31b
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
0 deletions
+44
-0
datrie.py
stbi/Lib/site-packages/pip/_vendor/html5lib/_trie/datrie.py
+44
-0
No files found.
stbi/Lib/site-packages/pip/_vendor/html5lib/_trie/datrie.py
0 → 100644
View file @
ec12b859
from
__future__
import
absolute_import
,
division
,
unicode_literals
from
datrie
import
Trie
as
DATrie
from
pip._vendor.six
import
text_type
from
._base
import
Trie
as
ABCTrie
class
Trie
(
ABCTrie
):
def
__init__
(
self
,
data
):
chars
=
set
()
for
key
in
data
.
keys
():
if
not
isinstance
(
key
,
text_type
):
raise
TypeError
(
"All keys must be strings"
)
for
char
in
key
:
chars
.
add
(
char
)
self
.
_data
=
DATrie
(
""
.
join
(
chars
))
for
key
,
value
in
data
.
items
():
self
.
_data
[
key
]
=
value
def
__contains__
(
self
,
key
):
return
key
in
self
.
_data
def
__len__
(
self
):
return
len
(
self
.
_data
)
def
__iter__
(
self
):
raise
NotImplementedError
()
def
__getitem__
(
self
,
key
):
return
self
.
_data
[
key
]
def
keys
(
self
,
prefix
=
None
):
return
self
.
_data
.
keys
(
prefix
)
def
has_keys_with_prefix
(
self
,
prefix
):
return
self
.
_data
.
has_keys_with_prefix
(
prefix
)
def
longest_prefix
(
self
,
prefix
):
return
self
.
_data
.
longest_prefix
(
prefix
)
def
longest_prefix_item
(
self
,
prefix
):
return
self
.
_data
.
longest_prefix_item
(
prefix
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment