1
2 r"""
3 :Copyright:
4
5 Copyright 2014 - 2016
6 Andr\xe9 Malo or his licensors, as applicable
7
8 :License:
9
10 Licensed under the Apache License, Version 2.0 (the "License");
11 you may not use this file except in compliance with the License.
12 You may obtain a copy of the License at
13
14 http://www.apache.org/licenses/LICENSE-2.0
15
16 Unless required by applicable law or agreed to in writing, software
17 distributed under the License is distributed on an "AS IS" BASIS,
18 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 See the License for the specific language governing permissions and
20 limitations under the License.
21
22 ================
23 Misc Utilities
24 ================
25
26 Misc utilities.
27 """
28 if __doc__:
29
30 __doc__ = __doc__.encode('ascii').decode('unicode_escape')
31 __author__ = r"Andr\xe9 Malo".encode('ascii').decode('unicode_escape')
32 __docformat__ = "restructuredtext en"
33
34
35 try:
36 unicode
37 except NameError:
38
39 unicode = str
40
41 try:
42 bytes
43 except NameError:
44
45 bytes = str
46
47 py2 = bytes is str
48
49
51 """
52 Determine all public names in space
53
54 If the space contains an ``__all__`` sequence, a copy is returned (as a
55 list). Otherwise, all symbol names not starting with an underscore are
56 listed.
57
58 :Parameters:
59 `space` : ``dict``
60 Name space to inspect
61
62 :Return: List of public names
63 :Rtype: ``list``
64 """
65 if '__all__' in space:
66 return list(space['__all__'])
67 return [key for key in space.keys() if not key.startswith('_')]
68