Mercurial > code > home > repos > rdfdb
changeset 30:a0f0fd316781
more py3 type fixes
Ignore-this: 229566f3d8d88227164e5f3a6974fc35
author | drewp@bigasterisk.com |
---|---|
date | Sat, 25 May 2019 00:30:43 +0000 |
parents | de2e5534abaf |
children | 3ca1a8774513 |
files | rdfdb/patchreceiver.py rdfdb/patchsender.py rdfdb/service.py |
diffstat | 3 files changed, 11 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/rdfdb/patchreceiver.py Fri May 24 22:46:23 2019 +0000 +++ b/rdfdb/patchreceiver.py Sat May 25 00:30:43 2019 +0000 @@ -26,13 +26,13 @@ self._register(label) def _register(self, label): - url = self.rdfdbRoot + 'graphClients' - body = urllib.parse.urlencode([('clientUpdate', self.updateResource), - ('label', label)]) + url = (self.rdfdbRoot + 'graphClients').encode('utf8') + body = urllib.parse.urlencode([(b'clientUpdate', self.updateResource), + (b'label', label)]).encode('utf8') cyclone.httpclient.fetch( url=url, - method='POST', - headers={'Content-Type': ['application/x-www-form-urlencoded']}, + method=b'POST', + headers={b'Content-Type': [b'application/x-www-form-urlencoded']}, postdata=body, ).addCallbacks(self._done, lambda err: self._registerError(err, url, body))
--- a/rdfdb/patchsender.py Fri May 24 22:46:23 2019 +0000 +++ b/rdfdb/patchsender.py Sat May 25 00:30:43 2019 +0000 @@ -115,7 +115,7 @@ return cyclone.httpclient.fetch( url=putUri, - method='PUT', - headers={'Content-Type': ['application/json']}, + method=b'PUT', + headers={b'Content-Type': [b'application/json']}, postdata=body, ).addCallback(putDone)
--- a/rdfdb/service.py Fri May 24 22:46:23 2019 +0000 +++ b/rdfdb/service.py Sat May 25 00:30:43 2019 +0000 @@ -5,6 +5,7 @@ from twisted.internet.inotify import humanReadableMask, IN_CREATE import sys, optparse, logging, json, os import cyclone.web, cyclone.httpclient, cyclone.websocket +from typing import Set from rdflib import ConjunctiveGraph, URIRef, Graph from rdfdb.graphfile import GraphFile @@ -34,7 +35,7 @@ """ one of our syncedgraph clients """ - def __init__(self, updateUri, label): + def __init__(self, updateUri: bytes, label): self.label = label # todo: updateUri is used publicly to compare clients. Replace # it with Client.__eq__ so WsClient doesn't have to fake an @@ -306,7 +307,7 @@ pass def post(self): - upd = self.get_argument("clientUpdate") + upd = self.get_argument("clientUpdate").encode('utf8') try: self.settings.db.addClient(Client(upd, self.get_argument("label"))) except: @@ -346,7 +347,7 @@ p.senderUpdateUri = self.wsClient.updateUri self.settings.db.patch(p) -liveClients = set() +liveClients: Set[Live] = set() def sendToLiveClients(d=None, asJson=None): j = asJson or json.dumps(d) for c in liveClients: