2024-07-18 23:24:32 +00:00
|
|
|
import array
|
|
|
|
|
2024-07-17 21:30:12 +00:00
|
|
|
from pseudodb import pseudodb
|
|
|
|
from utils.file_utils import search_path
|
|
|
|
from utils.str_utils import obscure, unobscure, get_random_string, get_dash_suffix
|
|
|
|
from utils.misc_utils import immutable_to_list
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
db = pseudodb.PseudoDB('pseudodb.default.data')
|
2024-07-17 21:59:13 +00:00
|
|
|
data_collections = db.get_collections()
|
2024-07-17 21:43:56 +00:00
|
|
|
print("Collections in Pseudodb: "+str(data_collections))
|
2024-07-18 23:24:32 +00:00
|
|
|
for collection, coltype in data_collections:
|
|
|
|
|
|
|
|
if coltype is dict:
|
|
|
|
print("Processing Dictionary: "+collection)
|
|
|
|
for key in db.get_keys(collection):
|
|
|
|
print("\t"+key+": "+str(db.get_values(collection, key)))
|
|
|
|
|
|
|
|
elif coltype is list:
|
|
|
|
print("Processing List: "+collection)
|
|
|
|
print([str(item) for item in db.get_values(collection)])
|
2024-07-17 21:43:56 +00:00
|
|
|
|
2024-07-18 23:24:32 +00:00
|
|
|
elif coltype is array.array:
|
|
|
|
print("Processing Array: "+collection)
|
|
|
|
print([str(item) for item in db.get_values(collection)])
|
2024-07-17 21:30:12 +00:00
|
|
|
|
2024-07-18 23:24:32 +00:00
|
|
|
elif coltype is tuple:
|
|
|
|
print("Processing Tuple: "+collection)
|
|
|
|
print([str(item) for item in db.get_values(collection)])
|
|
|
|
|
|
|
|
else: # just assume it's a string
|
|
|
|
print(str(db.get_values(collection)))
|
|
|
|
|
|
|
|
print("\n\n")
|
2024-07-17 21:30:12 +00:00
|
|
|
immutable_list = ('one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine')
|
|
|
|
print("Immutable: "+str(immutable_list))
|
|
|
|
shuffled_list = immutable_to_list(immutable_list, scramble=True)
|
|
|
|
print("Shuffled Mutable: "+str(shuffled_list))
|
|
|
|
|
2024-07-18 23:24:32 +00:00
|
|
|
print("\n\n")
|
2024-07-17 21:30:12 +00:00
|
|
|
files = search_path("./utils", "misc")
|
|
|
|
print("Search Results: "+str(files))
|
|
|
|
|
2024-07-18 23:24:32 +00:00
|
|
|
print("\n\n")
|
2024-07-17 21:30:12 +00:00
|
|
|
rando_string = get_random_string(30, caps=True, numbers=True, specials=True)
|
|
|
|
print("Random: "+rando_string)
|
|
|
|
|
|
|
|
obscured = obscure(rando_string)
|
|
|
|
print("Obscured: "+str(obscured))
|
|
|
|
|
|
|
|
unobscured = unobscure(obscured)
|
|
|
|
print("Unobscured: "+unobscured)
|
|
|
|
|
|
|
|
dash_suffix = get_dash_suffix("example-silly-string-with-dashes-"+get_random_string(10))
|
|
|
|
print("Suffix found: "+dash_suffix)
|