mirror of
https://github.com/khoj-ai/khoj.git
synced 2025-02-17 08:04:21 +00:00
Use raw string for regex in orgnode to fix deprecation warning
This commit is contained in:
parent
f59e321419
commit
1832e418e5
1 changed files with 9 additions and 9 deletions
|
@ -65,7 +65,7 @@ def makelist(filename):
|
||||||
|
|
||||||
for line in f:
|
for line in f:
|
||||||
ctr += 1
|
ctr += 1
|
||||||
hdng = re.search('^(\*+)\s(.*?)\s*$', line)
|
hdng = re.search(r'^(\*+)\s(.*?)\s*$', line)
|
||||||
if hdng:
|
if hdng:
|
||||||
if heading: # we are processing a heading line
|
if heading: # we are processing a heading line
|
||||||
thisNode = Orgnode(level, heading, bodytext, tag1, alltags)
|
thisNode = Orgnode(level, heading, bodytext, tag1, alltags)
|
||||||
|
@ -83,7 +83,7 @@ def makelist(filename):
|
||||||
bodytext = ""
|
bodytext = ""
|
||||||
tag1 = ""
|
tag1 = ""
|
||||||
alltags = [] # list of all tags in headline
|
alltags = [] # list of all tags in headline
|
||||||
tagsrch = re.search('(.*?)\s*:([a-zA-Z0-9].*?):([a-zA-Z0-9].*?):$',heading)
|
tagsrch = re.search(r'(.*?)\s*:([a-zA-Z0-9].*?):([a-zA-Z0-9].*?):$',heading)
|
||||||
if tagsrch:
|
if tagsrch:
|
||||||
heading = tagsrch.group(1)
|
heading = tagsrch.group(1)
|
||||||
tag1 = tagsrch.group(2)
|
tag1 = tagsrch.group(2)
|
||||||
|
@ -94,7 +94,7 @@ def makelist(filename):
|
||||||
if t != '': alltags.append(t)
|
if t != '': alltags.append(t)
|
||||||
else: # we are processing a non-heading line
|
else: # we are processing a non-heading line
|
||||||
if line[:10] == '#+SEQ_TODO':
|
if line[:10] == '#+SEQ_TODO':
|
||||||
kwlist = re.findall('([A-Z]+)\(', line)
|
kwlist = re.findall(r'([A-Z]+)\(', line)
|
||||||
for kw in kwlist: todos[kw] = ""
|
for kw in kwlist: todos[kw] = ""
|
||||||
|
|
||||||
# Ignore Properties Drawers Completely
|
# Ignore Properties Drawers Completely
|
||||||
|
@ -106,22 +106,22 @@ def makelist(filename):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# Ignore Clocking Lines
|
# Ignore Clocking Lines
|
||||||
if re.search('CLOCK: \[[0-9]{4}-[0-9]{2}-[0-9]{2}', line):
|
if re.search(r'CLOCK: \[[0-9]{4}-[0-9]{2}-[0-9]{2}', line):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if not in_properties_drawer and line[:1] != '#':
|
if not in_properties_drawer and line[:1] != '#':
|
||||||
bodytext = bodytext + line
|
bodytext = bodytext + line
|
||||||
|
|
||||||
prop_srch = re.search('^\s*:(.*?):\s*(.*?)\s*$', line)
|
prop_srch = re.search(r'^\s*:(.*?):\s*(.*?)\s*$', line)
|
||||||
if prop_srch:
|
if prop_srch:
|
||||||
propdict[prop_srch.group(1)] = prop_srch.group(2)
|
propdict[prop_srch.group(1)] = prop_srch.group(2)
|
||||||
continue
|
continue
|
||||||
sd_re = re.search('SCHEDULED:\s+<([0-9]+)\-([0-9]+)\-([0-9]+)', line)
|
sd_re = re.search(r'SCHEDULED:\s+<([0-9]+)\-([0-9]+)\-([0-9]+)', line)
|
||||||
if sd_re:
|
if sd_re:
|
||||||
sched_date = datetime.date(int(sd_re.group(1)),
|
sched_date = datetime.date(int(sd_re.group(1)),
|
||||||
int(sd_re.group(2)),
|
int(sd_re.group(2)),
|
||||||
int(sd_re.group(3)) )
|
int(sd_re.group(3)) )
|
||||||
dd_re = re.search('DEADLINE:\s*<(\d+)\-(\d+)\-(\d+)', line)
|
dd_re = re.search(r'DEADLINE:\s*<(\d+)\-(\d+)\-(\d+)', line)
|
||||||
if dd_re:
|
if dd_re:
|
||||||
deadline_date = datetime.date(int(dd_re.group(1)),
|
deadline_date = datetime.date(int(dd_re.group(1)),
|
||||||
int(dd_re.group(2)),
|
int(dd_re.group(2)),
|
||||||
|
@ -140,12 +140,12 @@ def makelist(filename):
|
||||||
# process the headings searching for TODO keywords
|
# process the headings searching for TODO keywords
|
||||||
for n in nodelist:
|
for n in nodelist:
|
||||||
h = n.Heading()
|
h = n.Heading()
|
||||||
todoSrch = re.search('([A-Z]+)\s(.*?)$', h)
|
todoSrch = re.search(r'([A-Z]+)\s(.*?)$', h)
|
||||||
if todoSrch:
|
if todoSrch:
|
||||||
if todoSrch.group(1) in todos:
|
if todoSrch.group(1) in todos:
|
||||||
n.setHeading( todoSrch.group(2) )
|
n.setHeading( todoSrch.group(2) )
|
||||||
n.setTodo ( todoSrch.group(1) )
|
n.setTodo ( todoSrch.group(1) )
|
||||||
prtysrch = re.search('^\[\#(A|B|C)\] (.*?)$', n.Heading())
|
prtysrch = re.search(r'^\[\#(A|B|C)\] (.*?)$', n.Heading())
|
||||||
if prtysrch:
|
if prtysrch:
|
||||||
n.setPriority(prtysrch.group(1))
|
n.setPriority(prtysrch.group(1))
|
||||||
n.setHeading(prtysrch.group(2))
|
n.setHeading(prtysrch.group(2))
|
||||||
|
|
Loading…
Add table
Reference in a new issue