import os
from .core import LogFileOutput, MapperOutput, computed  # noqa: F401
from .core.plugins import mapper, reducer, make_response, make_metadata  # noqa: F401
from .mappers import get_active_lines  # noqa: F401
from .util import defaults, parse_table  # noqa: F401

__here__ = os.path.dirname(os.path.abspath(__file__))
VERSION = "1.9.0"
NAME = "falafel"

with open(os.path.join(__here__, "RELEASE")) as f:
    RELEASE = f.read().strip()

with open(os.path.join(__here__, "COMMIT")) as f:
    COMMIT = f.read().strip()


def get_nvr():
    return "{0}-{1}-{2}".format(NAME, VERSION, RELEASE)

import os
from .core import LogFileOutput, MapperOutput, computed  # noqa: F401
from .core.plugins import mapper, reducer, make_response, make_metadata  # noqa: F401
from .mappers import get_active_lines  # noqa: F401
from .util import defaults, parse_table  # noqa: F401

__here__ = os.path.dirname(os.path.abspath(__file__))
VERSION = "1.9.0"
NAME = "falafel"

with open(os.path.join(__here__, "RELEASE")) as f:
    RELEASE = f.read().strip()

with open(os.path.join(__here__, "COMMIT")) as f:
    COMMIT = f.read().strip()


def get_nvr():
    return "{0}-{1}-{2}".format(NAME, VERSION, RELEASE)

RULES_STATUS = {}
"""
Mapping of dictionaries containing nvr and commitid for each rule repo included
in this instance

{"rule_repo_1": {"version": nvr(), "commit": sha1}}
"""


def add_status(name, nvr, commit):
    """
    Rule repositories should call this method in their package __init__ to
    register their version information.
    """
    RULES_STATUS[name] = {"version": nvr, "commit": commit}

Allow rule repos to provide version information
Allow rule repos to provide version information

Added a new method to the root package `add_status`.

Rule repos should use it during initialization:

import falafel
falafel.add_status(name="my_rule_repo", nvr="my-rules-1.0.0-1", commit="abcdef")

  import os
  from .core import LogFileOutput, MapperOutput, computed  # noqa: F401
  from .core.plugins import mapper, reducer, make_response, make_metadata  # noqa: F401
  from .mappers import get_active_lines  # noqa: F401
  from .util import defaults, parse_table  # noqa: F401
  
  __here__ = os.path.dirname(os.path.abspath(__file__))
  VERSION = "1.9.0"
  NAME = "falafel"
  
  with open(os.path.join(__here__, "RELEASE")) as f:
      RELEASE = f.read().strip()
  
  with open(os.path.join(__here__, "COMMIT")) as f:
      COMMIT = f.read().strip()
  
  
  def get_nvr():
      return "{0}-{1}-{2}".format(NAME, VERSION, RELEASE)
  
+ RULES_STATUS = {}
+ """
+ Mapping of dictionaries containing nvr and commitid for each rule repo included
+ in this instance
+ 
+ {"rule_repo_1": {"version": nvr(), "commit": sha1}}
+ """
+ 
+ 
+ def add_status(name, nvr, commit):
+     """
+     Rule repositories should call this method in their package __init__ to
+     register their version information.
+     """
+     RULES_STATUS[name] = {"version": nvr, "commit": commit}
+ 
Allow rule repos to provide version information
## Code Before:
import os
from .core import LogFileOutput, MapperOutput, computed  # noqa: F401
from .core.plugins import mapper, reducer, make_response, make_metadata  # noqa: F401
from .mappers import get_active_lines  # noqa: F401
from .util import defaults, parse_table  # noqa: F401

__here__ = os.path.dirname(os.path.abspath(__file__))
VERSION = "1.9.0"
NAME = "falafel"

with open(os.path.join(__here__, "RELEASE")) as f:
    RELEASE = f.read().strip()

with open(os.path.join(__here__, "COMMIT")) as f:
    COMMIT = f.read().strip()


def get_nvr():
    return "{0}-{1}-{2}".format(NAME, VERSION, RELEASE)

## Instruction:
Allow rule repos to provide version information
## Code After:
import os
from .core import LogFileOutput, MapperOutput, computed  # noqa: F401
from .core.plugins import mapper, reducer, make_response, make_metadata  # noqa: F401
from .mappers import get_active_lines  # noqa: F401
from .util import defaults, parse_table  # noqa: F401

__here__ = os.path.dirname(os.path.abspath(__file__))
VERSION = "1.9.0"
NAME = "falafel"

with open(os.path.join(__here__, "RELEASE")) as f:
    RELEASE = f.read().strip()

with open(os.path.join(__here__, "COMMIT")) as f:
    COMMIT = f.read().strip()


def get_nvr():
    return "{0}-{1}-{2}".format(NAME, VERSION, RELEASE)

RULES_STATUS = {}
"""
Mapping of dictionaries containing nvr and commitid for each rule repo included
in this instance

{"rule_repo_1": {"version": nvr(), "commit": sha1}}
"""


def add_status(name, nvr, commit):
    """
    Rule repositories should call this method in their package __init__ to
    register their version information.
    """
    RULES_STATUS[name] = {"version": nvr, "commit": commit}
