@@ -739,10 +739,11 @@ def add_condition(self, id_: str, name: str = None, **kwargs):
739739 if name is not None :
740740 record [CONDITION_NAME ] = name
741741 tmp_df = pd .DataFrame (record ).set_index ([CONDITION_ID ])
742- if self .condition_df is None :
743- self .condition_df = tmp_df
744- else :
745- self .condition_df = pd .concat ([self .condition_df , tmp_df ])
742+ self .condition_df = (
743+ pd .concat ([self .condition_df , tmp_df ])
744+ if self .condition_df is not None
745+ else tmp_df
746+ )
746747
747748 def add_observable (
748749 self ,
@@ -781,10 +782,11 @@ def add_observable(
781782 record .update (kwargs )
782783
783784 tmp_df = pd .DataFrame (record ).set_index ([OBSERVABLE_ID ])
784- if self .observable_df is None :
785- self .observable_df = tmp_df
786- else :
787- self .observable_df = pd .concat ([self .observable_df , tmp_df ])
785+ self .observable_df = (
786+ pd .concat ([self .observable_df , tmp_df ])
787+ if self .observable_df is not None
788+ else tmp_df
789+ )
788790
789791 def add_parameter (
790792 self ,
@@ -852,10 +854,11 @@ def add_parameter(
852854 record .update (kwargs )
853855
854856 tmp_df = pd .DataFrame (record ).set_index ([PARAMETER_ID ])
855- if self .parameter_df is None :
856- self .parameter_df = tmp_df
857- else :
858- self .parameter_df = pd .concat ([self .parameter_df , tmp_df ])
857+ self .parameter_df = (
858+ pd .concat ([self .parameter_df , tmp_df ])
859+ if self .parameter_df is not None
860+ else tmp_df
861+ )
859862
860863 def add_measurement (
861864 self ,
@@ -896,10 +899,11 @@ def add_measurement(
896899 record [PREEQUILIBRATION_CONDITION_ID ] = [preeq_cond_id ]
897900
898901 tmp_df = pd .DataFrame (record )
899- if self .measurement_df is None :
900- self .measurement_df = tmp_df
901- else :
902- self .measurement_df = pd .concat ([self .measurement_df , tmp_df ])
902+ self .measurement_df = (
903+ pd .concat ([self .measurement_df , tmp_df ])
904+ if self .measurement_df is not None
905+ else tmp_df
906+ )
903907
904908 def add_mapping (self , petab_id : str , model_id : str ):
905909 """Add a mapping table entry to the problem.
@@ -913,7 +917,8 @@ def add_mapping(self, petab_id: str, model_id: str):
913917 MODEL_ENTITY_ID : [model_id ],
914918 }
915919 tmp_df = pd .DataFrame (record ).set_index ([PETAB_ENTITY_ID ])
916- if self .mapping_df is None :
917- self .mapping_df = tmp_df
918- else :
919- self .mapping_df = pd .concat ([self .mapping_df , tmp_df ])
920+ self .mapping_df = (
921+ pd .concat ([self .mapping_df , tmp_df ])
922+ if self .mapping_df is not None
923+ else tmp_df
924+ )
0 commit comments