Merge pull request 'better filtering of builtins in check_api' (#4646) from mikem/koji:api-check-builtins into master
All checks were successful
/ flake8 (push) Successful in 15s
/ bandit (push) Successful in 16s
/ tests (fedora-44@sha256:5e1187ee4536674e08961cbe6b1b84dfc9df15a513dee328365909be5a0d5ed8) (push) Successful in 1m7s
/ tests (fedora-43@sha256:cf1ef55da0d7dd9251b79263c4d1e2350d4291fcd6dc54a1e751d3fe2cf4614d) (push) Successful in 1m13s
/ tests (centos-10@sha256:1f53b2b040e449b0cfce526f1a221e6dbd6648506270220ea333728a6b52a90b) (push) Successful in 1m49s
/ tests (fedora-rawhide@sha256:5e1187ee4536674e08961cbe6b1b84dfc9df15a513dee328365909be5a0d5ed8) (push) Successful in 49s
/ tests (centos-9@sha256:c5fe30a62d4b62b46acdf764bf1f7293e9fa4287972ec6a86ccb43209646dc32) (push) Successful in 2m36s
All checks were successful
/ flake8 (push) Successful in 15s
/ bandit (push) Successful in 16s
/ tests (fedora-44@sha256:5e1187ee4536674e08961cbe6b1b84dfc9df15a513dee328365909be5a0d5ed8) (push) Successful in 1m7s
/ tests (fedora-43@sha256:cf1ef55da0d7dd9251b79263c4d1e2350d4291fcd6dc54a1e751d3fe2cf4614d) (push) Successful in 1m13s
/ tests (centos-10@sha256:1f53b2b040e449b0cfce526f1a221e6dbd6648506270220ea333728a6b52a90b) (push) Successful in 1m49s
/ tests (fedora-rawhide@sha256:5e1187ee4536674e08961cbe6b1b84dfc9df15a513dee328365909be5a0d5ed8) (push) Successful in 49s
/ tests (centos-9@sha256:c5fe30a62d4b62b46acdf764bf1f7293e9fa4287972ec6a86ccb43209646dc32) (push) Successful in 2m36s
Reviewed-on: #4646
This commit is contained in:
commit
745606c9e9
2 changed files with 896 additions and 233 deletions
|
|
@ -5,6 +5,7 @@ import os
|
|||
import os.path
|
||||
import subprocess
|
||||
import sys
|
||||
import types
|
||||
from collections import OrderedDict
|
||||
|
||||
# import koji code from our checkout
|
||||
|
|
@ -109,23 +110,28 @@ def dump_module(mod):
|
|||
_type = str(type(value))
|
||||
if '__future__' in _type:
|
||||
continue
|
||||
if type(value) in (types.BuiltinFunctionType, types.BuiltinMethodType):
|
||||
vinfo['is_external'] = True
|
||||
vinfo['is_builtin'] = True
|
||||
vinfo['type'] = str(type(value))
|
||||
info[name] = vinfo
|
||||
if inspect.ismodule(value):
|
||||
vinfo['is_module'] = True
|
||||
continue
|
||||
try:
|
||||
if inspect.getsourcefile(value) != file:
|
||||
# don't dig any deeper if it isn't defined in the module
|
||||
if inspect.isclass(value):
|
||||
if 'builtins' in value.__module__:
|
||||
vinfo['is_external'] = True
|
||||
vinfo['is_builtin'] = True
|
||||
continue
|
||||
elif inspect.getsourcefile(value) != file:
|
||||
vinfo['is_external'] = True
|
||||
continue
|
||||
except TypeError:
|
||||
# getsourcefile fails for numerous types
|
||||
pass
|
||||
if inspect.isclass(value):
|
||||
vinfo['is_class'] = True
|
||||
vinfo.update(dump_class(value))
|
||||
elif inspect.isfunction(value):
|
||||
if inspect.getsourcefile(value) != file:
|
||||
vinfo['is_external'] = True
|
||||
continue
|
||||
vinfo['is_function'] = True
|
||||
vinfo.update(dump_func(value))
|
||||
return info
|
||||
|
|
@ -255,6 +261,9 @@ def compare_mod_global(mod, name, old, new):
|
|||
|
||||
|
||||
def compare_class(cls, old, new):
|
||||
if not new.get('is_class'):
|
||||
error(f'No longer a class: {cls}')
|
||||
return
|
||||
names1 = set(old['members'])
|
||||
names2 = set(new['members'])
|
||||
added = names2 - names1
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue