Skip to content

Commit ff5d483

Browse files
committed
Update formatting and fix docstrings
1 parent 6e4ef5b commit ff5d483

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

dbldatagen/data_analyzer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
class DataAnalyzer:
2525
"""
2626
This class is used to analyze an existing dataset to assist in generating a test data set with similar data
27-
characteristics. Analyzer results and to generate code from existing schemas and data.
27+
characteristics. Analyzer results can be used to generate code from existing schemas and data.
2828
2929
:param df: Spark ``DataFrame`` to analyze
3030
:param sparkSession: ``SparkSession`` to use

dbldatagen/text_generator_plugins.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import logging
1111
from collections.abc import Callable
1212
from types import ModuleType
13-
from typing import Optional, Union
13+
from typing import Optional
1414

1515
import pandas as pd
1616

@@ -88,16 +88,16 @@ class PyfuncText(TextGenerator): # lgtm [py/missing-equals]
8888
_initPerBatch: bool
8989
_rootProperty: object
9090
_pyFn: Callable
91-
_initFn: Union[Callable, None]
92-
_context: Union[_FnCallContext, None]
91+
_initFn: Callable | None
92+
_context: _FnCallContext | None
9393

9494
def __init__(
9595
self,
9696
fn: Callable,
9797
*,
98-
init: Union[Callable, None] = None,
98+
init: Callable | None = None,
9999
initPerBatch: bool = False,
100-
name: Union[str, None] = None,
100+
name: str | None = None,
101101
rootProperty: object = None
102102
) -> None:
103103
super().__init__()
@@ -218,10 +218,10 @@ def initFaker(ctx):
218218
"""
219219
_name: str
220220
_initPerBatch: bool
221-
_initFn: Union[Callable, None]
222-
_rootProperty: Union[object, None]
221+
_initFn: Callable | None
222+
_rootProperty: object | None
223223

224-
def __init__(self, name: Union[str, None] = None) -> None:
224+
def __init__(self, name: str | None = None) -> None:
225225
self._initFn = None
226226
self._rootProperty = None
227227
self._name = "PyfuncText" if name is None else name
@@ -270,7 +270,7 @@ def withRootProperty(self, prop: object) -> "PyfuncTextFactory":
270270

271271
def __call__(
272272
self,
273-
evalFn: Union[str, Callable],
273+
evalFn: str | Callable,
274274
*args,
275275
isProperty: bool = False,
276276
**kwargs
@@ -335,11 +335,11 @@ class FakerTextFactory(PyfuncTextFactory):
335335
def __init__(
336336
self,
337337
*,
338-
locale: Union[str, list[str], None] = None,
339-
providers: Union[list, None] = None,
338+
locale: str | list[str] | None = None,
339+
providers: list | None = None,
340340
name: str = "FakerText",
341-
lib: Union[str, None] = None,
342-
rootClass: Union[str, None] = None
341+
lib: str | None = None,
342+
rootClass: str | None = None
343343
) -> None:
344344

345345
super().__init__(name)
@@ -368,7 +368,7 @@ def __init__(
368368
self.withRootProperty("faker")
369369

370370
@classmethod
371-
def _getDefaultFactory(cls, lib: Union[str, None] = None, rootClass: Union[str, None] = None) -> "FakerTextFactory":
371+
def _getDefaultFactory(cls, lib: str | None = None, rootClass: str | None = None) -> "FakerTextFactory":
372372
"""
373373
Gets a default faker text factory.
374374
@@ -379,7 +379,7 @@ def _getDefaultFactory(cls, lib: Union[str, None] = None, rootClass: Union[str,
379379
cls._defaultFakerTextFactory = FakerTextFactory(lib=lib, rootClass=rootClass)
380380
return cls._defaultFakerTextFactory
381381

382-
def _mkInitFn(self, libModule: object, locale: Union[str, list[str], None], providers: Union[list, None]) -> Callable:
382+
def _mkInitFn(self, libModule: object, locale: str | list[str] | None, providers: list | None) -> Callable:
383383
"""
384384
Creates a Faker initialization function.
385385
@@ -438,7 +438,7 @@ def _loadLibrary(self, lib: str) -> ModuleType:
438438
raise DataGenError("Could not load or initialize Faker library") from err
439439

440440

441-
def fakerText(mname: str, *args, _lib: Union[str, None] = None, _rootClass: Union[str, None] = None, **kwargs) -> PyfuncText:
441+
def fakerText(mname: str, *args, _lib: str | None = None, _rootClass: str | None = None, **kwargs) -> PyfuncText:
442442
"""
443443
Creates a faker text generator object using the default ``FakerTextFactory`` instance. Calling this method is
444444
equivalent to calling ``FakerTextFactory()("sentence")``.

0 commit comments

Comments
 (0)