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 requests | |
import multiprocessing | |
import setproctitle | |
import os | |
import threading | |
import tracemalloc | |
import linecache | |
import traceback | |
import gc | |
import logging |
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
#!/usr/bin/env python3.5 | |
import zmq.asyncio | |
import zmq | |
import asyncio | |
import pickle | |
import logging | |
import tempfile | |
import traceback | |
import multiprocessing |
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
#include <unistd.h> | |
#include <sys/types.h> | |
#include <errno.h> | |
#include "zmq.h" | |
#include <stdio.h> | |
#include <sys/wait.h> | |
#include <stdlib.h> | |
#include <stdexcept> | |
#include <time.h> | |
#include <string> |
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 numpy as np | |
import netCDF4 | |
def reversed_list_enumerate(value: list): | |
for i in range(-1, -len(value) - 1, -1): | |
yield i, value[i] | |
def find_first(dataset, var_name, reverse: bool, ahps_to_inches: bool=False): |
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 asyncio | |
import aiohttp.web | |
async def stream_handler(request): | |
# Without the Content-Type, most (all?) browsers will not render | |
# partially downloaded content. Note, the response type is | |
# StreamResponse not Response. | |
resp = aiohttp.web.StreamResponse(status=200, | |
reason='OK', | |
headers={'Content-Type': 'text/html'}) |
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 inspect import iscoroutinefunction, isawaitable | |
import sys | |
from collections import deque | |
# NOTE: this follows the contextlib.ExitStack implementation | |
class _BaseExitStack: | |
def __init__(self): |
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 wrapt | |
from aws_xray_sdk.core import xray_recorder | |
from aws_xray_sdk.core.models import http | |
from aws_xray_sdk.ext.util import inject_trace_header | |
import ssl | |
_XRAY_PROP = '_xray_prop' |
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
#!/usr/local/bin/python3 | |
from aiohttp import (ClientSession, TCPConnector, BasicAuth) | |
from asyncio import get_event_loop | |
from async_timeout import timeout as aio_timeout | |
from ssl import create_default_context | |
from yarl import URL | |
# allows us to customize the session with cert files | |
def setup_session(self, path_to_cert=None, custom_headers=None, login=None, close=False): |
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 msgpack | |
import gc | |
import datetime | |
from datetime import timezone, timedelta | |
empty_dict_bytes = msgpack.packb({}) | |
_datetime_ExtType = 42 | |
# NOTE: if we were to store the timestamp instead of the extended information, for naive datetimes we'd have to convert |
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 asyncio | |
import logging | |
from typing import List | |
def _ignore_task_exception(task: asyncio.Future, logger: logging.Logger): | |
# noinspection PyBroadException | |
try: | |
task.result() | |
except BaseException: |
OlderNewer