-
Notifications
You must be signed in to change notification settings - Fork 6
SIO3Pack integration #288
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
MasloMaslane
wants to merge
26
commits into
main
Choose a base branch
from
SIO3Pack
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
SIO3Pack integration #288
Changes from 2 commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
1dba2fc
wip
SZonkil b648dbf
Change version
MasloMaslane fd1799e
wip 2
SZonkil 578e832
package_util wip
SZonkil fc0458e
package_util wip2
SZonkil 3399772
package_util wip3
SZonkil 876d99a
package_util wip4
SZonkil 7f3ee8a
Use package_utils
geoff128 c7d9e2a
import fixes
SZonkil 7c8a47d
gaming
SZonkil f2e4549
Changes
geoff128 82f41b8
WIP
geoff128 3b28887
WIP
geoff128 102449e
Fixes
geoff128 e728737
Fix sorting tests
geoff128 ebe7bba
Bump SIO3Pack version
MasloMaslane f5411ff
Terrible fix for sio2jail not working on some WSLs
MasloMaslane 68962c8
Remove debug
MasloMaslane 5b27dc2
Validate tests in sio3pack
MasloMaslane a28a47d
Minor changes
MasloMaslane 9448e01
Merge branch 'main' into SIO3Pack
MasloMaslane 1f2bf0e
Properly format sio3pack errors
MasloMaslane 315051b
Bump Python versions
MasloMaslane 23a8fb8
Bump Python versions
MasloMaslane 71fc0ae
Update SIO3Pack version
MasloMaslane 88639b5
Almost fix macos tests
MasloMaslane File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,21 +10,13 @@ | |
from sinol_make.helpers.func_cache import cache_result | ||
from sinol_make import util, contest_types | ||
from sinol_make.helpers import paths | ||
from sinol_make.sio3pack.package import Sio3Package | ||
from sinol_make.task_type import BaseTaskType | ||
|
||
|
||
@cache_result(cwd=True) | ||
def get_task_id() -> str: | ||
config = get_config() | ||
if "sinol_task_id" in config: | ||
return config["sinol_task_id"] | ||
else: | ||
print(util.warning("sinol_task_id not specified in config.yml. Using task id from directory name.")) | ||
task_id = os.path.split(os.getcwd())[-1] | ||
if len(task_id) == 3: | ||
return task_id | ||
else: | ||
util.exit_with_error("Invalid task id. Task id should be 3 characters long.") | ||
return Sio3Package().get_task_id() | ||
|
||
|
||
def extract_test_id(test_path, task_id): | ||
|
@@ -53,14 +45,7 @@ def get_test_key(test, task_id): | |
|
||
|
||
def get_config(): | ||
try: | ||
with open(os.path.join(os.getcwd(), "config.yml"), "r") as config_file: | ||
return yaml.load(config_file, Loader=yaml.FullLoader) or {} | ||
except FileNotFoundError: | ||
# Potentially redundant with util:exit_if_not_package | ||
util.exit_with_error("You are not in a package directory (couldn't find config.yml in current directory).") | ||
except yaml.YAMLError as e: | ||
util.exit_with_error("config.yml is not a valid YAML. Fix it before continuing:\n" + str(e)) | ||
return Sio3Package().get_config() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no error handling:( |
||
|
||
|
||
def get_solutions_re(task_id: str) -> re.Pattern: | ||
|
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import os | ||
|
||
from sio3pack import Package | ||
from sio3pack import LocalFile | ||
|
||
|
||
def _get_local_file(): | ||
return LocalFile(os.getcwd()) | ||
|
||
|
||
class Sio3Package: | ||
""" | ||
Singleton class for package base class. | ||
""" | ||
|
||
_instance = None | ||
|
||
def __new__(cls) -> Package: | ||
if cls._instance is None: | ||
cls._instance = Package.from_file(_get_local_file()) | ||
return cls._instance | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sinol_task_id
in config should still be handled