code stringlengths 66 870k | docstring stringlengths 19 26.7k | func_name stringlengths 1 138 | language stringclasses 1
value | repo stringlengths 7 68 | path stringlengths 5 324 | url stringlengths 46 389 | license stringclasses 7
values |
|---|---|---|---|---|---|---|---|
def format(self, record):
"""
Format the specified record as text.
The record's attribute dictionary is used as the operand to a
string formatting operation which yields the returned string.
Before formatting the dictionary, a couple of preparatory steps
are carried out.... |
Format the specified record as text.
The record's attribute dictionary is used as the operand to a
string formatting operation which yields the returned string.
Before formatting the dictionary, a couple of preparatory steps
are carried out. The message attribute of the record ... | format | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/logging/__init__.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/logging/__init__.py | MIT |
def __init__(self, linefmt=None):
"""
Optionally specify a formatter which will be used to format each
individual record.
"""
if linefmt:
self.linefmt = linefmt
else:
self.linefmt = _defaultFormatter |
Optionally specify a formatter which will be used to format each
individual record.
| __init__ | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/logging/__init__.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/logging/__init__.py | MIT |
def format(self, records):
"""
Format the specified records and return the result as a string.
"""
rv = ""
if len(records) > 0:
rv = rv + self.formatHeader(records)
for record in records:
rv = rv + self.linefmt.format(record)
rv... |
Format the specified records and return the result as a string.
| format | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/logging/__init__.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/logging/__init__.py | MIT |
def __init__(self, name=''):
"""
Initialize a filter.
Initialize with the name of the logger which, together with its
children, will have its events allowed through the filter. If no
name is specified, allow every event.
"""
self.name = name
self.nlen = l... |
Initialize a filter.
Initialize with the name of the logger which, together with its
children, will have its events allowed through the filter. If no
name is specified, allow every event.
| __init__ | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/logging/__init__.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/logging/__init__.py | MIT |
def filter(self, record):
"""
Determine if the specified record is to be logged.
Is the specified record to be logged? Returns 0 for no, nonzero for
yes. If deemed appropriate, the record may be modified in-place.
"""
if self.nlen == 0:
return 1
elif ... |
Determine if the specified record is to be logged.
Is the specified record to be logged? Returns 0 for no, nonzero for
yes. If deemed appropriate, the record may be modified in-place.
| filter | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/logging/__init__.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/logging/__init__.py | MIT |
def filter(self, record):
"""
Determine if a record is loggable by consulting all the filters.
The default is to allow the record to be logged; any filter can veto
this and the record is then dropped. Returns a zero value if a record
is to be dropped, else non-zero.
"""
... |
Determine if a record is loggable by consulting all the filters.
The default is to allow the record to be logged; any filter can veto
this and the record is then dropped. Returns a zero value if a record
is to be dropped, else non-zero.
| filter | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/logging/__init__.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/logging/__init__.py | MIT |
def _removeHandlerRef(wr):
"""
Remove a handler reference from the internal cleanup list.
"""
# This function can be called during module teardown, when globals are
# set to None. It can also be called from another thread. So we need to
# pre-emptively grab the necessary globals and check if the... |
Remove a handler reference from the internal cleanup list.
| _removeHandlerRef | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/logging/__init__.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/logging/__init__.py | MIT |
def _addHandlerRef(handler):
"""
Add a handler to the internal cleanup list using a weak reference.
"""
_acquireLock()
try:
_handlerList.append(weakref.ref(handler, _removeHandlerRef))
finally:
_releaseLock() |
Add a handler to the internal cleanup list using a weak reference.
| _addHandlerRef | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/logging/__init__.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/logging/__init__.py | MIT |
def __init__(self, level=NOTSET):
"""
Initializes the instance - basically setting the formatter to None
and the filter list to empty.
"""
Filterer.__init__(self)
self._name = None
self.level = _checkLevel(level)
self.formatter = None
# Add the han... |
Initializes the instance - basically setting the formatter to None
and the filter list to empty.
| __init__ | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/logging/__init__.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/logging/__init__.py | MIT |
def createLock(self):
"""
Acquire a thread lock for serializing access to the underlying I/O.
"""
if thread:
self.lock = threading.RLock()
else:
self.lock = None |
Acquire a thread lock for serializing access to the underlying I/O.
| createLock | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/logging/__init__.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/logging/__init__.py | MIT |
def format(self, record):
"""
Format the specified record.
If a formatter is set, use it. Otherwise, use the default formatter
for the module.
"""
if self.formatter:
fmt = self.formatter
else:
fmt = _defaultFormatter
return fmt.for... |
Format the specified record.
If a formatter is set, use it. Otherwise, use the default formatter
for the module.
| format | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/logging/__init__.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/logging/__init__.py | MIT |
def emit(self, record):
"""
Do whatever it takes to actually log the specified logging record.
This version is intended to be implemented by subclasses and so
raises a NotImplementedError.
"""
raise NotImplementedError('emit must be implemented '
... |
Do whatever it takes to actually log the specified logging record.
This version is intended to be implemented by subclasses and so
raises a NotImplementedError.
| emit | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/logging/__init__.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/logging/__init__.py | MIT |
def close(self):
"""
Tidy up any resources used by the handler.
This version removes the handler from an internal map of handlers,
_handlers, which is used for handler lookup by name. Subclasses
should ensure that this gets called from overridden close()
methods.
... |
Tidy up any resources used by the handler.
This version removes the handler from an internal map of handlers,
_handlers, which is used for handler lookup by name. Subclasses
should ensure that this gets called from overridden close()
methods.
| close | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/logging/__init__.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/logging/__init__.py | MIT |
def __init__(self, stream=None):
"""
Initialize the handler.
If stream is not specified, sys.stderr is used.
"""
Handler.__init__(self)
if stream is None:
stream = sys.stderr
self.stream = stream |
Initialize the handler.
If stream is not specified, sys.stderr is used.
| __init__ | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/logging/__init__.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/logging/__init__.py | MIT |
def __init__(self, filename, mode='a', encoding=None, delay=0):
"""
Open the specified file and use it as the stream for logging.
"""
#keep the absolute path, otherwise derived classes which use this
#may come a cropper when the current directory changes
if codecs is None... |
Open the specified file and use it as the stream for logging.
| __init__ | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/logging/__init__.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/logging/__init__.py | MIT |
def _open(self):
"""
Open the current base file with the (original) mode and encoding.
Return the resulting stream.
"""
if self.encoding is None:
stream = open(self.baseFilename, self.mode)
else:
stream = codecs.open(self.baseFilename, self.mode, s... |
Open the current base file with the (original) mode and encoding.
Return the resulting stream.
| _open | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/logging/__init__.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/logging/__init__.py | MIT |
def __init__(self, alogger):
"""
Initialize with the specified logger being a child of this placeholder.
"""
#self.loggers = [alogger]
self.loggerMap = { alogger : None } |
Initialize with the specified logger being a child of this placeholder.
| __init__ | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/logging/__init__.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/logging/__init__.py | MIT |
def append(self, alogger):
"""
Add the specified logger as a child of this placeholder.
"""
#if alogger not in self.loggers:
if alogger not in self.loggerMap:
#self.loggers.append(alogger)
self.loggerMap[alogger] = None |
Add the specified logger as a child of this placeholder.
| append | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/logging/__init__.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/logging/__init__.py | MIT |
def setLoggerClass(klass):
"""
Set the class to be used when instantiating a logger. The class should
define __init__() such that only a name argument is required, and the
__init__() should call Logger.__init__()
"""
if klass != Logger:
if not issubclass(klass, Logger):
raise... |
Set the class to be used when instantiating a logger. The class should
define __init__() such that only a name argument is required, and the
__init__() should call Logger.__init__()
| setLoggerClass | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/logging/__init__.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/logging/__init__.py | MIT |
def __init__(self, rootnode):
"""
Initialize the manager with the root node of the logger hierarchy.
"""
self.root = rootnode
self.disable = 0
self.emittedNoHandlerWarning = 0
self.loggerDict = {}
self.loggerClass = None |
Initialize the manager with the root node of the logger hierarchy.
| __init__ | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/logging/__init__.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/logging/__init__.py | MIT |
def getLogger(self, name):
"""
Get a logger with the specified name (channel name), creating it
if it doesn't yet exist. This name is a dot-separated hierarchical
name, such as "a", "a.b", "a.b.c" or similar.
If a PlaceHolder existed for the specified name [i.e. the logger
... |
Get a logger with the specified name (channel name), creating it
if it doesn't yet exist. This name is a dot-separated hierarchical
name, such as "a", "a.b", "a.b.c" or similar.
If a PlaceHolder existed for the specified name [i.e. the logger
didn't exist but a child of it did]... | getLogger | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/logging/__init__.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/logging/__init__.py | MIT |
def setLoggerClass(self, klass):
"""
Set the class to be used when instantiating a logger with this Manager.
"""
if klass != Logger:
if not issubclass(klass, Logger):
raise TypeError("logger not derived from logging.Logger: "
+ ... |
Set the class to be used when instantiating a logger with this Manager.
| setLoggerClass | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/logging/__init__.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/logging/__init__.py | MIT |
def _fixupParents(self, alogger):
"""
Ensure that there are either loggers or placeholders all the way
from the specified logger to the root of the logger hierarchy.
"""
name = alogger.name
i = name.rfind(".")
rv = None
while (i > 0) and not rv:
... |
Ensure that there are either loggers or placeholders all the way
from the specified logger to the root of the logger hierarchy.
| _fixupParents | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/logging/__init__.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/logging/__init__.py | MIT |
def _fixupChildren(self, ph, alogger):
"""
Ensure that children of the placeholder ph are connected to the
specified logger.
"""
name = alogger.name
namelen = len(name)
for c in ph.loggerMap.keys():
#The if means ... if not c.parent.name.startswith(nm)... |
Ensure that children of the placeholder ph are connected to the
specified logger.
| _fixupChildren | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/logging/__init__.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/logging/__init__.py | MIT |
def __init__(self, name, level=NOTSET):
"""
Initialize the logger with a name and an optional level.
"""
Filterer.__init__(self)
self.name = name
self.level = _checkLevel(level)
self.parent = None
self.propagate = 1
self.handlers = []
self.... |
Initialize the logger with a name and an optional level.
| __init__ | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/logging/__init__.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/logging/__init__.py | MIT |
def debug(self, msg, *args, **kwargs):
"""
Log 'msg % args' with severity 'DEBUG'.
To pass exception information, use the keyword argument exc_info with
a true value, e.g.
logger.debug("Houston, we have a %s", "thorny problem", exc_info=1)
"""
if self.isEnabledF... |
Log 'msg % args' with severity 'DEBUG'.
To pass exception information, use the keyword argument exc_info with
a true value, e.g.
logger.debug("Houston, we have a %s", "thorny problem", exc_info=1)
| debug | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/logging/__init__.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/logging/__init__.py | MIT |
def info(self, msg, *args, **kwargs):
"""
Log 'msg % args' with severity 'INFO'.
To pass exception information, use the keyword argument exc_info with
a true value, e.g.
logger.info("Houston, we have a %s", "interesting problem", exc_info=1)
"""
if self.isEnable... |
Log 'msg % args' with severity 'INFO'.
To pass exception information, use the keyword argument exc_info with
a true value, e.g.
logger.info("Houston, we have a %s", "interesting problem", exc_info=1)
| info | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/logging/__init__.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/logging/__init__.py | MIT |
def warning(self, msg, *args, **kwargs):
"""
Log 'msg % args' with severity 'WARNING'.
To pass exception information, use the keyword argument exc_info with
a true value, e.g.
logger.warning("Houston, we have a %s", "bit of a problem", exc_info=1)
"""
if self.is... |
Log 'msg % args' with severity 'WARNING'.
To pass exception information, use the keyword argument exc_info with
a true value, e.g.
logger.warning("Houston, we have a %s", "bit of a problem", exc_info=1)
| warning | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/logging/__init__.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/logging/__init__.py | MIT |
def error(self, msg, *args, **kwargs):
"""
Log 'msg % args' with severity 'ERROR'.
To pass exception information, use the keyword argument exc_info with
a true value, e.g.
logger.error("Houston, we have a %s", "major problem", exc_info=1)
"""
if self.isEnabledFo... |
Log 'msg % args' with severity 'ERROR'.
To pass exception information, use the keyword argument exc_info with
a true value, e.g.
logger.error("Houston, we have a %s", "major problem", exc_info=1)
| error | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/logging/__init__.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/logging/__init__.py | MIT |
def exception(self, msg, *args, **kwargs):
"""
Convenience method for logging an ERROR with exception information.
"""
kwargs['exc_info'] = 1
self.error(msg, *args, **kwargs) |
Convenience method for logging an ERROR with exception information.
| exception | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/logging/__init__.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/logging/__init__.py | MIT |
def critical(self, msg, *args, **kwargs):
"""
Log 'msg % args' with severity 'CRITICAL'.
To pass exception information, use the keyword argument exc_info with
a true value, e.g.
logger.critical("Houston, we have a %s", "major disaster", exc_info=1)
"""
if self.i... |
Log 'msg % args' with severity 'CRITICAL'.
To pass exception information, use the keyword argument exc_info with
a true value, e.g.
logger.critical("Houston, we have a %s", "major disaster", exc_info=1)
| critical | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/logging/__init__.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/logging/__init__.py | MIT |
def log(self, level, msg, *args, **kwargs):
"""
Log 'msg % args' with the integer severity 'level'.
To pass exception information, use the keyword argument exc_info with
a true value, e.g.
logger.log(level, "We have a %s", "mysterious problem", exc_info=1)
"""
i... |
Log 'msg % args' with the integer severity 'level'.
To pass exception information, use the keyword argument exc_info with
a true value, e.g.
logger.log(level, "We have a %s", "mysterious problem", exc_info=1)
| log | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/logging/__init__.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/logging/__init__.py | MIT |
def findCaller(self):
"""
Find the stack frame of the caller so that we can note the source
file name, line number and function name.
"""
f = currentframe()
#On some versions of IronPython, currentframe() returns None if
#IronPython isn't run with -X:Frames.
... |
Find the stack frame of the caller so that we can note the source
file name, line number and function name.
| findCaller | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/logging/__init__.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/logging/__init__.py | MIT |
def makeRecord(self, name, level, fn, lno, msg, args, exc_info, func=None, extra=None):
"""
A factory method which can be overridden in subclasses to create
specialized LogRecords.
"""
rv = LogRecord(name, level, fn, lno, msg, args, exc_info, func)
if extra is not None:
... |
A factory method which can be overridden in subclasses to create
specialized LogRecords.
| makeRecord | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/logging/__init__.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/logging/__init__.py | MIT |
def _log(self, level, msg, args, exc_info=None, extra=None):
"""
Low-level logging routine which creates a LogRecord and then calls
all the handlers of this logger to handle the record.
"""
if _srcfile:
#IronPython doesn't track Python frames, so findCaller raises an
... |
Low-level logging routine which creates a LogRecord and then calls
all the handlers of this logger to handle the record.
| _log | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/logging/__init__.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/logging/__init__.py | MIT |
def addHandler(self, hdlr):
"""
Add the specified handler to this logger.
"""
_acquireLock()
try:
if not (hdlr in self.handlers):
self.handlers.append(hdlr)
finally:
_releaseLock() |
Add the specified handler to this logger.
| addHandler | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/logging/__init__.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/logging/__init__.py | MIT |
def removeHandler(self, hdlr):
"""
Remove the specified handler from this logger.
"""
_acquireLock()
try:
if hdlr in self.handlers:
self.handlers.remove(hdlr)
finally:
_releaseLock() |
Remove the specified handler from this logger.
| removeHandler | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/logging/__init__.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/logging/__init__.py | MIT |
def callHandlers(self, record):
"""
Pass a record to all relevant handlers.
Loop through all handlers for this logger and its parents in the
logger hierarchy. If no handler was found, output a one-off error
message to sys.stderr. Stop searching up the hierarchy whenever a
... |
Pass a record to all relevant handlers.
Loop through all handlers for this logger and its parents in the
logger hierarchy. If no handler was found, output a one-off error
message to sys.stderr. Stop searching up the hierarchy whenever a
logger with the "propagate" attribute set... | callHandlers | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/logging/__init__.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/logging/__init__.py | MIT |
def getEffectiveLevel(self):
"""
Get the effective level for this logger.
Loop through this logger and its parents in the logger hierarchy,
looking for a non-zero logging level. Return the first one found.
"""
logger = self
while logger:
if logger.lev... |
Get the effective level for this logger.
Loop through this logger and its parents in the logger hierarchy,
looking for a non-zero logging level. Return the first one found.
| getEffectiveLevel | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/logging/__init__.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/logging/__init__.py | MIT |
def isEnabledFor(self, level):
"""
Is this logger enabled for level 'level'?
"""
if self.manager.disable >= level:
return 0
return level >= self.getEffectiveLevel() |
Is this logger enabled for level 'level'?
| isEnabledFor | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/logging/__init__.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/logging/__init__.py | MIT |
def getChild(self, suffix):
"""
Get a logger which is a descendant to this one.
This is a convenience method, such that
logging.getLogger('abc').getChild('def.ghi')
is the same as
logging.getLogger('abc.def.ghi')
It's useful, for example, when the parent logg... |
Get a logger which is a descendant to this one.
This is a convenience method, such that
logging.getLogger('abc').getChild('def.ghi')
is the same as
logging.getLogger('abc.def.ghi')
It's useful, for example, when the parent logger is named using
__name__ rath... | getChild | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/logging/__init__.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/logging/__init__.py | MIT |
def __init__(self, logger, extra):
"""
Initialize the adapter with a logger and a dict-like object which
provides contextual information. This constructor signature allows
easy stacking of LoggerAdapters, if so desired.
You can effectively pass keyword arguments as shown in the
... |
Initialize the adapter with a logger and a dict-like object which
provides contextual information. This constructor signature allows
easy stacking of LoggerAdapters, if so desired.
You can effectively pass keyword arguments as shown in the
following example:
adapter = ... | __init__ | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/logging/__init__.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/logging/__init__.py | MIT |
def process(self, msg, kwargs):
"""
Process the logging message and keyword arguments passed in to
a logging call to insert contextual information. You can either
manipulate the message itself, the keyword args or both. Return
the message and kwargs modified (or not) to suit your... |
Process the logging message and keyword arguments passed in to
a logging call to insert contextual information. You can either
manipulate the message itself, the keyword args or both. Return
the message and kwargs modified (or not) to suit your needs.
Normally, you'll only need... | process | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/logging/__init__.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/logging/__init__.py | MIT |
def debug(self, msg, *args, **kwargs):
"""
Delegate a debug call to the underlying logger, after adding
contextual information from this adapter instance.
"""
msg, kwargs = self.process(msg, kwargs)
self.logger.debug(msg, *args, **kwargs) |
Delegate a debug call to the underlying logger, after adding
contextual information from this adapter instance.
| debug | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/logging/__init__.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/logging/__init__.py | MIT |
def info(self, msg, *args, **kwargs):
"""
Delegate an info call to the underlying logger, after adding
contextual information from this adapter instance.
"""
msg, kwargs = self.process(msg, kwargs)
self.logger.info(msg, *args, **kwargs) |
Delegate an info call to the underlying logger, after adding
contextual information from this adapter instance.
| info | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/logging/__init__.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/logging/__init__.py | MIT |
def warning(self, msg, *args, **kwargs):
"""
Delegate a warning call to the underlying logger, after adding
contextual information from this adapter instance.
"""
msg, kwargs = self.process(msg, kwargs)
self.logger.warning(msg, *args, **kwargs) |
Delegate a warning call to the underlying logger, after adding
contextual information from this adapter instance.
| warning | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/logging/__init__.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/logging/__init__.py | MIT |
def error(self, msg, *args, **kwargs):
"""
Delegate an error call to the underlying logger, after adding
contextual information from this adapter instance.
"""
msg, kwargs = self.process(msg, kwargs)
self.logger.error(msg, *args, **kwargs) |
Delegate an error call to the underlying logger, after adding
contextual information from this adapter instance.
| error | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/logging/__init__.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/logging/__init__.py | MIT |
def exception(self, msg, *args, **kwargs):
"""
Delegate an exception call to the underlying logger, after adding
contextual information from this adapter instance.
"""
msg, kwargs = self.process(msg, kwargs)
kwargs["exc_info"] = 1
self.logger.error(msg, *args, **k... |
Delegate an exception call to the underlying logger, after adding
contextual information from this adapter instance.
| exception | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/logging/__init__.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/logging/__init__.py | MIT |
def critical(self, msg, *args, **kwargs):
"""
Delegate a critical call to the underlying logger, after adding
contextual information from this adapter instance.
"""
msg, kwargs = self.process(msg, kwargs)
self.logger.critical(msg, *args, **kwargs) |
Delegate a critical call to the underlying logger, after adding
contextual information from this adapter instance.
| critical | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/logging/__init__.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/logging/__init__.py | MIT |
def log(self, level, msg, *args, **kwargs):
"""
Delegate a log call to the underlying logger, after adding
contextual information from this adapter instance.
"""
msg, kwargs = self.process(msg, kwargs)
self.logger.log(level, msg, *args, **kwargs) |
Delegate a log call to the underlying logger, after adding
contextual information from this adapter instance.
| log | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/logging/__init__.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/logging/__init__.py | MIT |
def basicConfig(**kwargs):
"""
Do basic configuration for the logging system.
This function does nothing if the root logger already has handlers
configured. It is a convenience method intended for use by simple scripts
to do one-shot configuration of the logging package.
The default behaviour ... |
Do basic configuration for the logging system.
This function does nothing if the root logger already has handlers
configured. It is a convenience method intended for use by simple scripts
to do one-shot configuration of the logging package.
The default behaviour is to create a StreamHandler which... | basicConfig | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/logging/__init__.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/logging/__init__.py | MIT |
def getLogger(name=None):
"""
Return a logger with the specified name, creating it if necessary.
If no name is specified, return the root logger.
"""
if name:
return Logger.manager.getLogger(name)
else:
return root |
Return a logger with the specified name, creating it if necessary.
If no name is specified, return the root logger.
| getLogger | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/logging/__init__.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/logging/__init__.py | MIT |
def critical(msg, *args, **kwargs):
"""
Log a message with severity 'CRITICAL' on the root logger.
"""
if len(root.handlers) == 0:
basicConfig()
root.critical(msg, *args, **kwargs) |
Log a message with severity 'CRITICAL' on the root logger.
| critical | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/logging/__init__.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/logging/__init__.py | MIT |
def error(msg, *args, **kwargs):
"""
Log a message with severity 'ERROR' on the root logger.
"""
if len(root.handlers) == 0:
basicConfig()
root.error(msg, *args, **kwargs) |
Log a message with severity 'ERROR' on the root logger.
| error | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/logging/__init__.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/logging/__init__.py | MIT |
def exception(msg, *args, **kwargs):
"""
Log a message with severity 'ERROR' on the root logger,
with exception information.
"""
kwargs['exc_info'] = 1
error(msg, *args, **kwargs) |
Log a message with severity 'ERROR' on the root logger,
with exception information.
| exception | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/logging/__init__.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/logging/__init__.py | MIT |
def warning(msg, *args, **kwargs):
"""
Log a message with severity 'WARNING' on the root logger.
"""
if len(root.handlers) == 0:
basicConfig()
root.warning(msg, *args, **kwargs) |
Log a message with severity 'WARNING' on the root logger.
| warning | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/logging/__init__.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/logging/__init__.py | MIT |
def info(msg, *args, **kwargs):
"""
Log a message with severity 'INFO' on the root logger.
"""
if len(root.handlers) == 0:
basicConfig()
root.info(msg, *args, **kwargs) |
Log a message with severity 'INFO' on the root logger.
| info | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/logging/__init__.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/logging/__init__.py | MIT |
def debug(msg, *args, **kwargs):
"""
Log a message with severity 'DEBUG' on the root logger.
"""
if len(root.handlers) == 0:
basicConfig()
root.debug(msg, *args, **kwargs) |
Log a message with severity 'DEBUG' on the root logger.
| debug | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/logging/__init__.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/logging/__init__.py | MIT |
def log(level, msg, *args, **kwargs):
"""
Log 'msg % args' with the integer severity 'level' on the root logger.
"""
if len(root.handlers) == 0:
basicConfig()
root.log(level, msg, *args, **kwargs) |
Log 'msg % args' with the integer severity 'level' on the root logger.
| log | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/logging/__init__.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/logging/__init__.py | MIT |
def shutdown(handlerList=_handlerList):
"""
Perform any cleanup actions in the logging system (e.g. flushing
buffers).
Should be called at application exit.
"""
for wr in reversed(handlerList[:]):
#errors might occur, for example, if files are locked
#we just ignore them if rais... |
Perform any cleanup actions in the logging system (e.g. flushing
buffers).
Should be called at application exit.
| shutdown | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/logging/__init__.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/logging/__init__.py | MIT |
def _showwarning(message, category, filename, lineno, file=None, line=None):
"""
Implementation of showwarnings which redirects to logging, which will first
check to see if the file parameter is None. If a file is specified, it will
delegate to the original warnings implementation of showwarning. Otherw... |
Implementation of showwarnings which redirects to logging, which will first
check to see if the file parameter is None. If a file is specified, it will
delegate to the original warnings implementation of showwarning. Otherwise,
it will call warnings.formatwarning and will log the resulting string to a
... | _showwarning | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/logging/__init__.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/logging/__init__.py | MIT |
def captureWarnings(capture):
"""
If capture is true, redirect all warnings to the logging package.
If capture is False, ensure that warnings are not redirected to logging
but to their original destinations.
"""
global _warnings_showwarning
if capture:
if _warnings_showwarning is Non... |
If capture is true, redirect all warnings to the logging package.
If capture is False, ensure that warnings are not redirected to logging
but to their original destinations.
| captureWarnings | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/logging/__init__.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/logging/__init__.py | MIT |
def change_sequence(seq, action, seqno=_Unspecified, cond = _Unspecified):
"Change the sequence number of an action in a sequence list"
for i in range(len(seq)):
if seq[i][0] == action:
if cond is _Unspecified:
cond = seq[i][1]
if seqno is _Unspecified:
... | Change the sequence number of an action in a sequence list | change_sequence | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/msilib/__init__.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/msilib/__init__.py | MIT |
def __init__(self, db, cab, basedir, physical, _logical, default, componentflags=None):
"""Create a new directory in the Directory table. There is a current component
at each point in time for the directory, which is either explicitly created
through start_component, or implicitly when files are... | Create a new directory in the Directory table. There is a current component
at each point in time for the directory, which is either explicitly created
through start_component, or implicitly when files are added for the first
time. Files are added into the current component, and into the cab fil... | __init__ | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/msilib/__init__.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/msilib/__init__.py | MIT |
def start_component(self, component = None, feature = None, flags = None, keyfile = None, uuid=None):
"""Add an entry to the Component table, and make this component the current for this
directory. If no component name is given, the directory name is used. If no feature
is given, the current fea... | Add an entry to the Component table, and make this component the current for this
directory. If no component name is given, the directory name is used. If no feature
is given, the current feature is used. If no flags are given, the directory's default
flags are used. If no keyfile is given, the ... | start_component | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/msilib/__init__.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/msilib/__init__.py | MIT |
def add_file(self, file, src=None, version=None, language=None):
"""Add a file to the current component of the directory, starting a new one
if there is no current component. By default, the file name in the source
and the file table will be identical. If the src file is specified, it is
... | Add a file to the current component of the directory, starting a new one
if there is no current component. By default, the file name in the source
and the file table will be identical. If the src file is specified, it is
interpreted relative to the current directory. Optionally, a version and a
... | add_file | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/msilib/__init__.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/msilib/__init__.py | MIT |
def glob(self, pattern, exclude = None):
"""Add a list of files to the current component as specified in the
glob pattern. Individual files can be excluded in the exclude list."""
files = glob.glob1(self.absolute, pattern)
for f in files:
if exclude and f in exclude: continue... | Add a list of files to the current component as specified in the
glob pattern. Individual files can be excluded in the exclude list. | glob | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/msilib/__init__.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/msilib/__init__.py | MIT |
def remove_pyc(self):
"Remove .pyc/.pyo files on uninstall"
add_data(self.db, "RemoveFile",
[(self.component+"c", self.component, "*.pyc", self.logical, 2),
(self.component+"o", self.component, "*.pyo", self.logical, 2)]) | Remove .pyc/.pyo files on uninstall | remove_pyc | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/msilib/__init__.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/msilib/__init__.py | MIT |
def arbitrary_address(family):
'''
Return an arbitrary free address for the given family
'''
if family == 'AF_INET':
return ('localhost', 0)
elif family == 'AF_UNIX':
return tempfile.mktemp(prefix='listener-', dir=get_temp_dir())
elif family == 'AF_PIPE':
return tempfile.... |
Return an arbitrary free address for the given family
| arbitrary_address | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/multiprocessing/connection.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/multiprocessing/connection.py | MIT |
def address_type(address):
'''
Return the types of the address
This can be 'AF_INET', 'AF_UNIX', or 'AF_PIPE'
'''
if type(address) == tuple:
return 'AF_INET'
elif type(address) is str and address.startswith('\\\\'):
return 'AF_PIPE'
elif type(address) is str:
return ... |
Return the types of the address
This can be 'AF_INET', 'AF_UNIX', or 'AF_PIPE'
| address_type | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/multiprocessing/connection.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/multiprocessing/connection.py | MIT |
def accept(self):
'''
Accept a connection on the bound socket or named pipe of `self`.
Returns a `Connection` object.
'''
c = self._listener.accept()
if self._authkey:
deliver_challenge(c, self._authkey)
answer_challenge(c, self._authkey)
... |
Accept a connection on the bound socket or named pipe of `self`.
Returns a `Connection` object.
| accept | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/multiprocessing/connection.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/multiprocessing/connection.py | MIT |
def Client(address, family=None, authkey=None):
'''
Returns a connection to the address of a `Listener`
'''
family = family or address_type(address)
if family == 'AF_PIPE':
c = PipeClient(address)
else:
c = SocketClient(address)
if authkey is not None and not isinstance(auth... |
Returns a connection to the address of a `Listener`
| Client | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/multiprocessing/connection.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/multiprocessing/connection.py | MIT |
def Pipe(duplex=True):
'''
Returns pair of connection objects at either end of a pipe
'''
if duplex:
s1, s2 = socket.socketpair()
s1.setblocking(True)
s2.setblocking(True)
c1 = _multiprocessing.Connection(os.dup(s1.fileno()))
c2... |
Returns pair of connection objects at either end of a pipe
| Pipe | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/multiprocessing/connection.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/multiprocessing/connection.py | MIT |
def Pipe(duplex=True):
'''
Returns pair of connection objects at either end of a pipe
'''
address = arbitrary_address('AF_PIPE')
if duplex:
openmode = win32.PIPE_ACCESS_DUPLEX
access = win32.GENERIC_READ | win32.GENERIC_WRITE
obsize, ibsize = B... |
Returns pair of connection objects at either end of a pipe
| Pipe | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/multiprocessing/connection.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/multiprocessing/connection.py | MIT |
def SocketClient(address):
'''
Return a connection object connected to the socket given by `address`
'''
family = getattr(socket, address_type(address))
t = _init_timeout()
while 1:
s = socket.socket(family)
s.setblocking(True)
try:
s.connect(address)
... |
Return a connection object connected to the socket given by `address`
| SocketClient | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/multiprocessing/connection.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/multiprocessing/connection.py | MIT |
def PipeClient(address):
'''
Return a connection object connected to the pipe given by `address`
'''
t = _init_timeout()
while 1:
try:
win32.WaitNamedPipe(address, 1000)
h = win32.CreateFile(
address, win32.GENERIC_R... |
Return a connection object connected to the pipe given by `address`
| PipeClient | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/multiprocessing/connection.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/multiprocessing/connection.py | MIT |
def is_forking(argv):
'''
Return whether commandline indicates we are forking
'''
if len(argv) >= 2 and argv[1] == '--multiprocessing-fork':
assert len(argv) == 3
return True
else:
return False |
Return whether commandline indicates we are forking
| is_forking | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/multiprocessing/forking.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/multiprocessing/forking.py | MIT |
def get_command_line():
'''
Returns prefix of command line used for spawning a child process
'''
if getattr(process.current_process(), '_inheriting', False):
raise RuntimeError('''
Attempt to start a new process before the current process
has finished ... |
Returns prefix of command line used for spawning a child process
| get_command_line | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/multiprocessing/forking.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/multiprocessing/forking.py | MIT |
def main():
'''
Run code specified by data received over pipe
'''
assert is_forking(sys.argv)
handle = int(sys.argv[-1])
fd = msvcrt.open_osfhandle(handle, os.O_RDONLY)
from_parent = os.fdopen(fd, 'rb')
process.current_process()._inheriting = True
... |
Run code specified by data received over pipe
| main | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/multiprocessing/forking.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/multiprocessing/forking.py | MIT |
def get_preparation_data(name):
'''
Return info about parent needed by child to unpickle process object
'''
from .util import _logger, _log_to_stderr
d = dict(
name=name,
sys_path=sys.path,
sys_argv=sys.argv,
log_to_stderr=_log_to_... |
Return info about parent needed by child to unpickle process object
| get_preparation_data | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/multiprocessing/forking.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/multiprocessing/forking.py | MIT |
def prepare(data):
'''
Try to get current process ready to unpickle process object
'''
old_main_modules.append(sys.modules['__main__'])
if 'name' in data:
process.current_process().name = data['name']
if 'authkey' in data:
process.current_process()._authkey = data['authkey']
... |
Try to get current process ready to unpickle process object
| prepare | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/multiprocessing/forking.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/multiprocessing/forking.py | MIT |
def dispatch(c, id, methodname, args=(), kwds={}):
'''
Send a message to manager using connection `c` and return response
'''
c.send((id, methodname, args, kwds))
kind, result = c.recv()
if kind == '#RETURN':
return result
raise convert_to_error(kind, result) |
Send a message to manager using connection `c` and return response
| dispatch | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/multiprocessing/managers.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/multiprocessing/managers.py | MIT |
def all_methods(obj):
'''
Return a list of names of methods of `obj`
'''
temp = []
for name in dir(obj):
func = getattr(obj, name)
if hasattr(func, '__call__'):
temp.append(name)
return temp |
Return a list of names of methods of `obj`
| all_methods | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/multiprocessing/managers.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/multiprocessing/managers.py | MIT |
def serve_client(self, conn):
'''
Handle requests from the proxies in a particular process/thread
'''
util.debug('starting server thread to service %r',
threading.current_thread().name)
recv = conn.recv
send = conn.send
id_to_obj = self.id_to_o... |
Handle requests from the proxies in a particular process/thread
| serve_client | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/multiprocessing/managers.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/multiprocessing/managers.py | MIT |
def debug_info(self, c):
'''
Return some info --- useful to spot problems with refcounting
'''
self.mutex.acquire()
try:
result = []
keys = self.id_to_obj.keys()
keys.sort()
for ident in keys:
if ident != '0':
... |
Return some info --- useful to spot problems with refcounting
| debug_info | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/multiprocessing/managers.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/multiprocessing/managers.py | MIT |
def create(self, c, typeid, *args, **kwds):
'''
Create a new shared object and return its id
'''
self.mutex.acquire()
try:
callable, exposed, method_to_typeid, proxytype = \
self.registry[typeid]
if callable is None:
... |
Create a new shared object and return its id
| create | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/multiprocessing/managers.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/multiprocessing/managers.py | MIT |
def accept_connection(self, c, name):
'''
Spawn a new thread to serve this connection
'''
threading.current_thread().name = name
c.send(('#RETURN', None))
self.serve_client(c) |
Spawn a new thread to serve this connection
| accept_connection | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/multiprocessing/managers.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/multiprocessing/managers.py | MIT |
def get_server(self):
'''
Return server object with serve_forever() method and address attribute
'''
assert self._state.value == State.INITIAL
return Server(self._registry, self._address,
self._authkey, self._serializer) |
Return server object with serve_forever() method and address attribute
| get_server | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/multiprocessing/managers.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/multiprocessing/managers.py | MIT |
def connect(self):
'''
Connect manager object to the server process
'''
Listener, Client = listener_client[self._serializer]
conn = Client(self._address, authkey=self._authkey)
dispatch(conn, None, 'dummy')
self._state.value = State.STARTED |
Connect manager object to the server process
| connect | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/multiprocessing/managers.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/multiprocessing/managers.py | MIT |
def start(self, initializer=None, initargs=()):
'''
Spawn a server process for this manager object
'''
assert self._state.value == State.INITIAL
if initializer is not None and not hasattr(initializer, '__call__'):
raise TypeError('initializer must be a callable')
... |
Spawn a server process for this manager object
| start | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/multiprocessing/managers.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/multiprocessing/managers.py | MIT |
def _run_server(cls, registry, address, authkey, serializer, writer,
initializer=None, initargs=()):
'''
Create a server, report its address and run it
'''
if initializer is not None:
initializer(*initargs)
# create server
server = cls._Se... |
Create a server, report its address and run it
| _run_server | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/multiprocessing/managers.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/multiprocessing/managers.py | MIT |
def _create(self, typeid, *args, **kwds):
'''
Create a new shared object; return the token and exposed tuple
'''
assert self._state.value == State.STARTED, 'server not yet started'
conn = self._Client(self._address, authkey=self._authkey)
try:
id, exposed = di... |
Create a new shared object; return the token and exposed tuple
| _create | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/multiprocessing/managers.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/multiprocessing/managers.py | MIT |
def _debug_info(self):
'''
Return some info about the servers shared objects and connections
'''
conn = self._Client(self._address, authkey=self._authkey)
try:
return dispatch(conn, None, 'debug_info')
finally:
conn.close() |
Return some info about the servers shared objects and connections
| _debug_info | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/multiprocessing/managers.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/multiprocessing/managers.py | MIT |
def _number_of_objects(self):
'''
Return the number of shared objects
'''
conn = self._Client(self._address, authkey=self._authkey)
try:
return dispatch(conn, None, 'number_of_objects')
finally:
conn.close() |
Return the number of shared objects
| _number_of_objects | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/multiprocessing/managers.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/multiprocessing/managers.py | MIT |
def _finalize_manager(process, address, authkey, state, _Client):
'''
Shutdown the manager process; will be registered as a finalizer
'''
if process.is_alive():
util.info('sending shutdown message to manager')
try:
conn = _Client(address, authkey=a... |
Shutdown the manager process; will be registered as a finalizer
| _finalize_manager | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/multiprocessing/managers.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/multiprocessing/managers.py | MIT |
def register(cls, typeid, callable=None, proxytype=None, exposed=None,
method_to_typeid=None, create_method=True):
'''
Register a typeid with the manager type
'''
if '_registry' not in cls.__dict__:
cls._registry = cls._registry.copy()
if proxytype i... |
Register a typeid with the manager type
| register | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/multiprocessing/managers.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/multiprocessing/managers.py | MIT |
def _callmethod(self, methodname, args=(), kwds={}):
'''
Try to call a method of the referrent and return a copy of the result
'''
try:
conn = self._tls.connection
except AttributeError:
util.debug('thread %r does not own a connection',
... |
Try to call a method of the referrent and return a copy of the result
| _callmethod | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/multiprocessing/managers.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/multiprocessing/managers.py | MIT |
def __str__(self):
'''
Return representation of the referent (or a fall-back if that fails)
'''
try:
return self._callmethod('__repr__')
except Exception:
return repr(self)[:-1] + "; '__str__()' failed>" |
Return representation of the referent (or a fall-back if that fails)
| __str__ | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/multiprocessing/managers.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/multiprocessing/managers.py | MIT |
def RebuildProxy(func, token, serializer, kwds):
'''
Function used for unpickling proxy objects.
If possible the shared object is returned, or otherwise a proxy for it.
'''
server = getattr(current_process(), '_manager_server', None)
if server and server.address == token.address:
retur... |
Function used for unpickling proxy objects.
If possible the shared object is returned, or otherwise a proxy for it.
| RebuildProxy | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/multiprocessing/managers.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/multiprocessing/managers.py | MIT |
def MakeProxyType(name, exposed, _cache={}):
'''
Return a proxy type whose methods are given by `exposed`
'''
exposed = tuple(exposed)
try:
return _cache[(name, exposed)]
except KeyError:
pass
dic = {}
for meth in exposed:
exec '''def %s(self, *args, **kwds):
... |
Return a proxy type whose methods are given by `exposed`
| MakeProxyType | python | mchristopher/PokemonGo-DesktopMap | app/pywin/Lib/multiprocessing/managers.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pywin/Lib/multiprocessing/managers.py | MIT |
Subsets and Splits
Django Code with Docstrings
Filters Python code examples from Django repository that contain Django-related code, helping identify relevant code snippets for understanding Django framework usage patterns.
SQL Console for Shuu12121/python-treesitter-filtered-datasetsV2
Retrieves Python code examples from Django repository that contain 'django' in the code, which helps identify Django-specific code snippets but provides limited analytical insights beyond basic filtering.
SQL Console for Shuu12121/python-treesitter-filtered-datasetsV2
Retrieves specific code examples from the Flask repository but doesn't provide meaningful analysis or patterns beyond basic data retrieval.
HTTPX Repo Code and Docstrings
Retrieves specific code examples from the httpx repository, which is useful for understanding how particular libraries are used but doesn't provide broader analytical insights about the dataset.
Requests Repo Docstrings & Code
Retrieves code examples with their docstrings and file paths from the requests repository, providing basic filtering but limited analytical value beyond finding specific code samples.
Quart Repo Docstrings & Code
Retrieves code examples with their docstrings from the Quart repository, providing basic code samples but offering limited analytical value for understanding broader patterns or relationships in the dataset.