def get_py3_info():
<EOL>constants, values = get_variable_docstrings("<STR_LIT>")<EOL>constants = constants["<STR_LIT>"]<EOL>constants = [(k, v) for k, v in sorted(constants.items())]<EOL>values = dict([(v, k[<NUM_LIT:4>:]) for k, v in values.items() if k.startswith("<STR_LIT>")])<EOL>def make_value(attr, arg, default):<EOL><INDENT>"""<STR_LIT>"""<EOL>if (attr, arg) in CONSTANT_PARAMS and default in values:<EOL><INDENT>return values[default]<EOL><DEDENT>return repr(default)<EOL><DEDENT>py3 = Py3()<EOL>attrs = [x for x in dir(py3) if not x.startswith("<STR_LIT:_>")]<EOL>exceptions = []<EOL>methods = []<EOL>for attr in attrs:<EOL><INDENT>item = getattr(py3, attr)<EOL>if "<STR_LIT>" in str(item):<EOL><INDENT>args, vargs, kw, defaults = inspect.getargspec(item)<EOL>args = args[<NUM_LIT:1>:]<EOL>len_defaults = len(defaults) if defaults else <NUM_LIT:0><EOL>len_args = len(args)<EOL>sig = []<EOL>for index, arg in enumerate(args):<EOL><INDENT>if len_args - index <= len_defaults:<EOL><INDENT>default = defaults[len_defaults - len_args + index]<EOL>sig.append("<STR_LIT>" % (arg, make_value(attr, arg, default)))<EOL><DEDENT>else:<EOL><INDENT>sig.append(arg)<EOL><DEDENT><DEDENT>definition = "<STR_LIT>" % (attr, "<STR_LIT:U+002CU+0020>".join(sig))<EOL>methods.append((definition, item.__doc__))<EOL>continue<EOL><DEDENT>try:<EOL><INDENT>if isinstance(item(), Exception):<EOL><INDENT>exceptions.append((attr, item.__doc__))<EOL>continue<EOL><DEDENT><DEDENT>except:  <EOL><INDENT>pass<EOL><DEDENT><DEDENT>return {"<STR_LIT>": methods, "<STR_LIT>": exceptions, "<STR_LIT>": constants}<EOL>
Inspect Py3 class and get constants, exceptions, methods
along with their docstrings.