Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
lichenggang
/
bom_identify
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
46e4ed9c
authored
Jan 25, 2021
by
陈森彬
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
封装正则匹配
parent
b1a699a5
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
5 deletions
utils/functions.py
valid_server.py
utils/functions.py
View file @
46e4ed9c
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import
re
from
config
import
unit_map
,
cast_map
,
unit_regex
,
special_tuple
,
encap_list
,
temp_map
,
special_str
from
config
import
unit_map
,
cast_map
,
unit_regex
,
special_tuple
,
encap_list
,
temp_map
,
special_str
,
encap_regex
unit_pattern
=
re
.
compile
(
'(
\
d+|
\
d+[
\\
\
./?]
\
d+)('
+
unit_regex
+
')([.a-zA-Z
\\
-]?)'
)
encap_pattern
=
re
.
compile
(
'.*('
+
encap_regex
+
').*'
)
def
is_float
(
s
):
...
...
@@ -183,8 +184,9 @@ def check_encap(kw):
:param kw:
:return:
"""
if
kw
in
encap_list
:
return
True
encap_res
=
encap_pattern
.
findall
(
kw
)
if
encap_res
:
return
encap_res
return
False
...
...
valid_server.py
View file @
46e4ed9c
...
...
@@ -132,9 +132,8 @@ class UCHandler(tornado.web.RequestHandler):
if
check_temp
(
kw_info
):
attrs_list
.
append
(
kw_info
)
else
:
encap_res
=
self
.
encap_par
.
findall
(
kw_info
)
encap_res
=
check_encap
(
kw
)
if
encap_res
:
if
check_encap
(
encap_res
[
0
]):
encap_list
.
append
(
encap_res
[
0
])
continue
if
kw_info
and
check_symbol
(
kw_info
):
...
...
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