Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
devops committed May 13, 2024
2 parents 853aa74 + 773c83e commit 5adc07f
Show file tree
Hide file tree
Showing 5 changed files with 234 additions and 30 deletions.
46 changes: 43 additions & 3 deletions pyk/src/pyk/cli/args.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

import sys
from argparse import ArgumentParser
from argparse import ArgumentParser, FileType
from functools import cached_property
from pathlib import Path
from typing import IO, TYPE_CHECKING, Any
Expand All @@ -11,7 +11,7 @@
from .utils import bug_report_arg, dir_path, ensure_dir_path, file_path

if TYPE_CHECKING:
from collections.abc import Iterable
from collections.abc import Callable, Iterable

from ..utils import BugReport

Expand Down Expand Up @@ -52,6 +52,10 @@ def from_option_string() -> dict[str, Any]:
'w2e': 'warning_to_error',
}

@staticmethod
def get_argument_type() -> dict[str, Callable]:
return {'warnings': Warnings}


class OutputFileOptions(Options):
output_file: IO[Any]
Expand All @@ -62,17 +66,27 @@ def default() -> dict[str, Any]:
'output_file': sys.stdout,
}

@staticmethod
def get_argument_type() -> dict[str, Callable]:
return {'output-file': FileType('w')}


class DefinitionOptions(Options):
definition_dir: Path

@staticmethod
def default() -> dict[str, Any]:
def from_option_string() -> dict[str, Any]:
return {
'output-definition': 'definition_dir',
'definition': 'definition_dir',
}

@staticmethod
def get_argument_type() -> dict[str, Callable]:
return {
'definition': dir_path,
}


class DisplayOptions(Options):
minimize: bool
Expand Down Expand Up @@ -119,6 +133,13 @@ def default() -> dict[str, Any]:
'temp_directory': None,
}

@staticmethod
def get_argument_type() -> dict[str, Callable]:
return {
'save-directory': ensure_dir_path,
'temp-directory': ensure_dir_path,
}


class SpecOptions(SaveDirOptions):
spec_file: Path
Expand All @@ -141,6 +162,12 @@ def from_option_string() -> dict[str, str]:
'exclude-claim': 'exclude_claim_labels',
}

@staticmethod
def get_argument_type() -> dict[str, Callable]:
return {
'spec_file': file_path,
}


class KompileOptions(Options):
emit_json: bool
Expand Down Expand Up @@ -199,6 +226,13 @@ def from_option_string() -> dict[str, str]:
'O3': 'o3',
}

@staticmethod
def get_argument_type() -> dict[str, Callable]:
return {
'llvm-kompile-type': LLVMKompileType,
'llvm-kompile-output': Path,
}


class ParallelOptions(Options):
workers: int
Expand All @@ -223,6 +257,12 @@ class BugReportOptions(Options):
def default() -> dict[str, Any]:
return {'bug_report': None}

@staticmethod
def get_argument_type() -> dict[str, Callable]:
return {
'bug-report': bug_report_arg,
}


class SMTOptions(Options):
smt_timeout: int
Expand Down
9 changes: 8 additions & 1 deletion pyk/src/pyk/cli/cli.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
from __future__ import annotations

from typing import Any
from typing import TYPE_CHECKING, Any

if TYPE_CHECKING:
from collections.abc import Callable


class Options:
Expand All @@ -20,3 +23,7 @@ def __init__(self, args: dict[str, Any]) -> None:
@staticmethod
def from_option_string() -> dict[str, str]:
return {}

@staticmethod
def get_argument_type() -> dict[str, Callable]:
return {}
Loading

0 comments on commit 5adc07f

Please sign in to comment.