@@ -4681,7 +4681,8 @@ def __init__(self, *,
46814681 strands : List [Strand ] = None ,
46824682 grid : Grid = Grid .none ,
46834683 helices_view_order : List [int ] = None ,
4684- geometry : Geometry = None ) -> None :
4684+ geometry : Geometry = None ,
4685+ warn_duplicate_strand_names : bool = True ) -> None :
46854686 """
46864687 :param helices:
46874688 List of :any:`Helix`'s; if missing, set based on `strands`.
@@ -4763,9 +4764,9 @@ def __init__(self, *,
47634764 helices_in_group = [self .helices [idx ] for idx in helix_idxs_in_group ]
47644765 _check_helices_grid_legal (group .grid , helices_in_group )
47654766
4766- self .__post_init__ ()
4767+ self .__post_init__ (warn_duplicate_strand_names = warn_duplicate_strand_names )
47674768
4768- def __post_init__ (self ) -> None :
4769+ def __post_init__ (self , warn_duplicate_strand_names : bool = True ) -> None :
47694770 # XXX: exact order of these calls is important
47704771 self ._ensure_helices_distinct_objects ()
47714772 self ._ensure_strands_distinct_objects ()
@@ -4774,7 +4775,7 @@ def __post_init__(self) -> None:
47744775 self ._set_helices_min_max_offsets (update = False )
47754776 self ._ensure_helix_groups_exist ()
47764777 self ._assign_default_helices_view_orders_to_groups ()
4777- self ._check_legal_design ()
4778+ self ._check_legal_design (warn_duplicate_strand_names = warn_duplicate_strand_names )
47784779
47794780 if self .automatically_assign_color :
47804781 self ._assign_colors_to_strands ()
@@ -4861,7 +4862,7 @@ def roll_of_helix(self, helix: Helix) -> float:
48614862 return self .groups [helix .group ].roll + helix .roll
48624863
48634864 @staticmethod
4864- def from_scadnano_file (filename : str ) -> 'Design' : # remove quotes when Py3.6 support dropped
4865+ def from_scadnano_file (filename : str , warn_duplicate_strand_names : bool = True ) -> 'Design' : # remove quotes when Py3.6 support dropped
48654866 """
48664867 Loads a :any:`Design` from the file with the given name.
48674868
@@ -4870,10 +4871,10 @@ def from_scadnano_file(filename: str) -> 'Design': # remove quotes when Py3.6 s
48704871 """
48714872 with open (filename ) as f :
48724873 json_str = f .read ()
4873- return Design .from_scadnano_json_str (json_str )
4874+ return Design .from_scadnano_json_str (json_str , warn_duplicate_strand_names = warn_duplicate_strand_names )
48744875
48754876 @staticmethod
4876- def from_scadnano_json_str (json_str : str ) -> 'Design' : # remove quotes when Py3.6 support dropped
4877+ def from_scadnano_json_str (json_str : str , warn_duplicate_strand_names : bool = True ) -> 'Design' : # remove quotes when Py3.6 support dropped
48774878 """
48784879 Loads a :any:`Design` from the given JSON string.
48794880
@@ -4882,7 +4883,7 @@ def from_scadnano_json_str(json_str: str) -> 'Design': # remove quotes when Py3
48824883 """
48834884 json_map = json .loads (json_str )
48844885 try :
4885- design = Design .from_scadnano_json_map (json_map )
4886+ design = Design .from_scadnano_json_map (json_map , warn_duplicate_strand_names = warn_duplicate_strand_names )
48864887 return design
48874888 except KeyError as e :
48884889 raise IllegalDesignError (f'I was expecting a JSON key but did not find it: { e } ' )
@@ -5075,7 +5076,7 @@ def _helices_and_groups_and_grid_from_json(json_map: Dict) -> Tuple[List[Helix],
50755076
50765077 @staticmethod
50775078 def from_scadnano_json_map (
5078- json_map : dict ) -> 'Design' : # remove quotes when Py3.6 support dropped
5079+ json_map : dict , warn_duplicate_strand_names : bool = True ) -> 'Design' : # remove quotes when Py3.6 support dropped
50795080 """
50805081 Loads a :any:`Design` from the given JSON object (i.e., Python object obtained by calling
50815082 json.loads(json_str) from a string representing contents of a JSON file.
@@ -5131,6 +5132,7 @@ def from_scadnano_json_map(
51315132 grid = grid ,
51325133 helices_view_order = helices_view_order ,
51335134 geometry = geometry ,
5135+ warn_duplicate_strand_names = warn_duplicate_strand_names ,
51345136 )
51355137
51365138 def to_json_serializable (self , suppress_indent : bool = True , ** kwargs : Any ) -> Dict [str , Any ]:
0 commit comments