[Wikidata-bugs] [Maniphest] [Commented On] T119226: Very small (or very large) quantity values (represented in scientific notation) result in error in add/update via pywikibot/wikidata API

2020-02-16 Thread Xqt
Xqt added a comment. > PS: I add @Xqt because I guess you can help here Like matej_suchanek suggests please submit Patches to gerrit for reviewing. You may use Gerrit patch uploader if you don't want your own account there.

[Wikidata-bugs] [Maniphest] [Commented On] T119226: Very small (or very large) quantity values (represented in scientific notation) result in error in add/update via pywikibot/wikidata API

2020-02-15 Thread matej_suchanek
matej_suchanek added a comment. My T204331 is probably a duplicate. > Should I submit this? Sure, reviews are better in Gerrit. There are two problems: - Pywikibot can loose precision when manipulating data - Pywikibot submits

[Wikidata-bugs] [Maniphest] [Commented On] T119226: Very small (or very large) quantity values (represented in scientific notation) result in error in add/update via pywikibot/wikidata API

2020-02-14 Thread ArthurPSmith
ArthurPSmith added a comment. Sorry I never got around to looking at this further. @DD063520 do you understand the above comment from @thiemowmde about using the wbparsevalue api rather than python internals? TASK DETAIL https://phabricator.wikimedia.org/T119226 EMAIL PREFERENCES

[Wikidata-bugs] [Maniphest] [Commented On] T119226: Very small (or very large) quantity values (represented in scientific notation) result in error in add/update via pywikibot/wikidata API

2020-02-14 Thread DD063520
DD063520 added a comment. Ok, I think I found a patch. We can changes this https://github.com/wikimedia/pywikibot/blob/2dfe67426c22c3c11cf9be0eabcf538f8848bd48/pywikibot/__init__.py#L847: def toWikibase(self): """ Convert the data to a JSON object for the

[Wikidata-bugs] [Maniphest] [Commented On] T119226: Very small (or very large) quantity values (represented in scientific notation) result in error in add/update via pywikibot/wikidata API

2016-07-05 Thread ArthurPSmith
ArthurPSmith added a comment. Ok, that echoes something Tobias has said also about using strings and avoiding IEEE fp. I'm going to look at getting T112140 working first and then see if I can bring that implementation to bear on this.TASK DETAILhttps://phabricator.wikimedia.org/T119226EMAIL

[Wikidata-bugs] [Maniphest] [Commented On] T119226: Very small (or very large) quantity values (represented in scientific notation) result in error in add/update via pywikibot/wikidata API

2016-07-05 Thread thiemowmde
thiemowmde added a comment. Pywikibot should not assume all QuantityValues can be casted to IEEE numbers. For example, a QuantityValue can be "100.054321". Depending on the data types you have in your programming language (if it's single, double or something else) converting this to a

[Wikidata-bugs] [Maniphest] [Commented On] T119226: Very small (or very large) quantity values (represented in scientific notation) result in error in add/update via pywikibot/wikidata API

2016-07-04 Thread thiemowmde
thiemowmde added a comment. This limitation is not on input values. Use the wbparsevalue API, which is what the wikidata.org UI does and what https://www.wikidata.org/wiki/Help:Statements#Quantitative_values describes, and you can have all kinds of inputs. The resulting QuantityValue data

[Wikidata-bugs] [Maniphest] [Commented On] T119226: Very small (or very large) quantity values (represented in scientific notation) result in error in add/update via pywikibot/wikidata API

2016-07-02 Thread ArthurPSmith
ArthurPSmith added a comment. That restriction is NOT in the JSON spec: http://tools.ietf.org/html/rfc7159.html#section-6 - also the leading plus is not required by JSON. Is there some other reason for the limitation in the wikidata code? DataValues is a wikidata-specific PHP library right? I

[Wikidata-bugs] [Maniphest] [Commented On] T119226: Very small (or very large) quantity values (represented in scientific notation) result in error in add/update via pywikibot/wikidata API

2016-07-01 Thread ArthurPSmith
ArthurPSmith added a comment. Hmm. So is it a pywikibot problem or a wikibase API problem? Is pywikibot sending in JSON format?TASK DETAILhttps://phabricator.wikimedia.org/T119226EMAIL PREFERENCEShttps://phabricator.wikimedia.org/settings/panel/emailpreferences/To: ArthurPSmithCc: thiemowmde,

[Wikidata-bugs] [Maniphest] [Commented On] T119226: Very small (or very large) quantity values (represented in scientific notation) result in error in add/update via pywikibot/wikidata API

2016-07-01 Thread ArthurPSmith
ArthurPSmith added a comment. As far as testing goes, I have (in my own copy) added the following to the pywikibot tests/wikibase_edit_tests.py file (within the class TestWikibaseMakeClaim): def _check_quantity_claim(self, value, uncertainty): """Helper function to add and check quantity

[Wikidata-bugs] [Maniphest] [Commented On] T119226: Very small (or very large) quantity values (represented in scientific notation) result in error in add/update via pywikibot/wikidata API

2016-06-28 Thread Tobias1984
Tobias1984 added a comment. Here is some information of the range of values the API accepts: https://www.wikidata.org/wiki/Help:Statements#Quantitative_values We probably need more testing so things like 1e-123 arrives as:

[Wikidata-bugs] [Maniphest] [Commented On] T119226: Very small (or very large) quantity values (represented in scientific notation) result in error in add/update via pywikibot/wikidata API

2016-06-27 Thread ArthurPSmith
ArthurPSmith added a comment. Please note this is still an issue with the latest pywikibot code and current wikidata release - as of June 23, 2016. The following is the fix I have in the pywikibot core pywikibot/__init__.py file: instead of format(value, "+g") we need: if math.fabs(value) <