Valentin Lorentz
8af6761275
Use 'unicode_escape' in utils.str.dqrepr if running Python 3.
2012-08-04 17:33:17 +02:00
Valentin Lorentz
0a4a12243d
Prevent name clash in utils.iter.startswith.
2012-08-04 17:26:59 +02:00
Valentin Lorentz
b8fe420ef3
Use 'ast' instead of 'compiler' in utils.gen.safeEval.
2012-08-04 17:24:08 +02:00
Valentin Lorentz
d3d93da602
utils.gen.saltHash: encode string before hashing it.
2012-08-04 17:12:23 +02:00
Valentin Lorentz
ab978a8c31
Remove utils/gen.py dependency on deprecated libraries (new and UserDict).
2012-08-04 17:09:32 +02:00
Valentin Lorentz
caaf290c9b
utils/gen.py: Import imap from itertools instead of utils.iter.
2012-08-04 17:03:51 +02:00
Valentin Lorentz
9de7316f02
Change utils.file.AtomicFile into a wrapper instead of a subclass.
2012-08-04 17:01:36 +02:00
Valentin Lorentz
174a5a4b1f
Encode strings before hashing them in utils.file.mktemp.
2012-08-04 16:39:33 +02:00
Valentin Lorentz
602f1c7ecb
utils/str.py: Use classes Multiple* instead of lambda functions.
...
As in Python 3, functions are bound to a class when assigned to an attribute,
lambda functions get two parameters, unless they are decorated with classmethod().
And there is no reason to ask plugin developpers use this decorator, while we
avoid them doing this (more over, it is not obvious to debug if they forgot it).
2012-08-04 13:52:02 +02:00
Valentin Lorentz
d52e501ae8
Use open() instead of file().
2012-08-04 13:13:16 +02:00
Valentin Lorentz
fa35a07941
Add utils.str.multipleRemover.
2012-08-04 11:27:50 +02:00
Valentin Lorentz
fffccb4600
Add utils.str.multipleReplacer.
2012-08-04 11:27:41 +02:00
Valentin Lorentz
ef78c86974
Add configuration variable supybot.reply.format.url.
2012-07-31 13:12:33 +00:00
Guido Tabbernuk
7e002ed2a2
Fix normalizeWhitespace to support Unicode.
2012-07-29 11:45:27 +02:00
Valentin Lorentz
6286558fa5
Replace tabulations in utils.str.normalizeWhitespace. Closes GH-372.
2012-06-12 19:37:49 +02:00
Valentin Lorentz
a5e8f8ede8
Allow supybot.directories.backup to be /dev/null.
2012-03-15 20:22:46 +01:00
James McCoy
d1df9e8306
Use socket.inet_aton for isIPV4 since Windows doesn't (always?) have inet_pton
...
Closes: Sf#3430008
Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
Conflicts:
src/utils/net.py
2011-12-13 18:05:14 +01:00
James McCoy
ca23cbb774
Merge branch 'maint/0.83.4'
2011-12-06 01:18:18 -05:00
James McCoy
360a2036ac
Use socket.inet_aton for isIPV4 since Windows doesn't (always?) have inet_pton
...
Closes: Sf#3430008
Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
2011-12-05 22:48:09 -05:00
James McCoy
8b73f78b3e
Merge branch 'maint/0.83.4'
...
Conflicts:
plugins/Misc/plugin.py
src/ircutils.py
Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
2011-11-13 15:26:19 -05:00
Valentin Lorentz
08405c6ec5
Fix Windows support (broken in 543e7882
).
2011-10-29 14:46:35 +02:00
Valentin Lorentz
be585ecea9
Merge remote-tracking branch 'supybot/maint/0.83.4' into testing
...
Conflicts:
src/ircutils.py
2011-08-23 16:41:52 +02:00
Valentin Lorentz
5215aa1095
Move http server from src/utils/ to src/
2011-07-01 16:15:04 +02:00
Valentin Lorentz
efc30a4ed2
Fix traceback when sending POST requests to the 404 error handler.
2011-06-30 00:58:46 +02:00
Valentin Lorentz
509a6c1780
Forgot a debug print in httpserver.py
2011-06-25 16:28:49 +02:00
Valentin Lorentz
4df4977a76
Internationalize strings in the HTTP server. Closes GH-29.
2011-06-25 14:27:44 +02:00
Valentin Lorentz
fc41fc6153
Add support for POST and HEAD requests to the HTTP server.
2011-06-25 11:37:10 +02:00
Valentin Lorentz
fa3fc7d20a
Fix exception when stopping the HTTP server if already stopped.
2011-06-25 10:02:30 +02:00
Valentin Lorentz
b9baa579fe
Bug fix in HTTP server.
2011-06-24 16:26:32 +02:00
Valentin Lorentz
667d7c34b4
Bug fixes to the HTTP server
2011-06-24 15:32:22 +02:00
Valentin Lorentz
ef5438e937
Add docstrings to the HTTP server callbacks
2011-06-24 14:52:01 +02:00
Valentin Lorentz
13e4f45e30
Add an embedded HTTP server to Supybot.
2011-06-24 14:31:29 +02:00
James Vega
543e78828b
Add utils.net.isIPV4, with utils.net.isIP checking v4 or v6
...
Signed-off-by: James Vega <jamessan@users.sourceforge.net>
2011-06-06 21:44:15 -04:00
Valentin Lorentz
d6cd8a5427
Fix email regexp to be RFC-compliant
2011-05-03 20:23:20 +02:00
Daniel Folkinshteyn
b306c5440f
add damerau-levenshtein distance to supybot.utils.seq
...
use it in factoids invalid command to match possible typos
write tests for same.
2011-02-25 18:36:09 +01:00
Valentin Lorentz
ad2ad80263
Fix forgotten merge
2011-01-26 09:56:04 +01:00
Valentin Lorentz
17248b5d2c
Merge branch 'testing' into unit-tests
...
Conflicts:
src/utils/str.py
2011-01-22 10:29:22 +01:00
Valentin Lorentz
e4cced8364
Fix depluralize.
2011-01-22 10:28:27 +01:00
Valentin Lorentz
4649188b96
Fix detection of .42 domains
2011-01-02 13:22:54 +01:00
Valentin Lorentz
83aca7c651
Merge branch 'testing'
2010-12-22 18:12:28 +01:00
Valentin Lorentz
a58e270516
Fix issue with Pypy
2010-12-12 14:22:44 +01:00
Valentin Lorentz
f2a0b60e79
Fix unicode bug
2010-11-28 17:47:38 +01:00
Valentin Lorentz
4ea359d503
Merge branch 'l10n-fr' into testing
2010-11-11 12:03:04 +01:00
Valentin Lorentz
323ffe1a1f
i18n: Fix internationalization problems
2010-11-11 12:01:56 +01:00
Valentin Lorentz
52b701526d
Merge branch 'l10n-fr' into testing
2010-11-01 15:02:05 +01:00
Valentin Lorentz
30a1ca06b2
Fix the @Misc help formatting
...
Stop removing the \n in the translated docstrings
2010-11-01 15:01:50 +01:00
Valentin Lorentz
0410cf3d0d
Merge branch 'l10n-fr' into testing
2010-11-01 11:49:11 +01:00
Valentin Lorentz
a2c8c613db
Bug fix (didn't keep any beginning or ending space)
2010-11-01 11:47:19 +01:00
Valentin Lorentz
27bb53b560
Merge branch 'l10n-fr' into testing
2010-10-30 21:41:44 +02:00
Valentin Lorentz
3ea8115095
Internationalize src/utils/str.py and modify src/i18n.py to fit this changes
2010-10-30 21:10:49 +02:00
Valentin Lorentz
5f2699b2c0
Merge branch 'l10n-fr' into testing
2010-10-30 12:15:09 +02:00
Valentin Lorentz
b85d289bbb
Fix wrong method name
2010-10-30 12:14:54 +02:00
Valentin Lorentz
5e09a9c887
Merge branch 'l10n-fr' into testing
2010-10-30 12:11:29 +02:00
Valentin Lorentz
ec6a267c09
Internationalize more functions in src/utils/str.py
2010-10-29 15:31:36 +02:00
Valentin Lorentz
e8bc966827
Add locale abitrary code
...
Add the capability for Supybot to load code depending on the locale
src/utils/str.py now imports pluralize and depluralize from this code
2010-10-28 17:28:27 +02:00
Valentin Lorentz
b7651b06a1
Merge branch 'l10n-fr' into testing
2010-10-28 15:45:51 +02:00
Valentin Lorentz
f3a579f3da
Add the '<empty>' feature to nItems, and changed ChannelStats localization in order to use it as bug fixer
2010-10-28 15:18:06 +02:00
Valentin Lorentz
8be4aaeff1
Merge branch 'readability'
2010-10-23 10:38:52 +02:00
Valentin Lorentz
e556fbde2e
Added %S to format()
2010-10-16 11:37:10 +02:00
Valentin Lorentz
50acd3d8d9
Creating the internationalization module and internationalize/localize ChannelStats into French
2010-10-09 11:36:22 +02:00
James Vega
0abe22f5d1
Merge branch 'maint/0.83.4'
2010-09-08 23:50:35 -04:00
James Vega
b0575cec88
Handle changes to fnmatch.translate in Python 2.6
...
Define utils.python.glob2re based on the Python version being used.
Use glob2re in Todo and Note plugins.
Closes: Sf#3059292
Signed-off-by: James Vega <jamessan@users.sourceforge.net>
2010-09-08 23:31:01 -04:00
James Vega
a6857ce9bf
utils/web.py: Only try catching socket.sslerror if built with SSL support
...
Closes: Sf#2998820
Signed-off-by: James Vega <jamessan@users.sourceforge.net>
(cherry picked from commit f03a3f6c85
)
2010-08-24 19:49:30 -04:00
James Vega
f0852a9e45
utils.web: Provide access to the raw httpUrlRe/urlRe strings
...
Using the compiled regexps for a PluginRegexp method's __doc__ doesn't work.
Closes Sourceforge #2879862
Signed-off-by: James Vega <jamessan@users.sourceforge.net>
(cherry picked from commit 25fc2de643
)
2010-08-24 19:14:58 -04:00
Ricky Zhou
6299ef5c22
Account for negative times in timeElapsed.
...
Signed-off-by: James Vega <jamessan@users.sourceforge.net>
(cherry picked from commit aa2337791a
)
2010-08-24 19:02:16 -04:00
James Vega
f03a3f6c85
utils/web.py: Only try catching socket.sslerror if built with SSL support
...
Closes: Sf#2998820
Signed-off-by: James Vega <jamessan@users.sourceforge.net>
2010-05-24 15:44:25 -04:00
James Vega
25fc2de643
utils.web: Provide access to the raw httpUrlRe/urlRe strings
...
Using the compiled regexps for a PluginRegexp method's __doc__ doesn't work.
Closes Sourceforge #2879862
Signed-off-by: James Vega <jamessan@users.sourceforge.net>
2009-10-15 22:16:38 -04:00
James Vega
c5896ff6cb
utils.web: Import urllib's urlencode into our namespace.
...
Signed-off-by: James Vega <jamessan@users.sourceforge.net>
2009-09-29 19:54:07 -04:00
James Vega
de79e679f4
Add a data kwarg to getUrl(Fd) a la urllib2.Request.
...
This allows plugins to easily make POST requests using our getUrl(Fd)
functions.
Signed-off-by: James Vega <jamessan@users.sourceforge.net>
2009-09-16 01:17:33 -04:00
Štěpán Němec
a66034f852
Fix some typos/wordings.
...
Signed-off-by: James Vega <jamessan@users.sourceforge.net>
2009-08-26 16:34:12 -04:00
Ricky Zhou
aa2337791a
Account for negative times in timeElapsed.
...
Signed-off-by: James Vega <jamessan@users.sourceforge.net>
2009-07-20 16:07:51 -04:00
Jeremy Fincher
43129239d6
Added Seen.since, which lets a user see messages which were sent since the last time he parted a channel.
2009-07-01 15:40:58 -05:00
Ricky Zhou
fa3a2dd23b
Allow nItems to take longs as well.
...
Signed-off-by: James Vega <jamessan@users.sourceforge.net>
2009-05-19 00:58:07 -04:00
Jeremy Fincher
757991afc9
Added basic CacheDict with simple test.
2009-04-02 11:28:57 -05:00
James Vega
6b6861f884
Don't specify globals as a kwarg; only in 2.5+
...
Signed-off-by: James Vega <jamessan@users.sourceforge.net>
2009-03-22 13:47:42 -04:00
James Vega
58d308b54d
Fix perlReToReplacer when \ is used in the replacement
...
Signed-off-by: James Vega <jamessan@users.sourceforge.net>
2009-03-12 17:17:20 -04:00
James Vega
ecd2c63650
Make universalImport support 'from ModuleA import ModuleB'
...
Signed-off-by: James Vega <jamessan@users.sourceforge.net>
2009-03-11 15:55:08 -04:00
Jeremy Fincher
a86b4694d7
Added utils.python.universalImport to make the previous idiom cleaner.
2009-03-11 14:05:53 -04:00
James Vega
0c42ea111a
Fix our RE parsing to handle multiple backslashes before the separator
...
This also adds support for using brace pairs ({}, [], (), <>) as the
separators for m//.
2009-03-11 13:37:27 -04:00
James Vega
e787c7aa49
Clarify comment about timestamp() override
2009-03-11 13:37:26 -04:00
James Vega
3d5c877f80
Finally fix the XXX we had for httpUrlRe and urlRe
2009-03-11 13:37:26 -04:00
James Vega
828d41e37d
Add utils/crypt.py as a Python version-agnostic crypt module
2009-03-11 13:37:26 -04:00
James Vega
880cce5505
src/utils/str.format: Recognize digits before the '.' in %f formatting.
2006-04-06 04:01:11 +00:00
James Vega
a3e4fc5b1d
Change the modeline to use softtabstop instead of tabstop.
2006-02-11 15:52:51 +00:00
James Vega
9cb1669b5f
src/utils/web: Add another "UNKNOWN_HOST" code to catch.
2005-10-14 12:59:47 +00:00
James Vega
ef3e002db3
src/utils/net: Fix our method of determining whether an IPV6 or IP socket is needed.
2005-08-22 18:52:37 +00:00
Jeremy Fincher
f8156cc9cc
Removed TupleSubclass, which wasn't being used.
2005-07-21 18:32:41 +00:00
Jeremy Fincher
1aa73acd8d
Removed Acquire, which I won't be using anymore.
2005-07-21 05:04:31 +00:00
Jeremy Fincher
77330d496a
Moved an XXX and added a skeleton method.
2005-07-18 04:55:12 +00:00
Jeremy Fincher
fc87901a89
Added some more XXXes for dangerfan.
2005-07-18 04:46:41 +00:00
Jeremy Fincher
27ac845628
Moved some XXXes around, added some methods (so naming them isn't hard) and a new XXX about methods that return file objects.
2005-07-18 04:37:32 +00:00
Jeremy Fincher
91874dba2c
Added some XXXes to transaction.py.
2005-07-16 05:09:49 +00:00
Jeremy Fincher
5b8400e158
Removed utils.iter.one, which was dumb, because iterators have a .next() method that does the same thing.
2005-07-08 09:14:45 +00:00
Jeremy Fincher
a88f52bc7f
Forgot to change the exception name in one of the spots it was raised in.
2005-07-06 03:59:46 +00:00
Jeremy Fincher
e9c52f6a5f
Prefixed some non-public method names with an underscore.
2005-07-06 03:59:16 +00:00
Jeremy Fincher
612a8e1183
Added utils.{transaction,error}
2005-07-05 17:48:00 +00:00
Jeremy Fincher
b369039507
Added utils.iter.one, to grab one value from an iterable.
2005-06-12 04:54:15 +00:00
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
Jeremy Fincher
a1e707caa2
Changed Synchronized to make attributes (and changing the attributes' names) more maintainable.
2005-05-16 18:42:38 +00:00
Jeremy Fincher
79fc5b5994
Fixed a bug in the way Synchronized was implemented.
2005-05-16 00:23:44 +00:00
Jeremy Fincher
cbf154b4ff
Fixed Synchronized to allow synchronization of methods not defined in the current class.
2005-05-15 18:26:50 +00:00
Jeremy Fincher
4b0600a91a
Added a Synchronized metaclass.
2005-05-15 17:41:07 +00:00
Jeremy Fincher
2394005cdd
Moved utils.changeFunctionName to utils.python.
2005-05-15 17:17:26 +00:00
Jeremy Fincher
1d357dd470
Some more slight tweaks to the MetaFirewall implementation and stuff.
2005-05-15 17:08:02 +00:00
Jeremy Fincher
00fc0584ed
Put more useful information into the docstring for utils.seq.window.
2005-05-15 16:12:43 +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
Glen Mailer
7deadddbe8
utils.str.nth
2005-05-08 01:46:35 +00:00
Jeremy Fincher
c66e7b3e6e
Added a utils.python module for python-esque things.
2005-04-09 17:04:27 +00:00
Jeremy Fincher
29fc5681d3
Added a touch function to the file utils module.
2005-04-04 06:01:17 +00:00
Jeremy Fincher
c8d114b9bc
Added a few useful file functions.
2005-04-04 05:46:22 +00:00
James Vega
9971e991fe
Fix the modelines.
2005-03-23 20:07:45 +00:00
George-Cristian Bîrzan
7aae5ae41e
fix alternate separator with slash in first part of regexp
2005-03-17 19:51:24 +00:00
Jeremy Fincher
c598e4cca9
Added a few more UNKNOWN_HOST types.
2005-03-14 02:32:48 +00:00
James Vega
aefcd594df
Move structures to utils/
2005-03-12 18:01:47 +00:00
Jeremy Fincher
6aca01bafb
Made utils.file.mktemp a little more stochastic.
2005-02-18 07:04:48 +00:00
Jeremy Fincher
4808a68f7d
Added utils.iter.startswith.
2005-02-17 23:30:54 +00:00
Jeremy Fincher
7389f1757c
Forgot an import which broke choice.
2005-02-16 02:15:51 +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
6580fc535f
2.4 defines groupby, so there's no need to define our own.
2005-02-04 05:55:04 +00:00
Jeremy Fincher
5ca79f0f49
Hah, changed WebError to Error everywhere but the source :)
2005-02-02 14:07:20 +00:00
Jeremy Fincher
dbd9e9f16c
Added a %r handler (repr, just like normal string formatting).
2005-02-02 13:09:14 +00:00
Jeremy Fincher
f6e132dde4
Added test_format.py, added floating point formatting to format, and fixed a bug in the %t format.
2005-02-01 11:57:50 +00:00
Jeremy Fincher
f44be3b864
Allow timestamps in format to be None, indicating the current time.
2005-02-01 09:53:08 +00:00
Jeremy Fincher
74717061f2
Forgot to add u to the _formatRe.
2005-02-01 09:35:35 +00:00
Jeremy Fincher
4ac7bb4717
Added a %u specifier to format, for URLs.
2005-02-01 09:26:44 +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
James Vega
4d32d36982
Update a few more places that use utils.str functions.
2005-01-31 15:21:22 +00:00
James Vega
de89bf0265
Update usage of utils.str functions.
2005-01-31 14:52:27 +00:00
James Vega
47aa4c0f7c
Remove the extra argument to utils.str.pluralize.
...
We previously had a second argument to utils.str.pluralize which determined
whether we truly plurazlied a word or not. This has been removed so that
the function does what it says it does.
2005-01-31 13:37:47 +00:00
James Vega
9099a1a934
Update utils.str.format to support specifying an 'and' string.
2005-01-31 13:29:28 +00:00
James Vega
28cb5abc65
Update usage of functions in utils.gen.
2005-01-31 13:06:43 +00:00
Jeremy Fincher
5c72ded4a8
Stupid spelling error in a docstring.
2005-01-28 15:30:15 +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
90e901702b
Moved toBool to go before format in utils/str.py.
2005-01-28 15:21:03 +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