Merge lp:~stefanor/ibid/bases into lp:~ibid-core/ibid/old-trunk-pack-0.92

Proposed by Stefano Rivera
Status: Merged
Approved by: Jonathan Hitchcock
Approved revision: 564
Merged at revision: 552
Proposed branch: lp:~stefanor/ibid/bases
Merge into: lp:~ibid-core/ibid/old-trunk-pack-0.92
To merge this branch: bzr merge lp:~stefanor/ibid/bases
Reviewer Review Type Date Requested Status
Jonathan Hitchcock Approve
Michael Gorven Approve
Ibid Core Team Pending
Ibid Core Team feature Pending
Review via email: mp+3845@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Stefano Rivera (stefanor) wrote :

I couldn't tell from the bug report if it was supposed to add bases to the calculators or separately. I opted for the latter.

You can now happily make jokes in base 13:

Query: 6*9
Response: 54
Query: 54 in base 13
Response: That'd be about 42 in base 13

Revision history for this message
Michael Gorven (mgorven) wrote :

We also have a Base converter in tools.py (which should be in math.py though). Yours looks a bit better though, so we'll probably replace the existing one.

lp:~stefanor/ibid/bases updated
546. By Michael Gorven

BC: recommend install and strip output
https://code.launchpad.net/~stefanor/ibid/bc/+merge/3853

Revision history for this message
Michael Gorven (mgorven) wrote :

The base names are effectively defined twice: in the dict and in the regex. It
might be better to generate the regex like done in the factoids plugin.

def setup(self):
    self.set_factoid.im_func.pattern = re.compile(r'^(no[,.: ]\s*)?(.
+?)\s+(?:=(\S+)=)?(?(3)|(%s))(\s+also)?\s+(.+?)$' % '|'.join(self.verbs),
re.I)

Revision history for this message
Russell Cloran (russell) wrote :

"We also have a Base converter in tools.py (which should be in math.py though). Yours looks a bit better though, so we'll probably replace the existing one."

I'd like to see this branch properly "fix" trunk by replacing the base converter in tools/math.py. *shrug*

lp:~stefanor/ibid/bases updated
547. By Jonathan Hitchcock

IMDB: Error handling and cleanups
https://code.launchpad.net/~stefanor/ibid/imdb/+merge/3858

Revision history for this message
Stefano Rivera (stefanor) wrote :

r549 is pretty complete, including ascii

Revision history for this message
Michael Gorven (mgorven) wrote :

I'm happy.
 review approve

review: Approve
lp:~stefanor/ibid/bases updated
548. By Michael Gorven

Specify license in setup.py.
https://code.launchpad.net/~stefanor/ibid/licensing/+merge/3890

Revision history for this message
Jonathan Hitchcock (vhata) wrote :

I'd like the interface to this plugin to be a little more natural-language, and the responses a little less natural-language, if you know what I mean.

"15 in base 8" is a little terse - I'd like it to be able to handle the following (since users *are* going to try to do it this way):

convert 15 from base 10 to base 8
convert 15 base 10 to base 8
convert 15 to base 8

The trouble with this is that it will clash with the units plugin, which is something of a catch-all for "convert X to Y" responses. We have a mechanism to resolve this, which involves lowering the default priority of the plugin (bot owners can, of course, override this in their config files if they want to tweak which plugins respond), but we haven't really tested it in clash cases like this yet.

review: Needs Fixing
Revision history for this message
Jonathan Hitchcock (vhata) wrote :

"We have a mechanism to resolve this, which involves lowering the default priority of the plugin (bot owners can, of course, override this in their config files if they want to tweak which plugins respond), but we haven't really tested it in clash cases like this yet."

To clarify: before we merge this, I'd really like somebody to investigate the repercussions of having two plugins with clashing regexes co-existing like this, and to see how the priority option works. I know that I also fall under the category of 'somebody', and I'll get to it eventually if nobody else does :)

lp:~stefanor/ibid/bases updated
549. By Michael Gorven

Rename sender identifiers in Event objects. Closes LP:#333507.
https://code.launchpad.net/~mgorven/ibid/event.sender-333507/+merge/3872

550. By Michael Gorven

units: Better temperature conversions and error handling.
https://code.launchpad.net/~stefanor/ibid/units/+merge/3852

551. By Michael Gorven

Make additional functions available in calculator, and ban certain expressions.
https://code.launchpad.net/~mgorven/ibid/calc-334075/+merge/3924
Closes LP:#334075.

553. By Stefano Rivera

Less exception handling

554. By Stefano Rivera

support 'x base 12 to base 20' instead of only 'foo in bar'

555. By Stefano Rivera

Speak ascii

556. By Stefano Rivera

Arbitrary bases

557. By Stefano Rivera

Automate regex generation.
Knabbier output.
Allow "convert x" syntax.

Revision history for this message
Jonathan Hitchcock (vhata) wrote :

This plugin is looking really good, and I've tested it, but just one or two quick fixes before I think it's solid:

I appear to be able to convert 99 (base 7) to decimal. That's an invalid number, and should be griped about.

The regex only accepts 'in' or 'to', but not 'into'... (I would accept a fix to the 'units' plugin that lets it accept 'into' as well as 'to' in this merge.)

Finally, the plugin needs a lower priority than the 'units' plugin, because of the previously discussed regex-clash. I have tested it, and all you need to do is add 'priority = -1' to the 'bases' BaseConvert class (or add 'priority = 1' to the units plugin... Not sure which is better - discuss?). This makes sure that they get tested in the order of least acceptance to most acceptance, which is what we want.

review: Needs Fixing
lp:~stefanor/ibid/bases updated
558. By Stefano Rivera

Bases:
Factor out common code and make interfaces as similar as possible.
Improve error handling and messages.

559. By Stefano Rivera

Convert(tools.py) should fire after Base (math.py)

560. By Stefano Rivera

Repeat base64 message for encode

561. By Stefano Rivera

Allow into, as Vhata requested

562. By Stefano Rivera

usage should show canonical base syntax

563. By Stefano Rivera

Allow long base names

Revision history for this message
Stefano Rivera (stefanor) wrote :

r564 should meet your requirements. You'll need my patches to ibid-plugin from lp:~stefanor/ibid/misc to test it.

Query: convert G duotrigesimal to dec
Response: That is 16 in decimal.
Query: convert 99 base 7 to decimal
Response: '9' is not a valid digit in base 7
Query: convert 8 oct into hex
Response: '8' is not a valid digit in octal
Query: convert 32 l to gal
Response: 32 l = 8.4535057 gal
Query: convert 32 m into furlongs
Response: 32 m = 0.15907103 furlongs

lp:~stefanor/ibid/bases updated
564. By Stefano Rivera

More opportunities to name bases + function rename

Revision history for this message
Jonathan Hitchcock (vhata) :
review: Approve
lp:~stefanor/ibid/bases updated
565. By Stefano Rivera

Fix bug in determining existance of base64 plugin

Subscribers

People subscribed via source and target branches