Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions annet/annlib/netdev/devdb/data/devdb.json
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,10 @@
"H3C.S12500": " S125\\d{2}",
"H3C.S12500.S12500R": " S12500R",

"B4com": "^[Bb]4com",
"B4com.CS2148P": "^[Bb]4com B4T-CS2148P.*",
"B4com.CS4100": "^[Bb]4com B4T-CS41.*",
"B4com.CS4132U": "^[Bb]4com B4T-CS4132U.*",
"B4com.CS4148Q": "^[Bb]4com B4T-CS4148Q.*",
"B4com.CS4164U": "^[Bb]4com B4T-CS4164U.*"
"B4com": "^[Bb]4[Cc][Oo][Mm]",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"B4com": "^[Bb]4[Cc][Oo][Mm]",
"B4com": "^(?i:B4com)",
>>> re.match(r'^(?i:B4com)', 'B4COM')
<re.Match object; span=(0, 5), match='B4COM'>
>>> re.match(r'^(?i:B4com)', 'b4com')
<re.Match object; span=(0, 5), match='b4com'>

https://docs.python.org/3/library/re.html#index-17

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am hesitant of using inline flags here becase of https://bugs.python.org/issue39394

Is ok here since its in the begginging and local (?i:...) but I am afraid someone will copy-paste it and do not close brackets:

>>> re.compile("(?i)xxx")
re.compile('(?i)xxx', re.IGNORECASE)
>>>
>>> re.compile("xxx(?i:xxx)")
re.compile('xxx(?i:xxx)')
>>>
>>> re.compile("xxx(?i)xxx")
Traceback (most recent call last):
  ...
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/re/_parser.py", line 840, in _parse
    raise source.error('global flags not at the start '
re.error: global flags not at the start of the expression at position 3

"B4com.CS2148P": " B4T-CS2148P",
"B4com.CS4100": " B4T-CS41",
"B4com.CS4132U": " B4T-CS4132U",
"B4com.CS4148Q": " B4T-CS4148Q",
"B4com.CS4164U": " B4T-CS4164U"
}