Skip to content

Commit

Permalink
Merge pull request #350 from refaktor/allin
Browse files Browse the repository at this point in the history
improving support for thawed spreadsheets
  • Loading branch information
refaktor authored Sep 26, 2024
2 parents 625283f + a6de756 commit 2fc726d
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 75 deletions.
58 changes: 0 additions & 58 deletions .github/workflows/golangci-lint.yml

This file was deleted.

14 changes: 7 additions & 7 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ linters:
- dogsled
# - dupl
- errcheck
- exportloopref
# - exportloopref -- no more on 1.23.1
# - funlen
- gocheckcompilerdirectives
#- gocheckcompilerdirectives --x
- gochecknoinits
# - goconst
# - gocritic
Expand All @@ -105,12 +105,12 @@ linters:
# - lll
- misspell
# - nakedret
- noctx
- nolintlint
# - noctx --- x
# - nolintlint --- x
# - revive
- staticcheck
# - stylecheck
- typecheck
# - typecheck # --- temporarily removed, was throwing weird errors after upgrade to 1.23.1 on 20240925
- unconvert
# l1 - unparam
# - unused
Expand All @@ -134,8 +134,8 @@ linters:
issues:
# Excluding configuration per-path, per-linter, per-text and per-source
exclude-rules:
- text: "evaldo"
linters: typecheck
# - text: "evaldo"
# linters: typecheck
- text: "net/http/cgi" # REASON: only important for Go 1.6 and lower, Rye requires go1.8 or higher as defined in go.mod
linters: gosec

Expand Down
7 changes: 7 additions & 0 deletions env/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package env

import (
"fmt"
"reflect"
"sort"
"strings"
"sync"
Expand All @@ -14,6 +15,12 @@ import (
Set(word int, val Object) Object
} */

// UTIL

func IsPointer(v interface{}) bool {
return reflect.TypeOf(v).Kind() == reflect.Ptr
}

// This is experimental env without map for Functions with up to two variables

type EnvR2 struct {
Expand Down
48 changes: 48 additions & 0 deletions evaldo/builtins.go
Original file line number Diff line number Diff line change
Expand Up @@ -813,6 +813,34 @@ var builtins = map[string]*env.Builtin{
return &sp
case *env.Spreadsheet:
return sp
case env.Dict:
return &sp
case env.List:
return &sp
case env.Block:
return &sp
default:
return MakeArgError(ps, 1, []env.Type{env.SpreadsheetType}, "thaw")
}
},
},

"freeze": {
Argsn: 1,
Doc: "Makes a value (currently only spreadsheets) again immutable",
Pure: true,
Fn: func(ps *env.ProgramState, arg0 env.Object, arg1 env.Object, arg2 env.Object, arg3 env.Object, arg4 env.Object) env.Object {
switch sp := arg0.(type) {
case env.Spreadsheet:
return sp
case *env.Spreadsheet:
return *sp
case *env.Dict:
return *sp
case *env.List:
return *sp
case *env.Block:
return *sp
default:
return MakeArgError(ps, 1, []env.Type{env.SpreadsheetType}, "thaw")
}
Expand Down Expand Up @@ -1684,21 +1712,41 @@ var builtins = map[string]*env.Builtin{
if !esc {
return obj
}
case *env.Block:
obj, esc := term.DisplayBlock(*bloc, ps.Idx)
if !esc {
return obj
}
case env.Dict:
obj, esc := term.DisplayDict(bloc, ps.Idx)
if !esc {
return obj
}
case *env.Dict:
obj, esc := term.DisplayDict(*bloc, ps.Idx)
if !esc {
return obj
}
case env.Spreadsheet:
obj, esc := term.DisplayTable(bloc, ps.Idx)
if !esc {
return obj
}
case *env.Spreadsheet:
obj, esc := term.DisplayTable(*bloc, ps.Idx)
if !esc {
return obj
}
case env.SpreadsheetRow:
obj, esc := term.DisplaySpreadsheetRow(bloc, ps.Idx)
if !esc {
return obj
}
case *env.SpreadsheetRow:
obj, esc := term.DisplaySpreadsheetRow(*bloc, ps.Idx)
if !esc {
return obj
}
}

return arg0
Expand Down
3 changes: 0 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ module github.com/refaktor/rye

go 1.21

// toolchain go1.21.5

retract v0.0.11 // Published accidentally with a bug

require (
Expand Down Expand Up @@ -32,7 +30,6 @@ require (
github.com/mrz1836/postmark v1.6.5
github.com/pkg/term v1.2.0-beta.2.0.20211217091447-1a4a3b719465
github.com/refaktor/go-peg v0.0.0-20220116201714-31e3dfa8dc7d
github.com/refaktor/liner v1.2.10
github.com/sashabaranov/go-openai v1.29.0
github.com/shirou/gopsutil/v3 v3.24.5
github.com/thomasberger/parsemail v1.2.7
Expand Down
6 changes: 0 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ github.com/aws/aws-sdk-go-v2/service/sts v1.30.7 h1:NKTa1eqZYw8tiHSRGpP0VtTdub/8
github.com/aws/aws-sdk-go-v2/service/sts v1.30.7/go.mod h1:NXi1dIAGteSaRLqYgarlhP/Ij0cFT+qmCwiJqWh/U5o=
github.com/aws/smithy-go v1.20.4 h1:2HK1zBdPgRbjFOHlfeQZfpC4r72MOb9bZkiFwggKO+4=
github.com/aws/smithy-go v1.20.4/go.mod h1:irrKGvNn1InZwb2d7fkIRNucdfwR8R+Ts3wxYa/cJHg=
github.com/bitfield/script v0.22.1 h1:DphxoC5ssYciwd0ZS+N0Xae46geAD/0mVWh6a2NUxM4=
github.com/bitfield/script v0.22.1/go.mod h1:fv+6x4OzVsRs6qAlc7wiGq8fq1b5orhtQdtW0dwjUHI=
github.com/bitfield/script v0.23.0 h1:N0R5yLEl6wJIS9PR/A6xXwjMsplMubyxdi05N5l0X28=
github.com/bitfield/script v0.23.0/go.mod h1:fv+6x4OzVsRs6qAlc7wiGq8fq1b5orhtQdtW0dwjUHI=
github.com/bits-and-blooms/bitset v1.12.0 h1:U/q1fAF7xXRhFCrhROzIfffYnu+dlS38vCZtmFVPHmA=
Expand Down Expand Up @@ -152,7 +150,6 @@ github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovk
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-runewidth v0.0.3/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc=
github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU=
Expand All @@ -176,8 +173,6 @@ github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c h1:ncq/mPwQF
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE=
github.com/refaktor/go-peg v0.0.0-20220116201714-31e3dfa8dc7d h1:FXrWUGgPRzhaZIBho8zNLSrMp0VpP8E9+wbRRnJYlbE=
github.com/refaktor/go-peg v0.0.0-20220116201714-31e3dfa8dc7d/go.mod h1:iIkrsFobLIWX8kQ6Oqj4cl4nwdMSE92DWpWwk9YlG9s=
github.com/refaktor/liner v1.2.10 h1:MjbQj9EfNuSFnNk9zan37xpkNIRpsWKenyIBg7FZdVw=
github.com/refaktor/liner v1.2.10/go.mod h1:ziZSGVYZ4OzZ9kbeB254MtIrxxQlDibULRQGlDi1iK8=
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/rivo/uniseg v0.4.4 h1:8TfxU8dW6PdqD27gjM8MVNuicgxIjxpm4K7x4jp8sis=
github.com/rivo/uniseg v0.4.4/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
Expand Down Expand Up @@ -227,7 +222,6 @@ golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200909081042-eff7692f9009/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20211117180635-dee7805ff2e1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
Expand Down
2 changes: 1 addition & 1 deletion runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ func main_rye_repl(_ io.Reader, _ io.Writer, subc bool, here bool, lang string,
// userHomeDir, _ := os.UserHomeDir()
// profile_path := filepath.Join(userHomeDir, ".rye-profile")

fmt.Println("Welcome to Rye console. Use ls to list current or lsp and lsp\\ \"prin\" to list parent contexts.")
fmt.Println("Welcome to Rye console. Use lc to list current or lcp and lcp\\ \"pri\" to list parent contexts.")

//if _, err := os.Stat(profile_path); err == nil {
//content, err := os.ReadFile(profile_path)
Expand Down

0 comments on commit 2fc726d

Please sign in to comment.