Skip to content

Commit

Permalink
Fixed indents to be multiples of 4
Browse files Browse the repository at this point in the history
  • Loading branch information
merryman committed Sep 3, 2013
1 parent 929ed08 commit 82fd204
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 44 deletions.
32 changes: 17 additions & 15 deletions topaz/objects/bignumobject.py
Expand Up @@ -188,33 +188,35 @@ def method_divmod(self, space, w_other):
space.newbigint_fromrbigint(mod)])
else:
raise space.error(
space.w_TypeError,
"%s can't be coerced into Fixnum" % (
space.obj_to_s(space.getclass(w_other))
)
)
space.w_TypeError,
"%s can't be coerced into Fixnum" % (
space.obj_to_s(space.getclass(w_other))
)
)

@classdef.method("%")
@classdef.method("modulo")
def method_mod(self, space, w_other):
if space.getclass(w_other) is space.w_fixnum:
return space.newint(
space.int_w(self.method_mod_bigint_impl(
space, space.bigint_w(w_other)
)
)
)
space.int_w(
self.method_mod_bigint_impl(
space,
space.bigint_w(w_other)
)
)
)
elif space.getclass(w_other) is space.w_float:
return space.send(self.method_to_f(space), "%", [w_other])
elif space.getclass(w_other) is space.w_bignum:
return self.method_mod_bigint_impl(space, space.bigint_w(w_other))
else:
raise space.error(
space.w_TypeError,
"%s can't be coerced into Fixnum" % (
space.obj_to_s(space.getclass(w_other))
)
)
space.w_TypeError,
"%s can't be coerced into Fixnum" % (
space.obj_to_s(space.getclass(w_other))
)
)

def method_mod_bigint_impl(self, space, other):
if not other.tobool():
Expand Down
32 changes: 16 additions & 16 deletions topaz/objects/floatobject.py
Expand Up @@ -277,18 +277,18 @@ def method_quo(self, space):
def method_divmod(self, space, w_other):
if math.isnan(self.floatvalue) or math.isinf(self.floatvalue):
raise space.error(
space.w_FloatDomainError,
space.obj_to_s(space.getclass(w_other))
)
space.w_FloatDomainError,
space.obj_to_s(space.getclass(w_other))
)
if (space.is_kind_of(w_other, space.w_fixnum) or
space.is_kind_of(w_other, space.w_bignum) or
space.is_kind_of(w_other, space.w_float)):
y = space.float_w(w_other)
if math.isnan(y):
raise space.error(
space.w_FloatDomainError,
space.obj_to_s(space.getclass(w_other))
)
space.w_FloatDomainError,
space.obj_to_s(space.getclass(w_other))
)
x = self.floatvalue
mod = space.float_w(self.method_mod_float_impl(space, y))
# TAKEN FROM: pypy/module/cpytext/floatobject.py
Expand Down Expand Up @@ -317,11 +317,11 @@ def method_divmod(self, space, w_other):
return space.newarray([space.newbigint_fromfloat(div), space.newfloat(mod)])
else:
raise space.error(
space.w_TypeError,
"%s can't be coerced into Float" % (
space.obj_to_s(space.getclass(w_other))
)
)
space.w_TypeError,
"%s can't be coerced into Float" % (
space.obj_to_s(space.getclass(w_other))
)
)

@classdef.method("%")
@classdef.method("modulo")
Expand All @@ -332,11 +332,11 @@ def method_mod(self, space, w_other):
return self.method_mod_float_impl(space, space.float_w(w_other))
else:
raise space.error(
space.w_TypeError,
"%s can't be coerced into Float" % (
space.obj_to_s(space.getclass(w_other))
)
)
space.w_TypeError,
"%s can't be coerced into Float" % (
space.obj_to_s(space.getclass(w_other))
)
)

def method_mod_float_impl(self, space, other):
if other == 0.0:
Expand Down
26 changes: 13 additions & 13 deletions topaz/objects/intobject.py
Expand Up @@ -229,19 +229,19 @@ def method_divmod(self, space, w_other):
y = space.int_w(w_other)
if y == 0:
raise space.error(
space.w_ZeroDivisionError,
"devided by 0"
)
space.w_ZeroDivisionError,
"devided by 0"
)
mod = space.int_w(self.method_mod_int_impl(space, y))
div = (self.intvalue - mod) / y
return space.newarray([space.newint(int(round_away(div))), space.newfloat(mod)])
else:
raise space.error(
space.w_TypeError,
"%s can't be coerced into Fixnum" % (
space.obj_to_s(space.getclass(w_other))
)
)
space.w_TypeError,
"%s can't be coerced into Fixnum" % (
space.obj_to_s(space.getclass(w_other))
)
)

@classdef.method("%")
@classdef.method("modulo")
Expand All @@ -254,11 +254,11 @@ def method_mod(self, space, w_other):
return space.send(space.newbigint_fromint(self.intvalue), "%", [w_other])
else:
raise space.error(
space.w_TypeError,
"%s can't be coerced into Fixnum" % (
space.obj_to_s(space.getclass(w_other))
)
)
space.w_TypeError,
"%s can't be coerced into Fixnum" % (
space.obj_to_s(space.getclass(w_other))
)
)

def method_mod_int_impl(self, space, other):
if other == 0:
Expand Down

0 comments on commit 82fd204

Please sign in to comment.