Commit Graph

123 Commits

Author SHA1 Message Date
Jeremy Fincher
b5f1e2a3e7 Added utils.iter.limited, an iterable that limits the number of elements that can be taken from another iterable. 2005-05-30 19:19:11 +00:00
James Vega
7bfc9cbdd3 utils/str: Rename nth to ordinal and have it return the full string instead of just the ordinal ending. 2005-05-09 17:20:43 +00:00
James Vega
9971e991fe Fix the modelines. 2005-03-23 20:07:45 +00:00
Jeremy Fincher
6b19504515 Changed the utils.iter.choice test to work bettar. 2005-03-14 18:55:11 +00:00
James Vega
aefcd594df Move structures to utils/ 2005-03-12 18:01:47 +00:00
James Vega
568ebcdf96 Add tests for utils.iter.choice. 2005-02-18 13:40:29 +00:00
Jeremy Fincher
6aca01bafb Made utils.file.mktemp a little more stochastic. 2005-02-18 07:04:48 +00:00
Jeremy Fincher
8897e6458b Removed test/test_fix.py, moving its tests to test/test_utils.py, and fixed the resulting bugs that were discovered. 2005-02-01 07:08:30 +00:00
Jeremy Fincher
2b6994428e Fixed a bug that was introduced in nItems. 2005-02-01 07:06:36 +00:00
Jeremy Fincher
65893c8e3c Added emailRe to utils.net. 2005-02-01 06:34:58 +00:00
James Vega
afc3c3f94a Fix some calls to pluralize to not use the extra argument. Also updated the pluralize tests. 2005-01-31 15:59:44 +00:00
Jeremy Fincher
a19a979499 Robustified and improved utils.str.format a bit; added a simple test. 2005-01-28 15:23:18 +00:00
Jeremy Fincher
34f1fe6562 Swapped the argument order for nItems *again*. 2005-01-28 15:17:26 +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
74b9a3c702 Moved eachSubstring to be a nested function; we don't use it anywhere else. 2005-01-26 14:41:42 +00:00
Jeremy Fincher
895cd3e48e Resurrected the test suite with the new supybot-test program and RCS. 2005-01-23 19:42:25 +00:00
Jeremy Fincher
3d3b1498fe Changed copyright years on test files 2005-01-24 21:27:34 +00:00
Jeremy Fincher
8ca625d339 Initial import. 2005-01-19 13:14:38 +00:00
James Vega
dbfec8afb9 Add supybot module 2007-04-22 20:10:26 +00:00
Jeremy Fincher
fdeae5c022 Better error-checking. 2005-01-13 17:48:47 +00:00
Jeremy Fincher
493aa57d8e Added a couple asserts. 2005-01-12 02:47:35 +00:00
Jeremy Fincher
cc084d2535 Removed some XXXes and allowed other separators than /. 2004-12-16 09:22:39 +00:00
Jeremy Fincher
5d37d71afb Test is too tight, commented out until an appropriate test can be devised. 2004-12-16 09:18:36 +00:00
Jeremy Fincher
5466544350 Fix for a bug in the short timeElapsed. 2004-12-08 20:27:59 +00:00
Jeremy Fincher
e4f15ae1b3 Cleaner implementation. 2004-12-08 07:45:24 +00:00
Jeremy Fincher
58b3268bdd Have exnToString handle exceptions whose str representation is empty. 2004-11-04 06:01:17 +00:00
James Vega
601d58a662 utils.quoted 2004-10-23 19:40:00 +00:00
James Vega
23397b44b4 Remove #! lines. 2004-09-20 15:25:47 +00:00
Jeremy Fincher
ec55e86c61 Let's catch SyntaxError and turn it into an appropriate ValueError. 2004-08-25 05:17:37 +00:00
Jeremy Fincher
fbb348b6e7 Copyright updates. Again, more is left to be done, but this is my part. 2004-08-23 13:14:06 +00:00
Jeremy Fincher
0f1842b18d Only do real variable names. 2004-08-21 02:57:47 +00:00
Jeremy Fincher
f9c61271ea w00, less path mungingEXCLAIMEXCLAIM 2004-07-24 05:18:26 +00:00
James Vega
315810d08e yay! no more stray whitespace 2004-07-21 19:36:35 +00:00
James Vega
481dd5111a Add comma argument to commaAndify 2004-04-28 06:26:02 +00:00
Jeremy Fincher
48d6c982ce Made a SupyTestCase base class to handle COOL STUFF\! 2004-02-16 04:12:35 +00:00
Jeremy Fincher
9def8a49bd Hmm, didn't define keys. 2004-02-05 07:32:20 +00:00
Jeremy Fincher
6771c24ca6 Added InsensitivePreservingDict and made IrcDict a subclass of it. 2004-02-05 07:14:35 +00:00
Daniel DiPaolo
2c5e6163a0 This episode was brought to you by the letter 't' as in 'test'. More tests are
good.
2004-01-31 07:02:04 +00:00
Vincent Foley
3e2f3b7f77 Added tests to reflect the changes to pluralize() and depluralize() 2004-01-27 21:02:19 +00:00
Jeremy Fincher
29426e2f1d Moved isIP* to utils from ircutils. 2004-01-16 17:33:51 +00:00
Jeremy Fincher
4452ca879e Added functions for reading non-comment or empty lines of a file. 2004-01-11 14:33:38 +00:00
Jeremy Fincher
18b06dbb89 Fix for findBinaryInPath test. 2004-01-03 15:42:59 +00:00
Jeremy Fincher
bcbfd2130e Made matchCase its own available function. 2004-01-01 19:47:13 +00:00
Jeremy Fincher
42ce8c33a6 Swapped the argument order for utils.{pluralize,nItems} 2003-12-12 15:41:33 +00:00
Jeremy Fincher
88581d99e4 Added utils.sorted. 2003-12-09 14:46:12 +00:00
Jeremy Fincher
2a9d9d1b5d Reworked so there's no double-import problem. 2003-12-02 12:27:45 +00:00
Jeremy Fincher
fb2d9b7f4f Various re fixes, including bug #850931. 2003-12-01 11:06:17 +00:00
Jeremy Fincher
901a225619 Added safeEval. 2003-11-07 19:40:03 +00:00
Jeremy Fincher
d174226c5c Added the ability to do hashed passwords. 2003-10-28 15:13:53 +00:00
Jeremy Fincher
b63f2170e8 Added a saltHash function. 2003-10-28 14:20:00 +00:00
Jeremy Fincher
eaa15860d8 Made sure commaAndify raises TypeError when it's given lists of non-strings. 2003-10-28 05:10:03 +00:00
Jeremy Fincher
2ffe5a13dd Added depluralize function and fixed latent (untested) capitalization buggerishness. 2003-10-16 20:05:45 +00:00
Jeremy Fincher
ed3d757081 Made perlReToPythonRe always raise a ValueError instead of re.error. 2003-10-15 05:07:07 +00:00
Jeremy Fincher
b692681e1c Found bug in utils.sortBy, mentioned by Tim Peters on Python-dev. Fixed, and tested. 2003-10-14 03:47:35 +00:00
Jeremy Fincher
a0fe5410c0 Fixed bug in perlReToReplacer where escaped slashes would stay in the output. 2003-10-12 13:11:53 +00:00
Jeremy Fincher
88f33ed8dd Added test for ellipsisify. 2003-10-10 04:23:14 +00:00
Jeremy Fincher
0aa448bfc7 Added keyword option And to commaAndify to allow specifying a word other than 'and' as the last separator. 2003-09-12 08:55:30 +00:00
Jeremy Fincher
6aa3e06402 Raise ValueError in the case of bad input. 2003-09-08 06:10:06 +00:00
Jeremy Fincher
f65829b768 Moved several things from fix.py to utils.py. 2003-09-04 20:42:37 +00:00
Jeremy Fincher
4c980aeb3e Added nItems. 2003-09-03 09:40:26 +00:00
Jeremy Fincher
a764de50ad Added sortBy, which uses the decorate/sort/undecorate pattern to sort by a certain criteria. 2003-09-03 08:51:45 +00:00
Jeremy Fincher
83707f81c1 Added normalizeWhitespace. 2003-09-01 18:39:27 +00:00
Jeremy Fincher
1cd7ccbfa4 Found bug in perlReToPythonRe and fixed it. 2003-08-30 18:39:19 +00:00
Jeremy Fincher
53d883710e Added unCommaThe function. 2003-08-23 07:57:04 +00:00
James Vega
274ce40b0f Updated the tests to stress more possibilities 2003-08-22 21:32:06 +00:00
Jeremy Fincher
6bfd991947 commaAndified timeElapsed. 2003-08-21 16:31:11 +00:00
Jeremy Fincher
4858770ee7 Ew, modified the original argument in utils.commaAndify. 2003-08-21 11:47:43 +00:00
Jeremy Fincher
01eb6934ef Added function commaAndify to turn a list of strings into a proper English foo, bar, and baz string. 2003-08-20 09:24:57 +00:00
Daniel DiPaolo
e2e277df0f * added a test for utils.findBinaryInPath 2003-08-17 21:16:02 +00:00
Jeremy Fincher
f2bb968030 Added a few more test cases to testDQRepr and made it less fragile. 2003-08-17 06:26:50 +00:00
Jeremy Fincher
7d594954f7 Added another assert for proper IndexError raising. 2003-06-04 04:36:30 +00:00
Jeremy Fincher
09340376cb Changed utils.timeElapsed to use just a seconds instead of a now/then argument. 2003-05-20 15:37:25 +00:00
Jeremy Fincher
984e29e9c0 Initial import; new naming scheme. 2003-04-17 08:49:14 +00:00