Commit Graph

49 Commits

Author SHA1 Message Date
Valentin Lorentz
78a50c81bd Math: Display a nicer error in case of MemoryError. 2019-11-11 12:12:10 +01:00
Valentin Lorentz
3848ae78de Math: Rewrite calc functions with a proper evaluator.
Instead of hacking around eval(), which everyone knows is a bad idea
even with prior expression sanitizing.
2019-11-09 15:49:31 +01:00
Valentin Lorentz
fcf30a5601 Fix FutureWarning related to nested sets.
See https://bugs.python.org/issue30349
2018-12-29 23:36:57 +01:00
Valentin Lorentz
2d084f4deb Math: Convert the output of factorial() to a float. 2018-05-10 06:20:55 +02:00
James Lu
21a729d95a Math.convertcore: remove useless try/except clause 2017-09-29 15:50:58 -07:00
nyuszika7h
bb448f412d Math: Fix round() with single argument in 'calc' command
I broke this with my previous commit related to this.
2017-05-08 18:50:27 +02:00
nyuszika7h
7d299dc3d1 Math: Fix round() in calc command
The second argument of `round()` has to be an integer, and since every
number is converted to a float to avoid using too much memory, a wrapper
has to be added for this function. I've tested it with big numbers and
it doesn't seem to cause any issue.
2017-03-27 16:35:33 +02:00
Valentin Lorentz
27b878ff7c Math: Add comment about security. 2015-09-28 18:59:29 +02:00
Valentin Lorentz
0371480bd6 Math: add the 'round' function. 2015-09-28 18:57:46 +02:00
jacksonmj
97c7d0a9c3 Math.calc: allow factorial for smallish numbers 2015-08-29 01:27:50 +00:00
jacksonmj
1aeb847509 Math.rpn should use _mathSafeEnv, otherwise untrusted users can freeze the bot 2015-08-29 01:26:45 +00:00
Valentin Lorentz
c3a2c800f1 Remove need for 2to3. 2015-08-11 16:50:23 +02:00
Valentin Lorentz
5a82cefd51 Remove use of fix_long fixer. 2015-08-08 23:08:49 +02:00
James Lu
a755238ef4 Add/improve help for Debug + plugins from F-W:
- Debug
- Factoids
- Format
- Games
- Google
- Herald
- Internet
- Karma
- Lart
- Math
- Misc
- MoobotFactoids
- Network
- News
- NickAuth
- Nickometer
- Note
- Owner
- Protector
- Quote
- QuoteGrabs
- Relay
- Scheduler
- Seen
- ShrinkUrl
- Status
- String
- Time
- Todo
- Topic
- URL
- Unix
- User
- Utilities
- Web
2014-11-30 12:07:41 -08:00
Valentin Lorentz
06fdaa792f Continue accelerating the 2to3 step (remove fix_map). 2014-01-21 10:57:38 +01:00
Valentin Lorentz
bb7db3ab21 Continue accelerating the 2to3 step (remove fix_except). 2014-01-20 15:49:15 +01:00
Valentin Lorentz
3cc52aefca Math: Fix handling of negative integers in @calc. 2013-12-15 18:29:34 +00:00
Valentin Lorentz
40675ffdfa Merge remote-tracking branch 'supybot/master' into testing
Conflicts:
	plugins/Admin/plugin.py
	plugins/BadWords/config.py
	plugins/Filter/plugin.py
	plugins/Google/plugin.py
	plugins/Math/plugin.py
	plugins/Misc/plugin.py
	plugins/Note/plugin.py
	plugins/RSS/plugin.py
	plugins/Seen/test.py
	plugins/ShrinkUrl/config.py
	plugins/ShrinkUrl/plugin.py
	plugins/ShrinkUrl/test.py
	plugins/Status/plugin.py
	plugins/String/config.py
	plugins/String/plugin.py
	plugins/Time/plugin.py
	plugins/Todo/plugin.py
	plugins/Web/plugin.py
	plugins/__init__.py
	scripts/supybot-botchk
	setup.py
	src/__init__.py
	src/callbacks.py
	src/commands.py
	src/conf.py
	src/drivers/Socket.py
	src/ircdb.py
	src/irclib.py
	src/ircutils.py
	src/questions.py
	src/registry.py
	src/schedule.py
	src/test.py
	src/utils/file.py
	src/utils/gen.py
	src/utils/net.py
	src/utils/web.py
	src/world.py
2013-08-24 11:28:29 +02:00
Valentin Lorentz
c0c479a77c Math: Fix load on Python 3. 2013-05-08 19:28:16 +00:00
Valentin Lorentz
bbd9d1636a Math: Fix rounding. 2013-01-11 19:44:21 +01:00
Valentin Lorentz
ea63da3e7d Math: As unit conversion algorithm fails with high precision, make significant digits matter. 2013-01-11 18:14:11 +01:00
Valentin Lorentz
3dba9088b0 Merge remote-tracking branch 'supybot/master' into testing
Conflicts:
	INSTALL
	plugins/ChannelLogger/README.txt
	plugins/ChannelStats/README.txt
	plugins/Google/plugin.py
	plugins/Google/test.py
	plugins/Plugin/test.py
	plugins/Web/test.py
	setup.py
	src/callbacks.py
	src/ircdb.py
	src/irclib.py
	src/utils/str.py
	test/test_irclib.py
2013-01-01 21:11:24 +01:00
Daniel Folkinshteyn
3c30463e11 Math: default %f formatting rounds to 6 decimal places. increase that to 16.
Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
2012-11-04 19:48:53 -05:00
Daniel Folkinshteyn
c68afacc0f Math: calc: coerce argument to ascii string. working with unicode errors on the translate() step.
Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
2012-10-30 19:09:45 -04:00
James McCoy
82ecf36fcd Update my name/contact information
Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
2012-09-01 10:16:48 -04:00
Daniel Folkinshteyn
643788b478 Math: default %f formatting rounds to 6 decimal places. increase that to 16. 2012-08-30 11:32:43 +02:00
Valentin Lorentz
987aaa6c37 Math: use string.ascii_uppercase instead of string.uppercase. 2012-08-04 20:23:30 +02:00
Valentin Lorentz
dcd07a2ec4 ChannelStats & Filter & Math & Unit: use utils instead of str.translate. 2012-08-04 19:13:35 +02:00
nyuszika7h
d41acf34cc Math: Add cbrt() function 2012-05-23 12:11:43 +02:00
Valentin Lorentz
7593edb6fc Math: Allow 'factorial()' in icalc.
Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
2012-05-23 06:04:51 -04:00
Valentin Lorentz
e45b9abd23 Math: Block factorial() in calc functions.
Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
2012-05-23 06:04:28 -04:00
Valentin Lorentz
1f60a9487c Math: Allow 'factorial()' in icalc. 2012-05-07 17:52:02 +02:00
Valentin Lorentz
695078edeb Math: Block factorial() in calc functions. 2012-05-07 15:16:20 +00:00
Valentin Lorentz
203fe3c56a Internationalize Herald, Internet, Karma, Lart, Later, Limiter, Math, and Misc 2010-10-17 15:36:26 +02:00
James Vega
22da325656 Math: Move convertcore to the local directory
There's no need to try importing a system-wide copy (for now) as convertcore
is our own munging of convertall's code into a form that's easy for us to use.
This may change in the future.

Signed-off-by: James Vega <jamessan@users.sourceforge.net>
2009-03-11 19:58:21 -04:00
James Vega
ed32faabe1 Math: Remove extra try block in favor of universalImport
Signed-off-by: James Vega <jamessan@users.sourceforge.net>
2009-03-11 14:06:25 -04:00
Jeremy Fincher
a86b4694d7 Added utils.python.universalImport to make the previous idiom cleaner. 2009-03-11 14:05:53 -04:00
Jeremy Fincher
d6ad5b051f Fix math to be capable of using externally-installed third-party packages, while still providing them for people who don't have them externally installed. 2009-03-11 14:05:26 -04:00
James Vega
62897a9663 Workaround Python's idiocy with float -> str -> float conversions 2009-03-11 13:37:26 -04:00
James Vega
a3e4fc5b1d Change the modeline to use softtabstop instead of tabstop. 2006-02-11 15:52:51 +00:00
James Vega
099231df05 plugins/Math: Quote some example strings so the STX version is formatted better. 2005-07-25 22:15:14 +00:00
James Vega
9971e991fe Fix the modelines. 2005-03-23 20:07:45 +00:00
James Vega
90c000793d utils.gen.* functions shouldn't explicitly be called since they're all in the utils namespace. 2005-02-15 13:57:57 +00:00
Jeremy Fincher
b0cb616709 Changed callbacks.Privmsg to be callbacks.Plugin, and callbacks.PrivmsgCommandAndRegexp to be callbacks.Plugin. 2005-02-09 07:04:04 +00:00
James Vega
68d3b830da Remove the use of format() in logger functions since they handle it natively. 2005-02-01 13:43:57 +00:00
James Vega
de89bf0265 Update usage of utils.str functions. 2005-01-31 14:52:27 +00:00
James Vega
28cb5abc65 Update usage of functions in utils.gen. 2005-01-31 13:06:43 +00:00
Jeremy Fincher
5fd6bbb52d Completely restructured our utils modules.
Tons of changes.  Here's the summary of things that matter most:

* There is no more supybot.fix.
* There is no more supybot.webutils; now there is supybot.utils.web.
  * It's no longer webutils.WebError, but just utils.web.Error.
* You shouldn't import itertools, ideally, but instead import utils.iter.
* No more using imap/ifilter in commands unless absolutely necessary.  It's
  premature optimization and annoying.
* utils.str.format isn't quite ready yet, but will be soon.  That'll be the
  next big thing to fix in our code.
2005-01-27 06:59:08 +00:00
Jeremy Fincher
d9df5136cd Added the Math plugin in the new plugin package format. 2005-01-19 23:29:28 +00:00