GithubHelp home page GithubHelp logo

Comments (3)

sjbronner avatar sjbronner commented on September 25, 2024

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.

sjbronner avatar sjbronner commented on September 25, 2024

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.

coddingtonbear avatar coddingtonbear commented on September 25, 2024

Merged a fix for this via the changes in #124

from taskw.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.