Mercurial > repos > shellac > guppy_basecaller
comparison env/lib/python3.7/site-packages/packaging/_compat.py @ 0:26e78fe6e8c4 draft
"planemo upload commit c699937486c35866861690329de38ec1a5d9f783"
author | shellac |
---|---|
date | Sat, 02 May 2020 07:14:21 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:26e78fe6e8c4 |
---|---|
1 # This file is dual licensed under the terms of the Apache License, Version | |
2 # 2.0, and the BSD License. See the LICENSE file in the root of this repository | |
3 # for complete details. | |
4 from __future__ import absolute_import, division, print_function | |
5 | |
6 import sys | |
7 | |
8 from ._typing import MYPY_CHECK_RUNNING | |
9 | |
10 if MYPY_CHECK_RUNNING: # pragma: no cover | |
11 from typing import Any, Dict, Tuple, Type | |
12 | |
13 | |
14 PY2 = sys.version_info[0] == 2 | |
15 PY3 = sys.version_info[0] == 3 | |
16 | |
17 # flake8: noqa | |
18 | |
19 if PY3: | |
20 string_types = (str,) | |
21 else: | |
22 string_types = (basestring,) | |
23 | |
24 | |
25 def with_metaclass(meta, *bases): | |
26 # type: (Type[Any], Tuple[Type[Any], ...]) -> Any | |
27 """ | |
28 Create a base class with a metaclass. | |
29 """ | |
30 # This requires a bit of explanation: the basic idea is to make a dummy | |
31 # metaclass for one level of class instantiation that replaces itself with | |
32 # the actual metaclass. | |
33 class metaclass(meta): # type: ignore | |
34 def __new__(cls, name, this_bases, d): | |
35 # type: (Type[Any], str, Tuple[Any], Dict[Any, Any]) -> Any | |
36 return meta(name, bases, d) | |
37 | |
38 return type.__new__(metaclass, "temporary_class", (), {}) |