Skip to content

utils Module

add(x, y)

Add Function

Source code in geogee\utils.py
18
19
20
def add(x, y):
    """Add Function"""
    return x + y

divide(x, y)

Divide Function

Source code in geogee\utils.py
33
34
35
36
37
def divide(x, y):
    """Divide Function"""
    if y == 0:
        raise ValueError('Can not divide by zero!')
    return x / y 

multiply(x, y)

Multiply Function

Source code in geogee\utils.py
28
29
30
def multiply(x, y):
    """Multiply Function"""
    return x * y

random_string(string_length=3, use_seed=False)

Generates a random string of fixed length. Args: string_length (int, optional): Fixed length. Defaults to 3. Returns: str: A random string

Source code in geogee\utils.py
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
def random_string(string_length=3, use_seed=False):
    """Generates a random string of fixed length.
    Args:
        string_length (int, optional): Fixed length. Defaults to 3.
    Returns:
        str: A random string
    """
    import random
    import string

    if use_seed:
        random.seed(1001)
    letters = string.ascii_lowercase
    return "".join(random.choice(letters) for i in range(string_length))

subtract(x, y)

Subtract Function

Source code in geogee\utils.py
23
24
25
def subtract(x, y):
    """Subtract Function"""
    return x - y