]>
git.madduck.net Git - etc/taskwarrior.git/blobdiff - tasklib/task.py
madduck's git repository
Every one of the projects in this repository is available at the canonical
URL git://git.madduck.net/madduck/pub/<projectpath> — see
each project's metadata for the exact URL.
All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@ git. madduck. net .
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
SSH access, as well as push access can be individually
arranged .
If you use my repositories frequently, consider adding the following
snippet to ~/.gitconfig and using the third clone URL listed for each
project:
[url "git://git.madduck.net/madduck/"]
insteadOf = madduck:
def _load_data(self, data):
self._data = data
def _load_data(self, data):
self._data = data
+ self._original_data = data
def __getitem__(self, key):
hydrate_func = getattr(self, 'deserialize_{0}'.format(key),
def __getitem__(self, key):
hydrate_func = getattr(self, 'deserialize_{0}'.format(key),
dehydrate_func = getattr(self, 'serialize_{0}'.format(key),
lambda x: x)
self._data[key] = dehydrate_func(value)
dehydrate_func = getattr(self, 'serialize_{0}'.format(key),
lambda x: x)
self._data[key] = dehydrate_func(value)
- self._modified_fields.add(key)
def __str__(self):
s = six.text_type(self.__unicode__())
def __str__(self):
s = six.text_type(self.__unicode__())
kwargs.update(data)
self._load_data(kwargs)
kwargs.update(data)
self._load_data(kwargs)
- self._modified_fields = set()
def __unicode__(self):
return self['description']
def __unicode__(self):
return self['description']
def __hash__(self):
return self['uuid'].__hash__()
def __hash__(self):
return self['uuid'].__hash__()
+ @property
+ def _modified_fields(self):
+ for key in self._data.keys():
+ if self._data.get(key) != self._original_data.get(key):
+ yield key
+
@property
def completed(self):
return self['status'] == six.text_type('completed')
@property
def completed(self):
return self['status'] == six.text_type('completed')
# Circumvent the ID storage, since ID is considered read-only
self._data['id'] = int(id_lines[0].split(' ')[2].rstrip('.'))
# Circumvent the ID storage, since ID is considered read-only
self._data['id'] = int(id_lines[0].split(' ')[2].rstrip('.'))
- self._modified_fields.clear()
self.refresh()
def add_annotation(self, annotation):
self.refresh()
def add_annotation(self, annotation):
to_update = dict(
[(k, new_data.get(k)) for k in only_fields])
self._data.update(to_update)
to_update = dict(
[(k, new_data.get(k)) for k in only_fields])
self._data.update(to_update)
+ self._original_data.update(to_update)
else:
self._data = new_data
else:
self._data = new_data
+ self._original_data = new_data
class TaskFilter(object):
class TaskFilter(object):