changeset 35:deaabf47d82b

fix pyflakes warnings, including an error at import Ignore-this: a1baa5eeb251403e2a9506a1d1841ac8
author Drew Perttula <drewp@bigasterisk.com>
date Sat, 25 May 2019 06:39:05 +0000
parents f819c7f6f6b3
children fefdf52fc6bc
files Dockerfile.build rdfdb/autodepgraphapi.py rdfdb/graphfile.py rdfdb/service.py run_mypy.sh
diffstat 5 files changed, 11 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/Dockerfile.build	Sat May 25 02:53:56 2019 +0000
+++ b/Dockerfile.build	Sat May 25 06:39:05 2019 +0000
@@ -4,4 +4,4 @@
 
 RUN pip3 install --index-url https://projects.bigasterisk.com/ --extra-index-url https://pypi.org/simple rdflib cyclone mock treq rdflib-jsonld service_identity
 
-RUN pip3 install --index-url https://projects.bigasterisk.com/ --extra-index-url https://pypi.org/simple mypy nose2
+RUN pip3 install --index-url https://projects.bigasterisk.com/ --extra-index-url https://pypi.org/simple mypy nose2 pyflakes
--- a/rdfdb/autodepgraphapi.py	Sat May 25 02:53:56 2019 +0000
+++ b/rdfdb/autodepgraphapi.py	Sat May 25 06:39:05 2019 +0000
@@ -136,7 +136,7 @@
         """currently this needs to be in an addHandler section, but it
         sets no watchers so it won't actually update if the statement
         was added or dropped from contexts"""
-        func = self._getCurrentFunc()
+        #func = self._getCurrentFunc()
         return contextsForStatementNoWildcards(self._graph, triple)
 
     # i find myself wanting 'patch' (aka enter/leave) versions of these calls that tell
--- a/rdfdb/graphfile.py	Sat May 25 02:53:56 2019 +0000
+++ b/rdfdb/graphfile.py	Sat May 25 06:39:05 2019 +0000
@@ -115,7 +115,7 @@
         # bug left is that we'll retry too agressively on a file
         # that's being written
 
-        from twisted.internet.inotify import IN_CLOSE_WRITE, IN_MOVED_FROM, IN_MODIFY, IN_DELETE, IN_DELETE_SELF, IN_CHANGED
+        # See twisted.internet.inotify for IN_CHANGED event, etc.
 
         log.info("add watch on %s", self.path)
         self.notifier.watch(FilePath(self.path), callbacks=[self.notify])
--- a/rdfdb/service.py	Sat May 25 02:53:56 2019 +0000
+++ b/rdfdb/service.py	Sat May 25 06:39:05 2019 +0000
@@ -2,7 +2,7 @@
 import twisted.internet.error
 from twisted.python.filepath import FilePath
 from twisted.python.failure import Failure
-from twisted.internet.inotify import humanReadableMask, IN_CREATE
+from twisted.internet.inotify import IN_CREATE
 import sys, optparse, logging, json, os
 import cyclone.web, cyclone.httpclient, cyclone.websocket
 from typing import Dict, List, Set
@@ -151,8 +151,6 @@
         the triples from a new file. Calling this before patching the
         graph is still a reasonable thing to do, though.
         """
-        g = self.getSubgraph(ctx)
-
         if ctx not in self.graphFiles:
             outFile = fileForUri(self.dirUriMap, ctx)
             assert '//' not in outFile, (outFile, self.dirUriMap, ctx)
@@ -347,12 +345,6 @@
         p.senderUpdateUri = self.wsClient.updateUri
         self.settings.db.patch(p)
 
-liveClients: Set[Live] = set()
-def sendToLiveClients(d=None, asJson=None):
-    j = asJson or json.dumps(d)
-    for c in liveClients:
-        c.sendMessage(j)
-
 class Live(cyclone.websocket.WebSocketHandler):
 
     def connectionMade(self, *args, **kwargs):
@@ -368,6 +360,12 @@
         log.info("got message %s" % message)
         self.sendMessage(message)
 
+liveClients: Set[Live] = set()
+def sendToLiveClients(d=None, asJson=None):
+    j = asJson or json.dumps(d)
+    for c in liveClients:
+        c.sendMessage(j)
+
 class NoExts(cyclone.web.StaticFileHandler):
     # .html pages can be get() without .html on them
     def get(self, path, *args, **kw):
--- a/run_mypy.sh	Sat May 25 02:53:56 2019 +0000
+++ b/run_mypy.sh	Sat May 25 06:39:05 2019 +0000
@@ -1,3 +1,4 @@
 #!/bin/sh
 
+pyflakes rdfdb/*.py
 MYPYPATH=stubs mypy --check-untyped-defs rdfdb/*.py