misc#

Miscellaneous helper functions and classes.

Functions#

get_nonconflicting_string()

Returns a string distinct from given strings.

print_sdf()

Prints a spark dataframe in a deterministic way.

copy_if_mutable()

Returns a deep copy of argument if it is mutable.

get_fullname()

Returns the fully qualified name of the given object.

escape_column_name()

Escapes column name if it contains special characters.

get_nonconflicting_string(strs)#

Returns a string distinct from given strings.

Parameters

strs (List[str]) –

Return type

str

print_sdf(sdf)#

Prints a spark dataframe in a deterministic way.

Parameters

sdf (pyspark.sql.DataFrame) –

Return type

None

copy_if_mutable(value)#

Returns a deep copy of argument if it is mutable.

Parameters

value (T) –

Return type

T

get_fullname(obj)#

Returns the fully qualified name of the given object.

Parameters

obj (Any) – Object to get the name of.

Return type

str

escape_column_name(column_name)#

Escapes column name if it contains special characters.

Parameters

column_name (str) – The name of the column to check and potentially escape.

Return type

str

Classes#

RNGWrapper

Mimics python random interface for discrete gaussian sampling.

class RNGWrapper(rng)#

Mimics python random interface for discrete gaussian sampling.

Parameters

rng (numpy.random.Generator) –

__init__(rng)#

Constructor.

Parameters

rng (GeneratorGenerator) – NumPy random generator.

randrange(high)#

Returns a random integer between 0 (inclusive) and high (exclusive).

Parameters

high (int) – upper bound for random integer range.

Return type

int