text stringlengths 0 93.6k |
|---|
'engine_url': pediatorrent.url, |
'desc_link': href |
} |
prettyPrinter(row) |
return |
if self.insideResult and tag == self.DIV and 'flex' in css_classes and 'gap-x-3' in css_classes: |
self.insideYear = True |
return |
def handle_endtag(self, tag): |
if self.insideLink and tag == self.A: |
self.insideLink = False |
return |
if self.insideYear and tag == self.DIV: |
self.insideYear = False |
return |
if not self.insideLink and self.insideResult and tag == self.DIV: |
self.insideResult = False |
return |
if not self.insideResult and self.insideResultContainer and tag == self.DIV: |
self.insideResultContainer = False |
return |
if not self.insideResultContainer and self.insideResultList and tag == self.DIV: |
self.insideResultList = False |
return |
def download_torrent(self, info): |
print(download_file(info)) |
def get_search_url(self, what, cat): |
category = self.supported_categories[cat] |
return f'{self.url}/{category}?query={what}' |
def has_results(self, html): |
no_results_matches = re.finditer(self.no_results_regex, html, re.MULTILINE) |
no_results = [x.group() for x in no_results_matches] |
return len(no_results) == 0 |
def search(self, what, cat='all'): |
what = what.replace('%20', '+') |
retrieved_html = retrieve_url(self.get_search_url(what,cat), self.headers) |
parser = self.SearchResultsParser(self.url, cat) |
parser.feed(retrieved_html) |
parser.close() |
# <FILESEP> |
import os |
from config import get_config, show_config, save_config, load_config |
from data import Generator |
from base import BasicScenario |
from solver import REGISTRY |
def run(config): |
print(f"\n{'-' * 20} Start {'-' * 20}\n") |
# Load solver info: environment and solver class |
solver_info = REGISTRY.get(config.solver_name) |
Env, Solver = solver_info['env'], solver_info['solver'] |
print(f'Use {config.solver_name} Solver (Type = {solver_info["type"]})...\n') |
scenario = BasicScenario.from_config(Env, Solver, config) |
scenario.run() |
print(f"\n{'-' * 20} Complete {'-' * 20}\n") |
if __name__ == '__main__': |
# Please refer to `base.loader` to obtain all available solvers |
# 1. Get Config |
# The key settings are controlled with config.py |
# while other advanced settings are listed in settings/*.yaml |
config = get_config() |
# You can modify some settings directly here. |
# An example: |
# config.solver_name = 'a3c_gcn_seq2seq' # modify the algorithm of the solver |
# config.shortest_method = 'mcf' # modify the shortest path algorithm to Multi-commodity Flow |
# config.num_train_epochs = 100 # modify the number of trainning epochs |
# 2. Generate Dataset |
# Although we do not generate a static dataset, |
# the environment will automatically produce a random dataset. |
p_net, v_net_simulator = Generator.generate_dataset( |
config, |
p_net=False, |
v_nets=False, |
save=False) # Here, no dataset will be generated and saved. |
# 3. Start to Run |
# A scenario with an environment and a solver will be create following provided config. |
# The interaction between the environment and the solver will happen in this scenario. |
run(config) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.