Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions cppman/formatter/cppreference.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def member_type_function(g):
tail = ' ' + spectag.group(2)

cppvertag = re.search(
'^(.*?)(\[(?:(?:since|until) )?C\+\+\d+\]\s*(,\s*)?)+$', head)
r'^(.*?)(\[(?:(?:since|until) )?C\+\+\d+\]\s*(,\s*)?)+$', head)
if cppvertag:
head = cppvertag.group(1).strip()
tail = ' ' + cppvertag.group(2)
Expand Down Expand Up @@ -117,7 +117,7 @@ def member_type_function(g):
# Group t-lines
(r'<span></span>', r'', re.S),
(r'<span class="t-lines">(?:<span>.+?</span>.*)+</span>',
lambda x: re.sub('\s*</span><span>\s*', r', ', x.group(0)), re.S),
lambda x: re.sub(r'\s*</span><span>\s*', r', ', x.group(0)), re.S),
# Member type & function second col is group see basic_fstream for example
(r'<tr class="t-dsc">\s*?<td>((?:(?!</td>).)*?)</td>\s*?'
r'<td>((?:(?!</td>).)*?)<table[^>]*>((?:(?!</table>).)*?)</table>'
Expand Down
2 changes: 1 addition & 1 deletion cppman/formatter/tableparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def gen(self, fd, index=0, last=False, rowspan=None):
ci = 0
for i in range(total):
if i in rowspan:
fd.write('\^%s' % ('|' if i < total - 1 else ''))
fd.write(r'\^%s' % ('|' if i < total - 1 else ''))
if rowspan[i] == 1:
del rowspan[i]
else:
Expand Down
12 changes: 6 additions & 6 deletions cppman/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def rebuild_index(self):
self.db_conn = sqlite3.connect(environ.index_db_re)
self.db_cursor = self.db_conn.cursor()
try:
self.add_url_filter('\.(jpg|jpeg|gif|png|js|css|swf|svg)$')
self.add_url_filter(r'\.(jpg|jpeg|gif|png|js|css|swf|svg)$')
self.set_follow_mode(Crawler.F_SAME_PATH)

sources = [('cplusplus.com', 'https://cplusplus.com/reference/', None),
Expand Down Expand Up @@ -399,10 +399,10 @@ def _extract_keywords(self, text):
for tr in x.find_all('tr'):
tds = tr.find_all('td')
if len(tds) == 2:
if re.match("\s*Type\s*", tds[0].get_text()):
if re.match(r"\s*Type\s*", tds[0].get_text()):
typedefTable = True
elif typedefTable:
res = re.search('^\s*(\S*)\s+.*$', tds[0].get_text())
res = re.search(r'^\s*(\S*)\s+.*$', tds[0].get_text())
if res and res.group(1):
names.append(res.group(1))
elif not typedefTable:
Expand All @@ -420,7 +420,7 @@ def _extract_keywords(self, text):
if e.name == "table":
for tr in e.find_all('tr'):
text = re.sub('\n', ' ', tr.get_text())
res = re.search('^.* (\S+)\s*=.*$', text)
res = re.search(r'^.* (\S+)\s*=.*$', text)
if res:
names.append(res.group(1))
# search for "Helper types" list
Expand All @@ -433,7 +433,7 @@ def _extract_keywords(self, text):
if e.name == "table":
for tr in e.find_all('tr'):
text = re.sub('\n', ' ', tr.get_text())
res = re.search('^.* (\S+)\s*=.*$', text)
res = re.search(r'^.* (\S+)\s*=.*$', text)
if res:
names.append(res.group(1))
return [html.unescape(n) for n in names]
Expand Down Expand Up @@ -583,7 +583,7 @@ def find(self, pattern):

results = self._search_keyword(pattern)

pat = re.compile('(.*?)(%s)(.*?)( \(.*\))?$' %
pat = re.compile(r'(.*?)(%s)(.*?)( \(.*\))?$' %
re.escape(pattern), re.I)

if results:
Expand Down