Skip to content
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

Refactor user config path setting #257

Merged
merged 2 commits into from
Jun 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions atcodertools/tools/compiler.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
#!/usr/bin/python3
import argparse
from os.path import expanduser

from atcodertools.executils.run_command import run_command_with_returncode
from atcodertools.tools.models.metadata import Metadata
from atcodertools.common.language import Language
import os
import pathlib
from atcodertools.config.config import Config, ConfigType
from atcodertools.config.config import Config, ConfigType, USER_CONFIG_PATH
from atcodertools.tools import get_default_config_path

USER_CONFIG_PATH = os.path.join(expanduser("~"), ".atcodertools.toml")


class BadStatusCodeException(Exception):
pass
Expand Down
7 changes: 1 addition & 6 deletions atcodertools/tools/envgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import sys
import traceback
from multiprocessing import Pool, cpu_count
from os.path import expanduser
import time
from typing import Tuple

Expand All @@ -28,7 +27,7 @@
from atcodertools.tools import get_default_config_path
from atcodertools.tools.models.metadata import Metadata
from atcodertools.tools.utils import with_color
from atcodertools.config.config import ConfigType
from atcodertools.config.config import ConfigType, USER_CONFIG_PATH


class BannedFileDetectedError(Exception):
Expand Down Expand Up @@ -223,10 +222,6 @@ def prepare_contest(atcoder_client: AtCoderClient,
contest_dir_path)


USER_CONFIG_PATH = os.path.join(
expanduser("~"), ".atcodertools.toml")


def get_config(args: argparse.Namespace) -> Config:
def _load(path: str) -> Config:
logger.info("Going to load {} as config".format(path))
Expand Down
Loading