@@ -66,6 +66,7 @@ class Algorithm(enum.IntEnum):
6666 """Wavelet noise."""
6767
6868 def __repr__ (self ) -> str :
69+ """Return the string representation for this algorithm."""
6970 return f"tcod.noise.Algorithm.{ self .name } "
7071
7172
@@ -88,6 +89,7 @@ class Implementation(enum.IntEnum):
8889 """Turbulence noise implementation."""
8990
9091 def __repr__ (self ) -> str :
92+ """Return the string representation for this implementation."""
9193 return f"tcod.noise.Implementation.{ self .name } "
9294
9395
@@ -161,27 +163,30 @@ def __rng_from_seed(seed: None | int | tcod.random.Random) -> tcod.random.Random
161163 return seed
162164
163165 def __repr__ (self ) -> str :
166+ """Return the string representation of this noise instance."""
164167 parameters = [
165168 f"dimensions={ self .dimensions } " ,
166169 f"algorithm={ self .algorithm !r} " ,
167170 f"implementation={ Implementation (self .implementation )!r} " ,
168171 ]
169- if self .hurst != 0.5 :
172+ if self .hurst != 0.5 : # noqa: PLR2004 # Default value
170173 parameters .append (f"hurst={ self .hurst } " )
171- if self .lacunarity != 2 :
174+ if self .lacunarity != 2 : # noqa: PLR2004 # Default value
172175 parameters .append (f"lacunarity={ self .lacunarity } " )
173- if self .octaves != 4 :
176+ if self .octaves != 4 : # noqa: PLR2004 # Default value
174177 parameters .append (f"octaves={ self .octaves } " )
175178 if self ._seed is not None :
176179 parameters .append (f"seed={ self ._seed } " )
177180 return f"tcod.noise.Noise({ ', ' .join (parameters )} )"
178181
179182 @property
180183 def dimensions (self ) -> int :
184+ """Number of dimensions supported by this noise generator."""
181185 return int (self ._tdl_noise_c .dimensions )
182186
183187 @property
184188 def algorithm (self ) -> int :
189+ """Current selected algorithm. Can be changed."""
185190 noise_type = self .noise_c .noise_type
186191 return Algorithm (noise_type ) if noise_type else Algorithm .SIMPLEX
187192
@@ -191,6 +196,7 @@ def algorithm(self, value: int) -> None:
191196
192197 @property
193198 def implementation (self ) -> int :
199+ """Current selected implementation. Can be changed."""
194200 return Implementation (self ._tdl_noise_c .implementation )
195201
196202 @implementation .setter
@@ -202,14 +208,17 @@ def implementation(self, value: int) -> None:
202208
203209 @property
204210 def hurst (self ) -> float :
211+ """Noise hurst exponent. Can be changed."""
205212 return float (self .noise_c .H )
206213
207214 @property
208215 def lacunarity (self ) -> float :
216+ """Noise lacunarity. Can be changed."""
209217 return float (self .noise_c .lacunarity )
210218
211219 @property
212220 def octaves (self ) -> float :
221+ """Level of detail on fBm and turbulence implementations. Can be changed."""
213222 return float (self ._tdl_noise_c .octaves )
214223
215224 @octaves .setter
@@ -343,6 +352,7 @@ def sample_ogrid(self, ogrid: Sequence[ArrayLike]) -> NDArray[np.float32]:
343352 return out
344353
345354 def __getstate__ (self ) -> dict [str , Any ]:
355+ """Support picking this instance."""
346356 state = self .__dict__ .copy ()
347357 if self .dimensions < 4 and self .noise_c .waveletTileData == ffi .NULL : # noqa: PLR2004
348358 # Trigger a side effect of wavelet, so that copies will be synced.
@@ -374,6 +384,7 @@ def __getstate__(self) -> dict[str, Any]:
374384 return state
375385
376386 def __setstate__ (self , state : dict [str , Any ]) -> None :
387+ """Unpickle this instance."""
377388 if isinstance (state , tuple ): # deprecated format
378389 return self ._setstate_old (state )
379390 # unpack wavelet tile data if it exists
0 commit comments