コード例 #1
0
 def __init__(self):
     config = ConfigLoader.load()
     self.api = OchobaApiWrapper(config["api"])
     self.db = DataBaseWrapper(config["db"])
     self.stats = self.Stats()
     self.offset = 1
     self.count = 50
     self.subsite_id = 203796
コード例 #2
0
    def __init__(self):
        config = ConfigLoader.load()
        self.categories = config["parse_targets"]["categories"]
        self.users = config["parse_targets"]["users"]
        self.api = OchobaApiWrapper(config["api"])
        self.db = GetDataBaseWrapper(config["db"])
        self.middle_rating = {}

        self.__init_database()
コード例 #3
0
    def __init__(self):
        config = ConfigLoader.load()
        self.categories = []
        self.users = []
        self.timeline_length = 2000
        self.api = OchobaApiWrapper(config["api"])
        self.db = GetDataBaseWrapper(config["db"])
        self.parser_config = config["parser"]
        self.commit_every_step = False

        self.__init_database()
 def __init__(self):
     config = ConfigLoader.load()
     self.api = OchobaApiWrapper(config["api"])
     self.db = DataBaseWrapper(config["db"])
     self.stats = self.Stats()
コード例 #5
0
from src.common.config_loader import ConfigLoader
from src.common.data_base_wrapper import DataBaseWrapper
from src.common.sql_plot import SqlPlot

percentiles = [0.75, 0.5, 0.25]

config = ConfigLoader.load()
db = DataBaseWrapper(config["db"])

queries = []
for percentile in percentiles:
    queries.append({
        'query': f"""
            with length_data as (
                select
                       posts.id as post_id,
                       posts.created as created,
                       sum(coalesce(blocks.text_length, 0)) as text_length
                from posts
                join post_blocks blocks
                    on posts.id = blocks.post_id
                        and posts.type = 1
                group by posts.id
            )
            select
                date_trunc('week', created) as time_window,
                percentile_disc({percentile}) within group (order by text_length) as percentile
            from length_data
            where created between '2016-06-01' and '2020-07-19'
            group by time_window
            order by time_window
コード例 #6
0
 def __init__(self):
     config = ConfigLoader.load()
     self.db = DataBaseWrapper(config["db"])
     self.tag_regex = re.compile(config["api"]["tag_regex"])
コード例 #7
0
 def __init__(self):
     config = ConfigLoader.load()
     self.db = DataBaseWrapper(config["db"])