2015-10-04 01:39:52 +02:00
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
< html > < head > < title > Python: module utils< / title >
< meta http-equiv = "Content-Type" content = "text/html; charset=utf-8" >
< / head > < body bgcolor = "#f0f0f8" >
< table width = "100%" cellspacing = 0 cellpadding = 2 border = 0 summary = "heading" >
< tr bgcolor = "#7799ee" >
< td valign = bottom > < br >
< font color = "#ffffff" face = "helvetica, arial" > < br > < big > < big > < strong > utils< / strong > < / big > < / big > < / font > < /td
>< td align = right valign = bottom
>< font color = "#ffffff" face = "helvetica, arial" > < a href = "." > index< / a > < br > < a href = "file:/home/gl/pylink/utils.py" > /home/gl/pylink/utils.py< / a > < / font > < / td > < / tr > < / table >
2015-12-26 23:45:28 +01:00
< p > < tt > utils.py - PyLink utilities module.< br >
< br >
This module contains various utility functions related to IRC and/or the PyLink< br >
framework.< / tt > < / p >
2015-10-04 01:39:52 +02:00
< p >
< table width = "100%" cellspacing = 0 cellpadding = 2 border = 0 summary = "section" >
< tr bgcolor = "#aa55cc" >
< td colspan = 3 valign = bottom > < br >
< font color = "#ffffff" face = "helvetica, arial" > < big > < strong > Modules< / strong > < / big > < / font > < / td > < / tr >
< tr > < td bgcolor = "#aa55cc" > < tt > < / tt > < / td > < td > < / td >
2016-03-26 19:42:12 +01:00
< td width = "100%" > < table width = "100%" summary = "list" > < tr > < td width = "25%" valign = top > < a href = "collections.html" > collections< / a > < br >
< a href = "conf.html" > conf< / a > < br >
< / td > < td width = "25%" valign = top > < a href = "importlib.html" > importlib< / a > < br >
< a href = "inspect.html" > inspect< / a > < br >
< / td > < td width = "25%" valign = top > < a href = "os.html" > os< / a > < br >
< a href = "re.html" > re< / a > < br >
< / td > < td width = "25%" valign = top > < a href = "string.html" > string< / a > < br >
< a href = "world.html" > world< / a > < br >
2015-12-26 23:45:28 +01:00
< / td > < / tr > < / table > < / td > < / tr > < / table > < p >
2015-10-04 01:39:52 +02:00
< table width = "100%" cellspacing = 0 cellpadding = 2 border = 0 summary = "section" >
< tr bgcolor = "#ee77aa" >
< td colspan = 3 valign = bottom > < br >
< font color = "#ffffff" face = "helvetica, arial" > < big > < strong > Classes< / strong > < / big > < / font > < / td > < / tr >
< tr > < td bgcolor = "#ee77aa" > < tt > < / tt > < / td > < td > < / td >
< td width = "100%" > < dl >
< dt > < font face = "helvetica, arial" > < a href = "builtins.html#Exception" > builtins.Exception< / a > (< a href = "builtins.html#BaseException" > builtins.BaseException< / a > )
< / font > < / dt > < dd >
< dl >
< dt > < font face = "helvetica, arial" > < a href = "utils.html#NotAuthenticatedError" > NotAuthenticatedError< / a >
< / font > < / dt > < / dl >
< / dd >
< dt > < font face = "helvetica, arial" > < a href = "builtins.html#object" > builtins.object< / a >
< / font > < / dt > < dd >
< dl >
< dt > < font face = "helvetica, arial" > < a href = "utils.html#TS6SIDGenerator" > TS6SIDGenerator< / a >
< / font > < / dt > < dt > < font face = "helvetica, arial" > < a href = "utils.html#TS6UIDGenerator" > TS6UIDGenerator< / a >
< / font > < / dt > < / dl >
< / dd >
2016-03-26 19:42:12 +01:00
< dt > < font face = "helvetica, arial" > < a href = "collections.html#defaultdict" > collections.defaultdict< / a > (< a href = "builtins.html#dict" > builtins.dict< / a > )
< / font > < / dt > < dd >
< dl >
< dt > < font face = "helvetica, arial" > < a href = "utils.html#KeyedDefaultdict" > KeyedDefaultdict< / a >
< / font > < / dt > < / dl >
< / dd >
2015-10-04 01:39:52 +02:00
< / dl >
< p >
< table width = "100%" cellspacing = 0 cellpadding = 2 border = 0 summary = "section" >
< tr bgcolor = "#ffc8d8" >
< td colspan = 3 valign = bottom > < br >
2016-03-26 19:42:12 +01:00
< font color = "#000000" face = "helvetica, arial" > < a name = "KeyedDefaultdict" > class < strong > KeyedDefaultdict< / strong > < / a > (< a href = "collections.html#defaultdict" > collections.defaultdict< / a > )< / font > < / td > < / tr >
< tr bgcolor = "#ffc8d8" > < td rowspan = 2 > < tt > < / tt > < / td >
< td colspan = 2 > < tt > Subclass of < a href = "collections.html#defaultdict" > defaultdict< / a > allowing the key to be passed to the default factory.< br > < / tt > < / td > < / tr >
< tr > < td > < / td >
< td width = "100%" > < dl > < dt > Method resolution order:< / dt >
< dd > < a href = "utils.html#KeyedDefaultdict" > KeyedDefaultdict< / a > < / dd >
< dd > < a href = "collections.html#defaultdict" > collections.defaultdict< / a > < / dd >
< dd > < a href = "builtins.html#dict" > builtins.dict< / a > < / dd >
< dd > < a href = "builtins.html#object" > builtins.object< / a > < / dd >
< / dl >
< hr >
Methods defined here:< br >
< dl > < dt > < a name = "KeyedDefaultdict-__missing__" > < strong > __missing__< / strong > < / a > (self, key)< / dt > < dd > < tt > < a href = "#KeyedDefaultdict-__missing__" > __missing__< / a > (key) # Called by __getitem__ for missing key; pseudo-code:< br >
if self.< strong > default_factory< / strong > is None: raise KeyError((key,))< br >
self[key] = value = self.< a href = "#KeyedDefaultdict-default_factory" > default_factory< / a > ()< br >
return value< / tt > < / dd > < / dl >
< hr >
Data descriptors defined here:< br >
< dl > < dt > < strong > __dict__< / strong > < / dt >
< dd > < tt > dictionary for instance variables (if defined)< / tt > < / dd >
< / dl >
< dl > < dt > < strong > __weakref__< / strong > < / dt >
< dd > < tt > list of weak references to the object (if defined)< / tt > < / dd >
< / dl >
< hr >
Methods inherited from < a href = "collections.html#defaultdict" > collections.defaultdict< / a > :< br >
< dl > < dt > < a name = "KeyedDefaultdict-__copy__" > < strong > __copy__< / strong > < / a > (...)< / dt > < dd > < tt > D.< a href = "#KeyedDefaultdict-copy" > copy< / a > () -> a shallow copy of D.< / tt > < / dd > < / dl >
< dl > < dt > < a name = "KeyedDefaultdict-__getattribute__" > < strong > __getattribute__< / strong > < / a > (self, name, /)< / dt > < dd > < tt > Return getattr(self, name).< / tt > < / dd > < / dl >
< dl > < dt > < a name = "KeyedDefaultdict-__init__" > < strong > __init__< / strong > < / a > (self, /, *args, **kwargs)< / dt > < dd > < tt > Initialize self. See help(type(self)) for accurate signature.< / tt > < / dd > < / dl >
< dl > < dt > < a name = "KeyedDefaultdict-__reduce__" > < strong > __reduce__< / strong > < / a > (...)< / dt > < dd > < tt > Return state information for pickling.< / tt > < / dd > < / dl >
< dl > < dt > < a name = "KeyedDefaultdict-__repr__" > < strong > __repr__< / strong > < / a > (self, /)< / dt > < dd > < tt > Return repr(self).< / tt > < / dd > < / dl >
< dl > < dt > < a name = "KeyedDefaultdict-copy" > < strong > copy< / strong > < / a > (...)< / dt > < dd > < tt > D.< a href = "#KeyedDefaultdict-copy" > copy< / a > () -> a shallow copy of D.< / tt > < / dd > < / dl >
< hr >
Data descriptors inherited from < a href = "collections.html#defaultdict" > collections.defaultdict< / a > :< br >
< dl > < dt > < strong > default_factory< / strong > < / dt >
< dd > < tt > Factory for default value called by __missing__().< / tt > < / dd >
< / dl >
< hr >
Methods inherited from < a href = "builtins.html#dict" > builtins.dict< / a > :< br >
< dl > < dt > < a name = "KeyedDefaultdict-__contains__" > < strong > __contains__< / strong > < / a > (self, key, /)< / dt > < dd > < tt > True if D has a key k, else False.< / tt > < / dd > < / dl >
< dl > < dt > < a name = "KeyedDefaultdict-__delitem__" > < strong > __delitem__< / strong > < / a > (self, key, /)< / dt > < dd > < tt > Delete self[key].< / tt > < / dd > < / dl >
< dl > < dt > < a name = "KeyedDefaultdict-__eq__" > < strong > __eq__< / strong > < / a > (self, value, /)< / dt > < dd > < tt > Return self==value.< / tt > < / dd > < / dl >
< dl > < dt > < a name = "KeyedDefaultdict-__ge__" > < strong > __ge__< / strong > < / a > (self, value, /)< / dt > < dd > < tt > Return self> =value.< / tt > < / dd > < / dl >
< dl > < dt > < a name = "KeyedDefaultdict-__getitem__" > < strong > __getitem__< / strong > < / a > (...)< / dt > < dd > < tt > x.< a href = "#KeyedDefaultdict-__getitem__" > __getitem__< / a > (y) < ==> x[y]< / tt > < / dd > < / dl >
< dl > < dt > < a name = "KeyedDefaultdict-__gt__" > < strong > __gt__< / strong > < / a > (self, value, /)< / dt > < dd > < tt > Return self> value.< / tt > < / dd > < / dl >
< dl > < dt > < a name = "KeyedDefaultdict-__iter__" > < strong > __iter__< / strong > < / a > (self, /)< / dt > < dd > < tt > Implement iter(self).< / tt > < / dd > < / dl >
< dl > < dt > < a name = "KeyedDefaultdict-__le__" > < strong > __le__< / strong > < / a > (self, value, /)< / dt > < dd > < tt > Return self< =value.< / tt > < / dd > < / dl >
< dl > < dt > < a name = "KeyedDefaultdict-__len__" > < strong > __len__< / strong > < / a > (self, /)< / dt > < dd > < tt > Return len(self).< / tt > < / dd > < / dl >
< dl > < dt > < a name = "KeyedDefaultdict-__lt__" > < strong > __lt__< / strong > < / a > (self, value, /)< / dt > < dd > < tt > Return self< value.< / tt > < / dd > < / dl >
< dl > < dt > < a name = "KeyedDefaultdict-__ne__" > < strong > __ne__< / strong > < / a > (self, value, /)< / dt > < dd > < tt > Return self!=value.< / tt > < / dd > < / dl >
< dl > < dt > < a name = "KeyedDefaultdict-__new__" > < strong > __new__< / strong > < / a > (*args, **kwargs)< font color = "#909090" > < font face = "helvetica, arial" > from < a href = "builtins.html#type" > builtins.type< / a > < / font > < / font > < / dt > < dd > < tt > Create and return a new < a href = "builtins.html#object" > object< / a > . See help(type) for accurate signature.< / tt > < / dd > < / dl >
< dl > < dt > < a name = "KeyedDefaultdict-__setitem__" > < strong > __setitem__< / strong > < / a > (self, key, value, /)< / dt > < dd > < tt > Set self[key] to value.< / tt > < / dd > < / dl >
< dl > < dt > < a name = "KeyedDefaultdict-__sizeof__" > < strong > __sizeof__< / strong > < / a > (...)< / dt > < dd > < tt > D.< a href = "#KeyedDefaultdict-__sizeof__" > __sizeof__< / a > () -> size of D in memory, in bytes< / tt > < / dd > < / dl >
< dl > < dt > < a name = "KeyedDefaultdict-clear" > < strong > clear< / strong > < / a > (...)< / dt > < dd > < tt > D.< a href = "#KeyedDefaultdict-clear" > clear< / a > () -> None. Remove all items from D.< / tt > < / dd > < / dl >
< dl > < dt > < a name = "KeyedDefaultdict-fromkeys" > < strong > fromkeys< / strong > < / a > (iterable, value=None, /)< font color = "#909090" > < font face = "helvetica, arial" > from < a href = "builtins.html#type" > builtins.type< / a > < / font > < / font > < / dt > < dd > < tt > Returns a new dict with keys from iterable and values equal to value.< / tt > < / dd > < / dl >
< dl > < dt > < a name = "KeyedDefaultdict-get" > < strong > get< / strong > < / a > (...)< / dt > < dd > < tt > D.< a href = "#KeyedDefaultdict-get" > get< / a > (k[,d]) -> D[k] if k in D, else d. d defaults to None.< / tt > < / dd > < / dl >
< dl > < dt > < a name = "KeyedDefaultdict-items" > < strong > items< / strong > < / a > (...)< / dt > < dd > < tt > D.< a href = "#KeyedDefaultdict-items" > items< / a > () -> a set-like < a href = "builtins.html#object" > object< / a > providing a view on D's items< / tt > < / dd > < / dl >
< dl > < dt > < a name = "KeyedDefaultdict-keys" > < strong > keys< / strong > < / a > (...)< / dt > < dd > < tt > D.< a href = "#KeyedDefaultdict-keys" > keys< / a > () -> a set-like < a href = "builtins.html#object" > object< / a > providing a view on D's keys< / tt > < / dd > < / dl >
< dl > < dt > < a name = "KeyedDefaultdict-pop" > < strong > pop< / strong > < / a > (...)< / dt > < dd > < tt > D.< a href = "#KeyedDefaultdict-pop" > pop< / a > (k[,d]) -> v, remove specified key and return the corresponding value.< br >
If key is not found, d is returned if given, otherwise KeyError is raised< / tt > < / dd > < / dl >
< dl > < dt > < a name = "KeyedDefaultdict-popitem" > < strong > popitem< / strong > < / a > (...)< / dt > < dd > < tt > D.< a href = "#KeyedDefaultdict-popitem" > popitem< / a > () -> (k, v), remove and return some (key, value) pair as a< br >
2-tuple; but raise KeyError if D is empty.< / tt > < / dd > < / dl >
< dl > < dt > < a name = "KeyedDefaultdict-setdefault" > < strong > setdefault< / strong > < / a > (...)< / dt > < dd > < tt > D.< a href = "#KeyedDefaultdict-setdefault" > setdefault< / a > (k[,d]) -> D.< a href = "#KeyedDefaultdict-get" > get< / a > (k,d), also set D[k]=d if k not in D< / tt > < / dd > < / dl >
< dl > < dt > < a name = "KeyedDefaultdict-update" > < strong > update< / strong > < / a > (...)< / dt > < dd > < tt > D.< a href = "#KeyedDefaultdict-update" > update< / a > ([E, ]**F) -> None. Update D from dict/iterable E and F.< br >
If E is present and has a .< a href = "#KeyedDefaultdict-keys" > keys< / a > () method, then does: for k in E: D[k] = E[k]< br >
If E is present and lacks a .< a href = "#KeyedDefaultdict-keys" > keys< / a > () method, then does: for k, v in E: D[k] = v< br >
In either case, this is followed by: for k in F: D[k] = F[k]< / tt > < / dd > < / dl >
< dl > < dt > < a name = "KeyedDefaultdict-values" > < strong > values< / strong > < / a > (...)< / dt > < dd > < tt > D.< a href = "#KeyedDefaultdict-values" > values< / a > () -> an < a href = "builtins.html#object" > object< / a > providing a view on D's values< / tt > < / dd > < / dl >
< hr >
Data and other attributes inherited from < a href = "builtins.html#dict" > builtins.dict< / a > :< br >
< dl > < dt > < strong > __hash__< / strong > = None< / dl >
< / td > < / tr > < / table > < p >
< table width = "100%" cellspacing = 0 cellpadding = 2 border = 0 summary = "section" >
< tr bgcolor = "#ffc8d8" >
< td colspan = 3 valign = bottom > < br >
2015-10-04 01:39:52 +02:00
< font color = "#000000" face = "helvetica, arial" > < a name = "NotAuthenticatedError" > class < strong > NotAuthenticatedError< / strong > < / a > (< a href = "builtins.html#Exception" > builtins.Exception< / a > )< / font > < / td > < / tr >
< tr bgcolor = "#ffc8d8" > < td rowspan = 2 > < tt > < / tt > < / td >
2015-12-26 23:45:28 +01:00
< td colspan = 2 > < tt > < a href = "builtins.html#Exception" > Exception< / a > raised by < a href = "#-checkAuthenticated" > checkAuthenticated< / a > () when a user fails authentication< br >
requirements.< br > < / tt > < / td > < / tr >
2015-10-04 01:39:52 +02:00
< tr > < td > < / td >
< td width = "100%" > < dl > < dt > Method resolution order:< / dt >
< dd > < a href = "utils.html#NotAuthenticatedError" > NotAuthenticatedError< / a > < / dd >
< dd > < a href = "builtins.html#Exception" > builtins.Exception< / a > < / dd >
< dd > < a href = "builtins.html#BaseException" > builtins.BaseException< / a > < / dd >
< dd > < a href = "builtins.html#object" > builtins.object< / a > < / dd >
< / dl >
< hr >
Data descriptors defined here:< br >
< dl > < dt > < strong > __weakref__< / strong > < / dt >
< dd > < tt > list of weak references to the object (if defined)< / tt > < / dd >
< / dl >
< hr >
Methods inherited from < a href = "builtins.html#Exception" > builtins.Exception< / a > :< br >
< dl > < dt > < a name = "NotAuthenticatedError-__init__" > < strong > __init__< / strong > < / a > (self, /, *args, **kwargs)< / dt > < dd > < tt > Initialize self. See help(type(self)) for accurate signature.< / tt > < / dd > < / dl >
< dl > < dt > < a name = "NotAuthenticatedError-__new__" > < strong > __new__< / strong > < / a > (*args, **kwargs)< font color = "#909090" > < font face = "helvetica, arial" > from < a href = "builtins.html#type" > builtins.type< / a > < / font > < / font > < / dt > < dd > < tt > Create and return a new < a href = "builtins.html#object" > object< / a > . See help(type) for accurate signature.< / tt > < / dd > < / dl >
< hr >
Methods inherited from < a href = "builtins.html#BaseException" > builtins.BaseException< / a > :< br >
< dl > < dt > < a name = "NotAuthenticatedError-__delattr__" > < strong > __delattr__< / strong > < / a > (self, name, /)< / dt > < dd > < tt > Implement delattr(self, name).< / tt > < / dd > < / dl >
< dl > < dt > < a name = "NotAuthenticatedError-__getattribute__" > < strong > __getattribute__< / strong > < / a > (self, name, /)< / dt > < dd > < tt > Return getattr(self, name).< / tt > < / dd > < / dl >
2016-03-12 08:13:55 +01:00
< dl > < dt > < a name = "NotAuthenticatedError-__reduce__" > < strong > __reduce__< / strong > < / a > (...)< / dt > < dd > < tt > helper for pickle< / tt > < / dd > < / dl >
2015-10-04 01:39:52 +02:00
< dl > < dt > < a name = "NotAuthenticatedError-__repr__" > < strong > __repr__< / strong > < / a > (self, /)< / dt > < dd > < tt > Return repr(self).< / tt > < / dd > < / dl >
< dl > < dt > < a name = "NotAuthenticatedError-__setattr__" > < strong > __setattr__< / strong > < / a > (self, name, value, /)< / dt > < dd > < tt > Implement setattr(self, name, value).< / tt > < / dd > < / dl >
< dl > < dt > < a name = "NotAuthenticatedError-__setstate__" > < strong > __setstate__< / strong > < / a > (...)< / dt > < / dl >
< dl > < dt > < a name = "NotAuthenticatedError-__str__" > < strong > __str__< / strong > < / a > (self, /)< / dt > < dd > < tt > Return str(self).< / tt > < / dd > < / dl >
< dl > < dt > < a name = "NotAuthenticatedError-with_traceback" > < strong > with_traceback< / strong > < / a > (...)< / dt > < dd > < tt > < a href = "builtins.html#Exception" > Exception< / a > .< a href = "#NotAuthenticatedError-with_traceback" > with_traceback< / a > (tb) --< br >
set self.< strong > __traceback__< / strong > to tb and return self.< / tt > < / dd > < / dl >
< hr >
Data descriptors inherited from < a href = "builtins.html#BaseException" > builtins.BaseException< / a > :< br >
< dl > < dt > < strong > __cause__< / strong > < / dt >
< dd > < tt > exception cause< / tt > < / dd >
< / dl >
< dl > < dt > < strong > __context__< / strong > < / dt >
< dd > < tt > exception context< / tt > < / dd >
< / dl >
< dl > < dt > < strong > __dict__< / strong > < / dt >
< / dl >
< dl > < dt > < strong > __suppress_context__< / strong > < / dt >
< / dl >
< dl > < dt > < strong > __traceback__< / strong > < / dt >
< / dl >
< dl > < dt > < strong > args< / strong > < / dt >
< / dl >
< / td > < / tr > < / table > < p >
< table width = "100%" cellspacing = 0 cellpadding = 2 border = 0 summary = "section" >
< tr bgcolor = "#ffc8d8" >
< td colspan = 3 valign = bottom > < br >
< font color = "#000000" face = "helvetica, arial" > < a name = "TS6SIDGenerator" > class < strong > TS6SIDGenerator< / strong > < / a > (< a href = "builtins.html#object" > builtins.object< / a > )< / font > < / td > < / tr >
< tr bgcolor = "#ffc8d8" > < td rowspan = 2 > < tt > < / tt > < / td >
< td colspan = 2 > < tt > TS6 SID Generator. < query> is a 3 character string with any combination of< br >
uppercase letters, digits, and #'s. it must contain at least one #,< br >
which are used by the generator as a wildcard. On every < a href = "#TS6SIDGenerator-next_sid" > next_sid< / a > () call,< br >
the first available wildcard character (from the right) will be< br >
incremented to generate the next SID.< br >
< br >
When there are no more available SIDs left (SIDs are not reused, only< br >
incremented), RuntimeError is raised.< br >
< br >
Example queries:< br >
"1#A" would give: 10A, 11A, 12A ... 19A, 1AA, 1BA ... 1ZA (36 total results)< br >
"#BQ" would give: 0BQ, 1BQ, 2BQ ... 9BQ (10 total results)< br >
"6##" would give: 600, 601, 602, ... 60Y, 60Z, 610, 611, ... 6ZZ (1296 total results)< br > < / tt > < / td > < / tr >
< tr > < td > < / td >
< td width = "100%" > Methods defined here:< br >
2016-03-12 08:13:55 +01:00
< dl > < dt > < a name = "TS6SIDGenerator-__init__" > < strong > __init__< / strong > < / a > (self, irc)< / dt > < dd > < tt > Initialize self. See help(type(self)) for accurate signature.< / tt > < / dd > < / dl >
2015-10-04 01:39:52 +02:00
2015-12-26 23:45:28 +01:00
< dl > < dt > < a name = "TS6SIDGenerator-increment" > < strong > increment< / strong > < / a > (self, pos=2)< / dt > < dd > < tt > Increments the SID generator to the next available SID.< / tt > < / dd > < / dl >
2015-10-04 01:39:52 +02:00
2015-12-26 23:45:28 +01:00
< dl > < dt > < a name = "TS6SIDGenerator-next_sid" > < strong > next_sid< / strong > < / a > (self)< / dt > < dd > < tt > Returns the next unused TS6 SID for the server.< / tt > < / dd > < / dl >
2015-10-04 01:39:52 +02:00
< hr >
Data descriptors defined here:< br >
< dl > < dt > < strong > __dict__< / strong > < / dt >
< dd > < tt > dictionary for instance variables (if defined)< / tt > < / dd >
< / dl >
< dl > < dt > < strong > __weakref__< / strong > < / dt >
< dd > < tt > list of weak references to the object (if defined)< / tt > < / dd >
< / dl >
< / td > < / tr > < / table > < p >
< table width = "100%" cellspacing = 0 cellpadding = 2 border = 0 summary = "section" >
< tr bgcolor = "#ffc8d8" >
< td colspan = 3 valign = bottom > < br >
< font color = "#000000" face = "helvetica, arial" > < a name = "TS6UIDGenerator" > class < strong > TS6UIDGenerator< / strong > < / a > (< a href = "builtins.html#object" > builtins.object< / a > )< / font > < / td > < / tr >
< tr bgcolor = "#ffc8d8" > < td rowspan = 2 > < tt > < / tt > < / td >
2015-12-26 23:45:28 +01:00
< td colspan = 2 > < tt > TS6 UID Generator module, adapted from InspIRCd source:< br >
2015-10-04 01:39:52 +02:00
https://github.com/inspircd/inspircd/blob/f449c6b296ab/src/server.cpp#L85-L156< br > < / tt > < / td > < / tr >
< tr > < td > < / td >
< td width = "100%" > Methods defined here:< br >
2016-03-12 08:13:55 +01:00
< dl > < dt > < a name = "TS6UIDGenerator-__init__" > < strong > __init__< / strong > < / a > (self, sid)< / dt > < dd > < tt > Initialize self. See help(type(self)) for accurate signature.< / tt > < / dd > < / dl >
2015-10-04 01:39:52 +02:00
2015-12-26 23:45:28 +01:00
< dl > < dt > < a name = "TS6UIDGenerator-increment" > < strong > increment< / strong > < / a > (self, pos=5)< / dt > < dd > < tt > Increments the SID generator to the next available SID.< / tt > < / dd > < / dl >
2015-10-04 01:39:52 +02:00
2015-12-26 23:45:28 +01:00
< dl > < dt > < a name = "TS6UIDGenerator-next_uid" > < strong > next_uid< / strong > < / a > (self)< / dt > < dd > < tt > Returns the next unused TS6 UID for the server.< / tt > < / dd > < / dl >
2015-10-04 01:39:52 +02:00
< hr >
Data descriptors defined here:< br >
< dl > < dt > < strong > __dict__< / strong > < / dt >
< dd > < tt > dictionary for instance variables (if defined)< / tt > < / dd >
< / dl >
< dl > < dt > < strong > __weakref__< / strong > < / dt >
< dd > < tt > list of weak references to the object (if defined)< / tt > < / dd >
< / dl >
< / td > < / tr > < / table > < / td > < / tr > < / table > < p >
< table width = "100%" cellspacing = 0 cellpadding = 2 border = 0 summary = "section" >
< tr bgcolor = "#eeaa77" >
< td colspan = 3 valign = bottom > < br >
< font color = "#ffffff" face = "helvetica, arial" > < big > < strong > Functions< / strong > < / big > < / font > < / td > < / tr >
< tr > < td bgcolor = "#eeaa77" > < tt > < / tt > < / td > < td > < / td >
2015-12-26 23:45:28 +01:00
< td width = "100%" > < dl > < dt > < a name = "-add_cmd" > < strong > add_cmd< / strong > < / a > (func, name=None)< / dt > < dd > < tt > Binds an IRC command function to the given command name.< / tt > < / dd > < / dl >
< dl > < dt > < a name = "-add_hook" > < strong > add_hook< / strong > < / a > (func, command)< / dt > < dd > < tt > Binds a hook function to the given command name.< / tt > < / dd > < / dl >
2015-10-04 01:39:52 +02:00
< dl > < dt > < a name = "-applyModes" > < strong > applyModes< / strong > < / a > (irc, target, changedmodes)< / dt > < dd > < tt > Takes a list of parsed IRC modes, and applies them on the given target.< br >
< br >
The target can be either a channel or a user; this is handled automatically.< / tt > < / dd > < / dl >
2015-12-26 23:45:28 +01:00
< dl > < dt > < a name = "-checkAuthenticated" > < strong > checkAuthenticated< / strong > < / a > (irc, uid, allowAuthed=True, allowOper=True)< / dt > < dd > < tt > Checks whether the given user has operator status on PyLink, raising< br >
2015-10-04 01:39:52 +02:00
< a href = "#NotAuthenticatedError" > NotAuthenticatedError< / a > and logging the access denial if not.< / tt > < / dd > < / dl >
2016-03-26 19:42:12 +01:00
< dl > < dt > < a name = "-fullVersion" > < strong > fullVersion< / strong > < / a > (irc)< / dt > < dd > < tt > Returns a detailed version string including the PyLink daemon version,< br >
the protocol module in use, and the server hostname.< / tt > < / dd > < / dl >
2015-12-26 23:45:28 +01:00
< dl > < dt > < a name = "-getDatabaseName" > < strong > getDatabaseName< / strong > < / a > (dbname)< / dt > < dd > < tt > Returns a database filename with the given base DB name appropriate for the< br >
current PyLink instance.< br >
< br >
This returns '< dbname> .db' if the running config name is PyLink's default< br >
(config.yml), and '< dbname> -< config name> .db' for anything else. For example,< br >
if this is called from an instance running as './pylink testing.yml', it< br >
would return '< dbname> -testing.db'.< / tt > < / dd > < / dl >
2016-03-12 08:13:55 +01:00
< dl > < dt > < a name = "-getHostmask" > < strong > getHostmask< / strong > < / a > (irc, user, realhost=False, ip=False)< / dt > < dd > < tt > Returns the hostmask of the given user, if present. If the realhost option< br >
is given, return the real host of the user instead of the displayed host.< br >
If the ip option is given, return the IP address of the user (this overrides< br >
realhost).< / tt > < / dd > < / dl >
2015-12-26 23:45:28 +01:00
< dl > < dt > < a name = "-getProtocolModule" > < strong > getProtocolModule< / strong > < / a > (protoname)< / dt > < dd > < tt > Imports and returns the protocol module requested.< / tt > < / dd > < / dl >
< dl > < dt > < a name = "-isChannel" > < strong > isChannel< / strong > < / a > (s)< / dt > < dd > < tt > Returns whether the string given is a valid channel name.< / tt > < / dd > < / dl >
2015-10-04 01:39:52 +02:00
< dl > < dt > < a name = "-isHostmask" > < strong > isHostmask< / strong > < / a > (text)< / dt > < dd > < tt > Returns whether the given text is a valid hostmask.< / tt > < / dd > < / dl >
< dl > < dt > < a name = "-isManipulatableClient" > < strong > isManipulatableClient< / strong > < / a > (irc, uid)< / dt > < dd > < tt > Returns whether the given user is marked as an internal, manipulatable< br >
client. Usually, automatically spawned services clients should have this< br >
set True to prevent interactions with opers (like mode changes) from< br >
causing desyncs.< / tt > < / dd > < / dl >
2015-12-26 23:45:28 +01:00
< dl > < dt > < a name = "-isNick" > < strong > isNick< / strong > < / a > (s, nicklen=None)< / dt > < dd > < tt > Returns whether the string given is a valid nick.< / tt > < / dd > < / dl >
2015-10-04 01:39:52 +02:00
< dl > < dt > < a name = "-isOper" > < strong > isOper< / strong > < / a > (irc, uid, allowAuthed=True, allowOper=True)< / dt > < dd > < tt > Returns whether the given user has operator status on PyLink. This can be achieved< br >
by either identifying to PyLink as admin (if allowAuthed is True),< br >
or having user mode +o set (if allowOper is True). At least one of< br >
allowAuthed or allowOper must be True for this to give any meaningful< br >
results.< / tt > < / dd > < / dl >
2015-12-26 23:45:28 +01:00
< dl > < dt > < a name = "-isServerName" > < strong > isServerName< / strong > < / a > (s)< / dt > < dd > < tt > Returns whether the string given is a valid IRC server name.< / tt > < / dd > < / dl >
2015-10-04 01:39:52 +02:00
< dl > < dt > < a name = "-joinModes" > < strong > joinModes< / strong > < / a > (modes)< / dt > < dd > < tt > Takes a list of (mode, arg) tuples in < a href = "#-parseModes" > parseModes< / a > () format, and< br >
joins them into a string.< br >
< br >
See testJoinModes in tests/test_utils.py for some examples.< / tt > < / dd > < / dl >
2015-12-26 23:45:28 +01:00
< dl > < dt > < a name = "-loadModuleFromFolder" > < strong > loadModuleFromFolder< / strong > < / a > (name, folder)< / dt > < dd > < tt > Imports and returns a module, if existing, from a specific folder.< / tt > < / dd > < / dl >
2015-10-04 01:39:52 +02:00
< dl > < dt > < a name = "-parseModes" > < strong > parseModes< / strong > < / a > (irc, target, args)< / dt > < dd > < tt > Parses a modestring list into a list of (mode, argument) tuples.< br >
['+mitl-o', '3', 'person'] => [('+m', None), ('+i', None), ('+t', None), ('+l', '3'), ('-o', 'person')]< / tt > < / dd > < / dl >
< dl > < dt > < a name = "-reverseModes" > < strong > reverseModes< / strong > < / a > (irc, target, modes, oldobj=None)< / dt > < dd > < tt > Reverses/Inverts the mode string or mode list given.< br >
< br >
Optionally, an oldobj argument can be given to look at an earlier state of< br >
a channel/user < a href = "builtins.html#object" > object< / a > , e.g. for checking the op status of a mode setter< br >
before their modes are processed and added to the channel state.< br >
< br >
This function allows both mode strings or mode lists. Example uses:< br >
"+mi-lk test => "-mi+lk test"< br >
"mi-k test => "-mi+k test"< br >
[('+m', None), ('+r', None), ('+l', '3'), ('-o', 'person')< br >
=> {('-m', None), ('-r', None), ('-l', None), ('+o', 'person')})< br >
{('s', None), ('+o', 'whoever') => {('-s', None), ('-o', 'whoever')})< / tt > < / dd > < / dl >
< dl > < dt > < a name = "-toLower" > < strong > toLower< / strong > < / a > (irc, text)< / dt > < dd > < tt > Returns a lowercase representation of text based on the IRC < a href = "builtins.html#object" > object< / a > 's< br >
casemapping (rfc1459 or ascii).< / tt > < / dd > < / dl >
< / td > < / tr > < / table > < p >
< table width = "100%" cellspacing = 0 cellpadding = 2 border = 0 summary = "section" >
< tr bgcolor = "#55aa55" >
< td colspan = 3 valign = bottom > < br >
< font color = "#ffffff" face = "helvetica, arial" > < big > < strong > Data< / strong > < / big > < / font > < / td > < / tr >
< tr > < td bgcolor = "#55aa55" > < tt > < / tt > < / td > < td > < / td >
< td width = "100%" > < strong > hostmaskRe< / strong > = re.compile('^\\S+!\\S+@\\S+$')< br >
< strong > log< / strong > = < logging.RootLogger object> < / td > < / tr > < / table >
< / body > < / html >