Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
topydo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
topydo
Commits
6b204b4b
Commit
6b204b4b
authored
Nov 14, 2015
by
Bram Schoenmakers
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed some pylint errors.
parent
0611a867
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
12 deletions
+13
-12
topydo/lib/ListFormat.py
topydo/lib/ListFormat.py
+13
-12
No files found.
topydo/lib/ListFormat.py
View file @
6b204b4b
...
...
@@ -14,7 +14,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
""" Ulities for formatting output with "list_format" option."""
""" U
ti
lities for formatting output with "list_format" option."""
import
arrow
import
re
...
...
@@ -37,6 +37,7 @@ def filler(p_str, p_len):
return
to_fill
*
' '
+
p_str
def
humanize_date
(
p_datetime
):
""" Returns a relative date string from a datetime object. """
now
=
arrow
.
now
()
date
=
now
.
replace
(
day
=
p_datetime
.
day
,
month
=
p_datetime
.
month
,
year
=
p_datetime
.
year
)
return
date
.
humanize
()
...
...
@@ -56,11 +57,10 @@ def humanize_dates(p_due=None, p_start=None, p_creation=None):
dates_list
.
append
(
'due '
+
humanize_date
(
p_due
))
if
p_start
:
now
=
arrow
.
now
().
date
()
start
=
humanize_date
(
p_start
)
if
p_start
<=
now
:
dates_list
.
append
(
'started '
+
start
)
else
:
dates_list
.
append
(
'starts '
+
start
)
dates_list
.
append
(
'{} {}'
.
format
(
'started'
if
p_start
<=
now
else
'starts'
,
humanize_date
(
p_start
)
))
return
', '
.
join
(
dates_list
)
...
...
@@ -132,12 +132,13 @@ class ListFormatParser(object):
# list of tags (spaces) without hidden ones and due: and t:
'k'
:
lambda
t
:
' '
.
join
([
u
(
'{}:{}'
).
format
(
tag
,
value
)
for
tag
,
value
in
sorted
(
t
.
tags
())
if
tag
not
in
config
().
hidden_tags
()
+
[
config
().
tag_start
(),
config
().
tag_due
()]]),
for
tag
,
value
in
sorted
(
t
.
tags
())
if
tag
not
in
config
().
hidden_tags
()
+
[
config
().
tag_start
(),
config
().
tag_due
()]]),
# list of all tags (spaces)
'K'
:
lambda
t
:
' '
.
join
([
u
(
'{}:{}'
).
format
(
tag
,
value
)
for
tag
,
value
in
sorted
(
t
.
tags
())]),
for
tag
,
value
in
sorted
(
t
.
tags
())]),
# priority
'p'
:
lambda
t
:
t
.
priority
()
if
t
.
priority
()
else
''
,
...
...
@@ -243,14 +244,14 @@ class ListFormatParser(object):
attribute.
"""
parsed_list = []
repl_
S
= None
repl_
trunc
= None
for substr, placeholder, getter in self.format_list:
repl = getter(p_todo) if getter else ''
pattern = MAIN_PATTERN.format(ph=placeholder)
if placeholder == '
S
':
repl_
S
= repl
repl_
trunc
= repl
if repl == '':
substr = re.sub(pattern, '', substr)
...
...
@@ -264,7 +265,7 @@ class ListFormatParser(object):
parsed_str = remove_redundant_spaces(parsed_str)
if self.one_line and len(parsed_str) >= self.line_width:
parsed_str = self.truncate(parsed_str, repl_
S
)
parsed_str = self.truncate(parsed_str, repl_
trunc
)
if re.search('
.
*
\
t
', parsed_str):
parsed_str = self.right_align(parsed_str)
...
...
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