PK!iJremotemath/__init__.pyPK!iJp@@remotemath/operations.pyimport json import operator import attr from twisted.internet import task import klein def _get_numbers(request): body = json.loads(request.content.read().decode('utf-8')) return map(int, body) def _send_number(request, dfrd): request.setHeader('Content-Type', 'application/json') dfrd.addCallback(json.dumps) return dfrd @attr.s class Operations(object): app = klein.Klein() clock = attr.ib() @app.route('/multiply') def multiply(self, request): a, b = _get_numbers(request) res = task.deferLater(self.clock, 5, operator.mul, a, b) return _send_number(request, res) @app.route('/negate') def negate(self, request): a, = _get_numbers(request) res = task.deferLater(self.clock, 3, operator.neg, a) return _send_number(request, res) PK!iJA   remotemath/service.pyfrom twisted.python import usage from twisted.internet import endpoints from twisted.application import service as taservice, internet from twisted.web import server from remotemath import operations class Options(usage.Options): def __init__(self): usage.Options.__init__(self) self.ports = [] def opt_port(self, port): self.ports.append(port) def makeService(opt): from twisted.internet import reactor ops_instance = operations.Operations(reactor) resource = ops_instance.app.resource() site = server.Site(resource) ret = taservice.MultiService() for port in opt.ports: ep = endpoints.serverFromString(reactor, port) serv = internet.StreamServerEndpointService(ep, site) serv.setServiceParent(ret) return ret PK"iJiʊ  remotemath/_version.py""" Provides remotemath version information. """ # This file is auto-generated! Do not edit! # Use `python -m incremental.update remotemath` to change this file. from incremental import Version __version__ = Version('remotemath', 17, 3, 0) __all__ = ["__version__"] PK!iJ:Ctwisted/plugins/remotemath.pyfrom twisted.application.service import ServiceMaker serviceMaker = ServiceMaker( "Remote math service", "remotemath.service", "Web service to multiply and negate", "remotemath", ) PK`#iJi`K+remotemath-17.3.0.dist-info/DESCRIPTION.rstMath. Very remote. PK`#iJQі)remotemath-17.3.0.dist-info/metadata.json{"extensions": {"python.details": {"contacts": [{"email": "zadka.moshe@gmail.com", "name": "Moshe Zadka", "role": "author"}], "document_names": {"description": "DESCRIPTION.rst"}}}, "extras": [], "generator": "bdist_wheel (0.26.0)", "license": "MIT", "metadata_version": "2.0", "name": "remotemath", "run_requires": [{"requires": ["incremental", "klein"]}], "summary": "Math. Remote.", "version": "17.3.0"}PK`#iJ>y)remotemath-17.3.0.dist-info/top_level.txtremotemath twisted PK`#iJ''\\!remotemath-17.3.0.dist-info/WHEELWheel-Version: 1.0 Generator: bdist_wheel (0.26.0) Root-Is-Purelib: true Tag: py2-none-any PK`#iJ$remotemath-17.3.0.dist-info/METADATAMetadata-Version: 2.0 Name: remotemath Version: 17.3.0 Summary: Math. Remote. Home-page: UNKNOWN Author: Moshe Zadka Author-email: zadka.moshe@gmail.com License: MIT Platform: UNKNOWN Requires-Dist: incremental Requires-Dist: klein Math. Very remote. PK`#iJ>01"remotemath-17.3.0.dist-info/RECORDremotemath/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 remotemath/_version.py,sha256=UQySVxJws-T2txUBGTcipMlZyPPotinp1OHtyV8lt24,269 remotemath/operations.py,sha256=uTAkidzz-uVYIkUBXyrhWNsKriTD2dP4GDYkVEuWP00,832 remotemath/service.py,sha256=pR3kHJwA72uz2i8J2fFpqqJtEhz8FY7hljTBx3x27r0,800 remotemath-17.3.0.dist-info/DESCRIPTION.rst,sha256=rbxiA7Mb6F48M4BmWEEesB567WlKawfARL2dk2Gp0FM,21 remotemath-17.3.0.dist-info/METADATA,sha256=ko1qrHUN2akjOdsAKRlgnWVrq2qpqx8Ci88PwMzbRj8,254 remotemath-17.3.0.dist-info/RECORD,, remotemath-17.3.0.dist-info/WHEEL,sha256=JTb7YztR8fkPg6aSjc571Q4eiVHCwmUDlX8PhuuqIIE,92 remotemath-17.3.0.dist-info/metadata.json,sha256=lI4ZnbssbEfWJ61hOOslOa5LJAQOJDuUDv2KNM9Wu7g,406 remotemath-17.3.0.dist-info/top_level.txt,sha256=__8FvIS_LFL5HJnthasSajJ9UW2SRcAoSdOV8Eptfk8,19 twisted/plugins/remotemath.py,sha256=Fo7DH8UnsMtNJWxa_yqGOxpqmDGgfAskm39HjUMcup4,198 PK!iJremotemath/__init__.pyPK!iJp@@4remotemath/operations.pyPK!iJA   remotemath/service.pyPK"iJiʊ  remotemath/_version.pyPK!iJ:C>twisted/plugins/remotemath.pyPK`#iJi`K+? remotemath-17.3.0.dist-info/DESCRIPTION.rstPK`#iJQі) remotemath-17.3.0.dist-info/metadata.jsonPK`#iJ>y)z remotemath-17.3.0.dist-info/top_level.txtPK`#iJ''\\! remotemath-17.3.0.dist-info/WHEELPK`#iJ$o remotemath-17.3.0.dist-info/METADATAPK`#iJ>01" remotemath-17.3.0.dist-info/RECORDPK T