@@ -99,6 +99,7 @@ class Schema:
9999 """Base class for all Schema classes."""
100100
101101 def __init__ (self , atype : str , other_props : Optional [PropsType ] = None ) -> None :
102+ """Avro Schema initializer."""
102103 # Ensure valid ctor args
103104 if not isinstance (atype , str ):
104105 raise SchemaParseException (
@@ -123,9 +124,11 @@ def props(self) -> PropsType:
123124
124125 # utility functions to manipulate properties dict
125126 def get_prop (self , key : str ) -> Optional [PropType ]:
127+ """Retrieve a property from the Schema."""
126128 return self ._props .get (key )
127129
128130 def set_prop (self , key : str , value : Optional [PropType ]) -> None :
131+ """Set a Schema property."""
129132 self ._props [key ] = value
130133
131134
@@ -173,6 +176,7 @@ def validate(val: Optional[str], name: str) -> None:
173176
174177 @property
175178 def fullname (self ) -> Optional [str ]:
179+ """Retrieve the computed full name."""
176180 return self ._full
177181
178182 def get_space (self ) -> Optional [str ]:
@@ -189,10 +193,12 @@ class Names:
189193 """Track name set and default namespace during parsing."""
190194
191195 def __init__ (self , default_namespace : Optional [str ] = None ) -> None :
196+ """Create a namespace tracker."""
192197 self .names : dict [str , NamedSchema ] = {}
193198 self .default_namespace = default_namespace
194199
195200 def has_name (self , name_attr : str , space_attr : Optional [str ]) -> bool :
201+ """Test if the given namespace is stored."""
196202 test = Name (name_attr , space_attr , self .default_namespace ).fullname
197203 return test in self .names
198204
@@ -324,13 +330,16 @@ def __init__(
324330 # read-only properties
325331 @property
326332 def default (self ) -> Optional [Any ]:
333+ """Return the default value, if any."""
327334 return self .get_prop ("default" )
328335
329336 # utility functions to manipulate properties dict
330337 def get_prop (self , key : str ) -> Optional [PropType ]:
338+ """Retrieve a property from the Field."""
331339 return self ._props .get (key )
332340
333341 def set_prop (self , key : str , value : Optional [PropType ]) -> None :
342+ """Set a Field property."""
334343 self ._props [key ] = value
335344
336345
@@ -341,6 +350,7 @@ class PrimitiveSchema(Schema):
341350 """Valid primitive types are in PRIMITIVE_TYPES."""
342351
343352 def __init__ (self , atype : str , other_props : Optional [PropsType ] = None ) -> None :
353+ """Create a PrimitiveSchema."""
344354 # Ensure valid ctor args
345355 if atype not in PRIMITIVE_TYPES :
346356 raise AvroException (f"{ atype } is not a valid primitive type." )
0 commit comments