aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.landscape.yml3
-rw-r--r--libpathod/app.py17
-rw-r--r--libpathod/language/__init__.py2
-rw-r--r--libpathod/language/actions.py4
-rw-r--r--libpathod/language/base.py16
-rw-r--r--libpathod/language/http2.py2
-rw-r--r--libpathod/pathoc.py6
-rw-r--r--libpathod/pathoc_cmdline.py3
-rw-r--r--libpathod/pathod.py8
-rw-r--r--libpathod/pathod_cmdline.py4
10 files changed, 34 insertions, 31 deletions
diff --git a/.landscape.yml b/.landscape.yml
index 5926e7bf..ccaa5fc3 100644
--- a/.landscape.yml
+++ b/.landscape.yml
@@ -1,5 +1,8 @@
max-line-length: 120
pylint:
+ options:
+ dummy-variables-rgx: _$|.+_$|dummy_.+
+
disable:
- missing-docstring
- protected-access
diff --git a/libpathod/app.py b/libpathod/app.py
index 5bf331ac..cd7a8bd6 100644
--- a/libpathod/app.py
+++ b/libpathod/app.py
@@ -10,6 +10,7 @@ logging.basicConfig(level="DEBUG")
EXAMPLE_HOST = "example.com"
EXAMPLE_WEBSOCKET_KEY = "examplekey"
+# pylint: disable=unused-variable
def make_app(noapi, debug):
app = Flask(__name__)
@@ -145,24 +146,24 @@ def make_app(noapi, debug):
s = cStringIO.StringIO()
- set = copy.copy(app.config["pathod"].settings)
- set.request_host = EXAMPLE_HOST
- set.websocket_key = EXAMPLE_WEBSOCKET_KEY
+ settings = copy.copy(app.config["pathod"].settings)
+ settings.request_host = EXAMPLE_HOST
+ settings.websocket_key = EXAMPLE_WEBSOCKET_KEY
safe = r.preview_safe()
err, safe = app.config["pathod"].check_policy(
safe,
- set
+ settings
)
if err:
args["error"] = err
return render(template, False, **args)
if is_request:
- set.request_host = EXAMPLE_HOST
- language.serve(safe, s, set)
+ settings.request_host = EXAMPLE_HOST
+ language.serve(safe, s, settings)
else:
- set.websocket_key = EXAMPLE_WEBSOCKET_KEY
- language.serve(safe, s, set)
+ settings.websocket_key = EXAMPLE_WEBSOCKET_KEY
+ language.serve(safe, s, settings)
args["output"] = utils.escape_unprintables(s.getvalue())
return render(template, False, **args)
diff --git a/libpathod/language/__init__.py b/libpathod/language/__init__.py
index 10050bf8..4b06f7e4 100644
--- a/libpathod/language/__init__.py
+++ b/libpathod/language/__init__.py
@@ -13,7 +13,7 @@ assert Settings # prevent pyflakes from messing with this
def expand(msg):
times = getattr(msg, "times", None)
if times:
- for j in xrange(int(times.value)):
+ for j_ in xrange(int(times.value)):
yield msg.strike_token("times")
else:
yield msg
diff --git a/libpathod/language/actions.py b/libpathod/language/actions.py
index f825d0cc..7bb61005 100644
--- a/libpathod/language/actions.py
+++ b/libpathod/language/actions.py
@@ -71,7 +71,7 @@ class PauseAt(_Action):
def intermediate(self, settings):
return (self.offset, "pause", self.seconds)
- def freeze(self, settings):
+ def freeze(self, settings_):
return self
@@ -91,7 +91,7 @@ class DisconnectAt(_Action):
def intermediate(self, settings):
return (self.offset, "disconnect")
- def freeze(self, settings):
+ def freeze(self, settings_):
return self
diff --git a/libpathod/language/base.py b/libpathod/language/base.py
index 726580fc..1f42f65e 100644
--- a/libpathod/language/base.py
+++ b/libpathod/language/base.py
@@ -86,7 +86,7 @@ class Token(object):
"""
return self.__class__.__name__.lower()
- def resolve(self, settings, msg):
+ def resolve(self, settings_, msg_):
"""
Resolves this token to ready it for transmission. This means that
the calculated offsets of actions are fixed.
@@ -104,10 +104,10 @@ class _TokValueLiteral(Token):
def __init__(self, val):
self.val = val.decode("string_escape")
- def get_generator(self, settings):
+ def get_generator(self, settings_):
return self.val
- def freeze(self, settings):
+ def freeze(self, settings_):
return self
@@ -150,7 +150,7 @@ class TokValueGenerate(Token):
def bytes(self):
return self.usize * utils.SIZE_UNITS[self.unit]
- def get_generator(self, settings):
+ def get_generator(self, settings_):
return generators.RandomGenerator(self.datatype, self.bytes())
def freeze(self, settings):
@@ -194,7 +194,7 @@ class TokValueFile(Token):
e = e + v_naked_literal
return e.setParseAction(lambda x: cls(*x))
- def freeze(self, settings):
+ def freeze(self, settings_):
return self
def get_generator(self, settings):
@@ -310,7 +310,7 @@ class CaselessLiteral(_Component):
def spec(self):
return self.TOK
- def freeze(self, settings):
+ def freeze(self, settings_):
return self
@@ -390,7 +390,7 @@ class Integer(_Component):
def spec(self):
return "%s%s" % (self.preamble, self.value)
- def freeze(self, settings):
+ def freeze(self, settings_):
return self
@@ -476,7 +476,7 @@ class Boolean(_Component):
e = pp.Optional(pp.Literal("-"), default=True)
e += pp.Literal(cls.name).suppress()
- def parse(s, loc, toks):
+ def parse(s_, loc_, toks):
val = True
if toks[0] == "-":
val = False
diff --git a/libpathod/language/http2.py b/libpathod/language/http2.py
index b13d50de..86e04056 100644
--- a/libpathod/language/http2.py
+++ b/libpathod/language/http2.py
@@ -1,5 +1,5 @@
import pyparsing as pp
-from . import base, actions, message
+from . import base, message
"""
Normal HTTP requests:
diff --git a/libpathod/pathoc.py b/libpathod/pathoc.py
index b2a8ec22..6b040214 100644
--- a/libpathod/pathoc.py
+++ b/libpathod/pathoc.py
@@ -123,7 +123,7 @@ class WebsocketFrameReader(threading.Thread):
while True:
if self.ws_read_limit == 0:
return
- r, _, x = select.select([self.rfile], [], [], 0.05)
+ r, _, _ = select.select([self.rfile], [], [], 0.05)
delta = time.time() - starttime
if not r and self.timeout and delta > self.timeout:
return
@@ -501,11 +501,11 @@ def main(args): # pragma: nocover
if ret and args.oneshot:
return
# We consume the queue when we can, so it doesn't build up.
- for i in p.wait(timeout=0, finish=False):
+ for i_ in p.wait(timeout=0, finish=False):
pass
except (http.HttpError, tcp.NetLibError) as v:
break
- for i in p.wait(timeout=0.01, finish=True):
+ for i_ in p.wait(timeout=0.01, finish=True):
pass
except KeyboardInterrupt:
pass
diff --git a/libpathod/pathoc_cmdline.py b/libpathod/pathoc_cmdline.py
index 1d0df3b5..3722c7dc 100644
--- a/libpathod/pathoc_cmdline.py
+++ b/libpathod/pathoc_cmdline.py
@@ -3,9 +3,8 @@ import sys
import argparse
import os
import os.path
-import re
from netlib import http_uastrings
-from . import pathoc, pathod, version, utils, language
+from . import pathoc, version, utils, language
def args_pathoc(argv, stdout=sys.stdout, stderr=sys.stderr):
diff --git a/libpathod/pathod.py b/libpathod/pathod.py
index 001ab085..695f62a5 100644
--- a/libpathod/pathod.py
+++ b/libpathod/pathod.py
@@ -171,7 +171,7 @@ class PathodHandler(tcp.BaseHandler):
self.wfile.flush()
if not self.server.ssloptions.not_after_connect:
try:
- cert, key, chain_file = self.server.ssloptions.get_cert(
+ cert, key, chain_file_ = self.server.ssloptions.get_cert(
connect[0]
)
self.convert_to_ssl(
@@ -310,7 +310,7 @@ class PathodHandler(tcp.BaseHandler):
anchor_gen = iter([self.make_http_error_response(
"Spec Error",
"HTTP/2 only supports request/response with the craft anchor point: %s" %
- self.server.craftanchor
+ self.server.craftanchor
)])
@@ -576,9 +576,9 @@ class Pathod(tcp.TCPServer):
with lock:
self.log = []
- def log_by_id(self, id):
+ def log_by_id(self, identifier):
for i in self.log:
- if i["id"] == id:
+ if i["id"] == identifier:
return i
def get_log(self):
diff --git a/libpathod/pathod_cmdline.py b/libpathod/pathod_cmdline.py
index e5fa0bcd..1e3516ec 100644
--- a/libpathod/pathod_cmdline.py
+++ b/libpathod/pathod_cmdline.py
@@ -4,10 +4,10 @@ import argparse
import os
import os.path
import re
-from . import pathod, version, utils, language
+from . import pathod, version, utils
-def args_pathod(argv, stdout=sys.stdout, stderr=sys.stderr):
+def args_pathod(argv, stdout_=sys.stdout, stderr_=sys.stderr):
parser = argparse.ArgumentParser(
description='A pathological HTTP/S daemon.'
)