Comments (3)
I just ran across this while debugging the same issue in telch. I believe the problem is in fields/numeric.py
in the function NumericField.deserialize
. Deserialization as an integer is preferred there over deserialization as a float, regardless of the presence of decimal digits or a decimal point. This basically ensures that all numbers output from task
appear rounded in python.
In my opinion, a somewhat more complex check would be in order: if float(value) != int(value): return float(value)
, otherwise if '.' in value: return float(value)
, otherwise return int(value)
. The conditions for None
and a non-numeric value
should be kept as they are.
from taskw.
It turns out the following patch is enough to alleviate this specific problem:
--- /usr/lib/python3/dist-packages/taskw/fields/numeric.py.orig 2015-01-19 16:12:46.000000000 +0100
+++ /usr/lib/python3/dist-packages/taskw/fields/numeric.py 2020-12-06 23:34:32.081430072 +0100
@@ -11,7 +11,7 @@
return value
def deserialize(self, value):
- if value is None:
+ if value is None or isinstance(value, (int, float)):
return value
try:
return int(value)
from taskw.
Merged a fix for this via the changes in #124
from taskw.
Related Issues (20)
- taskw in marshaling mode doesn't work with pickle
- Python 3: str(TaskwarriorError(...)): TypeError: __str__ returned non-string (type bytes)
- TypeError: argument of type 'FileNotFoundError' is not iterable
- filter_tasks with multiple uuids HOT 2
- v1.3.0 not uploaded to PyPI HOT 2
- issue adding tasks "UUID has no attribute group" HOT 5
- Unable to update tasks
- `task_add` raises an error, but creates the task HOT 2
- Four test failures on openSUSE Tumbleweed HOT 2
- taskrc includes as relative paths cause FileNotFoundError in taskw
- Fetching a (periodic) task fails - Unable to find report that matches HOT 1
- unnecessary "task --version" 3x to start, 1x for every filter and 2x for every add
- Tag "next" seems not to be added if added as only tag in function add_task HOT 2
- If "annotations" not passed to task_update, it truncates annotations HOT 3
- Marshal=True results in loss of timestamp for annotations.
- Saving task with effort field corrupts the description field.
- Implement a lock file
- Taskwarrior 3.0 support? HOT 2
- Taskw unnecessarily encodes [ and ]
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from taskw.