コード例 #1
0
ファイル: has_dir_path.py プロジェクト: rohit507/exam_gen
import attr
import inspect
import textwrap
import os

from pprint import *
from pathlib import *

import exam_gen.util.logging as logging

log = logging.new(__name__, level="WARNING")


@attr.s
class HasDirPath():
    """
    Helps handle path and file lookup information esp. handling links that are
    written relative to a specific file or definition.

    Parameters:

      root_dir (Path): A path to the root directory for this object.

      parent_obj (HasDirPath): A parent object that should have a
        `root_dir` in the same directory or a parent directory of this one.

      parent_path (Path): A path that should be a parent of, or equal to, this
        object's root directory. Usually derived from `parent_obj`.
    """

    root_dir = attr.ib(default=None, kw_only=True)
コード例 #2
0
import shutil

from pprint import *
from pathlib import *

from ..document import Document
from ..buildable import Buildable
from ..templated import Templated, build_template_spec

from exam_gen.util.file_ops import dump_str, dump_yaml

import exam_gen.util.logging as logging

import os

log = logging.new(__name__, level="DEBUG")


class LatexDoc(Buildable, Templated):
    """
    Specializes the document type for latex
    """

    settings.template.format_dir = "latex"

    settings.template.format_ext = "tex"

    settings.build.new_value('latex_command',
                             default='pdflatex',
                             doc="""
        The actual command line application that will be used to build the
コード例 #3
0
ファイル: value.py プロジェクト: rohit507/exam_gen
import inspect
import textwrap
from pprint import *

import attr

import exam_gen.util.logging as logging

log = logging.new(__name__)

@attr.s
class ConfigValue():
    """
    This is an internal class that stores a single configuration value.

    Attributes:

       value (Any): The actual value stored. Ideally only immutable terms go
          here. It's a default term if ctxt is a class, an actual setting
          value otherwise.

       doc (str): The docstring for the value. Will be used when docs are
          generated for any configuration superclasses.

       ctxt (Class or Instance): The location where the default or runtime
          value was last set.

       path (List[str]): The chain of attributes that you need to walk in
          order to get to this element from the root config group.
    """