added @tuturto sugesstions and flake8 errors
This commit is contained in:
parent
dda291cfb5
commit
6778e9b2e1
@ -334,11 +334,14 @@ def checkargs(exact=None, min=None, max=None, even=None):
|
|||||||
_raise_wrong_args_number(
|
_raise_wrong_args_number(
|
||||||
expression,
|
expression,
|
||||||
"`%%s' needs at most %d arguments, got %%d" % (max))
|
"`%%s' needs at most %d arguments, got %%d" % (max))
|
||||||
|
|
||||||
is_even = not((len(expression) - 1) % 2)
|
is_even = not((len(expression) - 1) % 2)
|
||||||
if even is not None and is_even!=even:
|
if even is not None and is_even != even:
|
||||||
even_str = "even" if even else "odd"
|
even_str = "even" if even else "odd"
|
||||||
_raise_wrong_args_number(expression, "`%%s' needs an %s number of arguments, got %%d" % (even_str))
|
_raise_wrong_args_number(
|
||||||
|
expression,
|
||||||
|
"`%%s' needs an %s number of arguments, got %%d"
|
||||||
|
% (even_str))
|
||||||
|
|
||||||
return fn(self, expression)
|
return fn(self, expression)
|
||||||
|
|
||||||
@ -1141,12 +1144,13 @@ class HyASTCompiler(object):
|
|||||||
# (assoc foo bar baz) => foo[bar] = baz
|
# (assoc foo bar baz) => foo[bar] = baz
|
||||||
target = self.compile(expr.pop(0))
|
target = self.compile(expr.pop(0))
|
||||||
ret = target
|
ret = target
|
||||||
while expr != []:
|
while expr:
|
||||||
key = self.compile(expr.pop(0))
|
key = self.compile(expr.pop(0))
|
||||||
try:
|
try:
|
||||||
val = self.compile(expr.pop(0))
|
val = self.compile(expr.pop(0))
|
||||||
except IndexError:
|
except IndexError:
|
||||||
raise HyCompileError("Key {key} has no value to associate".format(key))
|
raise HyCompileError(
|
||||||
|
"Key {key} has no value to associate".format(key))
|
||||||
|
|
||||||
ret += key + val + ast.Assign(
|
ret += key + val + ast.Assign(
|
||||||
lineno=expr.start_line,
|
lineno=expr.start_line,
|
||||||
|
@ -352,7 +352,7 @@
|
|||||||
"NATIVE: test assoc multiple values"
|
"NATIVE: test assoc multiple values"
|
||||||
(setv vals {"one" "two"})
|
(setv vals {"one" "two"})
|
||||||
(assoc vals "two" "three" "four" "five")
|
(assoc vals "two" "three" "four" "five")
|
||||||
(assert (and (= (get vals "two") "three") (= (get vals "four") "five"))))
|
(assert (and (= (get vals "two") "three") (= (get vals "four") "five") (= (get vals "one") "two"))))
|
||||||
|
|
||||||
(defn test-pass []
|
(defn test-pass []
|
||||||
"NATIVE: Test pass worksish"
|
"NATIVE: Test pass worksish"
|
||||||
|
Loading…
Reference in New Issue
Block a user