# Path: monasca_api/common/repositories/model/sub_alarm_definition.py
# class SubAlarmDefinition(object):
#     def __init__(self, row=None, sub_expr=None):
#     def _init_dimensions(self, dimensions_str):
#     def expression(self):
#     def __hash__(self):
#     def __repr__(self):
#     def __eq__(self, other):
#     def same_key_fields(self, other):
# 
# Path: monasca_api/common/repositories/sqla/models.py
# def get_all_metadata():
# def create_a_model(metadata=None):
# def create_sadd_model(metadata=None):
# def create_aa_model(metadata=None):
# def create_md_model(metadata=None):
# def create_mde_model(metadata=None):
# def create_nm_model(metadata=None):
# def create_nmt_model(metadata=None):
# def create_mdd_model(metadata=None):
# def create_am_model(metadata=None):
# def create_ad_model(metadata=None):
# def create_sa_model(metadata=None):
# def create_sad_model(metadata=None):
#     def __init__(self, columns, separator=',', order_by=None):
# def _group_concat_oracle(element, compiler_, **kw):
# def _group_concat_postgresql(element, compiler_, **kw):
# def _group_concat_sybase(element, compiler_, **kw):
# def _group_concat_mysql(element, compiler_, **kw):
# def _group_concat_default(element, compiler_, **kw):
#     def __init__(self, column, fields):
# def _field_sort_mysql(element, compiler_, **kw):
# def _field_sort_general(element, compiler_, **kw):
# class group_concat(expression.ColumnElement):
# class field_sort(expression.ColumnElement):
# 
# Path: monasca_api/expression_parser/alarm_expr_parser.py
# _DETERMINISTIC_ASSIGNMENT_LEN = 3
# _DETERMINISTIC_ASSIGNMENT_SHORT_LEN = 1
# _DETERMINISTIC_ASSIGNMENT_VALUE_INDEX = 2
# _DEFAULT_PERIOD = 60
# _DEFAULT_PERIODS = 1
# COMMA = pyparsing.Suppress(pyparsing.Literal(","))
# LPAREN = pyparsing.Suppress(pyparsing.Literal("("))
# RPAREN = pyparsing.Suppress(pyparsing.Literal(")"))
# EQUAL = pyparsing.Literal("=")
# LBRACE = pyparsing.Suppress(pyparsing.Literal("{"))
# RBRACE = pyparsing.Suppress(pyparsing.Literal("}"))
# MINUS = pyparsing.Literal('-')
# AND = pyparsing.CaselessLiteral("and") | pyparsing.CaselessLiteral("&&")
# OR = pyparsing.CaselessLiteral("or") | pyparsing.CaselessLiteral("||")
# class SubExpr(object):
# class BinaryOp(object):
# class AndSubExpr(BinaryOp):
# class OrSubExpr(BinaryOp):
# class AlarmExprParser(object):
#     def __init__(self, tokens):
#     def fmtd_sub_expr_str(self):
#     def dimensions_str(self):
#     def operands_list(self):
#     def func(self):
#     def normalized_func(self):
#     def metric_name(self):
#     def normalized_metric_name(self):
#     def dimensions(self):
#     def dimensions_as_list(self):
#     def operator(self):
#     def threshold(self):
#     def period(self):
#     def periods(self):
#     def deterministic(self):
#     def normalized_operator(self):
#     def id(self):
#     def id(self, id):
#     def __init__(self, tokens):
#     def operands_list(self):
# def periodValidation(instr, loc, tokens):
# def periodsValidation(instr, loc, tokens):
#     def __init__(self, expr):
#     def sub_expr_list(self):
# def main():


import datetime
import fixtures
from oslo_config import cfg
from oslo_db.sqlalchemy.engines import create_engine
from sqlalchemy import delete, MetaData, insert, bindparam, select, func
from monasca_api.common.repositories import exceptions
from monasca_api.common.repositories.model import sub_alarm_definition
from monasca_api.common.repositories.sqla import models
from monasca_api.expression_parser import alarm_expr_parser
from monasca_api.tests import base
        from monasca_api.common.repositories.sqla import alarm_definitions_repository as adr
        from monasca_api.common.repositories import exceptions

        def _fake_engine_from_config(*args, **kw):
            return cls.engine

        cls.fixture = fixtures.MonkeyPatch(
            'sqlalchemy.create_engine', _fake_engine_from_config)
        cls.fixture.setUp()
        metadata = MetaData()

        cls.aa = models.create_aa_model(metadata)
        cls._delete_aa_query = delete(cls.aa)
        cls._insert_aa_query = (insert(cls.aa).values(
            alarm_definition_id=bindparam('alarm_definition_id'),
            alarm_state=bindparam('alarm_state'),
            action_id=bindparam('action_id')))

        cls.ad = models.create_ad_model(metadata)
        cls._delete_ad_query = delete(cls.ad)
        cls._insert_ad_query = (insert(cls.ad).values(
            id=bindparam('id'),
            tenant_id=bindparam('tenant_id'),
            name=bindparam('name'),
            severity=bindparam('severity'),
            expression=bindparam('expression'),
            match_by=bindparam('match_by'),
            actions_enabled=bindparam('actions_enabled'),
            created_at=bindparam('created_at'),
            updated_at=bindparam('updated_at'),
            deleted_at=bindparam('deleted_at')))


# Path: monasca_api/common/repositories/model/sub_alarm_definition.py
# class SubAlarmDefinition(object):
#     def __init__(self, row=None, sub_expr=None):
#     def _init_dimensions(self, dimensions_str):
#     def expression(self):
#     def __hash__(self):
#     def __repr__(self):
#     def __eq__(self, other):
#     def same_key_fields(self, other):
# 
# Path: monasca_api/common/repositories/sqla/models.py
# def get_all_metadata():
# def create_a_model(metadata=None):
# def create_sadd_model(metadata=None):
# def create_aa_model(metadata=None):
# def create_md_model(metadata=None):
# def create_mde_model(metadata=None):
# def create_nm_model(metadata=None):
# def create_nmt_model(metadata=None):
# def create_mdd_model(metadata=None):
# def create_am_model(metadata=None):
# def create_ad_model(metadata=None):
# def create_sa_model(metadata=None):
# def create_sad_model(metadata=None):
#     def __init__(self, columns, separator=',', order_by=None):
# def _group_concat_oracle(element, compiler_, **kw):
# def _group_concat_postgresql(element, compiler_, **kw):
# def _group_concat_sybase(element, compiler_, **kw):
# def _group_concat_mysql(element, compiler_, **kw):
# def _group_concat_default(element, compiler_, **kw):
#     def __init__(self, column, fields):
# def _field_sort_mysql(element, compiler_, **kw):
# def _field_sort_general(element, compiler_, **kw):
# class group_concat(expression.ColumnElement):
# class field_sort(expression.ColumnElement):
# 
# Path: monasca_api/expression_parser/alarm_expr_parser.py
# _DETERMINISTIC_ASSIGNMENT_LEN = 3
# _DETERMINISTIC_ASSIGNMENT_SHORT_LEN = 1
# _DETERMINISTIC_ASSIGNMENT_VALUE_INDEX = 2
# _DEFAULT_PERIOD = 60
# _DEFAULT_PERIODS = 1
# COMMA = pyparsing.Suppress(pyparsing.Literal(","))
# LPAREN = pyparsing.Suppress(pyparsing.Literal("("))
# RPAREN = pyparsing.Suppress(pyparsing.Literal(")"))
# EQUAL = pyparsing.Literal("=")
# LBRACE = pyparsing.Suppress(pyparsing.Literal("{"))
# RBRACE = pyparsing.Suppress(pyparsing.Literal("}"))
# MINUS = pyparsing.Literal('-')
# AND = pyparsing.CaselessLiteral("and") | pyparsing.CaselessLiteral("&&")
# OR = pyparsing.CaselessLiteral("or") | pyparsing.CaselessLiteral("||")
# class SubExpr(object):
# class BinaryOp(object):
# class AndSubExpr(BinaryOp):
# class OrSubExpr(BinaryOp):
# class AlarmExprParser(object):
#     def __init__(self, tokens):
#     def fmtd_sub_expr_str(self):
#     def dimensions_str(self):
#     def operands_list(self):
#     def func(self):
#     def normalized_func(self):
#     def metric_name(self):
#     def normalized_metric_name(self):
#     def dimensions(self):
#     def dimensions_as_list(self):
#     def operator(self):
#     def threshold(self):
#     def period(self):
#     def periods(self):
#     def deterministic(self):
#     def normalized_operator(self):
#     def id(self):
#     def id(self, id):
#     def __init__(self, tokens):
#     def operands_list(self):
# def periodValidation(instr, loc, tokens):
# def periodsValidation(instr, loc, tokens):
#     def __init__(self, expr):
#     def sub_expr_list(self):
# def main():


# Path: monasca_api/tests/test_ad_repository.py
import datetime
import fixtures
from oslo_config import cfg
from oslo_db.sqlalchemy.engines import create_engine
from sqlalchemy import delete, MetaData, insert, bindparam, select, func
from monasca_api.common.repositories import exceptions
from monasca_api.common.repositories.model import sub_alarm_definition
from monasca_api.common.repositories.sqla import models
from monasca_api.expression_parser import alarm_expr_parser
from monasca_api.tests import base
        from monasca_api.common.repositories.sqla import alarm_definitions_repository as adr
        from monasca_api.common.repositories import exceptions


        def _fake_engine_from_config(*args, **kw):
            return cls.engine

        cls.fixture = fixtures.MonkeyPatch(
            'sqlalchemy.create_engine', _fake_engine_from_config)
        cls.fixture.setUp()
        metadata = MetaData()

        cls.aa = models.create_aa_model(metadata)
        cls._delete_aa_query = delete(cls.aa)
        cls._insert_aa_query = (insert(cls.aa).values(
            alarm_definition_id=bindparam('alarm_definition_id'),
            alarm_state=bindparam('alarm_state'),
            action_id=bindparam('action_id')))

        cls.ad = models.create_ad_model(metadata)
        cls._delete_ad_query = delete(cls.ad)
        cls._insert_ad_query = (insert(cls.ad).values(
            id=bindparam('id'),
            tenant_id=bindparam('tenant_id'),
            name=bindparam('name'),
            severity=bindparam('severity'),
            expression=bindparam('expression'),
            match_by=bindparam('match_by'),
            actions_enabled=bindparam('actions_enabled'),
            created_at=bindparam('created_at'),
            updated_at=bindparam('updated_at'),
            deleted_at=bindparam('deleted_at')))


        cls.sad = models.create_sad_model(metadata)