From 1f286f3b25f71e736082437c78803ae87bb811b0 Mon Sep 17 00:00:00 2001 From: Jack Maguire Date: Thu, 7 Nov 2024 12:56:55 -0500 Subject: [PATCH 01/19] Create T003_ParentalShadowing.py --- .../src/test/T003_ParentalShadowing.py | 162 ++++++++++++++++++ 1 file changed, 162 insertions(+) create mode 100644 source/src/python/PyRosetta/src/test/T003_ParentalShadowing.py diff --git a/source/src/python/PyRosetta/src/test/T003_ParentalShadowing.py b/source/src/python/PyRosetta/src/test/T003_ParentalShadowing.py new file mode 100644 index 0000000000..d47b53ffff --- /dev/null +++ b/source/src/python/PyRosetta/src/test/T003_ParentalShadowing.py @@ -0,0 +1,162 @@ +# :noTabs=true: +# (c) Copyright Rosetta Commons Member Institutions. +# (c) This file is part of the Rosetta software suite and is made available under license. +# (c) The Rosetta software is developed by the contributing members of the Rosetta Commons. +# (c) For more information, see http://www.rosettacommons.org. Questions about this can be +# (c) addressed to University of Washington CoMotion, email: license@uw.edu. + +## @author Jack Maguire + +import pyrosetta +from pyrosetta.rosetta import core, numeric, protocols, basic + +class IsBad(): + def __init__(self): + self.bad = False + +global_is_bad = IsBad() + +class MyClass: + def __init__(self): + pass + +def extract_class_signature_from_overload_line( l ): + # 1. (pose: pyrosetta.rosetta.core.pose.Pose, residue_positions: pyrosetta.rosetta.utility.vector1_bool) -> None + l = l.split("->")[0] + # 1. (pose: pyrosetta.rosetta.core.pose.Pose, residue_positions: pyrosetta.rosetta.utility.vector1_bool) + s1 = l.find("(")+1 + s2 = l.rfind(")") + if s1==s2: return [] + l = l[s1:s2] + #pose: pyrosetta.rosetta.core.pose.Pose, residue_positions: pyrosetta.rosetta.utility.vector1_bool + ls = [a.strip().rstrip() for a in l.split( "," )] + #['pose: pyrosetta.rosetta.core.pose.Pose', 'residue_positions: pyrosetta.rosetta.utility.vector1_bool'] + ls = [ a[a.find(":")+1:].strip() for a in ls ] + #['pyrosetta.rosetta.core.pose.Pose', 'pyrosetta.rosetta.utility.vector1_bool'] + ls = [ eval(a) for a in ls ] + #[, ] + # returns a list of classes + return ls + +def signatures_conflict( sig1, sig2, only_enforce_distinct_parents=True ): + # if only_enforce_distinct_parents=True, we will not complain if foo() shadows foo(), we will only complain if foo() shadows foo() where A is a parent of B + if len(sig1) != len(sig2): return False + + if (sig1 == sig2) and only_enforce_distinct_parents: return False + + for i in range(len(sig1)): + class1 = sig1[i] + class2 = sig2[i] + check12 = issubclass( class1, class2 ) + check21 = issubclass( class2, class1 ) + if not (check12 or check21): + # if neither class clashes with the other one, these two signatures are safe + return False + + return True + + +def test_function( F, custom_name = None ): + + if custom_name is None: + custom_name = str(F) + + failed = True + try: + F( MyClass() ) + failed = False + except Exception as E: + exception_str = str(E) + + assert failed, F + assert "The following argument types are supported" in exception_str, exception_str + + signatures = [] + for l in exception_str.split("\n"): + if l[0:4] != " " or l[5] != ".": continue + #if "->" not in l: continue + + if "*" in l: + print( "Skipping weird signature", l ) + # like 2. pyrosetta.rosetta.core.chemical.MutableChiRecord(atm_vec: pyrosetta.rosetta.utility.vector1_void_*) + continue + + if "::" in l: + print( "Skipping incompletely bound signature", l ) + continue + + if "Tuple[" in l or "Callable[" in l: + print( "Skipping complicated signature (for now?)", l ) + continue + + try: + sig = extract_class_signature_from_overload_line( l ) + except Exception as e: + if str(e).startswith("name '") and str(e).endswith("' is not defined"): + print( "Skipping incompletely bound signature", l, ":", str(e) ) + continue + print( "ERROR" ) + print( l ) + print( "-----" ) + print( e ) + exit( 0 ) + signatures.append( sig ) + + for i in range(len(signatures)): + for j in range(i+1,len(signatures)): + if signatures_conflict( signatures[i], signatures[j] ): + print( f"CONFLICT `{custom_name}` --- `{signatures[i]}` --- `{signatures[j]}`" ) + global_is_bad.bad = True + +def test_class( C ): + # 1. test __init__ + try: + test_function( C ) + except AssertionError as E: + if "No constructor defined" in str(E): + print( "No constructor defined for", C ) + pass + else: + raise E + + # 2. test functions + for cname in dir(C): + if cname.startswith("__"): continue + #if cname == "__init__": continue + + cattr = getattr(C,cname) + type_str = str( type( cattr ) ) + if type_str == "": + try: + test_function( cattr, custom_name=f"{C}::{cname}" ) + except AssertionError as e: + if "takes no arguments" in str(e): + pass + else: + raise e + elif type_str == "": + print( cattr ) + exit( 0 ) #testing to see if this is possible + test_module( cattr ) + else: + print( "skipping type", type_str, "for", cname, "in", C ) + +def test_module( D ): + for dname in dir(D): + dattr = getattr(D,dname) + type_str = str( type( dattr ) ) + if type_str == "": + if dname.endswith( "Creator" ): + print( "skipping creator type", dname ) + else: + test_class( dattr ) + elif type_str == "": + test_function( dattr ) + elif type_str == "": + test_module( dattr ) + else: + print( "skipping type", type_str, "for", dname ) + +for module in [core, numeric, protocols, basic] + test_module( module ) +assert not global_is_bad.bad From 59d43cfffc9ab8efe05027ce928148674ed82203 Mon Sep 17 00:00:00 2001 From: Jack Maguire Date: Thu, 7 Nov 2024 13:06:04 -0500 Subject: [PATCH 02/19] Update rosetta.config --- source/src/python/PyRosetta/rosetta.config | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/source/src/python/PyRosetta/rosetta.config b/source/src/python/PyRosetta/rosetta.config index ebd29ff392..afd6b0b5ef 100644 --- a/source/src/python/PyRosetta/rosetta.config +++ b/source/src/python/PyRosetta/rosetta.config @@ -660,7 +660,12 @@ -function basic::MemTracer::create_impl # Bad/Ambiguous Overloads of copy-constructor, see test T121_core.ResidueSelector.test_residue_selector_ctors for a test case +-function core::select::jump_selector::NotJumpSelector::NotJumpSelector(const class core::select::jump_selector::NotJumpSelector &) +-function core::select::jump_selector::AndJumpSelector::AndJumpSelector(const class core::select::jump_selector::AndJumpSelector &) +-function core::select::jump_selector::AndJumpSelector::AndJumpSelector(class std::shared_ptr< const core::select::jump_selector::JumpSelector > ) -function core::select::residue_selector::NotResidueSelector::NotResidueSelector(const class core::select::residue_selector::NotResidueSelector &) +-function core::select::residue_selector::AndResidueSelector::AndResidueSelector(const class core::select::residue_selector::AndResidueSelector &) +-function core::select::residue_selector::AndResidueSelector::AndResidueSelector(class std::shared_ptr< const core::select::residue_selector::ResidueSelector > ) # problem with bool specialization? error: address of overloaded function 'swap' does not match required type 'void (core::id::DOF_ID_Map &, core::id::DOF_ID_Map &)' From 1281d43992000623034419f723d036536deefc2d Mon Sep 17 00:00:00 2001 From: Jack Maguire Date: Thu, 7 Nov 2024 13:17:35 -0500 Subject: [PATCH 03/19] Update rosetta.config --- source/src/python/PyRosetta/rosetta.config | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/src/python/PyRosetta/rosetta.config b/source/src/python/PyRosetta/rosetta.config index afd6b0b5ef..d8dd69b0a8 100644 --- a/source/src/python/PyRosetta/rosetta.config +++ b/source/src/python/PyRosetta/rosetta.config @@ -666,6 +666,9 @@ -function core::select::residue_selector::NotResidueSelector::NotResidueSelector(const class core::select::residue_selector::NotResidueSelector &) -function core::select::residue_selector::AndResidueSelector::AndResidueSelector(const class core::select::residue_selector::AndResidueSelector &) -function core::select::residue_selector::AndResidueSelector::AndResidueSelector(class std::shared_ptr< const core::select::residue_selector::ResidueSelector > ) +-function core::select::residue_selector::RandomGlycanFoliageSelector::RandomGlycanFoliageSelector(const class core::select::residue_selector::RandomGlycanFoliageSelector &) +-function core::select::residue_selector::SymmetricalResidueSelector::SymmetricalResidueSelector(const class core::select::residue_selector::SymmetricalResidueSelector &) +-function core::select::residue_selector::SymmetricalResidueSelector::SymmetricalResidueSelector(class std::shared_ptr< const core::select::residue_selector::ResidueSelector >) # problem with bool specialization? error: address of overloaded function 'swap' does not match required type 'void (core::id::DOF_ID_Map &, core::id::DOF_ID_Map &)' From 72a5f48be0ab4571dd0447f096a4105894533ee5 Mon Sep 17 00:00:00 2001 From: Jack Maguire Date: Thu, 7 Nov 2024 13:17:56 -0500 Subject: [PATCH 04/19] Update T003_ParentalShadowing.py --- source/src/python/PyRosetta/src/test/T003_ParentalShadowing.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/src/python/PyRosetta/src/test/T003_ParentalShadowing.py b/source/src/python/PyRosetta/src/test/T003_ParentalShadowing.py index d47b53ffff..5912b2f8fa 100644 --- a/source/src/python/PyRosetta/src/test/T003_ParentalShadowing.py +++ b/source/src/python/PyRosetta/src/test/T003_ParentalShadowing.py @@ -157,6 +157,6 @@ def test_module( D ): else: print( "skipping type", type_str, "for", dname ) -for module in [core, numeric, protocols, basic] +for module in [core, numeric, protocols, basic]: test_module( module ) assert not global_is_bad.bad From 06e3ea7ed53a424ecd215d184c8946264ea21633 Mon Sep 17 00:00:00 2001 From: Jack Maguire Date: Thu, 7 Nov 2024 13:34:28 -0500 Subject: [PATCH 05/19] Update T003_ParentalShadowing.py --- .../PyRosetta/src/test/T003_ParentalShadowing.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/source/src/python/PyRosetta/src/test/T003_ParentalShadowing.py b/source/src/python/PyRosetta/src/test/T003_ParentalShadowing.py index 5912b2f8fa..72bb0acdf5 100644 --- a/source/src/python/PyRosetta/src/test/T003_ParentalShadowing.py +++ b/source/src/python/PyRosetta/src/test/T003_ParentalShadowing.py @@ -10,6 +10,9 @@ import pyrosetta from pyrosetta.rosetta import core, numeric, protocols, basic +def verbose(): + return False + class IsBad(): def __init__(self): self.bad = False @@ -77,23 +80,23 @@ def test_function( F, custom_name = None ): #if "->" not in l: continue if "*" in l: - print( "Skipping weird signature", l ) + if verbose(): print( "Skipping weird signature", l ) # like 2. pyrosetta.rosetta.core.chemical.MutableChiRecord(atm_vec: pyrosetta.rosetta.utility.vector1_void_*) continue if "::" in l: - print( "Skipping incompletely bound signature", l ) + if verbose(): print( "Skipping incompletely bound signature", l ) continue if "Tuple[" in l or "Callable[" in l: - print( "Skipping complicated signature (for now?)", l ) + if verbose(): print( "Skipping complicated signature (for now?)", l ) continue try: sig = extract_class_signature_from_overload_line( l ) except Exception as e: if str(e).startswith("name '") and str(e).endswith("' is not defined"): - print( "Skipping incompletely bound signature", l, ":", str(e) ) + if verbose(): print( "Skipping incompletely bound signature", l, ":", str(e) ) continue print( "ERROR" ) print( l ) @@ -114,7 +117,7 @@ def test_class( C ): test_function( C ) except AssertionError as E: if "No constructor defined" in str(E): - print( "No constructor defined for", C ) + if verbose(): print( "No constructor defined for", C ) pass else: raise E From 567e88d4de3441998cfb920e8a985f6e420d9e41 Mon Sep 17 00:00:00 2001 From: Jack Maguire Date: Thu, 7 Nov 2024 14:07:21 -0500 Subject: [PATCH 06/19] Update T003_ParentalShadowing.py --- source/src/python/PyRosetta/src/test/T003_ParentalShadowing.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/src/python/PyRosetta/src/test/T003_ParentalShadowing.py b/source/src/python/PyRosetta/src/test/T003_ParentalShadowing.py index 72bb0acdf5..f6d5333980 100644 --- a/source/src/python/PyRosetta/src/test/T003_ParentalShadowing.py +++ b/source/src/python/PyRosetta/src/test/T003_ParentalShadowing.py @@ -142,7 +142,7 @@ def test_class( C ): exit( 0 ) #testing to see if this is possible test_module( cattr ) else: - print( "skipping type", type_str, "for", cname, "in", C ) + if verbose(): print( "skipping type", type_str, "for", cname, "in", C ) def test_module( D ): for dname in dir(D): From b1d5194967e6e2c01553c61f960b193d178acf14 Mon Sep 17 00:00:00 2001 From: Jack Maguire Date: Thu, 7 Nov 2024 15:58:44 -0500 Subject: [PATCH 07/19] decreasing output --- .../src/python/PyRosetta/src/test/T003_ParentalShadowing.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/src/python/PyRosetta/src/test/T003_ParentalShadowing.py b/source/src/python/PyRosetta/src/test/T003_ParentalShadowing.py index f6d5333980..65e54cb58e 100644 --- a/source/src/python/PyRosetta/src/test/T003_ParentalShadowing.py +++ b/source/src/python/PyRosetta/src/test/T003_ParentalShadowing.py @@ -150,7 +150,7 @@ def test_module( D ): type_str = str( type( dattr ) ) if type_str == "": if dname.endswith( "Creator" ): - print( "skipping creator type", dname ) + if verbose(): print( "skipping creator type", dname ) else: test_class( dattr ) elif type_str == "": @@ -158,7 +158,7 @@ def test_module( D ): elif type_str == "": test_module( dattr ) else: - print( "skipping type", type_str, "for", dname ) + if verbose(): print( "skipping type", type_str, "for", dname ) for module in [core, numeric, protocols, basic]: test_module( module ) From a6afc8b6b1d5f98d875eca86cca08b98671d7c2c Mon Sep 17 00:00:00 2001 From: Jack Maguire Date: Thu, 7 Nov 2024 16:22:34 -0500 Subject: [PATCH 08/19] Update T003_ParentalShadowing.py "tuple[" --- source/src/python/PyRosetta/src/test/T003_ParentalShadowing.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/src/python/PyRosetta/src/test/T003_ParentalShadowing.py b/source/src/python/PyRosetta/src/test/T003_ParentalShadowing.py index 65e54cb58e..78e077c679 100644 --- a/source/src/python/PyRosetta/src/test/T003_ParentalShadowing.py +++ b/source/src/python/PyRosetta/src/test/T003_ParentalShadowing.py @@ -88,7 +88,7 @@ def test_function( F, custom_name = None ): if verbose(): print( "Skipping incompletely bound signature", l ) continue - if "Tuple[" in l or "Callable[" in l: + if "Tuple[" in l or "Callable[" in l or "tuple[" in l: if verbose(): print( "Skipping complicated signature (for now?)", l ) continue From 4183fb95fc113525ed432a011d414b4e3db79deb Mon Sep 17 00:00:00 2001 From: Jack Maguire Date: Thu, 7 Nov 2024 16:52:28 -0500 Subject: [PATCH 09/19] No module named 'numpy' --- source/src/python/PyRosetta/src/test/T003_ParentalShadowing.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/src/python/PyRosetta/src/test/T003_ParentalShadowing.py b/source/src/python/PyRosetta/src/test/T003_ParentalShadowing.py index 78e077c679..55ae682314 100644 --- a/source/src/python/PyRosetta/src/test/T003_ParentalShadowing.py +++ b/source/src/python/PyRosetta/src/test/T003_ParentalShadowing.py @@ -72,7 +72,7 @@ def test_function( F, custom_name = None ): exception_str = str(E) assert failed, F - assert "The following argument types are supported" in exception_str, exception_str + assert "The following argument types are supported" in exception_str or "No module named 'numpy'" in exception_str, exception_str signatures = [] for l in exception_str.split("\n"): From b6ccfc62c7e4c848a86b56c7b65da32f3ec9fc50 Mon Sep 17 00:00:00 2001 From: Jack Maguire Date: Thu, 7 Nov 2024 17:38:08 -0500 Subject: [PATCH 10/19] Better error message --- .../python/PyRosetta/src/test/T003_ParentalShadowing.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/source/src/python/PyRosetta/src/test/T003_ParentalShadowing.py b/source/src/python/PyRosetta/src/test/T003_ParentalShadowing.py index 55ae682314..ccc748309f 100644 --- a/source/src/python/PyRosetta/src/test/T003_ParentalShadowing.py +++ b/source/src/python/PyRosetta/src/test/T003_ParentalShadowing.py @@ -16,6 +16,10 @@ def verbose(): class IsBad(): def __init__(self): self.bad = False + self.count = 0 + def register(self): + self.bad = True + self.count += 1 global_is_bad = IsBad() @@ -109,7 +113,7 @@ def test_function( F, custom_name = None ): for j in range(i+1,len(signatures)): if signatures_conflict( signatures[i], signatures[j] ): print( f"CONFLICT `{custom_name}` --- `{signatures[i]}` --- `{signatures[j]}`" ) - global_is_bad.bad = True + global_is_bad.register() def test_class( C ): # 1. test __init__ @@ -162,4 +166,5 @@ def test_module( D ): for module in [core, numeric, protocols, basic]: test_module( module ) -assert not global_is_bad.bad +if global_is_bad.bad: + raise Exception(f"Found {global_is_bad.count} shadowing instances") From ef59a96932c326d6e64c65f6bc6fc7cf9828a0fd Mon Sep 17 00:00:00 2001 From: Jack Maguire Date: Thu, 7 Nov 2024 18:09:09 -0500 Subject: [PATCH 11/19] Expecting 276-4=272 --- source/src/python/PyRosetta/rosetta.config | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/source/src/python/PyRosetta/rosetta.config b/source/src/python/PyRosetta/rosetta.config index d8dd69b0a8..0e6f5abc24 100644 --- a/source/src/python/PyRosetta/rosetta.config +++ b/source/src/python/PyRosetta/rosetta.config @@ -659,7 +659,10 @@ -function basic::Tracer::create_impl -function basic::MemTracer::create_impl +###### # Bad/Ambiguous Overloads of copy-constructor, see test T121_core.ResidueSelector.test_residue_selector_ctors for a test case +###### +# RESIDUE SELECTORS -function core::select::jump_selector::NotJumpSelector::NotJumpSelector(const class core::select::jump_selector::NotJumpSelector &) -function core::select::jump_selector::AndJumpSelector::AndJumpSelector(const class core::select::jump_selector::AndJumpSelector &) -function core::select::jump_selector::AndJumpSelector::AndJumpSelector(class std::shared_ptr< const core::select::jump_selector::JumpSelector > ) @@ -669,7 +672,11 @@ -function core::select::residue_selector::RandomGlycanFoliageSelector::RandomGlycanFoliageSelector(const class core::select::residue_selector::RandomGlycanFoliageSelector &) -function core::select::residue_selector::SymmetricalResidueSelector::SymmetricalResidueSelector(const class core::select::residue_selector::SymmetricalResidueSelector &) -function core::select::residue_selector::SymmetricalResidueSelector::SymmetricalResidueSelector(class std::shared_ptr< const core::select::residue_selector::ResidueSelector >) - +-function core::select::residue_selector::NativeSelector::NativeSelector(const class core::select::residue_selector::NativeSelector &) +-function core::select::residue_selector::SymmetricalResidueSelector::SymmetricalResidueSelector(const class core::select::residue_selector::SymmetricalResidueSelector &) +-function core::select::residue_selector::SymmetricalResidueSelector::SymmetricalResidueSelector(class std::shared_ptr< const core::select::residue_selector::ResidueSelector >) +-function core::pack::task::residue_selector::ClashBasedShellSelector::ClashBasedShellSelector(const class core::pack::task::residue_selector::ClashBasedShellSelector &) +-function core::pack::task::residue_selector::ClashBasedShellSelector::ClashBasedShellSelector(class std::shared_ptr< const core::select::residue_selector::ResidueSelector >) # problem with bool specialization? error: address of overloaded function 'swap' does not match required type 'void (core::id::DOF_ID_Map &, core::id::DOF_ID_Map &)' -function core::id::swap From 361b069f79efbefbb657fa634fe12cf766bbd02c Mon Sep 17 00:00:00 2001 From: Jack Maguire Date: Thu, 7 Nov 2024 18:31:08 -0500 Subject: [PATCH 12/19] 272 - 6 = 266 --- source/src/python/PyRosetta/rosetta.config | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/src/python/PyRosetta/rosetta.config b/source/src/python/PyRosetta/rosetta.config index 0e6f5abc24..fb3777d0e0 100644 --- a/source/src/python/PyRosetta/rosetta.config +++ b/source/src/python/PyRosetta/rosetta.config @@ -677,6 +677,10 @@ -function core::select::residue_selector::SymmetricalResidueSelector::SymmetricalResidueSelector(class std::shared_ptr< const core::select::residue_selector::ResidueSelector >) -function core::pack::task::residue_selector::ClashBasedShellSelector::ClashBasedShellSelector(const class core::pack::task::residue_selector::ClashBasedShellSelector &) -function core::pack::task::residue_selector::ClashBasedShellSelector::ClashBasedShellSelector(class std::shared_ptr< const core::select::residue_selector::ResidueSelector >) +# PACK DAEMON EXPRESSIONS +-function protocols::pack_daemon::ExpExpression::ExpExpression(const class protocols::pack_daemon::ExpExpression &) +-function protocols::pack_daemon::InSetExpression::InSetExpression(const class protocols::pack_daemon::InSetExpression &) +-function protocols::pack_daemon::LnExpression::LnExpression(const class protocols::pack_daemon::LnExpression &) # problem with bool specialization? error: address of overloaded function 'swap' does not match required type 'void (core::id::DOF_ID_Map &, core::id::DOF_ID_Map &)' -function core::id::swap From f93d2cea0e7ad5a0c5b148808ddcd0132b62acce Mon Sep 17 00:00:00 2001 From: Jack Maguire Date: Thu, 7 Nov 2024 18:48:01 -0500 Subject: [PATCH 13/19] Update T003_ParentalShadowing.py remove bool/int pairs. Should be way less than 266 now --- .../src/python/PyRosetta/src/test/T003_ParentalShadowing.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/src/python/PyRosetta/src/test/T003_ParentalShadowing.py b/source/src/python/PyRosetta/src/test/T003_ParentalShadowing.py index ccc748309f..f89f96a299 100644 --- a/source/src/python/PyRosetta/src/test/T003_ParentalShadowing.py +++ b/source/src/python/PyRosetta/src/test/T003_ParentalShadowing.py @@ -54,8 +54,8 @@ def signatures_conflict( sig1, sig2, only_enforce_distinct_parents=True ): for i in range(len(sig1)): class1 = sig1[i] class2 = sig2[i] - check12 = issubclass( class1, class2 ) - check21 = issubclass( class2, class1 ) + check12 = issubclass( class1, class2 ) and class1 is not bool + check21 = issubclass( class2, class1 ) and class2 is not bool if not (check12 or check21): # if neither class clashes with the other one, these two signatures are safe return False From b0d476429ec9ab008c438a30fb456225107c462c Mon Sep 17 00:00:00 2001 From: Jack Maguire Date: Thu, 7 Nov 2024 20:31:44 -0500 Subject: [PATCH 14/19] 245-24=221 --- source/src/python/PyRosetta/rosetta.config | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/src/python/PyRosetta/rosetta.config b/source/src/python/PyRosetta/rosetta.config index fb3777d0e0..9abc12edcd 100644 --- a/source/src/python/PyRosetta/rosetta.config +++ b/source/src/python/PyRosetta/rosetta.config @@ -681,6 +681,9 @@ -function protocols::pack_daemon::ExpExpression::ExpExpression(const class protocols::pack_daemon::ExpExpression &) -function protocols::pack_daemon::InSetExpression::InSetExpression(const class protocols::pack_daemon::InSetExpression &) -function protocols::pack_daemon::LnExpression::LnExpression(const class protocols::pack_daemon::LnExpression &) +# NICHE CLASSES THAT JACK FEELS COMFORTABLE MASKING OUT +-class protocols::mean_field::jagged_array< protocols::mean_field::AAProb > +-class protocols::mean_field::jagged_array< protocols::mean_field::RotProb > # problem with bool specialization? error: address of overloaded function 'swap' does not match required type 'void (core::id::DOF_ID_Map &, core::id::DOF_ID_Map &)' -function core::id::swap From ad32aef42d7315702efce74f084af2d52589992c Mon Sep 17 00:00:00 2001 From: Jack Maguire Date: Fri, 8 Nov 2024 08:11:18 -0500 Subject: [PATCH 15/19] 245-36=209 --- .../src/test/T003_ParentalShadowing.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/source/src/python/PyRosetta/src/test/T003_ParentalShadowing.py b/source/src/python/PyRosetta/src/test/T003_ParentalShadowing.py index f89f96a299..4cddfacc8d 100644 --- a/source/src/python/PyRosetta/src/test/T003_ParentalShadowing.py +++ b/source/src/python/PyRosetta/src/test/T003_ParentalShadowing.py @@ -9,6 +9,7 @@ import pyrosetta from pyrosetta.rosetta import core, numeric, protocols, basic +import re def verbose(): return False @@ -27,6 +28,19 @@ class MyClass: def __init__(self): pass +class GreenListManager: + def __init__(self): + self.greenlist_regex = [ + "^pyrosetta.rosetta.protocols.mean_field.jagged_array_protocols_mean_field_*$" + ] + def bypass(self, name): + for g in self.greenlist_regex: + if re.match( g, name ) is not None: + return True + return False + +greenlist = GreenListManager() + def extract_class_signature_from_overload_line( l ): # 1. (pose: pyrosetta.rosetta.core.pose.Pose, residue_positions: pyrosetta.rosetta.utility.vector1_bool) -> None l = l.split("->")[0] @@ -68,6 +82,9 @@ def test_function( F, custom_name = None ): if custom_name is None: custom_name = str(F) + if greenlist.bypass( str ): + return + failed = True try: F( MyClass() ) From b22d8ef55177fa7252d887438bcbf0cff42d198b Mon Sep 17 00:00:00 2001 From: Jack Maguire Date: Fri, 8 Nov 2024 08:45:48 -0500 Subject: [PATCH 16/19] dumb typo --- source/src/python/PyRosetta/src/test/T003_ParentalShadowing.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/src/python/PyRosetta/src/test/T003_ParentalShadowing.py b/source/src/python/PyRosetta/src/test/T003_ParentalShadowing.py index 4cddfacc8d..247cd5a6b8 100644 --- a/source/src/python/PyRosetta/src/test/T003_ParentalShadowing.py +++ b/source/src/python/PyRosetta/src/test/T003_ParentalShadowing.py @@ -82,7 +82,7 @@ def test_function( F, custom_name = None ): if custom_name is None: custom_name = str(F) - if greenlist.bypass( str ): + if greenlist.bypass( custom_name ): return failed = True From f19e1097538b329f89e27569670c005de743b2f2 Mon Sep 17 00:00:00 2001 From: Jack Maguire Date: Fri, 8 Nov 2024 09:26:36 -0500 Subject: [PATCH 17/19] Date: Fri, 8 Nov 2024 09:54:06 -0500 Subject: [PATCH 18/19] More in the green list --- .../src/python/PyRosetta/src/test/T003_ParentalShadowing.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source/src/python/PyRosetta/src/test/T003_ParentalShadowing.py b/source/src/python/PyRosetta/src/test/T003_ParentalShadowing.py index 9d7d0d9ea6..6b14e0f2ec 100644 --- a/source/src/python/PyRosetta/src/test/T003_ParentalShadowing.py +++ b/source/src/python/PyRosetta/src/test/T003_ParentalShadowing.py @@ -31,7 +31,10 @@ def __init__(self): class GreenListManager: def __init__(self): self.greenlist_regex = [ - "$", + "$" ] def bypass(self, name): for g in self.greenlist_regex: From cffc584c55b5dbecd306ddc97d555a231aaea3f1 Mon Sep 17 00:00:00 2001 From: Jack Maguire Date: Fri, 8 Nov 2024 16:33:37 -0500 Subject: [PATCH 19/19] Update T003_ParentalShadowing.py --- .../src/python/PyRosetta/src/test/T003_ParentalShadowing.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source/src/python/PyRosetta/src/test/T003_ParentalShadowing.py b/source/src/python/PyRosetta/src/test/T003_ParentalShadowing.py index 6b14e0f2ec..80109f74e7 100644 --- a/source/src/python/PyRosetta/src/test/T003_ParentalShadowing.py +++ b/source/src/python/PyRosetta/src/test/T003_ParentalShadowing.py @@ -30,11 +30,15 @@ def __init__(self): class GreenListManager: def __init__(self): + # Only add things here that are overloaded in a way that results in specification, not divergent behavior self.greenlist_regex = [ "$", - "$" + "$", + "