# mini_buildd.builtins module

mini_buildd.builtins.mbd_sorted(iterable)

  Just do (python) sorting – useful for models that use custom python ordering

mini_buildd.builtins.mbd_menu_active(context, name)

mini_buildd.builtins.mbd_get(obj)

  Identity function. Handy to set variables in templates (`{% mbd_get some_value as myvar %}`)

mini_buildd.builtins.mbd_dict_get(dict_, key, default=None)

  Get value from dict even if the key has a special name (like hyphens in a changes file field), or is in another variable

mini_buildd.builtins.mbd_fromtimestamp(stamp)

mini_buildd.builtins.mbd_parent(path)

  Get parent path (uri), always w/ trailing slash

      >>> mbd_parent("/parent/file")
      '/parent/'
      >>> mbd_parent("/parent/dir/")
      '/parent/'
      >>> mbd_parent("/parent/dir/dir/")
      '/parent/dir/'

mini_buildd.builtins.mbd_basename(path)

mini_buildd.builtins.mbd_join(path, *paths)

mini_buildd.builtins.mbd_jsonpp(obj)

  Get pretty print from json-serializable object

mini_buildd.builtins.mbd_token()

mini_buildd.builtins.mbd_hash(data)

mini_buildd.builtins.mbd_codename(diststr)

  Get codename from diststr. On any error, just return empty string

mini_buildd.builtins.mbd_repository(diststr)

  Get repository from diststr. On any error, just return empty string

mini_buildd.builtins.mbd_model_stats(model)

mini_buildd.builtins.mbd_absolute_uri(context, location)

mini_buildd.builtins.mbd_api(context, call, name=None, hide_options=False, verbose=False, popup=True, **kwargs)

mini_buildd.builtins.mbd_sbuild_status(bres)

class mini_buildd.builtins.PlainFilter(content, file_path, uri, title)

  Bases: `dict`

  Enrich plain text with HTML hints (TOC)

  Note

  http://tools.ietf.org/html/rfc5147: This, in theory, could be some way to create a TOC for text/plain (buildlogs and such). However

  - RFC only describes line/char based links, not text matching based (so scanning the text file would be needed still)

  - As it seems, main browsers simply don’t support it * https://bugzilla.mozilla.org/show_bug.cgi?id=660583 * https://bugs.chromium.org/p/chromium/issues/detail?id=77024

  ALLOWED_MIME_TYPES = ['application/json']

    Allow (non ‘text/’) mime types

  ALLOWED_EXTENSIONS = ['buildlog', 'changes', 'dsc', 'buildinfo', 'log', 'upload']

    Allow extensions that have no official mime type

  ALLOWED_FILES = ['InRelease', 'Release', 'Sources', 'Packages', '.sbuildrc']

    Allow complete (base) file names

  ok_to_filter(file_path)
  BUILDLOG_INDEX_REGEXES = [(re.compile('\\| (.*) \\|'), 1, 'mbd-info'), (re.compile('^MINI_BUILDD: .+'), 0, 'mbd-info'), (re.compile('.*make.*\\*\\*\\*.*'), 0, 'mbd-error'), (re.compile('(^W(ARNING)?: .+)|(^W(ARN)?: .+)', re.IGNORECASE), 0, 'mbd-warning'), (re.compile('(^E(RROR)?: .+)|(^E(RR)?: .+)', re.IGNORECASE), 0, 'mbd-error'), (re.compile('(^C(RITICAL)?: .+)|(^C(RIT)?: .+)', re.IGNORECASE), 0, 'mbd-error')]

    Regex filters for `*.buildlog`.

  LOG_INDEX_REGEXES = [(re.compile('^.+ W: (.*)', re.IGNORECASE), 0, 'mbd-warning'), (re.compile('^.+ E: (.*)', re.IGNORECASE), 0, 'mbd-error'), (re.compile('^.+ C: (.*)', re.IGNORECASE), 0, 'mbd-error')]

    Regex filters for `*.log`.

  regex_filter(file_path, regexes)
  filter_buildlog(file_path)
  filter_log(file_path)
  classmethod filter_json(file_path)
  classmethod filter_default(file_path)

mini_buildd.builtins.mbd_file(content=None, file_path=None, uri=None, title=None)

mini_buildd.builtins.mbd_datatable(identity, order=None, columns='null')