def update_from_config()

in usort/config.py [0:0]


    def update_from_config(self, toml_path: Path) -> None:
        conf = toml.loads(toml_path.read_text())
        tool = conf.get("tool", {})
        tbl = tool.get("usort", {})

        if "categories" in tbl:
            self.categories = [Category(x) for x in tbl["categories"]]
        if "default_category" in tbl:
            self.default_category = Category(tbl["default_category"])
        if "side_effect_modules" in tbl:
            self.side_effect_modules.extend(tbl["side_effect_modules"])
        if "first_party_detection" in tbl:
            self.first_party_detection = tbl["first_party_detection"]
        if "merge_imports" in tbl:
            self.merge_imports = tbl["merge_imports"]
        if "excludes" in tbl:
            self.excludes = tbl["excludes"]

        for cat, names in tbl.get("known", {}).items():
            typed_cat = Category(cat)
            if cat not in self.categories:
                raise ValueError(f"Known set for {cat} without it having an order")

            for name in names:
                self.known[name] = typed_cat

        # "legacy" options
        for cat, option in [
            (CAT_FIRST_PARTY, "known_first_party"),
            (CAT_THIRD_PARTY, "known_third_party"),
            (CAT_STANDARD_LIBRARY, "known_standard_library"),
        ]:
            if option in tbl:
                for name in tbl[option]:
                    # TODO validate (no dots or whitespace, etc)
                    assert "." not in name
                    self.known[name] = cat

        # black config
        tbl = tool.get("black", {})
        if "line-length" in tbl:
            self.line_length = int(tbl["line-length"])

        # make sure generated regexes get updated
        self.__post_init__()