@@ -510,9 +510,13 @@ def add_row(self, flags=0, location=None, metadata=None):
510510 array describing the location of this individual. If not specified
511511 or None, a zero-dimensional location is stored.
512512 :param object metadata: Any object that is valid metadata for the table's schema.
513+ Defaults to the default metadata value for the table's schema. This is
514+ typically ``{}``. For no schema, ``None``.
513515 :return: The ID of the newly added node.
514516 :rtype: int
515517 """
518+ if metadata is None :
519+ metadata = self .metadata_schema .empty_value
516520 metadata = self .metadata_schema .validate_and_encode_row (metadata )
517521 return self .ll_table .add_row (flags = flags , location = location , metadata = metadata )
518522
@@ -718,9 +722,13 @@ def add_row(self, flags=0, time=0, population=-1, individual=-1, metadata=None):
718722 :param int individual: The ID of the individual in which the new node was born.
719723 Defaults to :data:`tskit.NULL`.
720724 :param object metadata: Any object that is valid metadata for the table's schema.
725+ Defaults to the default metadata value for the table's schema. This is
726+ typically ``{}``. For no schema, ``None``.
721727 :return: The ID of the newly added node.
722728 :rtype: int
723729 """
730+ if metadata is None :
731+ metadata = self .metadata_schema .empty_value
724732 metadata = self .metadata_schema .validate_and_encode_row (metadata )
725733 return self .ll_table .add_row (flags , time , population , individual , metadata )
726734
@@ -913,9 +921,13 @@ def add_row(self, left, right, parent, child, metadata=None):
913921 :param int parent: The ID of parent node.
914922 :param int child: The ID of child node.
915923 :param object metadata: Any object that is valid metadata for the table's schema.
924+ Defaults to the default metadata value for the table's schema. This is
925+ typically ``{}``. For no schema, ``None``.
916926 :return: The ID of the newly added edge.
917927 :rtype: int
918928 """
929+ if metadata is None :
930+ metadata = self .metadata_schema .empty_value
919931 metadata = self .metadata_schema .validate_and_encode_row (metadata )
920932 return self .ll_table .add_row (left , right , parent , child , metadata )
921933
@@ -1127,9 +1139,13 @@ def add_row(self, left, right, node, source, dest, time, metadata=None):
11271139 :param int dest: The ID of the destination population.
11281140 :param float time: The time of the migration event.
11291141 :param object metadata: Any object that is valid metadata for the table's schema.
1142+ Defaults to the default metadata value for the table's schema. This is
1143+ typically ``{}``. For no schema, ``None``.
11301144 :return: The ID of the newly added migration.
11311145 :rtype: int
11321146 """
1147+ if metadata is None :
1148+ metadata = self .metadata_schema .empty_value
11331149 metadata = self .metadata_schema .validate_and_encode_row (metadata )
11341150 return self .ll_table .add_row (left , right , node , source , dest , time , metadata )
11351151
@@ -1334,9 +1350,13 @@ def add_row(self, position, ancestral_state, metadata=None):
13341350 :param float position: The position of this site in genome coordinates.
13351351 :param str ancestral_state: The state of this site at the root of the tree.
13361352 :param object metadata: Any object that is valid metadata for the table's schema.
1353+ Defaults to the default metadata value for the table's schema. This is
1354+ typically ``{}``. For no schema, ``None``.
13371355 :return: The ID of the newly added site.
13381356 :rtype: int
13391357 """
1358+ if metadata is None :
1359+ metadata = self .metadata_schema .empty_value
13401360 metadata = self .metadata_schema .validate_and_encode_row (metadata )
13411361 return self .ll_table .add_row (position , ancestral_state , metadata )
13421362
@@ -1560,11 +1580,15 @@ def add_row(self, site, node, derived_state, parent=-1, metadata=None, time=None
15601580 :param int parent: The ID of the parent mutation. If not specified,
15611581 defaults to :attr:`NULL`.
15621582 :param object metadata: Any object that is valid metadata for the table's schema.
1583+ Defaults to the default metadata value for the table's schema. This is
1584+ typically ``{}``. For no schema, ``None``.
15631585 :return: The ID of the newly added mutation.
15641586 :param float time: The occurrence time for the new mutation. If not specified,
15651587 defaults to ``UNKNOWN_TIME``, indicating the time is unknown.
15661588 :rtype: int
15671589 """
1590+ if metadata is None :
1591+ metadata = self .metadata_schema .empty_value
15681592 metadata = self .metadata_schema .validate_and_encode_row (metadata )
15691593 return self .ll_table .add_row (
15701594 site ,
@@ -1763,9 +1787,13 @@ def add_row(self, metadata=None):
17631787 :attr:`metadata_schema<tskit.PopulationTable.metadata_schema>`.
17641788
17651789 :param object metadata: Any object that is valid metadata for the table's schema.
1790+ Defaults to the default metadata value for the table's schema. This is
1791+ typically ``{}``. For no schema, ``None``.
17661792 :return: The ID of the newly added population.
17671793 :rtype: int
17681794 """
1795+ if metadata is None :
1796+ metadata = self .metadata_schema .empty_value
17691797 metadata = self .metadata_schema .validate_and_encode_row (metadata )
17701798 return self .ll_table .add_row (metadata = metadata )
17711799
0 commit comments