Create a base class with a metaclass. Vendored from six: https://github.com/benjaminp/six/blob/master/six.py
(meta, *bases)
| 145 | |
| 146 | |
| 147 | def with_metaclass(meta, *bases): |
| 148 | """Create a base class with a metaclass. |
| 149 | |
| 150 | Vendored from six: https://github.com/benjaminp/six/blob/master/six.py |
| 151 | """ |
| 152 | |
| 153 | # This requires a bit of explanation: the basic idea is to make a dummy |
| 154 | # metaclass for one level of class instantiation that replaces itself with |
| 155 | # the actual metaclass. |
| 156 | class metaclass(type): |
| 157 | def __new__(cls, name, this_bases, d): |
| 158 | # __orig_bases__ is required by PEP 560. |
| 159 | resolved_bases = types.resolve_bases(bases) |
| 160 | if resolved_bases is not bases: |
| 161 | d["__orig_bases__"] = bases |
| 162 | return meta(name, resolved_bases, d) |
| 163 | |
| 164 | @classmethod |
| 165 | def __prepare__( |
| 166 | cls, name: str, this_bases: tuple[type, ...], /, **kwds: Any |
| 167 | ) -> MutableMapping[str, object]: |
| 168 | return meta.__prepare__(name, bases) |
| 169 | |
| 170 | return type.__new__(metaclass, "temporary_class", (), {}) |
| 171 | |
| 172 | |
| 173 | def parse_collection_or_database_options(options): |
no test coverage detected