From 9bc70dab473c7057a20d182ce8566ad0a70a7c5d Mon Sep 17 00:00:00 2001 From: Fredrik Tolf Date: Mon, 2 Sep 2013 03:24:06 +0200 Subject: [PATCH] Made default argument specifications PEP 8-compliant. --- wrw/cookie.py | 4 ++-- wrw/env.py | 4 ++-- wrw/form.py | 6 +++--- wrw/req.py | 2 +- wrw/resp.py | 4 ++-- wrw/session.py | 8 ++++---- wrw/sp/cons.py | 2 +- wrw/util.py | 4 ++-- 8 files changed, 17 insertions(+), 17 deletions(-) diff --git a/wrw/cookie.py b/wrw/cookie.py index 4f5071a..140ba8f 100644 --- a/wrw/cookie.py +++ b/wrw/cookie.py @@ -23,7 +23,7 @@ class cookiedict(object): def __contains__(self, name): return name in self.bk - def get(self, name, default = None): + def get(self, name, default=None): if name not in self.bk: return default return self.bk[name].value @@ -39,7 +39,7 @@ class cookiedict(object): def cookies(req): return req.item(cookiedict) -def get(req, name, default = None): +def get(req, name, default=None): return cookies(req).get(name, default) def add(req, name, value, **kw): diff --git a/wrw/env.py b/wrw/env.py index 56d040d..ed313a3 100644 --- a/wrw/env.py +++ b/wrw/env.py @@ -10,7 +10,7 @@ class stack(object): class environment(object): __slots__ = ["parent", "map"] - def __init__(self, parent = None): + def __init__(self, parent=None): self.parent = parent self.map = weakref.WeakKeyDictionary() @@ -74,7 +74,7 @@ class binding(object): class var(object): __slots__ = ["__weakref__"] - def __init__(self, default = None): + def __init__(self, default=None): if default is not None: root.map[self] = default diff --git a/wrw/form.py b/wrw/form.py index 98157c0..0363b0b 100644 --- a/wrw/form.py +++ b/wrw/form.py @@ -13,7 +13,7 @@ class formwrap(object): def __getitem__(self, key): return self.cf[key][0] - def get(self, key, default = ""): + def get(self, key, default=""): if key in self: return self.cf[key][0] return default @@ -78,7 +78,7 @@ class formpart(object): raise badmultipart("Missing last multipart boundary") self.form.buf += ret - def read(self, limit = -1): + def read(self, limit=-1): self.fillbuf(limit) if limit >= 0: ret = self.buf[:limit] @@ -88,7 +88,7 @@ class formpart(object): self.buf = "" return ret - def readline(self, limit = -1): + def readline(self, limit=-1): last = 0 while True: p = self.buf.find('\n', last) diff --git a/wrw/req.py b/wrw/req.py index 5fbc2fe..41fd330 100644 --- a/wrw/req.py +++ b/wrw/req.py @@ -21,7 +21,7 @@ class headdict(object): def __iter__(self): return iter((list[0] for list in self.dict.itervalues())) - def get(self, key, default = ""): + def get(self, key, default=""): if key.lower() in self.dict: return self.dict[key.lower()][1] return default diff --git a/wrw/resp.py b/wrw/resp.py index fbb056f..7fae787 100644 --- a/wrw/resp.py +++ b/wrw/resp.py @@ -45,7 +45,7 @@ class message(dispatch.restart): return skelfor(req).message(req, self.message, *self.detail) class httperror(usererror): - def __init__(self, status, message = None, detail = None): + def __init__(self, status, message=None, detail=None): if message is None: message = proto.statusinfo[status][0] if detail is None: @@ -66,7 +66,7 @@ class redirect(dispatch.restart): "script": proto.scripturl, "site": proto.siteurl} - def __init__(self, url, status = 303, base = "url"): + def __init__(self, url, status=303, base="url"): super(redirect, self).__init__() self.url = url self.status = status diff --git a/wrw/session.py b/wrw/session.py index 43b9087..1e615e3 100644 --- a/wrw/session.py +++ b/wrw/session.py @@ -16,7 +16,7 @@ def gennonce(length): return nonce class session(object): - def __init__(self, lock, expire = 86400 * 7): + def __init__(self, lock, expire=86400 * 7): self.id = hexencode(gennonce(16)) self.dict = {} self.lock = lock @@ -39,7 +39,7 @@ class session(object): def __getitem__(self, key): return self.dict[key] - def get(self, key, default = None): + def get(self, key, default=None): return self.dict.get(key, default) def __setitem__(self, key, value): @@ -74,7 +74,7 @@ class session(object): return "" % self.id class db(object): - def __init__(self, backdb = None, cookiename = "wrwsess", path = "/"): + def __init__(self, backdb=None, cookiename="wrwsess", path="/"): self.live = {} self.cookiename = cookiename self.path = path @@ -235,7 +235,7 @@ class dirback(object): with open(os.path.join(self.path, key), "w") as out: out.write(value) -default = env.var(db(backdb = dirback(os.path.join("/tmp", "wrwsess-" + str(os.getuid()))))) +default = env.var(db(backdb=dirback(os.path.join("/tmp", "wrwsess-" + str(os.getuid()))))) def get(req): return default.val.get(req) diff --git a/wrw/sp/cons.py b/wrw/sp/cons.py index 168f297..ce258c6 100644 --- a/wrw/sp/cons.py +++ b/wrw/sp/cons.py @@ -63,7 +63,7 @@ class context(object): node.attrs[unicode(k)] = unicode(v) class constructor(object): - def __init__(self, ns, elcls = element, ctx=None): + def __init__(self, ns, elcls=element, ctx=None): self._ns = ns self._elcls = elcls if ctx is None: ctx = context() diff --git a/wrw/util.py b/wrw/util.py index 4fad6e9..7459b6d 100644 --- a/wrw/util.py +++ b/wrw/util.py @@ -62,7 +62,7 @@ class funplex(object): return fun return dec -def persession(data = None): +def persession(data=None): def dec(callable): def wrapper(req): sess = session.get(req) @@ -112,7 +112,7 @@ def pregen(callable): class sessiondata(object): @classmethod - def get(cls, req, create = True): + def get(cls, req, create=True): sess = cls.sessdb().get(req) with sess.lock: try: -- 2.11.0