class_docstr: See default_options at the end of this module for a list of all possible
  options and CmdLine.usage and CmdLine.parse_command_line() for their
  meaning.
class_docstr_tok: ["See","default_options","at","the","end","of","this","module","for","a","list","of","all","possible","options","and","CmdLine.usage","and","CmdLine.parse_command_line","(",")","for","their","meaning","."]
code: def __init__(self, defaults=None, **kw):
      self.include_path = []
      if defaults:
          if isinstance(defaults, CompilationOptions):
              defaults = defaults.__dict__
      else:
          defaults = default_options
  
      options = dict(defaults)
      options.update(kw)
  
      # let's assume 'default_options' contains a value for most known compiler options
      # and validate against them
      unknown_options = set(options) - set(default_options)
      # ignore valid options that are not in the defaults
      unknown_options.difference_update(["include_path"])
      if unknown_options:
          message = (
              "got unknown compilation option%s, please remove: %s"
              % (
                  "s" if len(unknown_options) > 1 else "",
                  ", ".join(unknown_options),
              )
          )
          raise ValueError(message)
  
      directive_defaults = Options.get_directive_defaults()
      directives = dict(
          options["compiler_directives"]
      )  # copy mutable field
      # check for invalid directives
      unknown_directives = set(directives) - set(directive_defaults)
      if unknown_directives:
          message = "got unknown compiler directive%s: %s" % (
              "s" if len(unknown_directives) > 1 else "",
              ", ".join(unknown_directives),
          )
          raise ValueError(message)
      options["compiler_directives"] = directives
      if directives.get("np_pythran", False) and not options["cplus"]:
          import warnings
  
          warnings.warn("C++ mode forced when in Pythran mode!")
          options["cplus"] = True
      if "language_level" in directives and "language_level" not in kw:
          options["language_level"] = directives["language_level"]
      elif not options.get("language_level"):
          options["language_level"] = directive_defaults.get(
              "language_level"
          )
      if "formal_grammar" in directives and "formal_grammar" not in kw:
          options["formal_grammar"] = directives["formal_grammar"]
      if options["cache"] is True:
          options["cache"] = os.path.join(
              Utils.get_cython_cache_dir(), "compiler"
          )
  
      self.__dict__.update(options)
  
imports: from __future__ import absolute_import
  import os
  import re
  import sys
  import io
  from .None import Errors
  from .StringEncoding import EncodedString
  from .Scanning import PyrexScanner, FileSourceDescriptor
  from .Errors import PyrexError, CompileError, error, warning
  from .Symtab import ModuleScope
  from ..None import Utils
  from .None import Options
  from .None import Version
label_desc: Use image node_id 1 to create a new CompilationOptions object from inherited base classes: object with example: obj = CompilationOptions(defaults)