def _getWarningString(self, obj, name, version): """ Create the warning string used by deprecated attributes. """ return _getDeprecationWarningString( obj.__name__ + '.' + name, version, DEPRECATION_WARNING_FORMAT + ': ')
def _getWarningString(self, attr): """ Create the warning string used by deprecated attributes. """ return _getDeprecationWarningString( deprecatedattributes.__name__ + '.' + attr, deprecatedattributes.version, DEPRECATION_WARNING_FORMAT + ': ' + deprecatedattributes.message)
def deferred(self): """ DEPRECATED. L{Deferred} fired when loop stops or fails. Use the L{Deferred} returned by L{LoopingCall.start}. """ warningString = _getDeprecationWarningString( "twisted.internet.task.LoopingCall.deferred", Version("Twisted", 16, 0, 0), replacement='the deferred returned by start()') warnings.warn(warningString, DeprecationWarning, stacklevel=2) return self._deferred
def deprecatedToUsefulText(name, deprecated): version = versionToUsefulText(deprecated[1]) if deprecated[2]: if isinstance(deprecated[2], ast.Keyword): replacement = deprecated[2].asList()[1].value else: replacement = deprecated[2].value else: replacement = None return _getDeprecationWarningString(name, version, replacement=replacement) + "."
def deprecatedToUsefulText(visitor, name, deprecated): """ Change a C{@deprecated} to a display string. """ from twisted.python.deprecate import _getDeprecationWarningString version = versionToUsefulObject(deprecated.args[0]) if len(deprecated.args) > 1 and deprecated.args[1]: if isinstance(deprecated.args[1], ast.Name): replacement = visitor.resolveName(deprecated.args[1].id) else: replacement = deprecated.args[1].s else: replacement = None return _getDeprecationWarningString(name, version, replacement=replacement) + "."
def deprecatedToUsefulText(name, deprecated): """ Change a C{@deprecated} to a display string. """ from twisted.python.deprecate import _getDeprecationWarningString version = versionToUsefulObject(deprecated[1]) if deprecated[2]: if isinstance(deprecated[2], ast.Keyword): replacement = deprecated[2].asList()[1].value else: replacement = deprecated[2].value else: replacement = None return _getDeprecationWarningString(name, version, replacement=replacement) + "."
def makeService(config): s = service.MultiService() if config["root"]: root = config["root"] if config["indexes"]: config["root"].indexNames = config["indexes"] else: # This really ought to be web.Admin or something root = demo.Test() if isinstance(root, static.File): root.registry.setComponent(interfaces.IServiceCollection, s) if config["extraHeaders"]: root = _AddHeadersResource(root, config["extraHeaders"]) if config["logfile"]: site = server.Site(root, logPath=config["logfile"]) else: site = server.Site(root) if config["display-tracebacks"]: site.displayTracebacks = True # Deprecate --notracebacks/-n if config["notracebacks"]: msg = deprecate._getDeprecationWarningString( "--notracebacks", incremental.Version("Twisted", 19, 7, 0) ) warnings.warn(msg, category=DeprecationWarning, stacklevel=2) if config["personal"]: site = makePersonalServerFactory(site) for port in config["ports"]: svc = strports.service(port, site) svc.setServiceParent(s) return s
def _getWarningString(self, obj, name, version): """ Create the warning string used by deprecated attributes. """ return _getDeprecationWarningString(obj.__name__ + '.' + name, version, DEPRECATION_WARNING_FORMAT + ': ')