<commit_before>import requests
import os
import shelve

from bs4 import BeautifulSoup
from bs4.element import Tag
from urllib.parse import urlparse
from zipfile import ZipFile
from json import loads
from pathlib import Path
from urllib.parse import unquote
from sys import stdout
from MultiMC import InstanceCfg, ForgePatch
from shutil import move, copytree, rmtree

useUserAgent = "Mozilla/5.0 (Windows NT 10.0; rv:50.0) Gecko/20100101 Firefox/50.0"


class CurseAPI:
    """Curse API"""
    search_types = {
        "mod": "mc-mods",
        "modpack": "modpacks",
        "texturepack": "customization"
    }

    def __init__(self):
        self.baseUrl = "https://mods.curse.com"
        self.forgeUrl = "https://minecraft.curseforge.com"

        # Set User Agent header for extra sneakyness
        self.session = requests.Session()
        self.session.headers.update({"User-Agent": useUserAgent})

        # TODO: Find the MultiMC folder automatically
        self.baseDir = ""
        for dirf in ["~/.local/share/multimc", "~/.local/share/multimc5"]:
            edir = os.path.expanduser(dirf)
            if os.path.exists(edir):
                self.baseDir = edir
                break

        self.db = shelve.open(self.baseDir+"/omm.db")

        if "packs" not in self.db:
            self.db["packs"] = list()
<commit_msg>ask for baseDir if not found<commit_after>import requests
import os
import shelve

from bs4 import BeautifulSoup
from bs4.element import Tag
from urllib.parse import urlparse
from zipfile import ZipFile
from json import loads
from pathlib import Path
from urllib.parse import unquote
from sys import stdout
from MultiMC import InstanceCfg, ForgePatch
from shutil import move, copytree, rmtree
from easygui import diropenbox

useUserAgent = "Mozilla/5.0 (Windows NT 10.0; rv:50.0) Gecko/20100101 Firefox/50.0"


class CurseAPI:
    """Curse API"""
    search_types = {
        "mod": "mc-mods",
        "modpack": "modpacks",
        "texturepack": "customization"
    }

    def __init__(self):
        self.baseUrl = "https://mods.curse.com"
        self.forgeUrl = "https://minecraft.curseforge.com"

        # Set User Agent header for extra sneakyness
        self.session = requests.Session()
        self.session.headers.update({"User-Agent": useUserAgent})

        self.db = shelve.open(os.path.expanduser("~/.omm.db"))

        if "baseDir" not in self.db:
            for dirf in ["~/.local/share/multimc", "~/.local/share/multimc5"]:
                edir = os.path.expanduser(dirf)
                if os.path.exists(edir):
                    self.db["baseDir"] = edir
                    break
            if "baseDir" not in self.db:
                self.db["baseDir"] = diropenbox("Select your MultiMC folder")

        self.baseDir = self.db["baseDir"]

        if "packs" not in self.db:
            self.db["packs"] = list()

{'fraction_non_alphanumeric': 0.11199722607489598, 'fraction_numerical': 0.015256588072122053, 'mean_word_length': 2.518292682926829, 'pattern_counts': {'":': 8, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7502024', 'n_tokens_mistral': 952, 'n_tokens_neox': 903, 'n_words': 245}