stdlib

package
v0.0.0-...-d353cf6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 10, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package stdlib provides standard library modules for the RAGE Python runtime.

Index

Constants

View Source
const (
	IGNORECASE = 2
	MULTILINE  = 8
	DOTALL     = 16
	VERBOSE    = 64
	ASCII      = 256
)

Regex flags

Variables

This section is empty.

Functions

func InitAllModules

func InitAllModules()

InitAllModules initializes all standard library modules. Call this before running any Python code that might import standard modules.

func InitAsyncioModule

func InitAsyncioModule()

InitAsyncioModule registers the asyncio module

func InitCSVModule

func InitCSVModule()

InitCSVModule registers the csv module

func InitCollectionsModule

func InitCollectionsModule()

InitCollectionsModule registers the collections module

func InitDatetimeModule

func InitDatetimeModule()

InitDatetimeModule registers the datetime module

func InitFunctoolsModule

func InitFunctoolsModule()

InitFunctoolsModule registers the functools module

func InitIOModule

func InitIOModule()

InitIOModule registers the io module and open() builtin

func InitItertoolsModule

func InitItertoolsModule()

InitItertoolsModule registers the itertools module

func InitJSONModule

func InitJSONModule()

InitJSONModule registers the json module

func InitMathModule

func InitMathModule()

InitMathModule registers the math module

func InitOSModule

func InitOSModule()

InitOSModule registers the os module

func InitRandomModule

func InitRandomModule()

InitRandomModule registers the random module

func InitReModule

func InitReModule()

InitReModule registers the re module

func InitStringModule

func InitStringModule()

InitStringModule registers the string module

func InitSysModule

func InitSysModule()

InitSysModule registers the sys module

func InitTimeModule

func InitTimeModule()

InitTimeModule registers the time module

func InitTypingModule

func InitTypingModule()

InitTypingModule registers the typing module

func SetArgv

func SetArgv(args []string)

SetArgv sets the command line arguments for sys.argv

Types

type CacheInfo

type CacheInfo struct {
	Hits     int64
	Misses   int64
	MaxSize  int
	CurrSize int
}

CacheInfo represents cache statistics

type PyCSVDictReader

type PyCSVDictReader struct {
	Lines      []string
	Index      int
	Delimiter  rune
	Quotechar  rune
	Fieldnames []string
	RestKey    string
	RestVal    string
}

PyCSVDictReader represents a CSV DictReader object

func (*PyCSVDictReader) String

func (r *PyCSVDictReader) String() string

func (*PyCSVDictReader) Type

func (r *PyCSVDictReader) Type() string

type PyCSVDictWriter

type PyCSVDictWriter struct {
	Buffer         *bytes.Buffer
	Fieldnames     []string
	Delimiter      rune
	Quotechar      rune
	Quoting        int
	Lineterminator string
	RestVal        string
	ExtrasAction   string
}

PyCSVDictWriter represents a CSV DictWriter object

func (*PyCSVDictWriter) String

func (w *PyCSVDictWriter) String() string

func (*PyCSVDictWriter) Type

func (w *PyCSVDictWriter) Type() string

type PyCSVReader

type PyCSVReader struct {
	Lines     []string
	Index     int
	Delimiter rune
	Quotechar rune
}

PyCSVReader represents a CSV reader object

func (*PyCSVReader) String

func (r *PyCSVReader) String() string

func (*PyCSVReader) Type

func (r *PyCSVReader) Type() string

type PyCSVWriter

type PyCSVWriter struct {
	Buffer         *bytes.Buffer
	Delimiter      rune
	Quotechar      rune
	Quoting        int
	Lineterminator string
}

PyCSVWriter represents a CSV writer object

func (*PyCSVWriter) String

func (w *PyCSVWriter) String() string

func (*PyCSVWriter) Type

func (w *PyCSVWriter) Type() string

type PyCmpKey

type PyCmpKey struct {
	CmpFunc runtime.Value
	Object  runtime.Value
}

PyCmpKey represents a key wrapper for comparison functions

func (*PyCmpKey) String

func (c *PyCmpKey) String() string

func (*PyCmpKey) Type

func (c *PyCmpKey) Type() string

type PyCountIter

type PyCountIter struct {
	Start   int64
	Step    int64
	Current int64
}

PyCountIter represents a count iterator

func (*PyCountIter) String

func (c *PyCountIter) String() string

func (*PyCountIter) Type

func (c *PyCountIter) Type() string

type PyCounter

type PyCounter struct {
	Items map[runtime.Value]int64
}

PyCounter wraps a dict that counts hashable objects

func (*PyCounter) String

func (c *PyCounter) String() string

func (*PyCounter) Type

func (c *PyCounter) Type() string

type PyCycleIter

type PyCycleIter struct {
	Items []runtime.Value
	Index int
}

PyCycleIter represents a cycle iterator

func (*PyCycleIter) String

func (c *PyCycleIter) String() string

func (*PyCycleIter) Type

func (c *PyCycleIter) Type() string

type PyDate

type PyDate struct {
	Year  int
	Month int
	Day   int
}

func (*PyDate) String

func (d *PyDate) String() string

func (*PyDate) Type

func (d *PyDate) Type() string

type PyDatetime

type PyDatetime struct {
	Year        int
	Month       int
	Day         int
	Hour        int
	Minute      int
	Second      int
	Microsecond int
}

func (*PyDatetime) String

func (d *PyDatetime) String() string

func (*PyDatetime) Type

func (d *PyDatetime) Type() string

type PyDefaultDict

type PyDefaultDict struct {
	Items          map[runtime.Value]runtime.Value
	DefaultFactory runtime.Value
}

PyDefaultDict is a dict with a default factory

func (*PyDefaultDict) String

func (d *PyDefaultDict) String() string

func (*PyDefaultDict) Type

func (d *PyDefaultDict) Type() string

type PyDeque

type PyDeque struct {
	Items  []runtime.Value
	Maxlen int64 // -1 means unbounded
}

PyDeque is a double-ended queue

func (*PyDeque) String

func (d *PyDeque) String() string

func (*PyDeque) Type

func (d *PyDeque) Type() string

type PyFile

type PyFile struct {
	// contains filtered or unexported fields
}

PyFile wraps an os.File with buffered I/O and Python-compatible state

func (*PyFile) String

func (f *PyFile) String() string

func (*PyFile) Type

func (f *PyFile) Type() string

type PyGenericAlias

type PyGenericAlias struct {
	Origin string
	Args   []runtime.Value
}

PyGenericAlias represents a parameterized generic type like List[int]

func (*PyGenericAlias) String

func (g *PyGenericAlias) String() string

func (*PyGenericAlias) Type

func (g *PyGenericAlias) Type() string

type PyGenericType

type PyGenericType struct {
	Name       string
	OriginType string // The underlying type (e.g., "list" for List)
}

PyGenericType represents a subscriptable generic type like List, Dict

func (*PyGenericType) String

func (g *PyGenericType) String() string

func (*PyGenericType) Type

func (g *PyGenericType) Type() string

type PyLruCache

type PyLruCache struct {
	Func    runtime.Value
	MaxSize int // -1 means unlimited
	Cache   map[string]runtime.Value
	Order   *list.List // For LRU ordering
	Keys    map[string]*list.Element
	Hits    int64
	Misses  int64
	// contains filtered or unexported fields
}

PyLruCache represents an LRU cache wrapper

func (*PyLruCache) String

func (l *PyLruCache) String() string

func (*PyLruCache) Type

func (l *PyLruCache) Type() string

type PyMatch

type PyMatch struct {
	Pattern *PyPattern
	Input   string
	Start   int
	End     int
	Groups  []string
}

PyMatch represents a regex match result

func (*PyMatch) String

func (m *PyMatch) String() string

func (*PyMatch) Type

func (m *PyMatch) Type() string

type PyParamSpec

type PyParamSpec struct {
	Name string
}

PyParamSpec represents a parameter specification variable

func (*PyParamSpec) String

func (p *PyParamSpec) String() string

func (*PyParamSpec) Type

func (p *PyParamSpec) Type() string

type PyPartial

type PyPartial struct {
	Func   runtime.Value
	Args   []runtime.Value
	Kwargs map[string]runtime.Value
}

PyPartial represents a partial function application

func (*PyPartial) String

func (p *PyPartial) String() string

func (*PyPartial) Type

func (p *PyPartial) Type() string

type PyPattern

type PyPattern struct {
	Pattern string
	Regex   *regexp.Regexp
	Flags   int
}

PyPattern represents a compiled regular expression

func (*PyPattern) String

func (p *PyPattern) String() string

func (*PyPattern) Type

func (p *PyPattern) Type() string

type PyRepeatIter

type PyRepeatIter struct {
	Object runtime.Value
	Times  int64 // -1 means infinite
	Count  int64
}

PyRepeatIter represents a repeat iterator

func (*PyRepeatIter) String

func (r *PyRepeatIter) String() string

func (*PyRepeatIter) Type

func (r *PyRepeatIter) Type() string

type PySpecialForm

type PySpecialForm struct {
	Name string
}

PySpecialForm represents a special typing form like Union, Optional

func (*PySpecialForm) String

func (s *PySpecialForm) String() string

func (*PySpecialForm) Type

func (s *PySpecialForm) Type() string

type PyStructTime

type PyStructTime struct {
	TmYear  int // year
	TmMon   int // month (1-12)
	TmMday  int // day of month (1-31)
	TmHour  int // hour (0-23)
	TmMin   int // minute (0-59)
	TmSec   int // second (0-61)
	TmWday  int // weekday (0-6, Monday=0)
	TmYday  int // day of year (1-366)
	TmIsdst int // DST flag (-1, 0, 1)
}

PyStructTime represents a time struct (like Python's time.struct_time)

type PyTime

type PyTime struct {
	Hour        int
	Minute      int
	Second      int
	Microsecond int
}

func (*PyTime) String

func (t *PyTime) String() string

func (*PyTime) Type

func (t *PyTime) Type() string

type PyTimedelta

type PyTimedelta struct {
	Days         int64
	Seconds      int64
	Microseconds int64
}

func (*PyTimedelta) String

func (td *PyTimedelta) String() string

func (*PyTimedelta) TotalSeconds

func (td *PyTimedelta) TotalSeconds() float64

func (*PyTimedelta) Type

func (td *PyTimedelta) Type() string

type PyTypeVar

type PyTypeVar struct {
	Name          string
	Bound         runtime.Value
	Covariant     bool
	Contravariant bool
	Constraints   []runtime.Value
}

PyTypeVar represents a type variable

func (*PyTypeVar) String

func (t *PyTypeVar) String() string

func (*PyTypeVar) Type

func (t *PyTypeVar) Type() string

type PyTypeVarTuple

type PyTypeVarTuple struct {
	Name string
}

PyTypeVarTuple represents a type variable tuple

func (*PyTypeVarTuple) String

func (t *PyTypeVarTuple) String() string

func (*PyTypeVarTuple) Type

func (t *PyTypeVarTuple) Type() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL