Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@want(int)
def sendBigInt(i):
print("{:d}".format(int(i))) # Expects a str, like "9223372036854775807"
return i
self.register("sendBigInt", sendBigInt)
@want(Student)
def sendStudent(s):
print s # Expects a Student, like "John Smith, Age: 18, ID: 1234"
self.register("sendStudent", sendStudent)
@want(Student)
def changeStudentID(s):
print s.studentID # Expects an int, like 1234
s.changeID(5678)
return s
self.register("changeStudentID", changeStudentID)
@want(User)
def model(self, other):
print "Received a publish from", other
other.sayHello()
@want(Student)
def sendStudent(s):
print s # Expects a str, like "John Smith, Age: 18, ID: 1234"
self.register("sendStudent", sendStudent)
@want(str)
def regStrInt(s):
print(s) # Expects a str, like "Hello"
return 42
self.register("regStrInt", regStrInt)
@want(str)
def regStrStr(s):
print(s) # Expects a str, like "Hello"
return "Hello World"
self.register("regStrStr", regStrStr)
@want(Student)
def changeStudentID(s):
print s.studentID # Expects an int, like 1234
s.changeID(5678)
return s
self.register("changeStudentID", changeStudentID)
@want(str)
def iWantStrings(s):
print(s) # Expects a str, like "Hi"
return "Thanks for saying {}".format(s)
self.register("iWantStrings", iWantStrings)
@want(bool)
def loggerDone(self, b):
print b # Expects a bool, like True
if b:
self.logger.leave()
return True