7aea07f4c122ec6ddcb6d6900bc6fb41e4f81d43,server/website/website/parser/parser.py,Parser,__utils,#Any#,26

Before Change


    @staticmethod
    def __utils(dbms_id=None):
        if Parser.__DBMS_UTILS_IMPLS is None:
            Parser.__DBMS_UTILS_IMPLS = {
                DBMSCatalog.objects.get(
                    type=DBMSType.POSTGRES, version="9.3").pk: PostgresOldParser("9.3"),
                DBMSCatalog.objects.get(
                    type=DBMSType.POSTGRES, version="9.2").pk: PostgresOldParser("9.2"),
                DBMSCatalog.objects.get(
                    type=DBMSType.POSTGRES, version="9.6").pk: Postgres96Parser("9.6"),
                DBMSCatalog.objects.get(
                    type=DBMSType.POSTGRES, version="9.4").pk: Postgres96Parser("9.4"),
                DBMSCatalog.objects.get(
                    type=DBMSType.MYROCKS, version="5.6").pk: MyRocks56Parser(),
                DBMSCatalog.objects.get(
                    type=DBMSType.ORACLE, version="19.0.0.0.0").pk: Oracle19Parser()
            }
        try:
            if dbms_id is None:
                return Parser.__DBMS_UTILS_IMPLS
            return Parser.__DBMS_UTILS_IMPLS[dbms_id]

After Change



            parsers = {}
            for obj in DBMSCatalog.objects.all():
                if obj.type == DBMSType.POSTGRES:
                    clz = PostgresParser
                elif obj.type == DBMSType.MYROCKS:
                    clz = MyRocksParser
                elif obj.type == DBMSType.ORACLE:
                    clz = OracleParser
                else:
                    raise NotImplementedError("Implement me! {}".format(obj))

                parsers[obj.pk] = clz(obj)

            Parser.__DBMS_UTILS_IMPLS = parsers
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 6

Instances


Project Name: cmu-db/ottertune
Commit Name: 7aea07f4c122ec6ddcb6d6900bc6fb41e4f81d43
Time: 2019-09-04
Author: dvanaken@cs.cmu.edu
File Name: server/website/website/parser/parser.py
Class Name: Parser
Method Name: __utils


Project Name: brian-team/brian2
Commit Name: 6e23720ba23b04e2cf8ae76dea5043ab25cbdc1d
Time: 2013-10-08
Author: marcel.stimberg@ens.fr
File Name: brian2/core/variables.py
Class Name: VariableView
Method Name: __setitem__


Project Name: IDSIA/sacred
Commit Name: 0cd42478586c9cb1febb6b76eea068aac8869a1e
Time: 2018-01-24
Author: dismaldenizen@gmail.com
File Name: sacred/ingredient.py
Class Name: Ingredient
Method Name: __init__


Project Name: deepgram/kur
Commit Name: bc6c691202e5f8755de7b13d88f86286ff878abb
Time: 2017-05-10
Author: ajsyp@syptech.net
File Name: kur/backend/keras_backend.py
Class Name: KerasBackend
Method Name: process_loss


Project Name: cmu-db/ottertune
Commit Name: 7aea07f4c122ec6ddcb6d6900bc6fb41e4f81d43
Time: 2019-09-04
Author: dvanaken@cs.cmu.edu
File Name: server/website/website/parser/parser.py
Class Name: Parser
Method Name: __utils