本文整理汇总了Python中twisted.spread.pb.setUnjellyableForClass函数的典型用法代码示例。如果您正苦于以下问题:Python setUnjellyableForClass函数的具体用法?Python setUnjellyableForClass怎么用?Python setUnjellyableForClass使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setUnjellyableForClass函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: remote_registerClasses
def remote_registerClasses(self, *args):
"""
Instructs my broker to register the classes specified by the
argument(s).
The classes will be registered for B{all} jobs, and are specified by
their string representations::
<package(s).module.class>
"""
modules = []
for stringRep in args:
# Load the class for the string representation
cls = reflect.namedObject(stringRep)
# Register instances of the class, including its type and module
pb.setUnjellyableForClass(stringRep, cls)
if cls.__module__ not in modules:
modules.append(cls.__module__)
# Try to build the modules for the classes in case they've changed
# since the last run
for module in modules:
try:
rebuild(reflect.namedModule(module), doLog=False)
except:
pass
开发者ID:D3f0,项目名称:txscada,代码行数:26,代码来源:jobs.py
示例2: discover
def discover():
for m in __all__:
for name, obj in inspect.getmembers(sys.modules[m]):
if inspect.isclass(obj) and \
issubclass(obj, operators.Operator):
if hasattr(obj, "operator_name"):
installed_ops[obj.operator_name] = obj
# register all operators with the perspective broker
# so we can remote-call them if we want to.
pb.setUnjellyableForClass(obj, obj)
开发者ID:ahaas,项目名称:smap,代码行数:11,代码来源:__init__.py
示例3: getTimeStamp
def getTimeStamp(self):
"""Get the timestamp for the message
@returns: the timestamp or None
@rtype: int
"""
# F0.4: timestamp was added in 0.4.2
return getattr(self, 'timestamp', None)
def getDescription(self):
"""Get the description for the message
@returns: the description or None
@rtype: str
"""
return getattr(self, 'description', None)
pb.setUnjellyableForClass(Message, Message)
# these are implemented as factory functions instead of classes because
# properly proxying to the correct subclass is hard with Copyable/RemoteCopy
def Error(*args, **kwargs):
"""
Create a L{Message} at ERROR level, indicating a failure that needs
intervention to be resolved.
"""
return Message(ERROR, *args, **kwargs)
# FIXME: figure out a way to not be shadowing the Warning builtin without
# breaking all other code
__pychecker__ = 'no-shadowbuiltin'
开发者ID:flyapen,项目名称:UgFlu,代码行数:31,代码来源:messages.py
示例4: SynchronousError
class SynchronousError(pb.Error):
"""
Helper used to test remote methods which raise exceptions which are
L{pb.Error} subclasses.
"""
#class JellyError(flavors.Jellyable, pb.Error): pass
class JellyError(flavors.Jellyable, pb.Error, pb.RemoteCopy):
pass
class SecurityError(pb.Error, pb.RemoteCopy):
pass
pb.setUnjellyableForClass(JellyError, JellyError)
pb.setUnjellyableForClass(SecurityError, SecurityError)
pb.globalSecurity.allowInstancesOf(SecurityError)
####
# server-side
####
class SimpleRoot(pb.Root):
def remote_asynchronousException(self):
"""
Fail asynchronously with a non-pb.Error exception.
"""
return defer.fail(AsynchronousException("remote asynchronous exception"))
def remote_synchronousException(self):
开发者ID:Architektor,项目名称:PySnip,代码行数:31,代码来源:test_pbfailure.py
示例5: __init__
"""
Created on 2015-4-24
@author: kong.lihua
This module is used to send complex object between sever and client.
"""
from twisted.spread import pb
class Request:
def __init__(self, name, paraDict):
self.name = name
self.paraDict = paraDict
class ClientRequest(Request, pb.Copyable):
pass
class ServerRequest(pb.RemoteCopy, Request):
pass
pb.setUnjellyableForClass(ClientRequest, ServerRequest)
开发者ID:cici0647,项目名称:SFIT_TradeSystemEngine,代码行数:25,代码来源:reqClazz.py
示例6: RemoteException
'message':4096
}
class RemoteException(Exception, pb.Copyable, pb.RemoteCopy):
"""Exception that can cross the PB barrier"""
def __init__(self, msg, tb):
Exception.__init__(self, msg)
self.traceback = tb
def __str__(self):
return "%s: %s" % (
Exception.__str__(self), self.traceback or '<no traceback>')
pb.setUnjellyableForClass(RemoteException, RemoteException)
# ZODB conflicts
class RemoteConflictError(RemoteException): pass
pb.setUnjellyableForClass(RemoteConflictError, RemoteConflictError)
# Invalid monitor specified
class RemoteBadMonitor(RemoteException): pass
def translateError(callable):
"""
Decorator function to wrap remote exceptions into something
understandable by our daemon.
开发者ID:zenoss,项目名称:zenoss-prodbin,代码行数:31,代码来源:PBDaemon.py
示例7: __repr__
Subclasses should override to add additional information.
"""
return {'id': self.id,
'requester': self.requesterId,
'domain': self.domain}
def __repr__(self):
return "<%s for requesterId %r in state %s>" % (
self.__class__.__name__,
self.requesterId, _statesEnum[self.state])
class KeycardGeneric(Keycard, object):
pass
pb.setUnjellyableForClass(KeycardGeneric, KeycardGeneric)
# class KeycardUACCP: username, address, crypt password
# from UsernameCryptPasswordCrypt
UCPP = credentials.UsernameCryptPasswordPlaintext
class KeycardUACPP(Keycard, UCPP):
"""
I am a keycard with a username, plaintext password and IP address.
I get authenticated against a crypt password.
"""
def __init__(self, username, password, address):
UCPP.__init__(self, username, password)
开发者ID:ylatuya,项目名称:Flumotion,代码行数:31,代码来源:keycards.py
示例8: __init__
def __init__(self):
pass
def __str__(self):
"""
Override the Python default to represent ourselves as a string
"""
return str(self.name)
__repr__ = __str__
def processClassPrimaryUrlPath(self):
return self.primaryUrlPath
pb.setUnjellyableForClass(ProcessProxy, ProcessProxy)
class ProcessConfig(CollectorConfigService):
def __init__(self, dmd, instance):
deviceProxyAttributes = ('zMaxOIDPerRequest',)
CollectorConfigService.__init__(self, dmd, instance, deviceProxyAttributes)
def _filterDevice(self, device):
include = CollectorConfigService._filterDevice(self, device)
include = include and device.snmpMonitorDevice()
return include
def _createDeviceProxy(self, device, proxy=None):
开发者ID:zenoss,项目名称:zenoss-prodbin,代码行数:30,代码来源:ProcessConfig.py
示例9: MetricId
class MetricId(pb.Copyable, pb.RemoteCopy):
instance = ""
def __init__(self, counterId, instance=""):
self.counterId = counterId
self.instance = instance
def __str__(self):
retString = str(self.counterId)
if self.instance and len(self.instance) > 0:
retString += "|" + self.instance
return retString
pb.setUnjellyableForClass(MetricId, MetricId)
clientCache = {}
def createGAEClient(username, password, printTrace=False, nocache=False, logseverity=logging.INFO):
client = None
if not nocache and clientCache.has_key(username):
client = clientCache[username]
if not client.loggedIn:
client = None
if not client:
client = GAEClient(username, password, printTrace, logseverity)
if not nocache:
clientCache[username] = client
开发者ID:anksp21,项目名称:Community-Zenpacks,代码行数:30,代码来源:gaeclient.py
示例10: ManagerComponentUIState
class ManagerComponentUIState(flavors.StateCacheable,
flavors.StateRemoteCache):
def processUniqueID(self):
# Make sure proxies for the same object are the same, if we are
# later cached by someone else. See bug #519.
return id(self.__dict__)
class AdminComponentUIState(flavors.StateRemoteCache):
pass
pb.setUnjellyableForClass(WorkerComponentUIState, ManagerComponentUIState)
pb.setUnjellyableForClass(ManagerComponentUIState, AdminComponentUIState)
class WizardEntryState(pb.RemoteCopy):
def getAcceptedMediaTypes(self):
"""
Fetches a list of media types this components accepts.
@returns: a list of strings
"""
return [format.media_type for format in self.accepts]
def getProvidedMediaTypes(self):
"""
Fetches a list of media types this components provides.
开发者ID:flyapen,项目名称:UgFlu,代码行数:29,代码来源:componentui.py
示例11: updateConfig
"""
if pid in self.pids:
del self.pids[pid]
def updateConfig(self, update):
"""
"""
if self is update:
return
self.name = update.name
self.originalName = update.originalName
self.ignoreParameters = update.ignoreParameters
self.restart = update.restart
self.severity = update.severity
pb.setUnjellyableForClass(Process, Process)
class Device(pb.Copyable, pb.RemoteCopy):
"""
Track device data
"""
name = ''
snmpConnInfo = None
proxy = None
lastScan = 0.
snmpStatus = 0
lastChange = 0
maxOidsPerRequest = 40
def __init__(self):
开发者ID:alecsandrb,项目名称:Community-Zenpacks,代码行数:31,代码来源:zensunprocess.py
示例12: Observer
self.d = d
return d
class Observer(pb.Referenceable):
notified = 0
obj = None
def remote_notify(self, other, obj):
self.obj = obj
self.notified = self.notified + 1
other.callRemote('unobserve',self)
class NewStyleCopy(pb.Copyable, pb.RemoteCopy, object):
def __init__(self, s):
self.s = s
pb.setUnjellyableForClass(NewStyleCopy, NewStyleCopy)
class NewStyleCopy2(pb.Copyable, pb.RemoteCopy, object):
allocated = 0
initialized = 0
value = 1
def __new__(self):
NewStyleCopy2.allocated += 1
inst = object.__new__(self)
inst.value = 2
return inst
def __init__(self):
NewStyleCopy2.initialized += 1
pb.setUnjellyableForClass(NewStyleCopy2, NewStyleCopy2)
开发者ID:KatiaBorges,项目名称:exeLearning,代码行数:30,代码来源:test_pb.py
示例13: __init__
#! /usr/bin/python
from twisted.spread import pb
class FrogPond:
def __init__(self, numFrogs, numToads):
self.numFrogs = numFrogs
self.numToads = numToads
def count(self):
return self.numFrogs + self.numToads
class SenderPond(FrogPond, pb.Copyable):
def getStateToCopy(self):
d = self.__dict__.copy()
d['frogsAndToads'] = d['numFrogs'] + d['numToads']
del d['numFrogs']
del d['numToads']
return d
class ReceiverPond(pb.RemoteCopy):
def setCopyableState(self, state):
self.__dict__ = state
def count(self):
return self.frogsAndToads
pb.setUnjellyableForClass(SenderPond, ReceiverPond)
开发者ID:AnthonyNystrom,项目名称:YoGoMee,代码行数:26,代码来源:copy2_classes.py
示例14: __init__
(interfacegl.DrawMenu, RemoteDrawMenu),
(interfacegl.DrawObjectPick, RemoteDrawObjectPick),
(interfacegl.DrawObjectHilight, RemoteDrawObjectHilight),
(interfacegl.DrawObjectHighLight, RemoteDrawObjectHighLight),
(interfacegl.DrawTmpVertex, RemoteDrawTmpVertex),
(interfacegl.DrawTmpEdge, RemoteDrawTmpEdge),
(camera.Camera, RemoteCamera),
(camera.OrthoCamera, RemoteCamera),
(graph.Graph, RemoteGraph),
(graph.Vertex, RemoteVertex),
(graph.DummyVertex, RemoteDummyVertex),
(graph.Edge, RemoteEdge),
(graph.SuperEdge, RemoteSuperEdge),
]
for src, tgt in mappings:
pb.setUnjellyableForClass(src, tgt)
class Handler:
def __init__(self, reactor, deliver):
self.serverRef = None
self.reactor = reactor
self.deliver = deliver
def error(self, obj):
print "error:", str(obj)
self.reactor.stop()
def getmaker(self, obj):
print "got maker:", obj
self.serverRef = obj
开发者ID:ulethHCI,项目名称:GLuskap,代码行数:31,代码来源:remoteobjs.py
示例15:
from twisted.spread import pb
import engine.Light
import engine.Map
import engine.Unit
import engine.Ability
import engine.Class
import engine.Scenario
import engine.Range
import engine.Effect
import engine.Light
import engine.Equipment
import engine.Battle
pb.setUnjellyableForClass(engine.Light.Light, engine.Light.Light)
pb.setUnjellyableForClass(engine.Map.MapSquare, engine.Map.MapSquare)
pb.setUnjellyableForClass(engine.Map.Map, engine.Map.Map)
pb.setUnjellyableForClass(engine.Unit.Unit, engine.Unit.Unit)
pb.setUnjellyableForClass(engine.Unit.StatusEffects, engine.Unit.StatusEffects)
pb.setUnjellyableForClass(engine.Ability.Ability, engine.Ability.Ability)
pb.setUnjellyableForClass(engine.Class.Class, engine.Class.Class)
pb.setUnjellyableForClass(engine.Scenario.Scenario, engine.Scenario.Scenario)
pb.setUnjellyableForClass(engine.Range.Line, engine.Range.Line)
pb.setUnjellyableForClass(engine.Range.Cross, engine.Range.Cross)
pb.setUnjellyableForClass(engine.Range.Diamond, engine.Range.Diamond)
pb.setUnjellyableForClass(engine.Range.DiamondExtend, engine.Range.DiamondExtend)
pb.setUnjellyableForClass(engine.Range.Single, engine.Range.Single)
pb.setUnjellyableForClass(engine.Effect.Damage, engine.Effect.Damage)
pb.setUnjellyableForClass(engine.Effect.DamageSP, engine.Effect.DamageSP)
pb.setUnjellyableForClass(engine.Effect.DrainLife, engine.Effect.DrainLife)
pb.setUnjellyableForClass(engine.Effect.HealFriendlyDamageHostile, engine.Effect.HealFriendlyDamageHostile)
开发者ID:jemofthewest,项目名称:GalaxyMage,代码行数:31,代码来源:netsupport.py
示例16: AddressBookEntry
from twisted.spread import pb
class AddressBookEntry(pb.Copyable, pb.RemoteCopy):
def __init__(self, name="", email="", phone="", address=""):
self.name = name
self.email = email
self.phone = phone
self.address = address
pb.setUnjellyableForClass(AddressBookEntry, AddressBookEntry)
开发者ID:rgravina,项目名称:Pyrope,代码行数:9,代码来源:addressbook_twisted_model.py
示例17: __str__
self.port = port
self.use_ssl = use_ssl
self.authenticator = authenticator
def __str__(self):
# have to use getattr in the case that the authenticator was
# transferred over the wire, because the remote reference is not
# an authenticator
if (self.authenticator
and getattr(self.authenticator, 'username', None)):
return '%[email protected]%s:%d' % (self.authenticator.username,
self.host, self.port)
else:
return '%s:%d' % (self.host, self.port)
pb.setUnjellyableForClass(PBConnectionInfo, PBConnectionInfo)
_pat = re.compile('^(([^:@]*)(:([^:@]+))[email protected])?([^:@]+)(:([0-9]+))?$')
def parsePBConnectionInfo(string, username='user', password='test',
port=7531, use_ssl=True):
"""
Parse a string representation of a PB connection into a
PBConnectionInfo object.
The expected format is [user[:pass]@]host[:port]. Only the host is
mandatory. The default values for username, password, and port will
be taken from the optional username, password and port arguments.
开发者ID:ylatuya,项目名称:Flumotion,代码行数:30,代码来源:connection.py
示例18: calculateScore
if self.team == 1:
return 2
else:
return 1
def calculateScore(self, team):
#print "score =================================="
if team == None:
team = self.team
# print "=== Our Team: " + str(team)
score = 0;
for playerId in self.players:
#score = score + 100
player = self.players[playerId]
#print "player team: " + str(player.team)
if player.team == team:
score = score + player.sides
score = score + player.resources
for buildingId in self.buildings:
#score = score + 10000
building = self.buildings[buildingId]
#print "bildg team: " + str(building.team)
if building.team == team:
score = score + building.sides
score = score + building.resources
return score * 1000;
pb.setUnjellyableForClass(Environment, Environment)
开发者ID:bmandeberg,项目名称:flatland-arg,代码行数:30,代码来源:environment.py
示例19: AgentProxy
p = AgentProxy(ip=self.manageIp,
port=self.zSnmpPort,
timeout=self.zSnmpTimeout,
tries=retries,
snmpVersion=self.zSnmpVer,
community=self.zSnmpCommunity,
cmdLineArgs=cmdLineArgs,
protocol=protocol,
allowCache=allowCache)
p.snmpConnInfo = self
return p
def __repr__(self):
return '<%s for %s>' % (self.__class__, self.id)
pb.setUnjellyableForClass(SnmpConnInfo, SnmpConnInfo)
class PerformanceConfig(HubService, ThresholdMixin):
def __init__(self, dmd, instance):
HubService.__init__(self, dmd, instance)
self.config = self.dmd.Monitors.Performance._getOb(self.instance)
self.procrastinator = Procrastinate(self.pushConfig)
self._collectorMap = {}
self._notifier = component.getUtility(IBatchNotifier)
@translateError
def remote_propertyItems(self):
return self.config.propertyItems()
开发者ID:bbc,项目名称:zenoss-prodbin,代码行数:30,代码来源:PerformanceConfig.py
示例20: iter
return iter(self.maps)
def append(self, obj):
self.maps.append(obj)
def extend(self, objmaps):
self.maps.extend(objmaps)
def asUnitTest(self):
"""
Return the results of the relationship map as something that can
be used directly for unit tests.
"""
return pformat(dict((map.id, map.asUnitTest()) for map in self.maps))
pb.setUnjellyableForClass(RelationshipMap, RelationshipMap)
class ObjectMap(PBSafe):
"""
ObjectMap defines a mapping of some data to a ZenModel object. To be valid
it must specify modname the full path to the module where the class to
be created is defined. If the class name is the same as the module
classname doesn't need to be defined.
"""
compname = ""
modname = ""
classname = ""
_blockattrs = ('compname', 'modname', 'classname')
_attrs = []
开发者ID:c0ns0le,项目名称:zenoss-4,代码行数:30,代码来源:DataMaps.py
注:本文中的twisted.spread.pb.setUnjellyableForClass函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论