Drop deprecation filters for pip and yamllint
[mudpy.git] / mudpy / __init__.py
1 """Core modules package for the mudpy engine."""
2
3 # Copyright (c) 2004-2022 mudpy authors. Permission to use, copy,
4 # modify, and distribute this software is granted under terms
5 # provided in the LICENSE file distributed with this software.
6
7 import importlib
8
9 import mudpy
10
11
12 def load():
13     """Import/reload some modules (be careful, as this can result in loops)."""
14
15     # dynamically build module list from package contents
16     modules = []
17     for module in mudpy.__spec__.loader.get_resource_reader().contents():
18
19         if (
20                 # make sure it's a module file, not a directory
21                 module.endswith('.py')
22
23                 # don't include this file, we're inside it
24                 and module != '__init__.py'):
25
26             # trim off the .py file extension
27             modules.append(module[:-3])
28
29     # iterate over the list of module files included in the package
30     for module in modules:
31
32         # attempt to reload the module, assuming it was probably imported
33         # earlier
34         try:
35             importlib.reload(getattr(mudpy, module))
36
37         # must not have been, so import it now
38         except AttributeError:
39             importlib.import_module("mudpy.%s" % module)
40
41
42 load()