Package gensaschema :: Module _util
[frames] | no frames]

Source Code for Module gensaschema._util

 1  # -*- coding: ascii -*- 
 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__:  # pragma: no branch 
29      # pylint: disable = redefined-builtin 
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:  # pragma: no cover 
38      # pylint: disable = redefined-builtin, invalid-name 
39      unicode = str 
40  else:  # pragma: no cover 
41      unicode = unicode  # pylint: disable = invalid-name 
42   
43  try: 
44      bytes 
45  except NameError:  # pragma: no cover 
46      # pylint: disable = redefined-builtin, invalid-name 
47      bytes = str 
48  else:  # pragma: no cover 
49      bytes = bytes  # pylint: disable = invalid-name 
50   
51  py2 = bytes is str 
52   
53  try: 
54      cmp 
55  except NameError:  # pragma: no cover 
56      cmp = lambda a, b: (a > b) - (a < b)  # pylint: disable = redefined-builtin 
57  else:  # pragma: no cover 
58      cmp = cmp 
59   
60   
61 -def find_public(space):
62 """ 63 Determine all public names in space 64 65 If the space contains an ``__all__`` sequence, a copy is returned (as a 66 list). Otherwise, all symbol names not starting with an underscore are 67 listed. 68 69 :Parameters: 70 `space` : ``dict`` 71 Name space to inspect 72 73 :Return: List of public names 74 :Rtype: ``list`` 75 """ 76 if '__all__' in space: 77 return list(space['__all__']) 78 return [key for key in space.keys() if not key.startswith('_')]
79