codeforces_client

package
v0.12.3 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: MIT Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const ErrorCodeforcesIsUnavailable = "codeforces is unavailable (check your internet connection)"
View Source
const ErrorNeedContestID = "you have to specify the Contest ID"
View Source
const ErrorNeedGroupID = "you have to specify the Group ID"
View Source
const ErrorNeedGymID = "you have to specify the Gym ID"
View Source
const ErrorNeedProblemID = "you have to specify the Problem ID"
View Source
const ErrorNeedSubmissionID = "you have to specify the Submission ID"
View Source
const ErrorNotSupportAcmsguru = "not support acmsguru"
View Source
const ErrorSkip = "exists, skip"
View Source
const ErrorUnknownType = "unknown type"

Variables

View Source
var ErrorNotLogged = "not logged in"
View Source
var Langs = map[string]string{
	"43": "GNU GCC C11 5.1.0",
	"80": "Clang++20 Diagnostics",
	"52": "Clang++17 Diagnostics",
	"50": "GNU G++14 6.4.0",
	"54": "GNU G++17 7.3.0",
	"73": "GNU G++20 11.2.0 (64 bit, winlibs)",
	"59": "Microsoft Visual C++ 2017",
	"61": "GNU G++17 9.2.0 (64 bit, msys 2)",
	"65": "C# 8, .NET Core 3.1",
	"79": "C# 10, .NET SDK 6.0",
	"9":  "C# Mono 6.8",
	"28": "D DMD32 v2.091.0",
	"32": "Go 1.19",
	"12": "Haskell GHC 8.10.1",
	"60": "Java 11.0.6",
	"74": "Java 17 64bit",
	"36": "Java 1.8.0_241",
	"48": "Kotlin 1.4.31",
	"72": "Kotlin 1.5.31",
	"77": "Kotlin 1.6.10",
	"19": "OCaml 4.02.1",
	"3":  "Delphi 7",
	"4":  "Free Pascal 3.0.2",
	"51": "PascalABC.NET 3.4.2",
	"13": "Perl 5.20.1",
	"6":  "PHP 8.1.7",
	"7":  "Python 2.7.18",
	"31": "Python 3.8.10",
	"40": "PyPy 2.7.13 (7.3.0)",
	"41": "PyPy 3.6.9 (7.3.0)",
	"70": "PyPy 3.9.10 (7.3.9, 64bit)",
	"67": "Ruby 3.0.0",
	"75": "Rust 1.64.0 (2021)",
	"20": "Scala 2.12.8",
	"34": "JavaScript V8 4.8.0",
	"55": "Node.js 12.16.3",
	"14": "ActiveTcl 8.5",
	"15": "Io-2008-01-07 (Win32)",
	"17": "Pike 7.8",
	"18": "Befunge",
	"22": "OpenCobol 1.0",
	"25": "Factor",
	"26": "Secret_171",
	"27": "Roco",
	"33": "Ada GNAT 4",
	"38": "Mysterious Language",
	"39": "FALSE",
	"44": "Picat 0.9",
	"47": "J",
	"56": "Microsoft Q#",
	"57": "Text",
	"62": "UnknownX",
	"68": "Secret 2021",
}

Langs generated by ^[\s\S]*?value="(.+?)"[\s\S]*?>([\s\S]+?)<[\s\S]*?$

"\1": "\2",
View Source
var LangsExt = map[string]string{
	"GNU C11":               "c",
	"Clang++17 Diagnostics": "cpp",
	"GNU C++0x":             "cpp",
	"GNU C++":               "cpp",
	"GNU C++11":             "cpp",
	"GNU C++14":             "cpp",
	"GNU C++17":             "cpp",
	"MS C++":                "cpp",
	"MS C++ 2017":           "cpp",
	"Mono C#":               "cs",
	"D":                     "d",
	"Go":                    "go",
	"Haskell":               "hs",
	"Kotlin":                "kt",
	"Ocaml":                 "ml",
	"Delphi":                "pas",
	"FPC":                   "pas",
	"PascalABC.NET":         "pas",
	"Perl":                  "pl",
	"PHP":                   "php",
	"Python 2":              "py",
	"Python 3":              "py",
	"PyPy 2":                "py",
	"PyPy 3":                "py",
	"Ruby":                  "rb",
	"Rust":                  "rs",
	"JavaScript":            "js",
	"Node.js":               "js",
	"Q#":                    "qs",
	"Java":                  "java",
	"Java 6":                "java",
	"Java 7":                "java",
	"Java 8":                "java",
	"Java 9":                "java",
	"Java 10":               "java",
	"Java 11":               "java",
	"Tcl":                   "tcl",
	"F#":                    "fs",
	"Befunge":               "bf",
	"Pike":                  "pike",
	"Io":                    "io",
	"Factor":                "factor",
	"Cobol":                 "cbl",
	"Secret_171":            "secret_171",
	"Ada":                   "adb",
	"FALSE":                 "f",
	"":                      "txt",
}

LangsExt language's ext

View Source
var ProblemTypes = [...]string{
	"contest",
	"gym",
	"group",
	"acmsguru",
}

Functions

func AesDecrypt

func AesDecrypt(cipherIn []byte, key, iv []byte) ([]byte, error)

func Init

func Init(path, host, proxy string)

Types

type CodeforcesClient

type CodeforcesClient struct {
	Jar            *cookiejar.Jar `json:"cookies"`
	Handle         string         `json:"handle"`
	HandleOrEmail  string         `json:"handle_or_email"`
	Password       string         `json:"password"`
	Ftaa           string         `json:"ftaa"`
	Bfaa           string         `json:"bfaa"`
	LastSubmission *Info          `json:"last_submission"`
	// contains filtered or unexported fields
}
var Instance *CodeforcesClient

func (*CodeforcesClient) ConfigLogin

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

func (*CodeforcesClient) DecryptPassword

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

func (*CodeforcesClient) Login

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

func (*CodeforcesClient) Parse

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

func (*CodeforcesClient) ParseProblem

func (c *CodeforcesClient) ParseProblem(URL, path string, mu *sync.Mutex) (name string, samples int, standardIO bool, perf util.Performance, err error)

func (*CodeforcesClient) Ping added in v0.7.1

func (c *CodeforcesClient) Ping() (err error)

func (*CodeforcesClient) Pull

func (c *CodeforcesClient) Pull(info Info, rootPath string, ac bool) (err error)

func (*CodeforcesClient) PullCode

func (c *CodeforcesClient) PullCode(URL, path, ext string, rename bool) (filename string, err error)

func (*CodeforcesClient) RaceContest

func (c *CodeforcesClient) RaceContest(info Info) (err error)

func (*CodeforcesClient) Statis

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

func (*CodeforcesClient) Submit

func (c *CodeforcesClient) Submit(info Info, langID, source string) (err error)

func (*CodeforcesClient) WatchSubmission

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

type Info

type Info struct {
	ProblemType  string `json:"problem_type"`
	ContestID    string `json:"contest_id"`
	GroupID      string `json:"group_id"`
	ProblemID    string `json:"problem_id"`
	SubmissionID string `json:"submission_id"`
	RootPath     string
}

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) PackagePath added in v0.8.0

func (info *Info) PackagePath() (string, error)

func (*Info) Path

func (info *Info) Path() string

func (*Info) ProblemSetURL

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

func (*Info) ProblemURL

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

func (*Info) StandingsURL

func (info *Info) StandingsURL(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)

type StatisInfo

type StatisInfo struct {
	ID     string
	Name   string
	IO     string
	Limit  string
	Passed string
	State  string
}

type Submission

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

func (*Submission) ParseID

func (s *Submission) ParseID() string

func (*Submission) ParseMemory

func (s *Submission) ParseMemory() string

func (*Submission) ParseProblemIndex

func (s *Submission) ParseProblemIndex() string

func (*Submission) ParseStatus

func (s *Submission) ParseStatus() string

func (*Submission) ParseTime

func (s *Submission) ParseTime() string

Jump to

Keyboard shortcuts

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