-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
24958b6
commit d841d2b
Showing
74 changed files
with
14,758 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
from tg_bot import LOAD, NO_LOAD, LOGGER | ||
|
||
|
||
def __list_all_modules(): | ||
from os.path import dirname, basename, isfile | ||
import glob | ||
# This generates a list of modules in this folder for the * in __main__ to work. | ||
mod_paths = glob.glob(dirname(__file__) + "/*.py") | ||
all_modules = [basename(f)[:-3] for f in mod_paths if isfile(f) | ||
and f.endswith(".py") | ||
and not f.endswith('__init__.py')] | ||
|
||
if LOAD or NO_LOAD: | ||
to_load = LOAD | ||
if to_load: | ||
if not all(any(mod == module_name for module_name in all_modules) for mod in to_load): | ||
LOGGER.error("Invalid loadorder names. Quitting.") | ||
quit(1) | ||
|
||
all_modules = sorted(set(all_modules) - set(to_load)) | ||
to_load = list(all_modules) + to_load | ||
|
||
else: | ||
to_load = all_modules | ||
|
||
if NO_LOAD: | ||
LOGGER.info("Not loading: {}".format(NO_LOAD)) | ||
return [item for item in to_load if item not in NO_LOAD] | ||
|
||
return to_load | ||
|
||
return all_modules | ||
|
||
|
||
ALL_MODULES = __list_all_modules() | ||
LOGGER.info("Modules to load: %s", str(ALL_MODULES)) | ||
__all__ = ALL_MODULES + ["ALL_MODULES"] |
Oops, something went wrong.