Compare commits
No commits in common. "3fecffe676515e3af7c9297c300bc5b6677d4d82" and "8465e707725940c2fccf7dcdcbfe832da258003f" have entirely different histories.
3fecffe676
...
8465e70772
3 changed files with 1 additions and 32 deletions
|
|
@ -8,7 +8,6 @@
|
||||||
---@field extension string
|
---@field extension string
|
||||||
---@field commands CpLangCommands
|
---@field commands CpLangCommands
|
||||||
---@field template? string
|
---@field template? string
|
||||||
---@field submit_id? string
|
|
||||||
|
|
||||||
---@class CpTemplatesConfig
|
---@class CpTemplatesConfig
|
||||||
---@field cursor_marker? string
|
---@field cursor_marker? string
|
||||||
|
|
@ -17,7 +16,6 @@
|
||||||
---@field extension? string
|
---@field extension? string
|
||||||
---@field commands? CpLangCommands
|
---@field commands? CpLangCommands
|
||||||
---@field template? string
|
---@field template? string
|
||||||
---@field submit_id? string
|
|
||||||
|
|
||||||
---@class CpPlatform
|
---@class CpPlatform
|
||||||
---@field enabled_languages string[]
|
---@field enabled_languages string[]
|
||||||
|
|
@ -295,9 +293,6 @@ local function merge_lang(base, ov)
|
||||||
if ov.template then
|
if ov.template then
|
||||||
out.template = ov.template
|
out.template = ov.template
|
||||||
end
|
end
|
||||||
if ov.submit_id then
|
|
||||||
out.submit_id = ov.submit_id
|
|
||||||
end
|
|
||||||
return out
|
return out
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
local cache = require('cp.cache')
|
local cache = require('cp.cache')
|
||||||
local config = require('cp.config')
|
|
||||||
local logger = require('cp.log')
|
local logger = require('cp.log')
|
||||||
local state = require('cp.state')
|
local state = require('cp.state')
|
||||||
|
|
||||||
|
|
@ -57,12 +56,6 @@ function M.submit(opts)
|
||||||
end
|
end
|
||||||
source_file = vim.fn.fnamemodify(source_file, ':p')
|
source_file = vim.fn.fnamemodify(source_file, ':p')
|
||||||
|
|
||||||
local lang_result = config.get_language_for_platform(platform, language)
|
|
||||||
local submit_language = language
|
|
||||||
if lang_result.valid and lang_result.effective and lang_result.effective.submit_id then
|
|
||||||
submit_language = lang_result.effective.submit_id
|
|
||||||
end
|
|
||||||
|
|
||||||
prompt_credentials(platform, function(creds)
|
prompt_credentials(platform, function(creds)
|
||||||
vim.cmd.update()
|
vim.cmd.update()
|
||||||
vim.notify('[cp.nvim] Submitting...', vim.log.levels.INFO)
|
vim.notify('[cp.nvim] Submitting...', vim.log.levels.INFO)
|
||||||
|
|
@ -71,7 +64,7 @@ function M.submit(opts)
|
||||||
platform,
|
platform,
|
||||||
contest_id,
|
contest_id,
|
||||||
problem_id,
|
problem_id,
|
||||||
submit_language,
|
language,
|
||||||
source_file,
|
source_file,
|
||||||
creds,
|
creds,
|
||||||
function(ev)
|
function(ev)
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from scrapers.language_ids import LANGUAGE_IDS, get_language_id
|
|
||||||
from scrapers.models import (
|
from scrapers.models import (
|
||||||
ContestListResult,
|
ContestListResult,
|
||||||
MetadataResult,
|
MetadataResult,
|
||||||
|
|
@ -138,21 +137,3 @@ def test_scraper_metadata_error(run_scraper_offline, scraper, contest_id):
|
||||||
assert objs
|
assert objs
|
||||||
assert objs[-1].get("success") is False
|
assert objs[-1].get("success") is False
|
||||||
assert objs[-1].get("error")
|
assert objs[-1].get("error")
|
||||||
|
|
||||||
|
|
||||||
EXPECTED_PLATFORMS = {"atcoder", "codeforces", "cses", "usaco", "kattis", "codechef"}
|
|
||||||
EXPECTED_LANGUAGES = {"cpp", "python"}
|
|
||||||
|
|
||||||
|
|
||||||
def test_language_ids_coverage():
|
|
||||||
assert set(LANGUAGE_IDS.keys()) == EXPECTED_PLATFORMS
|
|
||||||
for platform in EXPECTED_PLATFORMS:
|
|
||||||
for lang in EXPECTED_LANGUAGES:
|
|
||||||
lid = get_language_id(platform, lang)
|
|
||||||
assert lid is not None, f"Missing language ID: {platform}/{lang}"
|
|
||||||
assert isinstance(lid, str) and lid, f"Empty language ID: {platform}/{lang}"
|
|
||||||
|
|
||||||
|
|
||||||
def test_language_ids_unknown_returns_none():
|
|
||||||
assert get_language_id("codeforces", "rust") is None
|
|
||||||
assert get_language_id("nonexistent", "cpp") is None
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue