sio_client

package
v0.6.5 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2023 License: MIT Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const ErrorFetchingProblemSiteFailed = `fetching problem site failed`
View Source
const ErrorNeedCantFindProblemID = "couldn't find problem instance id (maybe a problem with this alias doesn't exist in this contest)"
View Source
const ErrorNeedContest = "you have to specify the contest"
View Source
const ErrorNeedProblemAlias = "you have to specify the Problem alias"
View Source
const ErrorNeedProblemIdentification = "you have to specify the problem alias or the problem instance id"
View Source
const ErrorNeedSubmissionID = "you have to specify the Submission ID"
View Source
const ErrorNoActiveRound = "there is no active round in this contest"
View Source
const ErrorParsingProblemsFailed = `parsing some problems failed`
View Source
const ErrorUnknownInstance = "unknown sio instance"
View Source
const ErrorUnrecognizedStatementFormat = `unrecognized statement format`
View Source
const LoginPageRegExp = `<h1>Log in</h1>`
View Source
const StandardIOReg = `(\nKomunikacja\n|\nOpis interfejsu\s+)`
View Source
const SubmissionsPageRegExp = `<title>My submissions[\S\s]+</title>|<title>Moje zgłoszenia[\S\s]+</title>`

Variables

View Source
var AcceptedExtensions = map[string]struct{}{
	"cpp": {},
	"cc":  {},
	"c":   {},
	"pas": {},
	"py":  {},
}
View Source
var ErrorNotLogged = "not logged in"

Functions

func Init

func Init(path, host, proxy string, instanceClient SioInstanceClient)

func ProblemURL

func ProblemURL(host, contest, problemAlias string) string

Types

type Info

type Info struct {
	Contest      string `json:"contest_id"`
	ProblemID    string `json:"problem_id"`
	ProblemAlias string `json:"problem_alias"`
	Round        string `json:"round"`
	SubmissionID string `json:"submission_id"`
	RootPath     string
}

func (*Info) ContestURL

func (info *Info) ContestURL(host string) (string, error)

func (*Info) Hint

func (info *Info) Hint() string

func (*Info) MySubmissionURL

func (info *Info) MySubmissionURL(host string) (string, error)

func (*Info) OpenURL

func (info *Info) OpenURL(host string) (string, error)

func (*Info) Path

func (info *Info) Path() string

func (*Info) ProblemURL

func (info *Info) ProblemURL(host string) (string, error)

func (*Info) StandingsURL

func (info *Info) StandingsURL(cln *SioClient, host string) (string, error)

func (*Info) StatusURL added in v0.6.0

func (info *Info) StatusURL(host string) (string, error)

func (*Info) SubmissionURL

func (info *Info) SubmissionURL(host string) (string, error)

func (*Info) SubmitURL

func (info *Info) SubmitURL(host string) (string, error)

func (*Info) ToTask

func (info *Info) ToTask() database_client.Task

type RoundInfo

type RoundInfo struct {
	Time           float64 `json:"time"`
	RoundStartDate float64 `json:"round_start_date"`
	RoundName      string  `json:"round_name"`
	Username       string  `json:"user"`
}

type SioClient

type SioClient struct {
	Jar            *cookiejar.Jar `json:"cookies"`
	Username       string         `json:"handle"`
	Password       string         `json:"password"`
	LastSubmission *Info          `json:"last_submission"`
	// contains filtered or unexported fields
}
var MimuwInstance *SioClient
var StaszicInstance *SioClient

func (*SioClient) ConfigLogin

func (c *SioClient) ConfigLogin() (err error)

func (*SioClient) DecryptPassword

func (c *SioClient) DecryptPassword() (string, error)

func (*SioClient) Login

func (c *SioClient) Login() (err error)

func (*SioClient) Parse

func (c *SioClient) Parse(info Info, db *sql.DB) (problems []StatisInfo, paths []string, err error)

func (*SioClient) ParseProblem

func (c *SioClient) ParseProblem(host, contestID, problemAlias, path string, mu *sync.Mutex) (name string, samples int, standardIO bool, perf util.Performance, err error)

func (*SioClient) RaceContest

func (c *SioClient) RaceContest(info Info) (round string, err error)

func (*SioClient) Statis

func (c *SioClient) Statis(info Info) (problems []StatisInfo, perf util.Performance, err error)

func (*SioClient) Submit

func (c *SioClient) Submit(info Info, sourcePath string) (err error)

func (*SioClient) WatchSubmission

func (c *SioClient) WatchSubmission(info Info, n int, line bool) (submissions []Submission, err error)

type SioInstanceClient added in v0.6.0

type SioInstanceClient int
const (
	Staszic SioInstanceClient = 0
	Mimuw   SioInstanceClient = 1
)

type StatisInfo

type StatisInfo struct {
	ID     string
	Name   string
	Alias  string
	Round  string
	Points string
}

func (*StatisInfo) ParsePoint

func (prob *StatisInfo) ParsePoint() string

type Submission

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

func (*Submission) ParseID

func (s *Submission) ParseID() string

func (*Submission) ParsePoints

func (s *Submission) ParsePoints() string

func (*Submission) ParseStatus

func (s *Submission) ParseStatus() string

Jump to

Keyboard shortcuts

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