コード例 #1
0
ファイル: discover.py プロジェクト: degreepath-core/auditor
try:
    import psycopg2  # type: ignore
except ImportError:
    psycopg2 = None

from dp import AreaOfStudy, Constants
from dp.base import Rule
from dp.predicate_clause import PredicateCompoundAnd, PredicateCompoundOr, PredicateNot, Predicate, ConditionalPredicate, SomePredicate
from dp.assertion_clause import Assertion, ConditionalAssertion, AnyAssertion, DynamicConditionalAssertion
from dp.rule.course import CourseRule
from dp.rule.count import CountRule
from dp.rule.proficiency import ProficiencyRule
from dp.rule.query import QueryRule
from dp.rule.requirement import RequirementRule

load_dotenv()

CourseReference = namedtuple('CourseReference', ['code', 'course', 'crsid'])
BucketReference = namedtuple('BucketReference', ['code', 'catalog', 'bucket'])


def main() -> None:
    parser = argparse.ArgumentParser()
    parser.add_argument('files', nargs='+')
    parser.add_argument('--insert', default=False, action='store_true')
    args = parser.parse_args()

    files: List[str] = args.files
    courses: Set[CourseReference] = set()
    buckets: Set[BucketReference] = set()
コード例 #2
0
ファイル: cli.py プロジェクト: degreepath-core/auditor
import argparse
import pathlib
import logging

import psycopg2  # type: ignore
import psycopg2.extensions  # type: ignore

from dp.run import load_area, load_student
from .audit import audit

from dp.dotenv import load as load_dotenv
# always resolve to the local .env file
dotenv_path = pathlib.Path(__file__).parent.parent.parent / '.env'
load_dotenv(filepath=dotenv_path)

logger = logging.getLogger(__name__)


def main() -> None:
    parser = argparse.ArgumentParser()
    parser.add_argument("--area",
                        dest="area_file",
                        metavar="AREA",
                        required=True,
                        help="the yaml specification of the area")
    parser.add_argument("--student",
                        dest="student_file",
                        metavar="STUDENT",
                        required=True,
                        help="the json version of the student data")
    parser.add_argument("--run",