This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Win32 virtual-key (VK) constants for Python, extracted from winuser.h with | |
comments. | |
Original copyright notice printed below: | |
/**************************************************************************** | |
* * | |
* winuser.h -- USER procedure declarations, constant definitions and macros * | |
* * | |
* Copyright (c) Microsoft Corporation. All rights reserved. * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from delta import DeltaTable | |
from pyspark.sql import SparkSession | |
from typing import Union | |
import logging | |
def get_logger(name: str): | |
"""Returns an instance of the logger""" | |
logger = logging.getLogger(name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
import numpy as np | |
from itertools import cycle | |
def generate_fake_dataframe(size, cols, col_names = None, intervals = None, seed = None): | |
categories_dict = {'animals': ['cow', 'rabbit', 'duck', 'shrimp', 'pig', 'goat', 'crab', 'deer', 'bee', 'sheep', 'fish', 'turkey', 'dove', 'chicken', 'horse'], | |
'names' : ['James', 'Mary', 'Robert', 'Patricia', 'John', 'Jennifer', 'Michael', 'Linda', 'William', 'Elizabeth', 'Ahmed', 'Barbara', 'Richard', 'Susan', 'Salomon', 'Juan Luis'], | |
'cities' : ['Stockholm', 'Denver', 'Moscow', 'Marseille', 'Palermo', 'Tokyo', 'Lisbon', 'Oslo', 'Nairobi', 'Río de Janeiro', 'Berlin', 'Bogotá', 'Manila', 'Madrid', 'Milwaukee'], | |
'colors' : ['red', 'orange', 'yellow', 'green', 'blue', 'indigo', 'purple', 'pink', 'silver', 'gold', 'beige', 'brown', 'grey', 'black', 'white'] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pyspark.sql.types import StructType | |
# get field name from schema (recursive for getting nested values) | |
def get_schema_field_name(field, parent=None): | |
if type(field.dataType) == StructType: | |
if parent == None: | |
prt = field.name | |
else: | |
prt = parent+"."+field.name # using dot notation | |
res = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Win32 virtual-key (VK) constants for Python, extracted from winuser.h with | |
comments. | |
Original copyright notice printed below: | |
/**************************************************************************** | |
* * | |
* winuser.h -- USER procedure declarations, constant definitions and macros * | |
* * | |
* Copyright (c) Microsoft Corporation. All rights reserved. * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
""" | |
Purpose: Convert .NET ticks to formatted ISO8601 time | |
Author: D Hohls < dhohls@csir.co.za> | |
""" | |
from __future__ import print_function | |
import datetime | |
import sys | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import struct | |
import time | |
import sys | |
import base64 | |
import hashlib | |
import datetime | |
def parse_thread_index(index: 'str') -> ("tuple (str, array [datetime.datetime, ...])"): | |
import binascii |