コード例 #1
0
    def _single_team_match_from_fixture(
        cls, session: orm.session.Session, fixture_data: pd.Series, at_home: bool
    ) -> TeamMatch:
        team_prefix = "home" if at_home else "away"
        team_name = fixture_data[f"{team_prefix}_team"]
        team = (
            session.execute(sql.select(Team).where(Team.name == team_name))
            .scalars()
            .one()
        )
        team_score = fixture_data.get(f"{team_prefix}_score", 0)

        return TeamMatch(team=team, at_home=at_home, score=team_score)
コード例 #2
0
    def __init__(self, sess: orm.session.Session):
        """Initializes info object

        :param orm.session.Session sess: session object
        """
        self._ver_major: int = 0
        self._ver_minor: int = 0
        self._ver_micro: int = 0
        self.databases: typ.Sequence[str] = []
        self.database_tables: typ.Dict[str, typ.List[str]] = []
        self.data_dir: str = None
        self.script_dir: str = osp.dirname(__file__)
        self.query_dir: str = osp.join(osp.dirname(__file__), u"../query")
        self.have_archive: bool = False
        self.have_bdb: bool = False
        self.have_federated_engine: bool = True
        self.have_innodb: bool = True
        self.have_myisam: bool = True
        self.have_ndb_cluster: bool = False
        self.max_connections: int = 0
        self.read_buffer_size: int = 0
        self.read_rnd_buffer_size: int = 0
        self.sort_buffer_size: int = 0
        self.thread_stack: int = 0
        self.join_buffer_size: int = 0
        self.record_buffer: int = 0
        self.record_rnd_buffer: int = 0
        self.temp_table_size: int = 0
        self.max_heap_table_size: int = 0
        self.key_buffer_size: int = 0
        self.binlog_cache_size: int = 0
        self.long_query_time: int = 0
        self.log_slow_queries: bool = False
        self.wait_timeout: int = 0
        self.interactive_timeout: int = 0
        self.innodb_buffer_pool_size: int = 0
        self.innodb_buffer_pool_instances: int = 0
        self.innodb_buffer_pool_chunk_size: int = 0
        self.innodb_additional_mem_pool_size: int = 0
        self.innodb_log_buffer_size: int = 0
        self.query_cache_size: int = 0
        self.query_cache_type: int = 0
        self.query_cache_limit: int = 0
        self.ariadb_pagecache_buffer_size: int = 0
        self.key_cache_block_size: int = 0
        self.open_files_limit: int = 0
        self.innodb_log_file_size: int = 0
        self.innodb_log_files_in_group: int = 0
        self.innodb_thread_concurrency: int = 0
        self.innodb_file_per_table: bool = True
        self.log_bin: bool = False
        self.have_threadpool: bool = False
        self.thread_pool_size: int = 0
        self.version: str = None
        self.performance_schema: bool = True
        self.have_galera: bool = False
        self.have_ariadb: bool = False
        self.have_tokudb: bool = False
        self.have_xtradb: bool = False
        self.have_rocksdb: bool = False
        self.have_spider: bool = False
        self.have_connect: bool = False
        self.wsrep_provider_options: str = None
        self.wsrep_causal_reads: str = None
        self.wsrep_cluster_name: str = None
        self.wsrep_on: bool = False
        self.wsrep_cluster_address: str = None
        self.wsrep_node_name: str = None
        self.wsrep_notify_cmd: str = None
        self.wsrep_sst_method: str = None
        self.wsrep_osu_method: str = None
        self.wsrep_max_ws_size: int = None
        self.log_error_file: str = None
        self.ignore_builtin_innodb: bool = False
        self.gtid_mode: str = None
        self.gtid_strict_mode: str = None
        self.binlog_format: str = None
        self.innodb_flush_log_at_trx_commit: bool = False
        self.slaves: typ.Dict[str, str] = {}
        self.replicas: typ.Dict[str, str] = {}
        self.read_only: bool = False
        self.thread_cache_size: int = 0
        self.thread_handling: str = None
        self.concurrent_insert: bool = False

        version_query_file: str = osp.join(self.query_dir, u"version-query.sql")

        with open(version_query_file, mode=u"r", encoding=u"utf-8") as vqf:
            version_query: str = vqf.read()

        result = sess.execute(version_query)
        Version = clct.namedtuple(u"Version", result.keys())
        versions: typ.Sequence[str] = [
            Version(*version).VERSION.split("-")[0].split(".")
            for version in result.fetchall()
        ]
        self._ver_major, self._ver_minor, self._ver_micro = [
            int(version)
            for version in versions[0]
        ]