Skip to content

Implement set repr #117

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Oct 14, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Gofmt
  • Loading branch information
xarus01 committed Oct 8, 2019
commit ff014f62f2f8cf23435d540794bcd7a59646fe97
4 changes: 2 additions & 2 deletions builtin/builtin.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ func init() {
"object": py.ObjectType,
"range": py.RangeType,
// "reversed": py.ReversedType,
"set": py.SetType,
"slice": py.SliceType,
"set": py.SetType,
"slice": py.SliceType,
"staticmethod": py.StaticMethodType,
"str": py.StringType,
// "super": py.SuperType,
Expand Down
2 changes: 1 addition & 1 deletion parser/lexer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ func approxEq(a, b float64) bool {
log.Printf("ApproxEq(a = %#v, b = %#v)", a, b)
diff := a - b
log.Printf("ApproxEq(diff = %e)", diff)
if math.Abs(diff) > 1E-10 {
if math.Abs(diff) > 1e-10 {
log.Printf("ApproxEq(false)")
return false
}
Expand Down
7 changes: 3 additions & 4 deletions py/range.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,9 +226,9 @@ func computeRangeSlice(r *Range, s *Slice) (Object, error) {
sliceLength = computeRangeLength(startIndex, stopIndex, stepIndex)

return &Range{
Start: startIndex,
Stop: stopIndex,
Step: stepIndex,
Start: startIndex,
Stop: stopIndex,
Step: stepIndex,
Length: sliceLength,
}, nil
}
Expand All @@ -238,7 +238,6 @@ var _ I__getitem__ = (*Range)(nil)
var _ I__iter__ = (*Range)(nil)
var _ I_iterator = (*RangeIterator)(nil)


func (a *Range) M__eq__(other Object) (Object, error) {
b, ok := other.(*Range)
if !ok {
Expand Down
2 changes: 1 addition & 1 deletion py/range_repr110.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ func (r *Range) repr() (Object, error) {
b.WriteString(")")

return String(b.String()), nil
}
}
2 changes: 1 addition & 1 deletion py/range_repr19.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ func (r *Range) repr() (Object, error) {
b.WriteString(")")

return String(b.String()), nil
}
}
2 changes: 1 addition & 1 deletion py/set.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ func (s *Set) M__bool__() (Object, error) {
return NewBool(len(s.items) > 0), nil
}

func (s * Set) M__repr__() (Object, error) {
func (s *Set) M__repr__() (Object, error) {
var out bytes.Buffer
out.WriteRune('{')
spacer := false
Expand Down
2 changes: 1 addition & 1 deletion symtable/symtable_data_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ var symtableTestData = []struct {
Children: Children{},
},
},
}, nil,""},
}, nil, ""},
{"def fn(a):\n global b\n global b\n return b", "exec", &SymTable{
Type: ModuleBlock,
Name: "top",
Expand Down
4 changes: 2 additions & 2 deletions time/time.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Return the current time in seconds since the Epoch.
Fractions of a second may be present if the system clock provides them.`

func time_time(self py.Object) (py.Object, error) {
return py.Float(time.Now().UnixNano()) / 1E9, nil
return py.Float(time.Now().UnixNano()) / 1e9, nil
}

// func floatclock(_Py_clock_info_t *info) (py.Object, error) {
Expand Down Expand Up @@ -141,7 +141,7 @@ func time_sleep(self py.Object, args py.Tuple) (py.Object, error) {
if secs < 0 {
return nil, py.ExceptionNewf(py.ValueError, "sleep length must be non-negative")
}
time.Sleep(time.Duration(secs * 1E9))
time.Sleep(time.Duration(secs * 1e9))
return py.None, nil
}

Expand Down