This repository was archived by the owner on Apr 4, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathconfig.py
52 lines (35 loc) · 1.59 KB
/
config.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
"""Configurations."""
from pathlib import Path
import click
from util.config import Config, Option
class MainConfig(Config):
"""Global configurations for all commands."""
report: Option[bool] = Option(
'Output a report after a task has completed.', default=False)
progress: Option[bool] = Option(
'Print the progress of a task.', default=False)
dataset: Option[str] = Option(
'The name of the dataset to create/use', final=True)
output: Option[Path] = Option(
'Output directory', click_type=click.Path(
file_okay=False, dir_okay=True, writable=True,
resolve_path=True),
converter=lambda p: Path(str(p)),
default=Path('data'), final=True)
force: Option[bool] = Option(
'Force regeneration of cached results', default=False)
@property
def output_directory(self) -> Path:
"""Get the output directory."""
return self.output / self.dataset
class ExtractRoleMetadataConfig(MainConfig):
"""Configuration for role metadata extraction."""
count: Option[int] = Option('Top number of roles to keep', required=False)
class CloneConfig(MainConfig):
"""Configuration for cloning."""
resume: Option[bool] = Option(
'Resuming cloning from a previous run.', default=True)
class ExtractStructuralModelsConfig(MainConfig):
"""Configuration for structural model extraction."""
commits: Option[bool] = Option(
'Extract a structural model for each commit. If disabled, extracts for semantic versions only.', default=False)