id stringlengths 24 24 | repo stringclasses 13
values | path stringlengths 10 71 | func_name stringlengths 3 57 | url stringlengths 107 162 | split stringclasses 2
values | language stringclasses 3
values | docstring stringlengths 6 2.13k | code stringlengths 90 7.46k | text stringlengths 126 7.53k | token_count int32 36 1.5k | doc_chars int32 6 2.13k | code_chars int32 90 7.46k | license_basis stringclasses 1
value | source stringclasses 1
value | added stringdate 2026-12-05 00:00:00 2026-12-05 00:00:00 | record_sha256 stringlengths 64 64 | license stringclasses 1
value | license_class stringclasses 1
value | license_source stringclasses 13
values |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
a21b936b2e5060567f9a4db2 | spiegel-im-spiegel/gofacade | gofacade.go | NewContext | https://github.com/spiegel-im-spiegel/gofacade/blob/e90ff3c693480e6a1b33bd83a4f8b33053f2e5dd/gofacade.go#L26-L28 | train | go | // NewContext returns a new Context instance | func NewContext(r io.Reader, w, e io.Writer) *Context {
return &Context{BasicUi: &cli.BasicUi{Reader: r, Writer: w, ErrorWriter: e}}
} | // NewContext returns a new Context instance
func NewContext(r io.Reader, w, e io.Writer) *Context {
return &Context{BasicUi: &cli.BasicUi{Reader: r, Writer: w, ErrorWriter: e}}
} | 51 | 44 | 135 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | c6689801905a5df3e932b654c1ae15bcc15772b2d996089364c3c7ecf1c0ade9 | CC0-1.0 | permissive | https://github.com/spiegel-im-spiegel/gofacade/blob/master/LICENSE |
afa372c375f0cba5252278e5 | spiegel-im-spiegel/gofacade | gofacade.go | NewFacade | https://github.com/spiegel-im-spiegel/gofacade/blob/e90ff3c693480e6a1b33bd83a4f8b33053f2e5dd/gofacade.go#L39-L41 | train | go | // NewFacade returns a new Facade instance | func NewFacade(cxt *Context) *Facade {
return &Facade{Cxt: cxt, commands: make(map[string]cli.CommandFactory)}
} | // NewFacade returns a new Facade instance
func NewFacade(cxt *Context) *Facade {
return &Facade{Cxt: cxt, commands: make(map[string]cli.CommandFactory)}
} | 42 | 42 | 113 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | cd1221d34993644857734553be085ad6c66b95535d2f927cdd7cf047e0f9eb95 | CC0-1.0 | permissive | https://github.com/spiegel-im-spiegel/gofacade/blob/master/LICENSE |
eb98e1c07efa6d14aa948e4b | spiegel-im-spiegel/gofacade | gofacade.go | AddCommand | https://github.com/spiegel-im-spiegel/gofacade/blob/e90ff3c693480e6a1b33bd83a4f8b33053f2e5dd/gofacade.go#L44-L48 | train | go | // AddCommand add command | func (f *Facade) AddCommand(name string, command cli.Command) {
f.commands[name] = func() (cli.Command, error) {
return command, nil
}
} | // AddCommand add command
func (f *Facade) AddCommand(name string, command cli.Command) {
f.commands[name] = func() (cli.Command, error) {
return command, nil
}
} | 45 | 25 | 140 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 944eb514a7a83d57730ede0e68e3b9708e638156b2bc747bcebc4506412a854c | CC0-1.0 | permissive | https://github.com/spiegel-im-spiegel/gofacade/blob/master/LICENSE |
25109405e912cce47905a6d5 | spiegel-im-spiegel/gofacade | gofacade.go | Run | https://github.com/spiegel-im-spiegel/gofacade/blob/e90ff3c693480e6a1b33bd83a4f8b33053f2e5dd/gofacade.go#L51-L57 | train | go | // Run facade | func (f *Facade) Run(appName, version string, args []string) (int, error) {
c := cli.NewCLI(appName, version)
c.Args = args
c.Commands = f.commands
c.HelpWriter = f.Cxt.Writer
return c.Run()
} | // Run facade
func (f *Facade) Run(appName, version string, args []string) (int, error) {
c := cli.NewCLI(appName, version)
c.Args = args
c.Commands = f.commands
c.HelpWriter = f.Cxt.Writer
return c.Run()
} | 62 | 13 | 197 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 25e49486a5cf9b9927f46cfb79a9cdfc7b68ff38b4cda7bd9213816463583cb2 | CC0-1.0 | permissive | https://github.com/spiegel-im-spiegel/gofacade/blob/master/LICENSE |
120eb1bd64f8b6a75ad64aba | spiegel-im-spiegel/gocli | signal/signal.go | Context | https://github.com/spiegel-im-spiegel/gocli/blob/3e939b56b665677023383e8a22a9f15079c80a43/signal/signal.go#L14-L31 | train | go | //Context returns context.Context with Cancel | func Context(parent context.Context, sig ...os.Signal) context.Context {
cctx, cancel := context.WithCancel(parent)
go func() {
defer cancel()
sigCh := make(chan os.Signal, 1)
signl.Notify(sigCh, sig...)
defer signl.Stop(sigCh)
select {
case <-cctx.Done(): // cancel event from parent context
return
... | //Context returns context.Context with Cancel
func Context(parent context.Context, sig ...os.Signal) context.Context {
cctx, cancel := context.WithCancel(parent)
go func() {
defer cancel()
sigCh := make(chan os.Signal, 1)
signl.Notify(sigCh, sig...)
defer signl.Stop(sigCh)
select {
case <-cctx.Done(): ... | 112 | 45 | 383 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 5b91d368713c89d1a7274bd8aa2b5eb96015bcc7d753fd1618e79be543c19fa9 | CC0-1.0 | permissive | https://github.com/goark/gocli/blob/master/LICENSE |
152528c194bfa080005b08b2 | spiegel-im-spiegel/gocli | exitcode/exitcode.go | String | https://github.com/spiegel-im-spiegel/gocli/blob/3e939b56b665677023383e8a22a9f15079c80a43/exitcode/exitcode.go#L30-L35 | train | go | //Stringer method | func (c ExitCode) String() string {
if str, ok := exitcodeMap[c]; ok {
return str
}
return "unknown"
} | //Stringer method
func (c ExitCode) String() string {
if str, ok := exitcodeMap[c]; ok {
return str
}
return "unknown"
} | 38 | 17 | 107 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 870042b2318ed15e560640497a8421b7446f4f184f3cf2c55082a316b802232a | CC0-1.0 | permissive | https://github.com/goark/gocli/blob/master/LICENSE |
edd5d663b5552031a0fe8b89 | spiegel-im-spiegel/gocli | prompt/prompt.go | New | https://github.com/spiegel-im-spiegel/gocli/blob/3e939b56b665677023383e8a22a9f15079c80a43/prompt/prompt.go#L30-L36 | train | go | //New returns new Prompt instance | func New(rw *rwi.RWI, function func(string) (string, error), opts ...OptFunc) *Prompt {
p := &Prompt{rw: rw, function: function, scanner: bufio.NewScanner(rw.Reader())}
for _, opt := range opts {
opt(p)
}
return p
} | //New returns new Prompt instance
func New(rw *rwi.RWI, function func(string) (string, error), opts ...OptFunc) *Prompt {
p := &Prompt{rw: rw, function: function, scanner: bufio.NewScanner(rw.Reader())}
for _, opt := range opts {
opt(p)
}
return p
} | 74 | 33 | 221 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | c03fbb07fce9e898e4e5819130e51dd51e98aab7d14a2fe98fee33055e972601 | CC0-1.0 | permissive | https://github.com/goark/gocli/blob/master/LICENSE |
ecc77e03f7e79fe88ebb3b33 | spiegel-im-spiegel/gocli | prompt/prompt.go | IsTerminal | https://github.com/spiegel-im-spiegel/gocli/blob/3e939b56b665677023383e8a22a9f15079c80a43/prompt/prompt.go#L53-L65 | train | go | //IsTerminal returns true if running in terminal | func (p *Prompt) IsTerminal() bool {
if file, ok := p.rw.Reader().(*os.File); !ok {
return false
} else if !isatty.IsTerminal(file.Fd()) && !isatty.IsCygwinTerminal(file.Fd()) {
return false
}
if file, ok := p.rw.Writer().(*os.File); !ok {
return false
} else if !isatty.IsTerminal(file.Fd()) && !isatty.IsCyg... | //IsTerminal returns true if running in terminal
func (p *Prompt) IsTerminal() bool {
if file, ok := p.rw.Reader().(*os.File); !ok {
return false
} else if !isatty.IsTerminal(file.Fd()) && !isatty.IsCygwinTerminal(file.Fd()) {
return false
}
if file, ok := p.rw.Writer().(*os.File); !ok {
return false
} else... | 133 | 48 | 377 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | d5cbab625ae2d043070a07d6721f03e8842c35b1612ba7d91d3f05bb827bcabd | CC0-1.0 | permissive | https://github.com/goark/gocli/blob/master/LICENSE |
c5f78aeecac8c76fe66b25a1 | spiegel-im-spiegel/gocli | prompt/prompt.go | Run | https://github.com/spiegel-im-spiegel/gocli/blob/3e939b56b665677023383e8a22a9f15079c80a43/prompt/prompt.go#L68-L98 | train | go | //Run function starts interactive mode. | func (p *Prompt) Run() error {
if p == nil {
return ErrTerminate
}
if len(p.headerMsg) > 0 {
if err := p.rw.Outputln(p.headerMsg); err != nil {
return err
}
}
for {
s, ok := p.get()
if !ok {
break
}
if res, err := p.function(s); err != nil {
_ = p.rw.Outputln(res)
if !errors.Is(err, ErrT... | //Run function starts interactive mode.
func (p *Prompt) Run() error {
if p == nil {
return ErrTerminate
}
if len(p.headerMsg) > 0 {
if err := p.rw.Outputln(p.headerMsg); err != nil {
return err
}
}
for {
s, ok := p.get()
if !ok {
break
}
if res, err := p.function(s); err != nil {
_ = p.rw... | 182 | 39 | 510 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | a3fe71ab7106d50f6221d28b7bc0194e8422bfdb91bcd1e385f6a05916cc9f1c | CC0-1.0 | permissive | https://github.com/goark/gocli/blob/master/LICENSE |
fb7695c2fd71f5383e5ca11c | spiegel-im-spiegel/gocli | rwi/rwi.go | New | https://github.com/spiegel-im-spiegel/gocli/blob/3e939b56b665677023383e8a22a9f15079c80a43/rwi/rwi.go#L25-L31 | train | go | // New returns a new RWI instance | func New(opts ...OptFunc) *RWI {
c := &RWI{reader: ioutil.NopCloser(bytes.NewReader(nil)), writer: ioutil.Discard, errorWriter: ioutil.Discard}
for _, opt := range opts {
opt(c)
}
return c
} | // New returns a new RWI instance
func New(opts ...OptFunc) *RWI {
c := &RWI{reader: ioutil.NopCloser(bytes.NewReader(nil)), writer: ioutil.Discard, errorWriter: ioutil.Discard}
for _, opt := range opts {
opt(c)
}
return c
} | 67 | 33 | 196 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 2c7624b4ce529d954aad76b6a95b14dbb6d10c68344d98309e100ca931f883bf | CC0-1.0 | permissive | https://github.com/goark/gocli/blob/master/LICENSE |
2d1fa710f8f4412bfb10e11a | spiegel-im-spiegel/gocli | rwi/rwi.go | WithReader | https://github.com/spiegel-im-spiegel/gocli/blob/3e939b56b665677023383e8a22a9f15079c80a43/rwi/rwi.go#L34-L40 | train | go | //WithReader returns function for setting Reader | func WithReader(r io.Reader) OptFunc {
return func(c *RWI) {
if r != nil {
c.reader = r
}
}
} | //WithReader returns function for setting Reader
func WithReader(r io.Reader) OptFunc {
return func(c *RWI) {
if r != nil {
c.reader = r
}
}
} | 45 | 48 | 102 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | cdc775c8af95d831006d8acae86851c72c29289b17a4987a23fff6daae15b000 | CC0-1.0 | permissive | https://github.com/goark/gocli/blob/master/LICENSE |
7d1dad94d25fe6a1ad530c57 | spiegel-im-spiegel/gocli | rwi/rwi.go | WithWriter | https://github.com/spiegel-im-spiegel/gocli/blob/3e939b56b665677023383e8a22a9f15079c80a43/rwi/rwi.go#L43-L49 | train | go | //WithWriter returns function for setting Writer | func WithWriter(w io.Writer) OptFunc {
return func(c *RWI) {
if w != nil {
c.writer = w
}
}
} | //WithWriter returns function for setting Writer
func WithWriter(w io.Writer) OptFunc {
return func(c *RWI) {
if w != nil {
c.writer = w
}
}
} | 45 | 48 | 102 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | f5b5356621bcbb032d0c116276874d9fe158a41757522e5869168495fbec1645 | CC0-1.0 | permissive | https://github.com/goark/gocli/blob/master/LICENSE |
defe9aab2cd48111ff73f68e | spiegel-im-spiegel/gocli | rwi/rwi.go | WithErrorWriter | https://github.com/spiegel-im-spiegel/gocli/blob/3e939b56b665677023383e8a22a9f15079c80a43/rwi/rwi.go#L52-L58 | train | go | //WithErrorWriter returns function for setting Writer (error) | func WithErrorWriter(e io.Writer) OptFunc {
return func(c *RWI) {
if e != nil {
c.errorWriter = e
}
}
} | //WithErrorWriter returns function for setting Writer (error)
func WithErrorWriter(e io.Writer) OptFunc {
return func(c *RWI) {
if e != nil {
c.errorWriter = e
}
}
} | 49 | 61 | 112 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 52b527c6dfa4398408f8eec19f31ff0413de949e5ad4a1f70a441571831870d0 | CC0-1.0 | permissive | https://github.com/goark/gocli/blob/master/LICENSE |
32af4cbf595d13e71b82ccb6 | spiegel-im-spiegel/gocli | rwi/rwi.go | OutputBytes | https://github.com/spiegel-im-spiegel/gocli/blob/3e939b56b665677023383e8a22a9f15079c80a43/rwi/rwi.go#L86-L88 | train | go | //OutputBytes to RWI.writer ([]byte data). | func (c *RWI) OutputBytes(data []byte) error {
return c.WriteFrom(bytes.NewReader(data))
} | //OutputBytes to RWI.writer ([]byte data).
func (c *RWI) OutputBytes(data []byte) error {
return c.WriteFrom(bytes.NewReader(data))
} | 36 | 43 | 91 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 5d78dd4619e55ca9a9164897fc66cf7dd0a9f11d474dd1d948696884cebdc6a8 | CC0-1.0 | permissive | https://github.com/goark/gocli/blob/master/LICENSE |
5357684338688272f196c97c | spiegel-im-spiegel/gocli | rwi/rwi.go | WriteFrom | https://github.com/spiegel-im-spiegel/gocli/blob/3e939b56b665677023383e8a22a9f15079c80a43/rwi/rwi.go#L91-L94 | train | go | //WriteFrom copy from io.Reader to RWI.writer | func (c *RWI) WriteFrom(r io.Reader) error {
_, err := io.Copy(c.writer, r)
return err
} | //WriteFrom copy from io.Reader to RWI.writer
func (c *RWI) WriteFrom(r io.Reader) error {
_, err := io.Copy(c.writer, r)
return err
} | 43 | 46 | 90 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | b36cc8492c858b04e61fcaad72c3a731c18c87ab4679f295e0201f8278c08961 | CC0-1.0 | permissive | https://github.com/goark/gocli/blob/master/LICENSE |
38992cf18eec4a5ac429759a | spiegel-im-spiegel/gocli | rwi/rwi.go | OutputErrBytes | https://github.com/spiegel-im-spiegel/gocli/blob/3e939b56b665677023383e8a22a9f15079c80a43/rwi/rwi.go#L107-L109 | train | go | //OutputErrBytes copy to RWI.errorWriter ([]byte data). | func (c *RWI) OutputErrBytes(data []byte) error {
return c.WriteErrFrom(bytes.NewReader(data))
} | //OutputErrBytes copy to RWI.errorWriter ([]byte data).
func (c *RWI) OutputErrBytes(data []byte) error {
return c.WriteErrFrom(bytes.NewReader(data))
} | 41 | 56 | 97 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 84a25a11f6aff3dee93caa46ac5932e9774f0ebcddaad71bcda5b110b3b292d9 | CC0-1.0 | permissive | https://github.com/goark/gocli/blob/master/LICENSE |
0c6b262f849783127a3ee313 | spiegel-im-spiegel/gocli | rwi/rwi.go | WriteErrFrom | https://github.com/spiegel-im-spiegel/gocli/blob/3e939b56b665677023383e8a22a9f15079c80a43/rwi/rwi.go#L112-L115 | train | go | //WriteErrFrom copy from io.Reader to RWI.errorWriter | func (c *RWI) WriteErrFrom(r io.Reader) error {
_, err := io.Copy(c.errorWriter, r)
return err
} | //WriteErrFrom copy from io.Reader to RWI.errorWriter
func (c *RWI) WriteErrFrom(r io.Reader) error {
_, err := io.Copy(c.errorWriter, r)
return err
} | 46 | 53 | 98 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | b89b85d6169de30e6d16cfb96a6386e68b06abe4d8ced843cf6b48ca64ff4d78 | CC0-1.0 | permissive | https://github.com/goark/gocli/blob/master/LICENSE |
49fe4e1e0c75b4d194cc91ef | spiegel-im-spiegel/gocli | rwi/rwi.go | doOutput | https://github.com/spiegel-im-spiegel/gocli/blob/3e939b56b665677023383e8a22a9f15079c80a43/rwi/rwi.go#L118-L121 | train | go | //Output to io.Writer (internal) | func doOutput(writer io.Writer, val []interface{}) error {
_, err := fmt.Fprint(writer, val...)
return err
} | //Output to io.Writer (internal)
func doOutput(writer io.Writer, val []interface{}) error {
_, err := fmt.Fprint(writer, val...)
return err
} | 36 | 32 | 110 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | d47531eb3ef2008e37388515add96ec4a96ee5d5e4b470c368b3cbb58f771822 | CC0-1.0 | permissive | https://github.com/goark/gocli/blob/master/LICENSE |
dc3f45fc4d63d19cf6834188 | spiegel-im-spiegel/gocli | rwi/rwi.go | doOutputln | https://github.com/spiegel-im-spiegel/gocli/blob/3e939b56b665677023383e8a22a9f15079c80a43/rwi/rwi.go#L124-L127 | train | go | //Output to io.Writer (add newline, internal) | func doOutputln(writer io.Writer, val []interface{}) error {
_, err := fmt.Fprintln(writer, val...)
return err
} | //Output to io.Writer (add newline, internal)
func doOutputln(writer io.Writer, val []interface{}) error {
_, err := fmt.Fprintln(writer, val...)
return err
} | 40 | 45 | 114 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 9782d864bfb2bded159d7f60105d60b75b7a65911a709762cf9af345feae1afb | CC0-1.0 | permissive | https://github.com/goark/gocli/blob/master/LICENSE |
070b9b314e65170850ce6a9d | spiegel-im-spiegel/gocli | file/glob.go | NewGlobOption | https://github.com/spiegel-im-spiegel/gocli/blob/3e939b56b665677023383e8a22a9f15079c80a43/file/glob.go#L55-L61 | train | go | //NewGlobOption returns GlobOption instance | func NewGlobOption(opts ...GlogOptFunc) *GlobOption {
o := &GlobOption{flags: GlobStdFlags}
for _, opt := range opts {
opt(o)
}
return o
} | //NewGlobOption returns GlobOption instance
func NewGlobOption(opts ...GlogOptFunc) *GlobOption {
o := &GlobOption{flags: GlobStdFlags}
for _, opt := range opts {
opt(o)
}
return o
} | 57 | 43 | 144 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 54ce5b701d65866859951412266c344ffb134f2f06e835bd150104697cced70f | CC0-1.0 | permissive | https://github.com/goark/gocli/blob/master/LICENSE |
f4dbcce930a42710cb3644ee | spiegel-im-spiegel/gocli | file/glob.go | Glob | https://github.com/spiegel-im-spiegel/gocli/blob/3e939b56b665677023383e8a22a9f15079c80a43/file/glob.go#L71-L79 | train | go | //Glob returns an array containing the matching directory/file names. | func Glob(path string, opt *GlobOption) []string {
if path == "" {
return []string{}
}
if opt == nil {
opt = NewGlobOption()
}
return removeDuplicate(getPaths("", path), opt)
} | //Glob returns an array containing the matching directory/file names.
func Glob(path string, opt *GlobOption) []string {
if path == "" {
return []string{}
}
if opt == nil {
opt = NewGlobOption()
}
return removeDuplicate(getPaths("", path), opt)
} | 65 | 69 | 185 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 47d9f9186851d6d074e0b660955ddecf4459e19ac956e5a4d543d9d68f75c21c | CC0-1.0 | permissive | https://github.com/goark/gocli/blob/master/LICENSE |
32f4276d7aa36d69faddda5d | slideshow-s9/slideshow | slideshow-models/lib/slideshow/commands/merge.rb | Slideshow.Merge.merge | https://github.com/slideshow-s9/slideshow/blob/b7a397f9136f623589816bef498914943980a313/slideshow-models/lib/slideshow/commands/merge.rb#L22-L90 | train | ruby | original working dir (user called slideshow from) | def merge( deck, ctx, headers, content_for )
manifestsrc = ctx[:manifestsrc]
name = ctx[:name]
outdir = ctx[:outdir]
## note:
## assumes name == basename (e.g. name without extension and directory)
## rename name to basename - why? why not??
## note: as... | original working dir (user called slideshow from)
def merge( deck, ctx, headers, content_for )
manifestsrc = ctx[:manifestsrc]
name = ctx[:name]
outdir = ctx[:outdir]
## note:
## assumes name == basename (e.g. name without extension and directory)
## rename name ... | 574 | 49 | 2,086 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | fb0984fe211dc7ae2125eb841f941c1b65353e750a1d66dc3d1345c44d7f7284 | CC0-1.0 | permissive | https://github.com/slideshow-s9/slideshow/blob/master/LICENSE.md |
6e21cfebd8114b6b8c8424f0 | slideshow-s9/slideshow | slideshow-models/lib/slideshow/commands/build.rb | Slideshow.Build.create_slideshow | https://github.com/slideshow-s9/slideshow/blob/b7a397f9136f623589816bef498914943980a313/slideshow-models/lib/slideshow/commands/build.rb#L72-L204 | train | ruby | process files | def create_slideshow( args )
## first check if manifest exists / available / valid
manifestsrc = ManifestFinder.new( config ).find_manifestsrc( config.manifest )
# expand output path in current dir and make sure output path exists
outdir = File.expand_path( config.output_path, usrdir )
lo... | process files
def create_slideshow( args )
## first check if manifest exists / available / valid
manifestsrc = ManifestFinder.new( config ).find_manifestsrc( config.manifest )
# expand output path in current dir and make sure output path exists
outdir = File.expand_path( config.output_path, u... | 945 | 13 | 3,877 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | f953f702383a94252400fac3b485dea50f65387aa48b698143ab3f5ade245000 | CC0-1.0 | permissive | https://github.com/slideshow-s9/slideshow/blob/master/LICENSE.md |
c9cef3e9ecdb41ab4e545c9e | slideshow-s9/slideshow | slideshow-models/lib/slideshow/commands/build.rb | Slideshow.Build.create_deck_from_string | https://github.com/slideshow-s9/slideshow/blob/b7a397f9136f623589816bef498914943980a313/slideshow-models/lib/slideshow/commands/build.rb#L208-L287 | train | ruby | method create_slideshow | def create_deck_from_string( buf )
##
## todo/fix: cleanup how to handle files/folders
## e.g. do we need outdir,srcdir,usrdir ??
## does srcdir make any sense for "inline" buffer??
## use srcdir==usrdir - and what is usrdir default ?? etc.
## use a tmp folder for out... | method create_slideshow
def create_deck_from_string( buf )
##
## todo/fix: cleanup how to handle files/folders
## e.g. do we need outdir,srcdir,usrdir ??
## does srcdir make any sense for "inline" buffer??
## use srcdir==usrdir - and what is usrdir default ?? etc.
## ... | 640 | 23 | 2,580 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | fa60d9081bd580bf61877dc7699f2e5d4a2f6edd226133d82528aba3692c3a2d | CC0-1.0 | permissive | https://github.com/slideshow-s9/slideshow/blob/master/LICENSE.md |
9d9762a186f1038d698d9088 | slideshow-s9/slideshow | slideshow-models/lib/slideshow/filters/text_filter.rb | Slideshow.TextFilter.erb_rename_helper_hack | https://github.com/slideshow-s9/slideshow/blob/b7a397f9136f623589816bef498914943980a313/slideshow-models/lib/slideshow/filters/text_filter.rb#L103-L120 | train | ruby | todo: fix move to textutils gem (including helpers and config) - why? why not?? | def erb_rename_helper_hack( content )
# note: include is a ruby keyword; rename to s9_include so we can use it
rename_counter = 0
# turn renames into something like:
# include|class etc.
renames = DIRECTIVES_RENAMES.join( '|' )
content.gsub!( /<%=[ \t]*(#{renames})/ ) do |mat... | todo: fix move to textutils gem (including helpers and config) - why? why not??
def erb_rename_helper_hack( content )
# note: include is a ruby keyword; rename to s9_include so we can use it
rename_counter = 0
# turn renames into something like:
# include|class etc.
renames = DIRECTI... | 167 | 79 | 521 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 560d86cf97744214b6daf4a23d324d2a36f84056194ab123280f8cfa79055832 | CC0-1.0 | permissive | https://github.com/slideshow-s9/slideshow/blob/master/LICENSE.md |
745c47eecc96d8f0864ba05d | slideshow-s9/slideshow | slideshow-models/lib/slideshow/models/slide.rb | Slideshow.Slide.parse | https://github.com/slideshow-s9/slideshow/blob/b7a397f9136f623589816bef498914943980a313/slideshow-models/lib/slideshow/models/slide.rb#L34-L85 | train | ruby | def to_drop() SlideDrop.new( self ); end -- add - why? why not?? | def parse
## pass 1) check for (css style) classes and data attributes
## check for css style classes
from = 0
while( pos = @content.index( /<!-- _S9(SLIDE|STYLE)_(.*?)-->/m, from ))
logger.debug " adding css classes from pi >#{$1.downcase}<: >#{$2.strip}<"
from = Regexp.last_m... | def to_drop() SlideDrop.new( self ); end -- add - why? why not??
def parse
## pass 1) check for (css style) classes and data attributes
## check for css style classes
from = 0
while( pos = @content.index( /<!-- _S9(SLIDE|STYLE)_(.*?)-->/m, from ))
logger.debug " adding css classes fro... | 556 | 65 | 1,931 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 25618aeab7d5475e9afd65c3086dbf7775af1f7b587b7e40fcbf46c27348fd6f | CC0-1.0 | permissive | https://github.com/slideshow-s9/slideshow/blob/master/LICENSE.md |
17f2041b1874e616fc3f8c8b | slideshow-s9/slideshow | slideshow-models/lib/slideshow/models/slide.rb | Slideshow.Slide.to_classic_html | https://github.com/slideshow-s9/slideshow/blob/b7a397f9136f623589816bef498914943980a313/slideshow-models/lib/slideshow/models/slide.rb#L101-L109 | train | ruby | convenience helpers | def to_classic_html
buf = ""
buf << "<div class='slide "
buf << classes if classes
buf << "'>\n"
buf << content
buf << "</div>\n"
buf
end | convenience helpers
def to_classic_html
buf = ""
buf << "<div class='slide "
buf << classes if classes
buf << "'>\n"
buf << content
buf << "</div>\n"
buf
end | 58 | 19 | 187 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 834c88220b74d9888c6e8f60a7650808e160b10cc4e96e78094efdee2251819c | CC0-1.0 | permissive | https://github.com/slideshow-s9/slideshow/blob/master/LICENSE.md |
b10069b8f5143aebb0c377a4 | slideshow-s9/slideshow | slideshow-models/lib/slideshow/helpers/capture_helper.rb | Slideshow.CaptureHelper.content_for | https://github.com/slideshow-s9/slideshow/blob/b7a397f9136f623589816bef498914943980a313/slideshow-models/lib/slideshow/helpers/capture_helper.rb#L29-L35 | train | ruby | Called in pages and partials to store up content for later use. Takes a
string and/or a block. First, the string is evaluated, and then the
block is captured using the capture() helper provided by the template
languages. The two are concatenated together.
Content is retrieved by calling the method without a string... | def content_for( obj, string = nil, &block )
return @content_for[obj] unless string || block_given?
cur = @content_for[obj].to_s
new = string.to_s + (block_given? ? capture_erb(&block) : "")
@content_for[obj] = cur + new
end | Called in pages and partials to store up content for later use. Takes a
string and/or a block. First, the string is evaluated, and then the
block is captured using the capture() helper provided by the template
languages. The two are concatenated together.
Content is retrieved by calling the method without a string... | 235 | 734 | 250 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 85d0b0af131ec4119c0bb64b11727bdbcec69aa465b2228de4279cdebc4f65fb | CC0-1.0 | permissive | https://github.com/slideshow-s9/slideshow/blob/master/LICENSE.md |
0967a2a4ea3156efc9b4c9ca | slideshow-s9/slideshow | slideshow-models/lib/slideshow/helpers/capture_helper.rb | Slideshow.CaptureHelper.capture_erb | https://github.com/slideshow-s9/slideshow/blob/b7a397f9136f623589816bef498914943980a313/slideshow-models/lib/slideshow/helpers/capture_helper.rb#L89-L109 | train | ruby | This method is used to capture content from an ERB filter evaluation. It
is useful to helpers that need to process chunks of data during ERB filter
processing.
==== Parameters
*args:: Arguments to pass to the block.
&block:: The ERB block to call.
==== Returns
String:: The output of the block.
==== Examples
... | def capture_erb( *args, &block )
# get the buffer from the block's binding
buffer = _erb_buffer(block.binding) rescue nil
# If there is no buffer, just call the block and get the contents
if buffer.nil?
block.call(*args)
# If there is a buffer, execute the block, then extract its cont... | This method is used to capture content from an ERB filter evaluation. It
is useful to helpers that need to process chunks of data during ERB filter
processing.
==== Parameters
*args:: Arguments to pass to the block.
&block:: The ERB block to call.
==== Returns
String:: The output of the block.
==== Examples
... | 247 | 430 | 562 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 027bdefc8b275bed9b7e435186df14e7b4cb86ad6c1940f4fbc8f4d078f70419 | CC0-1.0 | permissive | https://github.com/slideshow-s9/slideshow/blob/master/LICENSE.md |
be0027786111ac68c130eecd | slideshow-s9/slideshow | slideshow-models/lib/slideshow/filters/debug_filter.rb | Slideshow.DebugFilter.dump_content_to_file_debug_text_erb | https://github.com/slideshow-s9/slideshow/blob/b7a397f9136f623589816bef498914943980a313/slideshow-models/lib/slideshow/filters/debug_filter.rb#L8-L25 | train | ruby | use it to dump content before erb merge | def dump_content_to_file_debug_text_erb( content )
# NB: using attribs from mixed in class
# - opts
# - outdir
return content unless config.verbose?
outname = "#{outdir}/#{@name}.debug.text.erb"
puts " Dumping content before erb merge to #{outname}..."
File.open( outname, 'w' ) do |f|
f.wr... | use it to dump content before erb merge
def dump_content_to_file_debug_text_erb( content )
# NB: using attribs from mixed in class
# - opts
# - outdir
return content unless config.verbose?
outname = "#{outdir}/#{@name}.debug.text.erb"
puts " Dumping content before erb merge to #{outname}..."
... | 112 | 39 | 355 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 55ecbca057900c7ce77762f3ebfca0cc913fc063231a1f773406c85357214465 | CC0-1.0 | permissive | https://github.com/slideshow-s9/slideshow/blob/master/LICENSE.md |
9db7ff3882fad949f38068dd | slideshow-s9/slideshow | slideshow-models/lib/slideshow/commands/fetch.rb | Slideshow.Fetch.fetch_template | https://github.com/slideshow-s9/slideshow/blob/b7a397f9136f623589816bef498914943980a313/slideshow-models/lib/slideshow/commands/fetch.rb#L58-L71 | train | ruby | method run | def fetch_template( src )
# src = 'http://github.com/geraldb/slideshow/raw/d98e5b02b87ee66485431b1bee8fb6378297bfe4/code/templates/fullerscreen.txt'
# src = 'http://github.com/geraldb/sandbox/raw/13d4fec0908fbfcc456b74dfe2f88621614b5244/s5blank/s5blank.txt'
uri = URI.parse( src )
logger.debug "scheme: #... | method run
def fetch_template( src )
# src = 'http://github.com/geraldb/slideshow/raw/d98e5b02b87ee66485431b1bee8fb6378297bfe4/code/templates/fullerscreen.txt'
# src = 'http://github.com/geraldb/sandbox/raw/13d4fec0908fbfcc456b74dfe2f88621614b5244/s5blank/s5blank.txt'
uri = URI.parse( src )
logger.debu... | 217 | 10 | 683 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | a6049a706b79bc3001cd5a46bddb883b7a2511a6f5adf82a0280f87a16151f28 | CC0-1.0 | permissive | https://github.com/slideshow-s9/slideshow/blob/master/LICENSE.md |
127f16473a6c59817f710029 | slideshow-s9/slideshow | slideshow-models/lib/slideshow/commands/manifest_finder.rb | Slideshow.ManifestFinder.find_manifestsrc | https://github.com/slideshow-s9/slideshow/blob/b7a397f9136f623589816bef498914943980a313/slideshow-models/lib/slideshow/commands/manifest_finder.rb#L21-L70 | train | ruby | original working dir (user called slideshow from) | def find_manifestsrc( manifest_arg ) ## rename - just use find_manifest ??
manifest_path_or_name = manifest_arg.dup ## make a copy
# add .txt file extension if missing (for convenience)
if manifest_path_or_name.downcase.ends_with?( '.txt' ) == false
manifest_path_or_name << '.txt'
en... | original working dir (user called slideshow from)
def find_manifestsrc( manifest_arg ) ## rename - just use find_manifest ??
manifest_path_or_name = manifest_arg.dup ## make a copy
# add .txt file extension if missing (for convenience)
if manifest_path_or_name.downcase.ends_with?( '.txt' ) == f... | 432 | 49 | 1,893 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 9fa0f7078e1a97f0eab7d16ab08e58749669a334ed9333be6f8a857e1869789f | CC0-1.0 | permissive | https://github.com/slideshow-s9/slideshow/blob/master/LICENSE.md |
68fed912b95b5a1cc838845c | slideshow-s9/slideshow | slideshow-models/lib/slideshow/markdown.rb | Slideshow.MarkdownEngines.markdown_to_html | https://github.com/slideshow-s9/slideshow/blob/b7a397f9136f623589816bef498914943980a313/slideshow-models/lib/slideshow/markdown.rb#L8-L19 | train | ruby | note: for now keep it simple use just kramdown | def markdown_to_html( content )
## note: set to gfm (github-flavored markdown) by default
## see http://kramdown.gettalong.org/parser/gfm.html
kramdown_config = {
'input' => 'GFM',
'hard_wrap' => false
}
puts " Converting markdown-text (#{content.length} bytes) to HTM... | note: for now keep it simple use just kramdown
def markdown_to_html( content )
## note: set to gfm (github-flavored markdown) by default
## see http://kramdown.gettalong.org/parser/gfm.html
kramdown_config = {
'input' => 'GFM',
'hard_wrap' => false
}
puts " Convertin... | 136 | 46 | 457 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 596d014349dd162412bb09287c17cef87c398d90b366faa012f83c9928d08a79 | CC0-1.0 | permissive | https://github.com/slideshow-s9/slideshow/blob/master/LICENSE.md |
b8e5031acc5dbe017579a966 | slideshow-s9/slideshow | slideshow-models/lib/slideshow/helpers/text_helper.rb | Slideshow.TextHelper.code | https://github.com/slideshow-s9/slideshow/blob/b7a397f9136f623589816bef498914943980a313/slideshow-models/lib/slideshow/helpers/text_helper.rb#L20-L47 | train | ruby | Usage example:
<%= code 'code/file.rb#section', :lang => 'ruby', :class => 'small' %>
or
<% code :lang => 'ruby' do %>
code goes here
<% end %> | def code( *args, &blk )
# check for optional hash for options
opts = args.last.kind_of?(Hash) ? args.pop : {}
name_plus_part = args.first # check for optional filename
if name_plus_part
name, part = name_plus_part.split( '#' ) # split off optional part/anchor
content = find_con... | Usage example:
<%= code 'code/file.rb#section', :lang => 'ruby', :class => 'small' %>
or
<% code :lang => 'ruby' do %>
code goes here
<% end %>
def code( *args, &blk )
# check for optional hash for options
opts = args.last.kind_of?(Hash) ? args.pop : {}
name_plus_part = args.first # check ... | 269 | 157 | 860 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 2e8b87058125990dacc909a1d2e0930259c7e7e6996a647b0f48062da33f730d | CC0-1.0 | permissive | https://github.com/slideshow-s9/slideshow/blob/master/LICENSE.md |
a617d7c9162a5b7ea4b30034 | slideshow-s9/slideshow | slideshow-models/lib/slideshow/commands/gen.rb | Slideshow.Gen.render | https://github.com/slideshow-s9/slideshow/blob/b7a397f9136f623589816bef498914943980a313/slideshow-models/lib/slideshow/commands/gen.rb#L29-L55 | train | ruby | NB: "initalized" in create_slideshow | def render( content, ctx )
####################
## todo/fix: move ctx to Gen.initialize - why? why not?
@name = ctx[:name]
@outdir = ctx[:outdir]
@srcdir = ctx[:srcdir]
@usrdir = ctx[:usrdir]
# run text filters
config.text_filters.each do |filter|
mn = filte... | NB: "initalized" in create_slideshow
def render( content, ctx )
####################
## todo/fix: move ctx to Gen.initialize - why? why not?
@name = ctx[:name]
@outdir = ctx[:outdir]
@srcdir = ctx[:srcdir]
@usrdir = ctx[:usrdir]
# run text filters
config.text_fil... | 199 | 36 | 700 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 80d4396d5838ea2b5bcb9d73f9e4c2cca03a88e4607cdd41988ecd20790d6e3e | CC0-1.0 | permissive | https://github.com/slideshow-s9/slideshow/blob/master/LICENSE.md |
8752e128aaa1539231277035 | slideshow-s9/slideshow | slideshow-models/lib/slideshow/commands/quick.rb | Slideshow.Quick.fetch_pak | https://github.com/slideshow-s9/slideshow/blob/b7a397f9136f623589816bef498914943980a313/slideshow-models/lib/slideshow/commands/quick.rb#L49-L82 | train | ruby | todo rename to fetch_quick_pak??
share/use same code in fetch too?? | def fetch_pak( shortcut )
sources = config.map_fetch_shortcut( shortcut )
if sources.empty?
puts "*** error: no mapping found for shortcut '#{shortcut}'."
exit 2
end
sources = sources.select { |s| s.include?('.txt.quick') || s.include?('.quick.txt') }
if sources.empty?
pu... | todo rename to fetch_quick_pak??
share/use same code in fetch too??
def fetch_pak( shortcut )
sources = config.map_fetch_shortcut( shortcut )
if sources.empty?
puts "*** error: no mapping found for shortcut '#{shortcut}'."
exit 2
end
sources = sources.select { |s| s.include?('.tx... | 350 | 69 | 1,156 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 94e315ee916dc2e648054707716f7ef736fbd4990845289aa4dd515c5dbf9fb5 | CC0-1.0 | permissive | https://github.com/slideshow-s9/slideshow/blob/master/LICENSE.md |
f6651870cbbb3a6b13436a3c | slideshow-s9/slideshow | slideshow-models/lib/slideshow/headers.rb | Slideshow.Headers.put | https://github.com/slideshow-s9/slideshow/blob/b7a397f9136f623589816bef498914943980a313/slideshow-models/lib/slideshow/headers.rb#L13-L22 | train | ruby | todo: rename put to store like std hash method | def put( key, value )
key = normalize_key( key )
setter = "#{key}=".to_sym
if respond_to?( setter )
send( setter, value )
else
@hash[ key ] = value
end
end | todo: rename put to store like std hash method
def put( key, value )
key = normalize_key( key )
setter = "#{key}=".to_sym
if respond_to?( setter )
send( setter, value )
else
@hash[ key ] = value
end
end | 67 | 46 | 190 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 26792509c4edf7fd0f60850726e389f0feaeec37a7861fe5d4f666c3910c17b1 | CC0-1.0 | permissive | https://github.com/slideshow-s9/slideshow/blob/master/LICENSE.md |
20bbbc31fc52d04adc2759b6 | slideshow-s9/slideshow | slideshow-models/lib/slideshow/headers.rb | Slideshow.Headers.get | https://github.com/slideshow-s9/slideshow/blob/b7a397f9136f623589816bef498914943980a313/slideshow-models/lib/slideshow/headers.rb#L61-L70 | train | ruby | todo: rename get to fetch?? | def get( key, default=nil )
key = normalize_key(key)
value = @hash.fetch( key, nil )
value = @config.header( key ) if value.nil? # try lookup in config properties next
if value.nil?
default
else
value
end
end | todo: rename get to fetch??
def get( key, default=nil )
key = normalize_key(key)
value = @hash.fetch( key, nil )
value = @config.header( key ) if value.nil? # try lookup in config properties next
if value.nil?
default
else
value
end
end | 74 | 27 | 248 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 8264671ae9acad1a7dc5dddc620ac1ec40d4e141340981fe90d7b595d696bbdd | CC0-1.0 | permissive | https://github.com/slideshow-s9/slideshow/blob/master/LICENSE.md |
4ae4c76dcb115ea992ba6f2e | slideshow-s9/slideshow | slideshow-models/lib/slideshow/models/deck.rb | Slideshow.DeckFilter.add_slide_directive_before_h1 | https://github.com/slideshow-s9/slideshow/blob/b7a397f9136f623589816bef498914943980a313/slideshow-models/lib/slideshow/models/deck.rb#L24-L39 | train | ruby | note/todo: more alternatives/options for slide breaks
add a simple slide break rule for two or more blank lines
add slide directive before h1 (tells slideshow gem where to break slides)
e.g. changes:
<h1 id='optional' class='optional'>
to
html comment -> _S9SLIDE_ (note: rdoc can't handle html comments?)
<h... | def add_slide_directive_before_h1( content )
# mark h1 for getting wrapped into slide divs
# note: use just <h1 since some processors add ids e.g. <h1 id='x'>
slide_count = 0
content = content.gsub( /<h1/ ) do |match|
slide_count += 1
"\n<!-- _S9SLIDE_ -->\n#{Regexp.last_match(0)}"
end
... | note/todo: more alternatives/options for slide breaks
add a simple slide break rule for two or more blank lines
add slide directive before h1 (tells slideshow gem where to break slides)
e.g. changes:
<h1 id='optional' class='optional'>
to
html comment -> _S9SLIDE_ (note: rdoc can't handle html comments?)
<h... | 219 | 353 | 407 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 2e6933da51e0db35093658fe8873a64559f6c85c365d9917fee5eb9d3f6dd608 | CC0-1.0 | permissive | https://github.com/slideshow-s9/slideshow/blob/master/LICENSE.md |
27dbcb361834dfd28d3dd796 | microformats/microformats-ruby | lib/microformats/format_parser.rb | Microformats.FormatParser.imply_dates | https://github.com/microformats/microformats-ruby/blob/d0841b2489ce7bf6fbae03d3e3aa1ecfbf56e98b/lib/microformats/format_parser.rb#L323-L347 | train | ruby | imply date for dt-end if dt-start is defined with a date | def imply_dates
return unless !@properties['end'].nil? && !@properties['start'].nil?
start_date = nil
@properties['start'].each do |start_val|
if start_val =~ /^(\d{4}-[01]\d-[0-3]\d)/
start_date = Regexp.last_match(1) if start_date.nil?
elsif start_val =~ /^(\d{4}-[0-3]\d\... | imply date for dt-end if dt-start is defined with a date
def imply_dates
return unless !@properties['end'].nil? && !@properties['start'].nil?
start_date = nil
@properties['start'].each do |start_val|
if start_val =~ /^(\d{4}-[01]\d-[0-3]\d)/
start_date = Regexp.last_match(1) if st... | 230 | 56 | 725 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 3ed6ea1fcca01b2e1cac1d8498fe0db7065b5e63ced65220e0345cce244b33b1 | CC0-1.0 | permissive | https://github.com/microformats/microformats-ruby/blob/main/LICENSE |
149b30ab50d24c01a7bc3eb7 | feedreader/pluto | pluto-merge/lib/pluto/merge/manifest_helpers.rb | Pluto.ManifestHelper.installed_template_manifest_patterns | https://github.com/feedreader/pluto/blob/d2e304441f8df42e2e1c296476f2a40c56a6f316/pluto-merge/lib/pluto/merge/manifest_helpers.rb#L17-L45 | train | ruby | shared methods for handling manifest lookups
note: required attribs (in host class) include:
- opts.config_path | def installed_template_manifest_patterns
# 1) search . # that is, working/current dir
# 2) search <config_dir>
# 3) search <gem>/templates
###
# Note
# -- for now - no longer ship w/ builtin template packs
# - download on demand if needed
builtin_patterns = [
## "#{Pluto.root}/templates/*.txt... | shared methods for handling manifest lookups
note: required attribs (in host class) include:
- opts.config_path
def installed_template_manifest_patterns
# 1) search . # that is, working/current dir
# 2) search <config_dir>
# 3) search <gem>/templates
###
# Note
# -- for now - no longer ship w/... | 221 | 119 | 792 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | d92e44dc34ea510f8f070053be585ff46803c2033fcec52ba1207644f39803e0 | CC0-1.0 | permissive | https://github.com/feedreader/pluto/blob/master/LICENSE.md |
430ede6e55b8ebc0bb246921 | worlddb/world.db | worlddb-models/attic/loader.rb | WorldDb.Loader.load_fixtures_with_include_path | https://github.com/worlddb/world.db/blob/8fd44fa8d8dc47290c63b881c713634494aae291/worlddb-models/attic/loader.rb#L26-L34 | train | ruby | todo: rename to load_fixtures_w_include_path (a little shorter - why? why not?) | def load_fixtures_with_include_path( name, include_path ) # load from file system
path = "#{include_path}/#{name}.rb"
puts "*** loading data '#{name}' (#{path})..."
CodeReader.new( logger, path ).eval( CodeContext )
# Prop.create!( :key => "db.#{name}.version", :value => WorldDb::VERSION )
en... | todo: rename to load_fixtures_w_include_path (a little shorter - why? why not?)
def load_fixtures_with_include_path( name, include_path ) # load from file system
path = "#{include_path}/#{name}.rb"
puts "*** loading data '#{name}' (#{path})..."
CodeReader.new( logger, path ).eval( CodeContext )
# ... | 106 | 79 | 321 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 866efe41960afc62390ea654218e06fdd93bd7771f602dba4a019e5c312696d2 | CC0-1.0 | permissive | https://github.com/worlddb/world.db/blob/master/LICENSE.md |
5fbcc05ab786b64adca4093f | worlddb/world.db | worlddb-models/lib/worlddb/reader.rb | WorldDb.ReaderBase.load | https://github.com/worlddb/world.db/blob/8fd44fa8d8dc47290c63b881c713634494aae291/worlddb-models/lib/worlddb/reader.rb#L40-L167 | train | ruby | method load_setup | def load( name )
if name =~ /^continents/
load_continent_defs( name )
elsif name =~ /\/continents/
load_continent_refs( name )
elsif name =~ /^lang/
## todo: pass along opts too
## use match_usage( name ) - why? why not?? ???
r = create_lang_reader( name )
r.read()... | method load_setup
def load( name )
if name =~ /^continents/
load_continent_defs( name )
elsif name =~ /\/continents/
load_continent_refs( name )
elsif name =~ /^lang/
## todo: pass along opts too
## use match_usage( name ) - why? why not?? ???
r = create_lang_reader( nam... | 1,403 | 17 | 5,997 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | d90c8a6996dcf8feca214252dd3c27c88895984732744164e4b216937a961c71 | CC0-1.0 | permissive | https://github.com/worlddb/world.db/blob/master/LICENSE.md |
d7c2a3128e08802cd2bf048c | worlddb/world.db | worlddb-models/lib/worlddb/reader.rb | WorldDb.ReaderBase.load_states_xxx | https://github.com/worlddb/world.db/blob/8fd44fa8d8dc47290c63b881c713634494aae291/worlddb-models/lib/worlddb/reader.rb#L171-L182 | train | ruby | use StateAttrReader | def load_states_xxx( country_key, xxx, name )
country = Country.find_by_key!( country_key )
logger.debug "Country #{country.key} >#{country.name} (#{country.code})<"
reader = create_hash_reader( name )
reader.each do |key, value|
state = State.find_by_country_id_and_key!( country.id, key )
... | use StateAttrReader
def load_states_xxx( country_key, xxx, name )
country = Country.find_by_key!( country_key )
logger.debug "Country #{country.key} >#{country.name} (#{country.code})<"
reader = create_hash_reader( name )
reader.each do |key, value|
state = State.find_by_country_id_and_key!( co... | 103 | 19 | 383 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 38ac8d17c90af415fff84860a34897ea1956e6faffe49b20a412db34c9d16354 | CC0-1.0 | permissive | https://github.com/worlddb/world.db/blob/master/LICENSE.md |
07e101aac857b7cef692b226 | worlddb/world.db | worlddb-models/lib/worlddb/reader.rb | WorldDb.ReaderBase.load_continent_refs | https://github.com/worlddb/world.db/blob/8fd44fa8d8dc47290c63b881c713634494aae291/worlddb-models/lib/worlddb/reader.rb#L186-L195 | train | ruby | use ContinentRefReader | def load_continent_refs( name )
reader = create_hash_reader( name )
reader.each do |key, value|
country = Country.find_by_key!( key )
continent = Continent.find_by_key!( value )
country.continent_id = continent.id
country.save!
end
end | use ContinentRefReader
def load_continent_refs( name )
reader = create_hash_reader( name )
reader.each do |key, value|
country = Country.find_by_key!( key )
continent = Continent.find_by_key!( value )
country.continent_id = continent.id
country.save!
end
end | 69 | 22 | 274 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 073761a08b0433e6d55254c269851290546b83d8372f042fde98c1371b36228e | CC0-1.0 | permissive | https://github.com/worlddb/world.db/blob/master/LICENSE.md |
d6366dbadf23b63759cd6280 | worlddb/world.db | worlddb-models/lib/worlddb/reader.rb | WorldDb.ReaderBase.load_continent_defs | https://github.com/worlddb/world.db/blob/8fd44fa8d8dc47290c63b881c713634494aae291/worlddb-models/lib/worlddb/reader.rb#L198-L221 | train | ruby | use ContinentDef Reader | def load_continent_defs( name, more_attribs={} )
reader = create_values_reader( name, more_attribs )
reader.each_line do |attribs, values|
## check optional values
values.each_with_index do |value, index|
logger.warn "unknown type for value >#{value}<"
end
rec = Continent.find... | use ContinentDef Reader
def load_continent_defs( name, more_attribs={} )
reader = create_values_reader( name, more_attribs )
reader.each_line do |attribs, values|
## check optional values
values.each_with_index do |value, index|
logger.warn "unknown type for value >#{value}<"
end
... | 153 | 23 | 625 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 52ff19190b954e4e16b54251554f7e57c6831244c3d1a8e0692ae54526514d35 | CC0-1.0 | permissive | https://github.com/worlddb/world.db/blob/master/LICENSE.md |
44d2021676e57b3ee38a784e | worlddb/world.db | worlddb-models/lib/worlddb/reader.rb | WorldDb.ReaderBase.load_codes | https://github.com/worlddb/world.db/blob/8fd44fa8d8dc47290c63b881c713634494aae291/worlddb-models/lib/worlddb/reader.rb#L224-L273 | train | ruby | load_continent_defs | def load_codes( name )
reader = create_line_reader( name )
reader.each_line do |line|
values = line.split(',')
## logger.debug '[>' + values.join( '<|>' ) + '<]'
if name =~ /iso/
# special case for iso
# country ref, alpha2, alpha3, num
country_name = values[0].str... | load_continent_defs
def load_codes( name )
reader = create_line_reader( name )
reader.each_line do |line|
values = line.split(',')
## logger.debug '[>' + values.join( '<|>' ) + '<]'
if name =~ /iso/
# special case for iso
# country ref, alpha2, alpha3, num
country... | 403 | 19 | 1,399 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 02edd0ed63f253c9c0e0135ef81f4c67e6a80f82035de236b8009d4e09ce728f | CC0-1.0 | permissive | https://github.com/worlddb/world.db/blob/master/LICENSE.md |
86b8a4cec2e934252ea9dbc9 | worlddb/world.db | worlddb-service/attic/service.rb | WorldDB::Service.Server.data_for_cities | https://github.com/worlddb/world.db/blob/8fd44fa8d8dc47290c63b881c713634494aae291/worlddb-service/attic/service.rb#L83-L102 | train | ruby | =begin
def csv_content_type
case request.user_agent
when /windows/i then 'application/vnd.ms-excel'
else 'text/csv'
end
end
=end | def data_for_cities( cities )
## fix: move to model? why? why not?
## add virtual column like kind for metro, metro|city, city, district
## todo add region.title if present
data = []
cities.each do |city|
data << { key: city.key,
title: city.title,
... | =begin
def csv_content_type
case request.user_agent
when /windows/i then 'application/vnd.ms-excel'
else 'text/csv'
end
end
=end
def data_for_cities( cities )
## fix: move to model? why? why not?
## add virtual column like kind for metro, metro|city, city, district
... | 177 | 164 | 587 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | cb7697233f8f6d29c37d423305ddd8aff717fde83360658f4c7e1b0f99ea88e0 | CC0-1.0 | permissive | https://github.com/worlddb/world.db/blob/master/LICENSE.md |
80da61d4c7e82297f4f08e87 | worlddb/world.db | worlddb-service/attic/service.rb | WorldDB::Service.Server.table_for_data | https://github.com/worlddb/world.db/blob/8fd44fa8d8dc47290c63b881c713634494aae291/worlddb-service/attic/service.rb#L137-L151 | train | ruby | method csv_for_data | def table_for_data( data )
buf = ""
buf << "<html><head><meta http-equiv='Content-Type' content='text/html; charset=utf-8'></head><body>\n"
buf << "<table>\n"
data.each do |rec|
buf << " <tr>"
rec.values.each do |value|
buf << "<td>#{value}</td>"
end
buf << "</tr>\n"
... | method csv_for_data
def table_for_data( data )
buf = ""
buf << "<html><head><meta http-equiv='Content-Type' content='text/html; charset=utf-8'></head><body>\n"
buf << "<table>\n"
data.each do |rec|
buf << " <tr>"
rec.values.each do |value|
buf << "<td>#{value}</td>"
end
... | 124 | 19 | 390 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 678d9c18cbcec612db95edf370d71c3d6382aa24b8691db85cfb665ff93aa120 | CC0-1.0 | permissive | https://github.com/worlddb/world.db/blob/master/LICENSE.md |
af63cfce92c5fc444f7b0c6a | worlddb/world.db | worlddb-service/attic/service.rb | WorldDB::Service.Server.json_or_jsonp | https://github.com/worlddb/world.db/blob/8fd44fa8d8dc47290c63b881c713634494aae291/worlddb-service/attic/service.rb#L155-L168 | train | ruby | method table_for_data
helper for json or jsonp response (depending on callback para) | def json_or_jsonp( data )
callback = params.delete('callback')
response = ''
if callback
content_type :js
response = "#{callback}(#{data.to_json})"
else
content_type :json
response = data.to_json
end
response
end | method table_for_data
helper for json or jsonp response (depending on callback para)
def json_or_jsonp( data )
callback = params.delete('callback')
response = ''
if callback
content_type :js
response = "#{callback}(#{data.to_json})"
else
content_type :json
response = data.to_json
end
r... | 82 | 85 | 244 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 92e3a6c014a9c0033a5abd3de7fe5d15151c385939582a935f8b9dbb765843a1 | CC0-1.0 | permissive | https://github.com/worlddb/world.db/blob/master/LICENSE.md |
871dce94e6d313a1008ea282 | worlddb/world.db | worlddb-models/lib/worlddb/matcher.rb | WorldDb.Matcher.match_xxx_for_country | https://github.com/worlddb/world.db/blob/8fd44fa8d8dc47290c63b881c713634494aae291/worlddb-models/lib/worlddb/matcher.rb#L86-L120 | train | ruby | check: use double \\ or just \ ?? | def match_xxx_for_country( name, xxx ) # xxx e.g. cities|states|beers|breweries
# auto-add required country code (from folder structure)
# note: always let match_xxx_for_country_n_state go first
# note: allow /cities and /1--hokkaido--cities
xxx_pattern = "(?:#{xxx}|[0-9]+--[^\\/]+?--#{xxx})" ... | check: use double \\ or just \ ??
def match_xxx_for_country( name, xxx ) # xxx e.g. cities|states|beers|breweries
# auto-add required country code (from folder structure)
# note: always let match_xxx_for_country_n_state go first
# note: allow /cities and /1--hokkaido--cities
xxx_pattern = "(?:... | 495 | 33 | 1,500 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | db50adcf0a3d0253d7be1c64344159811a384507fa88111c6fb9f29704e5f0ed | CC0-1.0 | permissive | https://github.com/worlddb/world.db/blob/master/LICENSE.md |
f888d252885e27b1ea3099f7 | worlddb/world.db | worlddb-models/lib/worlddb/matcher_adm.rb | WorldDb.Matcher.match_xxx_for_country_n_adm1 | https://github.com/worlddb/world.db/blob/8fd44fa8d8dc47290c63b881c713634494aae291/worlddb-models/lib/worlddb/matcher_adm.rb#L33-L54 | train | ruby | todo/check: adm1 => state
why use adm1 and not state ?? duplicate of match___country_n_state ?? | def match_xxx_for_country_n_adm1( name, xxx ) # xxx e.g. parts|counties|etc.
# auto-add required country n states (from folder structure)
#
# e.g. de-deutschland!/3--by-bayern/parts (regierungsbezirke)
# europe/de-deutschland!/3--by-bayern/parts
#
# at-austria!/1--n-niederoesterrei... | todo/check: adm1 => state
why use adm1 and not state ?? duplicate of match___country_n_state ??
def match_xxx_for_country_n_adm1( name, xxx ) # xxx e.g. parts|counties|etc.
# auto-add required country n states (from folder structure)
#
# e.g. de-deutschland!/3--by-bayern/parts (regierungsbezirke)
... | 266 | 99 | 773 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 2d6664b117772067b437bf6ef56b51f55e7d7ecd1bf6dfa5c4b6f1317924952c | CC0-1.0 | permissive | https://github.com/worlddb/world.db/blob/master/LICENSE.md |
47e6e5ec58f8eb1f958055b0 | worlddb/world.db | worlddb-models/lib/worlddb/helpers/value_helper.rb | TextUtils.ValueHelper.match_country | https://github.com/worlddb/world.db/blob/8fd44fa8d8dc47290c63b881c713634494aae291/worlddb-models/lib/worlddb/helpers/value_helper.rb#L15-L24 | train | ruby | todo/check: add to pair of matchers??
e.g. match_country and match_country!
- match_country will use find_by_key and match_country will use find_by_key! - why? why not? | def match_country( value )
if value =~ /^country:/ # country:
country_key = value[8..-1] # cut off country: prefix
country = WorldDb::Model::Country.find_by_key!( country_key )
yield( country )
true # bingo - match found
else
false # no match found
end
end | todo/check: add to pair of matchers??
e.g. match_country and match_country!
- match_country will use find_by_key and match_country will use find_by_key! - why? why not?
def match_country( value )
if value =~ /^country:/ # country:
country_key = value[8..-1] # cut off country: prefix
country =... | 124 | 171 | 307 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | d048142c5a5954283fe5d27569a2a0579396eab9da38ffe2e5212da5e21fb581 | CC0-1.0 | permissive | https://github.com/worlddb/world.db/blob/master/LICENSE.md |
ace36ea454cf068f7b3f6c13 | worlddb/world.db | worlddb-models/lib/worlddb/helpers/value_helper.rb | TextUtils.ValueHelper.match_state_for_country | https://github.com/worlddb/world.db/blob/8fd44fa8d8dc47290c63b881c713634494aae291/worlddb-models/lib/worlddb/helpers/value_helper.rb#L58-L71 | train | ruby | fix/todo: use match_state_for_country! w/ !!! why? why not? | def match_state_for_country( value, country_id ) ## NB: required country_id
if value =~ /^state:/ ## state:
state_key = value[6..-1] ## cut off state: prefix
state = WorldDb::Model::State.find_by_key_and_country_id!( state_key, country_id )
yield( state )
true # bingo - match found
... | fix/todo: use match_state_for_country! w/ !!! why? why not?
def match_state_for_country( value, country_id ) ## NB: required country_id
if value =~ /^state:/ ## state:
state_key = value[6..-1] ## cut off state: prefix
state = WorldDb::Model::State.find_by_key_and_country_id!( state_key, country_id... | 172 | 59 | 581 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | ba0997a8c4f8a7f493fe408dcf8b8857f8e31660b5516ddcc130a7860e14c3e2 | CC0-1.0 | permissive | https://github.com/worlddb/world.db/blob/master/LICENSE.md |
fa0db338b8903788cbff4369 | beerkit/beer.db | beerdb-models/lib/beerdb/reader.rb | BeerDb.ReaderBase.load | https://github.com/beerkit/beer.db/blob/2e815dfa25b5012ceb58c97d15159302ec6cb70d/beerdb-models/lib/beerdb/reader.rb#L56-L80 | train | ruby | method load_setup | def load( name )
if match_beers_for_country_n_state( name ) do |country_key, state_key|
load_beers_for_country_n_state( country_key, state_key, name )
end
elsif match_beers_for_country( name ) do |country_key|
load_beers_for_country( country_key, name )
end
elsif... | method load_setup
def load( name )
if match_beers_for_country_n_state( name ) do |country_key, state_key|
load_beers_for_country_n_state( country_key, state_key, name )
end
elsif match_beers_for_country( name ) do |country_key|
load_beers_for_country( country_key, name )
... | 272 | 17 | 1,077 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 7e5cc85ec65849310be11605e8c2d978daa1313af557b1b1d1b2634daf5d16de | CC0-1.0 | permissive | https://github.com/beerkit/beer.db/blob/master/LICENSE.md |
bd2909dd5e6593b13b5d3c1f | loureirorg/ruby-safenet | lib/safenet.rb | SafeNet.Client.defaults | https://github.com/loureirorg/ruby-safenet/blob/fe4c1a01f2a096ca978daae711928475c2183570/lib/safenet.rb#L46-L55 | train | ruby | default values | def defaults
{
name: "Ruby Demo App",
version: "0.0.1",
vendor: "Vendor's Name",
id: "org.thevendor.demo",
launcher_server: API_ENDPOINT,
conf_path: File.join(File.expand_path('..', __FILE__), "conf.json")
}
end | default values
def defaults
{
name: "Ruby Demo App",
version: "0.0.1",
vendor: "Vendor's Name",
id: "org.thevendor.demo",
launcher_server: API_ENDPOINT,
conf_path: File.join(File.expand_path('..', __FILE__), "conf.json")
}
end | 73 | 14 | 275 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | b8e32feeb0a5f8d80311270908c14a1cf747c109ca27d43abfdae719ecdc5762 | CC0-1.0 | permissive | https://github.com/loureirorg/ruby-safenet/blob/master/LICENSE |
b740a1d730c0707e2514813b | loureirorg/ruby-safenet | lib/safenet.rb | SafeNet.Auth.auth | https://github.com/loureirorg/ruby-safenet/blob/fe4c1a01f2a096ca978daae711928475c2183570/lib/safenet.rb#L105-L141 | train | ruby | Any application that wants to access API endpoints that require authorised
access must receive an authorisation token from SAFE Launcher.
Reading public data using the DNS API does not require an authorisation
token. All other API endpoints require authorised access.
The application will initiate the authorisat... | def auth
# entry point
url = "#{@client.app_info[:launcher_server]}#{API_VERSION}/auth"
# payload
payload = {
app: {
name: @client.app_info[:name],
version: @client.app_info[:version],
vendor: @client.app_info[:vendor],
id: @client.app_info[:id]
... | Any application that wants to access API endpoints that require authorised
access must receive an authorisation token from SAFE Launcher.
Reading public data using the DNS API does not require an authorisation
token. All other API endpoints require authorised access.
The application will initiate the authorisat... | 423 | 885 | 999 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | f78e02925086949afc611b608a22a2680c9c33ec3c09e2ceaeb1cad0bc80ef68 | CC0-1.0 | permissive | https://github.com/loureirorg/ruby-safenet/blob/master/LICENSE |
7e6d3e6bac1676055178306a | loureirorg/ruby-safenet | lib/safenet.rb | SafeNet.Auth.is_token_valid | https://github.com/loureirorg/ruby-safenet/blob/fe4c1a01f2a096ca978daae711928475c2183570/lib/safenet.rb#L154-L166 | train | ruby | Check whether the authorisation token obtained from SAFE Launcher is still
valid.
Usage: my_client.auth.is_token_valid()
Fail: false
Success: true
Reference: https://maidsafe.readme.io/docs/is-token-valid | def is_token_valid
# entry point
url = "#{@client.app_info[:launcher_server]}#{API_VERSION}/auth"
# api call
uri = URI(url)
http = Net::HTTP.new(uri.host, uri.port)
req = Net::HTTP::Get.new(uri.path, {
'Authorization' => "Bearer #{@client.key_helper.get_token()}"
})
... | Check whether the authorisation token obtained from SAFE Launcher is still
valid.
Usage: my_client.auth.is_token_valid()
Fail: false
Success: true
Reference: https://maidsafe.readme.io/docs/is-token-valid
def is_token_valid
# entry point
url = "#{@client.app_info[:launcher_server]}#{API_VERSION}/au... | 145 | 212 | 379 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | f5662a8131242fcf37e32089b2471de04bbbb022ff3e945d242fefd6406e337a | CC0-1.0 | permissive | https://github.com/loureirorg/ruby-safenet/blob/master/LICENSE |
7e6ab8c9f63a96dd052b81c3 | loureirorg/ruby-safenet | lib/safenet.rb | SafeNet.Auth.revoke_token | https://github.com/loureirorg/ruby-safenet/blob/fe4c1a01f2a096ca978daae711928475c2183570/lib/safenet.rb#L178-L190 | train | ruby | Revoke the authorisation token obtained from SAFE Launcher.
Usage: my_client.auth.revoke_token()
Fail: false
Success: true
Reference: https://maidsafe.readme.io/docs/revoke-token | def revoke_token
# entry point
url = "#{@client.app_info[:launcher_server]}#{API_VERSION}/auth"
# api call
uri = URI(url)
http = Net::HTTP.new(uri.host, uri.port)
req = Net::HTTP::Delete.new(uri.path, {
'Authorization' => "Bearer #{@client.key_helper.get_valid_token()}"
... | Revoke the authorisation token obtained from SAFE Launcher.
Usage: my_client.auth.revoke_token()
Fail: false
Success: true
Reference: https://maidsafe.readme.io/docs/revoke-token
def revoke_token
# entry point
url = "#{@client.app_info[:launcher_server]}#{API_VERSION}/auth"
# api call
ur... | 140 | 184 | 386 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 2875ca52ff780bc3a0ba8eb27d7dd344a4d89101305705e8040359e126f219f5 | CC0-1.0 | permissive | https://github.com/loureirorg/ruby-safenet/blob/master/LICENSE |
40e6bcc8c9e89b86a5a2d6dd | loureirorg/ruby-safenet | lib/safenet.rb | SafeNet.NFS.create_directory | https://github.com/loureirorg/ruby-safenet/blob/fe4c1a01f2a096ca978daae711928475c2183570/lib/safenet.rb#L211-L237 | train | ruby | Create a public or private directory either in the application's root
directory or in SAFE Drive.
Only authorised requests can create a directory.
Usage: my_client.nfs.create_directory("/photos")
Adv.Usage: my_client.nfs.create_directory("/photos", meta: "some meta", root_path: 'drive', is_private: true)
Fail: {... | def create_directory(dir_path, options = {})
# Default values
options[:root_path] = 'app' if ! options.has_key?(:root_path)
options[:is_private] = true if ! options.has_key?(:is_private)
# Entry point
url = "#{@client.app_info[:launcher_server]}#{API_VERSION}/nfs/directory/#{opt... | Create a public or private directory either in the application's root
directory or in SAFE Drive.
Only authorised requests can create a directory.
Usage: my_client.nfs.create_directory("/photos")
Adv.Usage: my_client.nfs.create_directory("/photos", meta: "some meta", root_path: 'drive', is_private: true)
Fail: {... | 343 | 477 | 948 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 7d6a73370d23cc33fdce53c63a9acc77ae969f50aa7108958dc8e6bd196143df | CC0-1.0 | permissive | https://github.com/loureirorg/ruby-safenet/blob/master/LICENSE |
5ff11ac406d796d1eb4e6bed | loureirorg/ruby-safenet | lib/safenet.rb | SafeNet.NFS.get_directory | https://github.com/loureirorg/ruby-safenet/blob/fe4c1a01f2a096ca978daae711928475c2183570/lib/safenet.rb#L261-L276 | train | ruby | Fetch a directory.
Only authorised requests can invoke this API.
Usage: my_client.nfs.get_directory("/photos", root_path: 'drive')
Fail: {"errorCode"=>-1502, "description"=>"FfiError::PathNotFound"}
Success: {"info"=> {"name"=> "my_dir", ...}, ...}
Reference: https://maidsafe.readme.io/docs/nfs-get-directory | def get_directory(dir_path, options = {})
# Default values
options[:root_path] = 'app' if ! options.has_key?(:root_path)
# Entry point
url = "#{@client.app_info[:launcher_server]}#{API_VERSION}/nfs/directory/#{options[:root_path]}/#{SafeNet.escape(dir_path)}"
# API call
uri = URI(u... | Fetch a directory.
Only authorised requests can invoke this API.
Usage: my_client.nfs.get_directory("/photos", root_path: 'drive')
Fail: {"errorCode"=>-1502, "description"=>"FfiError::PathNotFound"}
Success: {"info"=> {"name"=> "my_dir", ...}, ...}
Reference: https://maidsafe.readme.io/docs/nfs-get-directory
de... | 221 | 316 | 564 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 6a545689827d6a56619d4344bbb3d03efa65952b7016eddc870bbe693302f6ef | CC0-1.0 | permissive | https://github.com/loureirorg/ruby-safenet/blob/master/LICENSE |
271223729ae666bc6ede9cf1 | loureirorg/ruby-safenet | lib/safenet.rb | SafeNet.NFS.create_file | https://github.com/loureirorg/ruby-safenet/blob/fe4c1a01f2a096ca978daae711928475c2183570/lib/safenet.rb#L360-L381 | train | ruby | Create a file.
Only authorised requests can invoke the API.
Usage: my_client.nfs.create_file("/docs/hello.txt", "Hello World!")
Adv.Usage: my_client.nfs.create_file("/docs/hello.txt", meta: "some meta", root_path: "app", content_type: "text/plain")
Fail: {"errorCode"=>-505, "description"=>"NfsError::FileAlreadyExi... | def create_file(file_path, contents, options = {})
# Default values
options[:root_path] = 'app' if ! options.has_key?(:root_path)
contents ||= ""
# Entry point
url = "#{@client.app_info[:launcher_server]}#{API_VERSION}/nfs/file/#{options[:root_path]}/#{SafeNet.escape(file_path)}"
#... | Create a file.
Only authorised requests can invoke the API.
Usage: my_client.nfs.create_file("/docs/hello.txt", "Hello World!")
Adv.Usage: my_client.nfs.create_file("/docs/hello.txt", meta: "some meta", root_path: "app", content_type: "text/plain")
Fail: {"errorCode"=>-505, "description"=>"NfsError::FileAlreadyExi... | 324 | 405 | 895 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 85f0fc3167a178dc969a509433c1d21b3439c2c9f65f924eaca8ce764fa71906 | CC0-1.0 | permissive | https://github.com/loureirorg/ruby-safenet/blob/master/LICENSE |
a94bc81850e170ad312340dd | loureirorg/ruby-safenet | lib/safenet.rb | SafeNet.NFS.get_file_meta | https://github.com/loureirorg/ruby-safenet/blob/fe4c1a01f2a096ca978daae711928475c2183570/lib/safenet.rb#L395-L414 | train | ruby | Fetch the metadata of a file.
Only authorised requests can invoke the API.
Usage: my_client.nfs.get_file_meta("/docs/hello.txt")
Adv.Usage: my_client.nfs.get_file_meta("/docs/hello.txt", root_path: "app")
Fail: {"errorCode"=>-505, "description"=>"NfsError::FileAlreadyExistsWithSameName"}
Success:
Reference: htt... | def get_file_meta(file_path, options = {})
# Default values
options[:root_path] = 'app' if ! options.has_key?(:root_path)
# Entry point
url = "#{@client.app_info[:launcher_server]}#{API_VERSION}/nfs/file/#{options[:root_path]}/#{SafeNet.escape(file_path)}"
# API call
uri = URI(url)... | Fetch the metadata of a file.
Only authorised requests can invoke the API.
Usage: my_client.nfs.get_file_meta("/docs/hello.txt")
Adv.Usage: my_client.nfs.get_file_meta("/docs/hello.txt", root_path: "app")
Fail: {"errorCode"=>-505, "description"=>"NfsError::FileAlreadyExistsWithSameName"}
Success:
Reference: htt... | 307 | 370 | 852 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 8225623d2173cfa38b0d4bc6ee2a610cf8e3803ce68fbc1cbb0649514df33188 | CC0-1.0 | permissive | https://github.com/loureirorg/ruby-safenet/blob/master/LICENSE |
e93ec32d7b69a12162aab2c1 | loureirorg/ruby-safenet | lib/safenet.rb | SafeNet.NFS.get_file | https://github.com/loureirorg/ruby-safenet/blob/fe4c1a01f2a096ca978daae711928475c2183570/lib/safenet.rb#L430-L456 | train | ruby | Read a file.
The file can be streamed in chunks and also fetched as partial content
based on the range header specified in the request.
Only authorised requests can invoke the API.
Usage: my_client.nfs.get_file("/docs/hello.txt")
Adv.Usage: my_client.nfs.get_file("/docs/hello.txt", range: "bytes 0-1000", root_pa... | def get_file(file_path, options = {})
# Default values
options[:offset] = 0 if ! options.has_key?(:offset)
options[:root_path] = 'app' if ! options.has_key?(:root_path)
# Entry point
url = "#{@client.app_info[:launcher_server]}#{API_VERSION}/nfs/file/#{options[:root_path]}/#{SafeNe... | Read a file.
The file can be streamed in chunks and also fetched as partial content
based on the range header specified in the request.
Only authorised requests can invoke the API.
Usage: my_client.nfs.get_file("/docs/hello.txt")
Adv.Usage: my_client.nfs.get_file("/docs/hello.txt", range: "bytes 0-1000", root_pa... | 507 | 785 | 1,081 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | f7a47451e48717b3a582239fd8a41f8998111645a54b291eb9d713ecb252bf00 | CC0-1.0 | permissive | https://github.com/loureirorg/ruby-safenet/blob/master/LICENSE |
1de0eec87835eacbedae2617 | loureirorg/ruby-safenet | lib/safenet.rb | SafeNet.NFS.move_file | https://github.com/loureirorg/ruby-safenet/blob/fe4c1a01f2a096ca978daae711928475c2183570/lib/safenet.rb#L502-L524 | train | ruby | Move or copy a file | def move_file(src_root_path, src_path, dst_root_path, dst_path, action = 'move')
# Entry point
url = "#{@client.app_info[:launcher_server]}#{API_VERSION}/nfs/movefile"
# Payload
payload = {}
payload["srcRootPath"] = src_root_path # 'app' or 'drive'
payload["srcPath"] = src_path
... | Move or copy a file
def move_file(src_root_path, src_path, dst_root_path, dst_path, action = 'move')
# Entry point
url = "#{@client.app_info[:launcher_server]}#{API_VERSION}/nfs/movefile"
# Payload
payload = {}
payload["srcRootPath"] = src_root_path # 'app' or 'drive'
payload["srcP... | 226 | 19 | 836 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 4df8985a453856dba3508dae33a24239e231954feb8b45b6fd7f9f06e701a3a0 | CC0-1.0 | permissive | https://github.com/loureirorg/ruby-safenet/blob/master/LICENSE |
d72f13832236dd7f263b551a | loureirorg/ruby-safenet | lib/safenet.rb | SafeNet.NFS.delete_file | https://github.com/loureirorg/ruby-safenet/blob/fe4c1a01f2a096ca978daae711928475c2183570/lib/safenet.rb#L537-L552 | train | ruby | Delete a file.
Only authorised requests can invoke the API.
Usage: my_client.nfs.delete_file("/docs/hello.txt")
Adv.Usage: my_client.nfs.delete_file("/docs/hello.txt", root_path: "app")
Fail: {"errorCode"=>-1503, "description"=>"FfiError::InvalidPath"}
Success: true
Reference: https://maidsafe.readme.io/docs/nf... | def delete_file(file_path, options = {})
# Default values
options[:root_path] = 'app' if ! options.has_key?(:root_path)
# Entry point
url = "#{@client.app_info[:launcher_server]}#{API_VERSION}/nfs/file/#{options[:root_path]}/#{SafeNet.escape(file_path)}"
# API call
uri = URI(url)
... | Delete a file.
Only authorised requests can invoke the API.
Usage: my_client.nfs.delete_file("/docs/hello.txt")
Adv.Usage: my_client.nfs.delete_file("/docs/hello.txt", root_path: "app")
Fail: {"errorCode"=>-1503, "description"=>"FfiError::InvalidPath"}
Success: true
Reference: https://maidsafe.readme.io/docs/nf... | 235 | 333 | 589 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 3bfbafc05cf681bf9de14620429a61c74c1ccefa5836753a4fa5df5f54f098bb | CC0-1.0 | permissive | https://github.com/loureirorg/ruby-safenet/blob/master/LICENSE |
624bcda8f60d9db24ddb2fe7 | loureirorg/ruby-safenet | lib/safenet.rb | SafeNet.DNS.register_service | https://github.com/loureirorg/ruby-safenet/blob/fe4c1a01f2a096ca978daae711928475c2183570/lib/safenet.rb#L597-L622 | train | ruby | Register a long name and a service.
Only authorised requests can invoke the API.
Usage: my_client.dns.register_service("my-domain", "www", "/sources")
Fail: {"errorCode"=>-1503, "description"=>"FfiError::InvalidPath"}
Success: true
Reference: https://maidsafe.readme.io/docs/dns-register-service | def register_service(long_name, service_name, service_home_dir_path, options = {})
# Entry point
url = "#{@client.app_info[:launcher_server]}#{API_VERSION}/dns"
# Payload
payload = {
longName: long_name,
serviceName: service_name,
rootPath: 'app',
serviceHomeDirP... | Register a long name and a service.
Only authorised requests can invoke the API.
Usage: my_client.dns.register_service("my-domain", "www", "/sources")
Fail: {"errorCode"=>-1503, "description"=>"FfiError::InvalidPath"}
Success: true
Reference: https://maidsafe.readme.io/docs/dns-register-service
def register_ser... | 271 | 302 | 829 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 2c6cb91753d6bf4faa1beb383d735cdb9a1666122bdc9ab1eac98f772663171a | CC0-1.0 | permissive | https://github.com/loureirorg/ruby-safenet/blob/master/LICENSE |
a2c6ac594de3b6d9d4b41f22 | loureirorg/ruby-safenet | lib/safenet.rb | SafeNet.DNS.get_home_dir | https://github.com/loureirorg/ruby-safenet/blob/fe4c1a01f2a096ca978daae711928475c2183570/lib/safenet.rb#L692-L704 | train | ruby | https://maidsafe.readme.io/docs/dns-get-home-dir | def get_home_dir(long_name, service_name)
# entry point
url = "#{@client.app_info[:launcher_server]}#{API_VERSION}/dns/#{SafeNet.escape(service_name)}/#{SafeNet.escape(long_name)}"
# api call
uri = URI(url)
http = Net::HTTP.new(uri.host, uri.port)
req = Net::HTTP::Get.new(uri.path)
... | https://maidsafe.readme.io/docs/dns-get-home-dir
def get_home_dir(long_name, service_name)
# entry point
url = "#{@client.app_info[:launcher_server]}#{API_VERSION}/dns/#{SafeNet.escape(service_name)}/#{SafeNet.escape(long_name)}"
# api call
uri = URI(url)
http = Net::HTTP.new(uri.host, u... | 153 | 48 | 540 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 3c13e84b5940e001ef07a276849e4434339d15bb9d785dcacf3ee4bd0578b074 | CC0-1.0 | permissive | https://github.com/loureirorg/ruby-safenet/blob/master/LICENSE |
688bce01b68f9f938a1fbaac | loureirorg/ruby-safenet | lib/safenet.rb | SafeNet.DNS.get_file_unauth | https://github.com/loureirorg/ruby-safenet/blob/fe4c1a01f2a096ca978daae711928475c2183570/lib/safenet.rb#L709-L721 | train | ruby | https://maidsafe.readme.io/docs/dns-get-file-unauth
get_file_unauth("thegoogle", "www", "index.html") | def get_file_unauth(long_name, service_name, file_path)
# entry point
url = "#{@client.app_info[:launcher_server]}#{API_VERSION}/dns/#{SafeNet.escape(service_name)}/#{SafeNet.escape(long_name)}/#{SafeNet.escape(file_path)}"
# api call
uri = URI(url)
http = Net::HTTP.new(uri.host, uri.port... | https://maidsafe.readme.io/docs/dns-get-file-unauth
get_file_unauth("thegoogle", "www", "index.html")
def get_file_unauth(long_name, service_name, file_path)
# entry point
url = "#{@client.app_info[:launcher_server]}#{API_VERSION}/dns/#{SafeNet.escape(service_name)}/#{SafeNet.escape(long_name)}/#{SafeNet.... | 183 | 102 | 577 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | af55ada12dd858a2014559988dc504ba9740c5c8b07c1f2bc10e198ebcca2892 | CC0-1.0 | permissive | https://github.com/loureirorg/ruby-safenet/blob/master/LICENSE |
f41133289e3c3e7a6cf22a29 | loureirorg/ruby-safenet | lib/safenet.rb | SafeNet.SD.set | https://github.com/loureirorg/ruby-safenet/blob/fe4c1a01f2a096ca978daae711928475c2183570/lib/safenet.rb#L1049-L1055 | train | ruby | create or update | def set(name, contents = '', type = 500)
sd = @client.sd.update(name, contents)
if sd.is_a?(Hash) && (sd["errorCode"] == -22) # doesn't exist
sd = @client.sd.create(name, contents)
end
sd
end | create or update
def set(name, contents = '', type = 500)
sd = @client.sd.update(name, contents)
if sd.is_a?(Hash) && (sd["errorCode"] == -22) # doesn't exist
sd = @client.sd.create(name, contents)
end
sd
end | 69 | 16 | 227 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 9df73c9adb7b1fcb25bd98eb53179f82669ff8df295f67ce2427bef5571fe0d9 | CC0-1.0 | permissive | https://github.com/loureirorg/ruby-safenet/blob/master/LICENSE |
dfed50ad682272038fb6e102 | loureirorg/ruby-safenet | lib/safenet.rb | SafeNet.Immutable.create | https://github.com/loureirorg/ruby-safenet/blob/fe4c1a01f2a096ca978daae711928475c2183570/lib/safenet.rb#L1171-L1187 | train | ruby | helper | def create(contents)
# plain (not encrypted)
hnd_cipher = @client.cipher.get_handle
# write
hnd_w = @client.immutable.get_writer_handle
@client.immutable.write_data(hnd_w, contents)
hnd_data_id = @client.immutable.close_writer(hnd_w, hnd_cipher)
name = @client.data_id.serializ... | helper
def create(contents)
# plain (not encrypted)
hnd_cipher = @client.cipher.get_handle
# write
hnd_w = @client.immutable.get_writer_handle
@client.immutable.write_data(hnd_w, contents)
hnd_data_id = @client.immutable.close_writer(hnd_w, hnd_cipher)
name = @client.data_id.... | 141 | 6 | 551 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 1c6657c03fe76373f40ad1543aff00feecd6a28f24c7a4e8ff07ddd283590f89 | CC0-1.0 | permissive | https://github.com/loureirorg/ruby-safenet/blob/master/LICENSE |
eae7fbf57873b33554666144 | loureirorg/ruby-safenet | lib/safenet.rb | SafeNet.Immutable.dump | https://github.com/loureirorg/ruby-safenet/blob/fe4c1a01f2a096ca978daae711928475c2183570/lib/safenet.rb#L1195-L1204 | train | ruby | helper | def dump(name, path)
contents = nil
File.open(path, "wb") do |file|
contents = @client.immutable.read(name)
file.write(contents)
end
contents.is_a?(Hash) ? contents : true
end | helper
def dump(name, path)
contents = nil
File.open(path, "wb") do |file|
contents = @client.immutable.read(name)
file.write(contents)
end
contents.is_a?(Hash) ? contents : true
end | 57 | 6 | 221 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 1c868739833a6fbe50915927f95946736621c8746a438881b9090351225a2142 | CC0-1.0 | permissive | https://github.com/loureirorg/ruby-safenet/blob/master/LICENSE |
f7961a708049f9c624ec69d2 | loureirorg/ruby-safenet | lib/safenet.rb | SafeNet.Immutable.read | https://github.com/loureirorg/ruby-safenet/blob/fe4c1a01f2a096ca978daae711928475c2183570/lib/safenet.rb#L1207-L1221 | train | ruby | helper | def read(name, chunk_pos = nil, max_chunk_size = 1_000_000)
name = Base64.decode64(name)
hnd_data_id = @client.data_id.deserialize(name)
hnd_r = @client.immutable.get_reader_handle(hnd_data_id)
contents = if chunk_pos
@client.immutable.read_data(hnd_r, "bytes=#{chunk_pos}-#{chunk_pos+ma... | helper
def read(name, chunk_pos = nil, max_chunk_size = 1_000_000)
name = Base64.decode64(name)
hnd_data_id = @client.data_id.deserialize(name)
hnd_r = @client.immutable.get_reader_handle(hnd_data_id)
contents = if chunk_pos
@client.immutable.read_data(hnd_r, "bytes=#{chunk_pos}-#{chun... | 139 | 6 | 520 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 876d31953e5c008997a171cb667d3aed872a87a7ffd1d97fd8b4a8f54feafa59 | CC0-1.0 | permissive | https://github.com/loureirorg/ruby-safenet/blob/master/LICENSE |
9cc98d43d1dd54147dff9d66 | sportdb/sport.db | sportdb-models/lib/sportdb/utils_map.rb | SportDb.FixtureHelpers.map_ground! | https://github.com/sportdb/sport.db/blob/68a6d7ce7f31fc7dc74c8d6b74a6b542ff7d0396/sportdb-models/lib/sportdb/utils_map.rb#L15-L22 | test | ruby | todo/fix: pass in known_grounds as a parameter? why? why not?
todo/fix:
remove =nil in para - make param required w/o fallback | def map_ground!( line, known_grounds=nil )
if known_grounds.nil?
puts "depreciated API call map_ground! (pass in mapping table as 2nd param)"
known_grounds = @known_grounds
end
TextUtils.map_titles_for!( 'ground', line, known_grounds )
end | todo/fix: pass in known_grounds as a parameter? why? why not?
todo/fix:
remove =nil in para - make param required w/o fallback
def map_ground!( line, known_grounds=nil )
if known_grounds.nil?
puts "depreciated API call map_ground! (pass in mapping table as 2nd param)"
known_grounds = @known_gro... | 108 | 131 | 273 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 3d5d06b797a59844489ec50cbff3a01513ff2968fc0f1d4cfe1dea57c3ec6b87 | CC0-1.0 | permissive | https://github.com/sportdb/sport.db/blob/master/LICENSE.md |
1c5f4c63f75ac8e3bd3f7e2d | sportdb/sport.db | sportdb-models/lib/sportdb/utils_map.rb | SportDb.FixtureHelpers.map_person! | https://github.com/sportdb/sport.db/blob/68a6d7ce7f31fc7dc74c8d6b74a6b542ff7d0396/sportdb-models/lib/sportdb/utils_map.rb#L32-L39 | test | ruby | todo/fix:
remove =nil in para - make param required w/o fallback | def map_person!( line, known_persons=nil )
if known_persons.nil?
puts "depreciated API call map_person! (pass in mapping table as 2nd param)"
known_persons = @known_persons
end
TextUtils.map_titles_for!( 'person', line, known_persons )
end | todo/fix:
remove =nil in para - make param required w/o fallback
def map_person!( line, known_persons=nil )
if known_persons.nil?
puts "depreciated API call map_person! (pass in mapping table as 2nd param)"
known_persons = @known_persons
end
TextUtils.map_titles_for!( 'person', l... | 90 | 68 | 277 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | ffa2c1a69d8170ea4861c716d8cd6ece2295f13abf156635a42ed14412683636 | CC0-1.0 | permissive | https://github.com/sportdb/sport.db/blob/master/LICENSE.md |
8f466dc69d7d1358dbeb9489 | sportdb/sport.db | sportdb-models/lib/sportdb/rsssf_reader.rb | SportDb.RsssfGameReader.find_rsssf_date! | https://github.com/sportdb/sport.db/blob/68a6d7ce7f31fc7dc74c8d6b74a6b542ff7d0396/sportdb-models/lib/sportdb/rsssf_reader.rb#L85-L88 | test | ruby | method find_rsssf_scores! | def find_rsssf_date!( line, opts={} )
finder = RsssfDateFinder.new
finder.find!( line, opts )
end | method find_rsssf_scores!
def find_rsssf_date!( line, opts={} )
finder = RsssfDateFinder.new
finder.find!( line, opts )
end | 39 | 25 | 110 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 81d632a6c1acdc3f9dfc2283bfeed52e0da11212eff689bf4c4377c13d4f55e4 | CC0-1.0 | permissive | https://github.com/sportdb/sport.db/blob/master/LICENSE.md |
5abf5094a9185d0cf2984f73 | sportdb/sport.db | sportdb-models/lib/sportdb/rsssf_reader.rb | SportDb.RsssfGameReader.parse_round_header | https://github.com/sportdb/sport.db/blob/68a6d7ce7f31fc7dc74c8d6b74a6b542ff7d0396/sportdb-models/lib/sportdb/rsssf_reader.rb#L123-L185 | test | ruby | method find_rsssf_round! | def parse_round_header( line )
## todo/fix:
## simplify - for now round number always required
# e.g. no auto-calculation supported here
# fail if round found w/o number/pos !!!
#
# also remove knockout flag for now (set to always false for now)
logger.debug "par... | method find_rsssf_round!
def parse_round_header( line )
## todo/fix:
## simplify - for now round number always required
# e.g. no auto-calculation supported here
# fail if round found w/o number/pos !!!
#
# also remove knockout flag for now (set to always false for now)
... | 523 | 24 | 2,011 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 2cc9810892df428337ac05e2de5b77f98879facd906e9c31d93ec102aa68bc0a | CC0-1.0 | permissive | https://github.com/sportdb/sport.db/blob/master/LICENSE.md |
0ee12fdb3ddb869ed511de6c | sportdb/sport.db | sportdb-models/lib/sportdb/finders/scores.rb | SportDb.ScoresFinder.find! | https://github.com/sportdb/sport.db/blob/68a6d7ce7f31fc7dc74c8d6b74a6b542ff7d0396/sportdb-models/lib/sportdb/finders/scores.rb#L123-L236 | test | ruby | todo: allow all-in-one "literal form a la kicker" e.g.
2:2 (1:1, 1:0) n.V. 5:1 i.E. | def find!( line, opts={} )
### fix: add and match all-in-one literal first, followed by
# note: always call after find_dates !!!
# scores match date-like patterns!! e.g. 10-11 or 10:00 etc.
# -- note: score might have two digits too
### fix: depending on language allow 1:1 or 1-1
## do... | todo: allow all-in-one "literal form a la kicker" e.g.
2:2 (1:1, 1:0) n.V. 5:1 i.E.
def find!( line, opts={} )
### fix: add and match all-in-one literal first, followed by
# note: always call after find_dates !!!
# scores match date-like patterns!! e.g. 10-11 or 10:00 etc.
# -- note: score mig... | 1,252 | 85 | 3,574 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | cf107483c728039ebfb57b23b24d6e825eaf0bfbc2a266de310bb897856fb41e | CC0-1.0 | permissive | https://github.com/sportdb/sport.db/blob/master/LICENSE.md |
End of preview. Expand in Data Studio
CodeSearchNet — CC0-1.0 micro dataset
Working copy (2026-12-05). Every row is CC0-1.0 (public-domain dedication), taken from the four per-language permissive datasets. Micro set: 327 rows.
- 327 rows, 13 repositories
- 332,565 characters, 80,640 tokens
(tiktoken
cl100k_base) - parquet
368,071bytes (zstd), 20 columns - splits: train 312 · test 15
Full datasheet: datasheet.md.
By language
| language | rows | tokens | share |
|---|---|---|---|
| python | 239 | 58,739 | 73.1% |
| ruby | 67 | 20,592 | 20.5% |
| go | 21 | 1,309 | 6.4% |
Schema
id, repo, path, func_name, url, split, language, docstring, code, text,
token_count, doc_chars, code_chars, license_basis, source, added,
record_sha256, license, license_class, license_source
license == "CC0-1.0" for every row; license_class == "permissive".
license_source is the GitHub licence URL.
Rights
- Single licence: CC0-1.0 for all 327 rows, audited per repository via the GitHub licence API.
- CC0 waives copyright and neighbouring rights; attribution is not required.
repoandurlare kept for provenance. - No copyleft and no
NOASSERTION/unknownrows. - CC0 does not clear patents or trademarks that may apply to the code.
Not checked
- PII in code/docstrings; no scrubber was run.
- Whether GitHub's LICENSE-file detection matches the repo's actual terms.
- Vendored/generated files inside repos that may carry other licences.
- Patents/trademarks in the CC0 code.
Authors
Piotr Styła (SlayerLab / Fabryka AI), 2026. See CITATION.cff.
Citation
If you use this dataset, cite it via CITATION.cff (or the Hugging Face
dataset page). Upstream code should be cited/attributed via the repo and
url fields.
Dataset licence
Curation, selection and metadata: CC0-1.0 (see LICENSE). Code and
documentation remain under their upstream licences, recorded per row in
license / license_source; see NOTICE, ATTRIBUTION.md and LICENSES/.
- Downloads last month
- 49