-
Notifications
You must be signed in to change notification settings - Fork 9
FIX: compatibility with Python v2.x #9
base: master
Are you sure you want to change the base?
Conversation
MOD: some cosmetics regarding folding of function comments
todotxtio.py
Outdated
@@ -1,5 +1,9 @@ | |||
#!/usr/bin/python |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file isn't meant to be executable. What is the purpose of this line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmmm... I always create my librarys so that in the end, they can be used as libraries AND can be executed as standalone tools (where this makes sense). So, you are right, here the line makes no sense, yet.
todotxtio.py
Outdated
|
||
:param str string: The string to parse | ||
:rtype: list | ||
""" | ||
|
||
# init |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sorry but the comments you added in this function doesn't add any useful information, given the statements are simple enough to understand. Please remove them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you are right. the comments don't add any functionality. It is just a question of style and readability in general (which is in the end a question of personal taste). I can remove it.
Hi, thank you for your interest in Todo.txt I/O! I added some comments in your PR. Once they'll be addressed, this PR will be ready to be merged and a new version of Todo.txt I/O will be released. Also please create a contributors list in the readme (like here) then add yourself as well as what you done in a few words. |
Also please update the docs (saying it's also compatible with Python 2) as well as the setup.py. |
todotxtio.py
Outdated
@@ -85,43 +114,57 @@ def from_string(string): | |||
if todo_pre_data.group(2): | |||
todo.completion_date = todo_pre_data.group(2) | |||
else: | |||
todo.creation_date = todo_pre_data.group(2) | |||
todo.creation_date = todo_pre_data.group(4) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well that's working ATM, maybe the regex is wrong. Better check the regex first. Anyway I never had issues with creation dates.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please check with the following code (just open the Python interpreter and paste the code in. I did it for both, Python v2.7 and Python v3.6):
import re
todo_data_regex = re.compile( \
'^(?:(x) )?' + \
'(?:(\d{4}-\d{2}-\d{2}) )?' + \
'(?:\(([A-Z])\) )?' + \
'(?:(\d{4}-\d{2}-\d{2}) )?' \
)
match = todo_data_regex.match( \
'(A) 2018-03-28 an unfinished task created at 2018-03-28 +TestProject @Home due:2018-03-29')
print( \
'the complete prefix: ' + str(match.group(0)) + '\n' + \
'the COMPLETED FLAG: ' + str(match.group(1)) + '\n' + \
'the COMPLETED DATE: ' + str(match.group(2)) + '\n' + \
'the PRIORITY: ' + str(match.group(3)) + '\n' + \
'the CREATION DATE: ' + str(match.group(4)) \
)
in both versions, the creation date should appear in match.group(4)
. When inserting a COMPLETED TASK in the code above, the creation date appears in match.group(4)
as well. As I understand RegEx there, the algorithm should not differ with a changed input string.
NEW: REMARKS specification by using CURLY BRACKETS
…e can be handled FIX: __setattr__() function now handles persons and remarks as well MOD: rename "author" -> "authors" and "responsible" -> "responsibles" as they are lists
…rting alpha char for attributes
link) into list of list
…d from descriptions.
…cters instilled e.g. by GitLab special characters following the plus sign will skip the element
modified some bits in order to make the code run on Python v2.x (checked with v2.7). Imported the standard module "io" which provides unicode character handling for Python v2 and v3 in the same way. Additionally, the call of the function "super()" had to be modified in order to fit both Python versions. Some cosmetics regarding the function comments were made to facilitate better standard folding within editors.