This file contains hidden or 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 threading import Timer | |
class RepeatedTimer(object): | |
def __init__(self, interval, function, *args, **kwargs): | |
self._timer = None | |
self.interval = interval | |
self.function = function | |
self.args = args | |
self.kwargs = kwargs |
This file contains hidden or 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 lxml import etree | |
from lxml.etree import CDATA | |
from lxml.etree import QName | |
_CONST_ATTRIB_INDICATOR = '#' | |
def _build_xml_element(parent, d, wrap_lists, nsmap): | |
if isinstance(d, dict): | |
attrib = {} | |
content = {} |
This file contains hidden or 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 re | |
def exists(obj, path): | |
path = path.split('.') | |
level0 = path[0] | |
level1 = '.'.join(path[1:]) | |
return obj is not None and hasattr(obj, level0) if len(path) == 1 else exists(getattr(obj, level0), level1) if hasattr(obj, level0) else False |
This file contains hidden or 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 csv | |
import os | |
import re | |
import sys | |
from collections import defaultdict | |
from datetime import datetime | |
def reduce_ifopt(ifopt_id: str) -> str: | |
pattern = r"^[a-z]{2}:\d{5}:[\w\d]+(:[\w\d]+){0,2}$" |
This file contains hidden or 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 json | |
import os | |
from datetime import datetime | |
from lxml.etree import fromstring | |
from lxml.etree import tostring | |
class Datalog: | |
@classmethod |
This file contains hidden or 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 click | |
import csv | |
import duckdb | |
import polars | |
@click.command | |
@click.option('--file', '-f', help='Input CSV file') | |
@click.option('--db', '-d', help='DuckDB filename') | |
@click.option('--table', '-t', help='Destination table name to import the CSV file') | |
@click.option('--create-statement', '-c', default=None, help='Create statement filename for destination table') |
This file contains hidden or 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 csv | |
import re | |
import os | |
from isa.ascdef import name2def | |
######################################################################################################################## | |
# Helper class for reading and modifying *.asc files. | |
######################################################################################################################## |
This file contains hidden or 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 csv | |
import re | |
######################################################################################################################## | |
# Helper class for reading and modifying *.x10 files. | |
######################################################################################################################## | |
def read_x10_file(filename): | |
x10_file = X10File() | |
x10_file.read(filename) |
This file contains hidden or 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 os | |
import requests | |
import math | |
import zipfile | |
from optparse import OptionParser | |
# map server constants | |
MAP_SERVER_ADDRESS = '[YourMapServer]' | |
MAP_SERVER_USERNAME = '' |
This file contains hidden or 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 hashlib | |
import re | |
import unittest | |
from abc import abstractmethod | |
class ObjectUnifier: | |
_token_list = [] |
NewerOlder