source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
run_all.py | """Run all test cases.
Run each file in a separate process to avoid GPU memory conflicts.
Usages:
# Run all files
python3 run_all.py
# Run files whose names contain "pipeline"
python3 run_all.py --run-pattern pipeline
# Run files whose names contain "shard_parallel"
python3 run_all.py --run-pattern shard_parallel
#... |
server_tester.py | # Copyright 2019 MobiledgeX, Inc. All rights and licenses reserved.
# MobiledgeX, Inc. 156 2nd Street #408, San Francisco, CA 94105
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# htt... |
federated_thzdata_sample_1NN.py | from __future__ import absolute_import, division, print_function, unicode_literals
from keras.utils import to_categorical
import numpy as np
import tensorflow as tf
import datetime
import scipy.io as sio
import multiprocessing
import math
from matplotlib.pyplot import pause
import os
import glob
# Parameters for learn... |
useless_machine.py | import threading
class UselessMachine(object):
def __init__(self):
self.switches = ["OFF" for x in range(10)]
self.queue = []
self.cond = threading.Condition()
self.finished = False
def flipOn(self, idx):
self.cond.acquire()
if self.switches[idx] == "OFF":
self.queue.append(idx)
... |
rnn_model.py | from __future__ import print_function
import tensorflow as tf
import threading as th
import numpy as np
from glob import glob
from math import ceil
from keras.layers import Dense, GRU, Embedding
from keras.metrics import binary_accuracy as accuracy
from keras.objectives import binary_crossentropy as crossentropy
from ... |
stinner.py | """stinner.py: Read from stdin with curses and figure out what keys were pressed."""
import Queue
import curses
import string
from threading import Thread
import sys
__author__ = "Raido Pahtma"
__license__ = "MIT"
def read_stdin(stdin_input, queue):
"""
Reading from stdin in a thread and then communicating ... |
installwizard.py | import sys
from PyQt4.QtGui import *
from PyQt4.QtCore import *
import PyQt4.QtCore as QtCore
import electrum
from electrum.wallet import Wallet
from electrum.mnemonic import prepare_seed
from electrum.util import UserCancelled
from electrum.base_wizard import BaseWizard
from electrum.i18n import _
from seed_dialog ... |
bench.py | #!/usr/bin/env python3
import os
import sys
import time
import subprocess
import gc
import statistics
import json
import threading
import re
import csv
# Need to avoid as much extra CPU usage as possible
gc.disable()
# sysfs power supply nodes for power sampling
POWER_SUPPLY = None
POWER_SUPPLY_NODES = [
# Qualc... |
wallet_multiwallet.py | #!/usr/bin/env python3
# Copyright (c) 2017-2020 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test multiwallet.
Verify that a xepd node can load multiple wallet files
"""
from decimal import Decim... |
test_pooling.py | # Copyright 2009-present MongoDB, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wri... |
subscriber.py | from sbf import *
import threading
import time
import pickle
def dispatch(queue):
queue.dispatch()
class SubscriberDelegate(SbfSubDelegate):
def onSubReady(self, sub):
print("Subscriber Ready")
def onSubMessage(self, sub, buffer):
global received
received += 1
if (received... |
server.py | import socket
from .conn import Server_conn
import os
import threading
class Server:
def __init__(self, host, port):
self.host = host
self.port = port
def start(self):
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind((self.host, self.port))
s.listen(... |
__init__.py | import numpy
import json as _json
import uuid as _uuid
import socket as _socket
import threading as _td
import logging as _log
import base64 as _base64
import struct as _struct
import time as _time
from warnings import warn as _warn
def _current_time_millis():
"""Returns current time in milliseconds.
"""
... |
basic_models.py | import tensorflow as tf
import numpy as np, os, time, logging, json
import multiprocessing as mp
import util
from functools import partial
from copy import deepcopy
initializer = tf.contrib.layers.xavier_initializer(uniform=False)
dense = partial(tf.layers.dense, kernel_initializer = initializer)
class CFG(object):
... |
data.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import random
import logging
import sys
import numbers
import math
import sklearn
import datetime
import numpy as np
import cv2
import mxnet as mx
from mxnet import ndarray as nd
#from . import _ndar... |
tello.py | # coding=utf-8
import logging
import socket
import time
import threading
import cv2
from threading import Thread
from .decorators import accepts
class Tello:
"""Python wrapper to interact with the Ryze Tello drone using the official Tello api.
Tello API documentation:
https://dl-cdn.ryzerobotics.com/downl... |
p2pRTCHttp.py | import sys
import argparse
import asyncio
import json
import time
import threading
import urllib.parse
import urllib.request
import logging
try:
from aiortc import RTCIceCandidate, RTCPeerConnection, RTCSessionDescription
from aiortc.contrib.signaling import BYE
except:
print("Please install aiortc with be... |
13 with-lock-test.py | # encoding = utf-8
__author__ = "mcabana.com"
# 订单要求生产1000个杯子,组织10个工人生产。请忽略老板,关注工人生成杯子
import logging
import threading
import time
FORMAT = "%(asctime)s %(threadName)s %(thread)d: %(message)s"
logging.basicConfig(format=FORMAT, level=logging.DEBUG)
cups = []
lock = threading.Lock()
def worker(count=1000):
lo... |
context.py | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... |
shell.py | # Description: Recv/Send to master
import sys
import time
from queue import Queue
from threading import Thread, RLock
class Shell(object):
def __init__(self, sess_obj, interface):
self.interface = interface
self.keylogging = False
self.keystrokes = None
self.sess = ... |
insultU.py | # Importing all the required libraries
import cv2
import threading
import random, time
import win32com.client as wincl
import curselist
# Using Haar cascade classifiers for object detection
face_cascade = cv2.CascadeClassifier(
cv2.data.haarcascades + "haarcascade_frontalface_default.xml"
)
smile_cascade = cv2.Cas... |
mav_test1.py | #
# Air Cam Pro 2021
# This is tests for python mavlink for camera control
# It uses snippets and code from the sources given below
# REV 1.1 23-12-2021 1700
#
# Mark Jacobsen
# mark@syriaairlift.org
#
# example mavlink GUI
# https://github.com/markdjacobsen/hellomav
#
# Joystick readers and mavlink over UDP
# https:/... |
youtube_download_playlist.py |
from pytube import YouTube
from pytube import Playlist
import os
import glob
from time import sleep
import ffmpeg
from multiprocessing import Process
from multiprocessing import Queue
import configparser
import shutil
import re
global PLAYLIST_URLS, VIDEO_URLS, TARGET_RESOLUTION, NUMBER_OF_THREADS, DELAY_M... |
learner.py | # Copyright 2020 DeepMind Technologies Limited. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... |
common_utils.py | r"""Importing this file must **not** initialize CUDA context. test_distributed
relies on this assumption to properly run. This means that when this is imported
no CUDA calls shall be made, including torch.cuda.device_count(), etc.
torch.testing._internal.common_cuda.py can freely initialize CUDA context when imported.... |
main.py | import os
import string
import argparse
from threading import Thread
from scrapper import Scrapper
code_chars = list(string.ascii_lowercase) + list(string.digits)
base = len(code_chars)
def digit_to_char(digit):
if digit < 10:
return str(digit)
return chr(ord('a') + digit - 10)
def str_base(number, ... |
cad_view.py | import json
import os
import tkinter as tk
from pathlib import Path
from queue import Queue
from threading import Thread
import rasterio
from flask import Flask, Response, jsonify, request, send_from_directory
from PIL import ImageColor
from annotation_gui_gcp.lib.view import distinct_colors
def _load_georeference_m... |
core_test.py | # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
streamdeck.py | # Python Stream Deck Library
# Released under the MIT license
#
# dean [at] fourwalledcubicle [dot] com
# www.fourwalledcubicle.com
#
import threading
import time
from abc import ABC, abstractmethod
from ..transport.Transport import TransportError
class StreamDeck(ABC):
"""
Represents... |
sort_by_md5.py | import requests
import ujson
import csv
import threading
import time
import os
import asyncio
import aiohttp
import queue
import shutil
#file_root_path = '/home/data/'
file_root_path = 'D:/pro_test_data'
file_name1 = 'dwa_d_ia_s_user_prod_0716.txt'
file_name2 = 'dwa_d_ia_s_user_prod_transcoded.txt'
md5_tel_dict = 'md5... |
workflow_docker.py | #!/usr/bin/env python3
"""Docker workflow runner"""
import os
import io
import json
import time
import sys
import subprocess
from typing import Optional
from threading import Event, Thread
from collections.abc import Callable
import logging
#DOCKER_IMAGE = 'agdrone/drone-workflow:1.1'
DOCKER_IMAGE = 'chrisatua/develo... |
common.py | import re
import socket
from threading import Thread
import requests
from influx_line_protocol import MetricCollection
from requests import Timeout
RE_URL = re.compile(r"^https?://.+$")
class Client:
"""Telegraf report client which knows own ip :o"""
def __init__(self, url: str, tgf_address):
if R... |
test_ssl.py | # Test the support for SSL and sockets
import sys
import unittest
from test import support
import socket
import select
import time
import datetime
import gc
import os
import errno
import pprint
import tempfile
import urllib.request
import traceback
import asyncore
import weakref
import platform
import functools
ssl =... |
broker.py | # Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to us... |
load_GiTax_info.py | #!/usr/bin/python
import MySQLdb
import multiprocessing
from contextlib import closing
"""
load_gi_to_taxID.py -
Generates GIs and corresponding TaxIDs. When instantiated, utilize genNucl or
genProt to yield the line from the respective dmp. If run on its own, it will
create database table giTax with gi and taxI... |
cabot_ble.py | #!/usr/bin/env python
# Copyright (c) 2020 Carnegie Mellon University
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use... |
master_monitor.py | # Software License Agreement (BSD License)
#
# Copyright (c) 2012, Fraunhofer FKIE/US, Alexander Tiderko
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code mus... |
test_mix.py | import pdb
import copy
import pytest
import threading
import datetime
import logging
from time import sleep
from multiprocessing import Process
import sklearn.preprocessing
from milvus import IndexType, MetricType
from utils import *
dim = 128
index_file_size = 10
table_id = "test_mix"
add_interval_time = 2
vectors = ... |
liveview.py | import argparse
import logging
import datetime
import time
import json
import threading
import pandas as pd
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation
from pymongo import MongoClient
import strategies
import indicators
plt.style.use('ggplot')
class LiveTicker():
def __init_... |
context.py | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... |
molfile_stereo_desc.py | import os
import sys
import threading
sys.path.append("../../common")
from env_indigo import *
threading.stack_size(2 * 1024 * 1024)
def stereo_desc_test(py_file, out_queue):
indigo = Indigo()
indigo.setOption("molfile-saving-skip-date", "1")
indigo.setOption("molfile-saving-add-stereo-desc", "1")
... |
app.py | #!/usr/local/bin/python
# -*- coding: utf-8 -*-
from sentry_sdk.integrations.flask import FlaskIntegration
import sentry_sdk
import threading
import time
from Models.leaderboard import Leaderboard
from Models.setting import Setting
from Models.riot import Riot
from Models.network import Network
from Models.player impor... |
decorator.py | # Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... |
main.py | import numpy as np
import argparse
import pickle
import cv2
import os
from threading import Thread
import pyttsx3
from usbcamvideostream import USBCamVideoStream
from fps import FPS
fps = FPS().start()
block = True
name = None
frames = []
def voice():
if os.name == 'nt':
engine = pyttsx3.init(driverName... |
process.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import os
import tempfile
import subprocess
import tensorflow as tf
import numpy as np
import tfimage as im
import threading
import time
import multiprocessing
edge_pool = None
parser = argp... |
test_dag_processing.py | #
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... |
http.py | # -*- coding: utf-8 -*-
'''
HTTP(s) transport for napalm-logs.
'''
from __future__ import absolute_import
from __future__ import unicode_literals
# Import stdlib
import logging
import threading
import json
try:
import Queue as queue
except ImportError:
import queue
# Import third party libs
try:
import re... |
static.py | from isobar.pattern.core import *
import threading
import inspect
import math
class PStaticViaOSC (Pattern):
listening = False
def __init__(self, default = 0, address = "/value", port = 9900):
if not PStaticViaOSC.initialised:
server = OSC.OSCServer(("localhost", port))
se... |
http_server.py | import threading
from collections import defaultdict
from http import HTTPStatus
from http.server import HTTPServer, BaseHTTPRequestHandler
from urllib.parse import urlparse
import pytest
class TestHandler(BaseHTTPRequestHandler):
handlers = defaultdict(dict)
@classmethod
def handler(cls, method, path)... |
app.py | # -*- coding: utf-8 -*-
import bot
import json
import hashlib
import requests
import os
import asyncio
import tinys3
from flask import Flask, request, make_response, render_template, send_from_directory, send_file
from pyppeteer.launcher import launch
from os.path import join, dirname
from dotenv import load_dotenv
f... |
geemap.py | """Main module for interactive mapping using Google Earth Engine Python API and ipyleaflet.
Keep in mind that Earth Engine functions use both camel case and snake case, such as setOptions(), setCenter(), centerObject(), addLayer().
ipyleaflet functions use snake case, such as add_tile_layer(), add_wms_layer(), add_mi... |
gcc.py |
#
# Copyright 2016-2017 Games Creators Club
#
# MIT License
#
import pygame
import pyros
import pyros.gccui
import threading
import time
import socket
import netifaces
import sys
DEBUG = False
rovers = []
doDiscovery = True
showRovers = False
selectedRover = 0
connectedRover = 0
selectedRoverMap = {}
# {
# "ro... |
playSolid.py | # NeoPixel multithreaded display
# This script plays all lyr_* modules in the directory, calling hte NeoFX() function from the module
# Author: Karl Grindley (karl@linuxninja.net)
#
# derived from NeoPixel library strandtest example
# NeoPixel strandtest Author: Tony DiCola (tony@tonydicola.com)
import time
import mul... |
get_audio.py | #coding:utf-8
import pyaudio
import threading
import numpy as np
from pathlib import Path
from take_picture import AutoTakePictures
#from matplotlib import pyplot as plt
chunk = 1024*2
FORMAT = pyaudio.paInt16
CHANNELS = 1
RATE = 16000
RECORD_SECONDS = 1
STOCK_FILE_NUM = 20
p = pyaudio.PyAudio()
picture = AutoTakeP... |
covidtrooper.py | # IMPORT
import csv
import requests
from bs4 import BeautifulSoup
import time
import threading
import math
import tweepy
from tkinter import *
import pyttsx3
# TWITTER CONSUMER AND ACCESS KEY
consumer_key = 'zDWPLuFK9IoGhs5lrXpKqCNBp'
consumer_secret = '2MV94YDcCwtXE54FhYYzk1mngQroA7rWNqajbkipGRcSwAWTQ2'... |
PeerNode.py | #!/usr/bin/env python3
import os
import json
import time
import socket
import threading
from . import config
from uuid import uuid4
from .logging import LOGGER
from rich.table import Table
from .CustomAES import CustomAES
from base64 import b64encode, b64decode
from .GenericMultiThreadedServer import GenericMultiThrea... |
my_chat.py | # -*- coding: utf-8 -*-
import itchat
import sys
import os
import importlib
import threading
import time
from constants.type import *
from config.config import *
from itchat.content import *
from proto.info import *
from proto.proto import IdAgreement
from proto.proto import KeyAgreement
from proto.util import UtilTool... |
app.py | import json
import logging
import multiprocessing as mp
import os
from logging.handlers import QueueHandler
from typing import Dict, List
import sys
import signal
import yaml
from gevent import pywsgi
from geventwebsocket.handler import WebSocketHandler
from peewee_migrate import Router
from playhouse.sqlite_ext impor... |
smtio.py | #
# yosys -- Yosys Open SYnthesis Suite
#
# Copyright (C) 2012 Clifford Wolf <clifford@clifford.at>
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#... |
fj_refactored_old.py | import numpy
import time
import multiprocessing
import ctypes
import warnings
#Suppress the divide by zero errors
warnings.filterwarnings('ignore', category=RuntimeWarning)
numpy.set_printoptions(linewidth = 200, suppress = True)
def fisher_jenks(values, classes=5, cores=None, sort=True):
'''Fisher-Jenks Optimal ... |
audio.py | from plyer.facades import Audio
import pyaudio
import wave
import threading
class LinuxAudio(Audio):
_chunk = 1024
_format = pyaudio.paInt16
_channels = 2
_rate = 44100
_frames = []
_recording = None
def _start(self):
self._recording = threading.Thread(target=self.__record, args=(... |
workflows_scaling.py | #!/usr/bin/env python
"""A small script to drive workflow performance testing.
% ./test/manual/launch_and_run.sh workflows_scaling --collection_size 500 --workflow_depth 4
$ .venv/bin/python scripts/summarize_timings.py --file /tmp/<work_dir>/handler1.log --pattern 'Workflow step'
$ .venv/bin/python scripts/summarize_... |
reduce.py | import string
from copy import deepcopy
import os.path
from time import gmtime, strftime
from multiprocessing import Queue
from threading import Thread
import time
import numpy as np
import pandas as pd
import h5py
from refnx.reduce.platypusnexus import (
PlatypusNexus,
ReflectNexus,
number_datafile,
... |
Telegram.py | import telebot, Ethereum, threading, time, MongoDB
from datetime import datetime
bot = telebot.TeleBot('TOKEN')
def timer_func():
while True:
for address in MongoDB.get_contracts_notification():
notification = Ethereum.auction_event(address['Contract_Address'], address['Time'])
... |
test_logging.py | # Copyright 2001-2019 by Vinay Sajip. All Rights Reserved.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted,
# provided that the above copyright notice appear in all copies and that
# both that copyright notice and this permissio... |
test_locks.py | # -*- coding:utf-8 -*-
from __future__ import (
absolute_import, division, print_function, unicode_literals,
)
from threading import Thread
import pytest
from django.db import OperationalError, connection, connections
from django.db.transaction import TransactionManagementError, atomic
from django.test import Tes... |
test_sql_hsqldb.py | # This file is Public Domain and may be used without restrictions,
# because noone should have to waste their lives typing this again.
import _jpype
import jpype
from jpype.types import *
from jpype import java
import jpype.dbapi2 as dbapi2
import common
import time
import datetime
import decimal
import threading
java... |
managers.py | #
# Module providing the `SyncManager` class for dealing
# with shared objects
#
# multiprocessing/managers.py
#
# Copyright (c) 2006-2008, R Oudkerk
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are m... |
app.py | # -*- coding: utf-8 -*-
"""
:author: Grey Li (李辉)
:url: http://greyli.com
:copyright: © 2018 Grey Li
:license: MIT, see LICENSE for more details.
"""
import os
from threading import Thread
import sendgrid
from sendgrid.helpers.mail import Email as SGEmail, Content, Mail as SGMail
from flask_mail import... |
util.py | # Copyright 2013-2018 Aerospike, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... |
monit.py | import curses
import sys
import threading
import time
import traceback
from .__main__ import (process_cpu_command, process_mem_command,
process_pid_command, process_stderr_command,
process_stdout_command, process_uptime_command)
from .units import Size, Time
CTRL_Z = 26
C... |
GUI_test.py | #!/usr/bin/env python
#############################################################################
##
## Copyright (C) 2013 Riverbank Computing Limited.
## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
## All rights reserved.
##
## This file is part of the examples of PyQt.
##
## $QT_BEGIN_LICENS... |
mlx_thermal.py | import time
import board
import busio
import adafruit_mlx90640
import cv2
import numpy as np
from PIL import Image
import imutils
from collections import deque
import threading
import datetime
def save_to_file(filename, area, mean_temp, max_temp):
current_time = datetime.datetime.now().isoformat("_")
array_to... |
Misc.py | ## @file
# Common routines used by all tools
#
# Copyright (c) 2007 - 2019, Intel Corporation. All rights reserved.<BR>
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
##
# Import Modules
#
from __future__ import absolute_import
import sys
import string
import threading
import time
import re
import ... |
test_extending.py | import math
import operator
import sys
import pickle
import multiprocessing
import ctypes
import warnings
from distutils.version import LooseVersion
import re
import numpy as np
from numba import njit, jit, vectorize, guvectorize, objmode
from numba.core import types, errors, typing, compiler, cgutils
from numba.core... |
leader.py | # -*- coding: UTF-8 -*-
# 基本
from __future__ import division
import time
import uuid
import logging
import sys
import json
import threading
import os
# 访问activemq
import stomp
# 访问zookeeper
from kazoo.client import KazooClient
# 访问数据库
import psycopg2
# 定时任务
from datetime import datetime
from apscheduler.schedulers.bac... |
train_pg_f18.py | """
Original code from John Schulman for CS294 Deep Reinforcement Learning Spring 2017
Adapted for CS294-112 Fall 2017 by Abhishek Gupta and Joshua Achiam
Adapted for CS294-112 Fall 2018 by Michael Chang and Soroush Nasiriany
"""
import inspect
import os
import time
from multiprocessing import Process
import gym
impor... |
kb_reaction_gene_finderServer.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import datetime
import json
import os
import random as _random
import sys
import traceback
from getopt import getopt, GetoptError
from multiprocessing import Process
from os import environ
from wsgiref.simple_server import make_server
import requests as _requests
from json... |
camnode.py | #emacs, this is -*-Python-*- mode
"""
There are several ways we want to acquire data:
A) From live cameras (for indefinite periods).
B) From full-frame .fmf files (of known length).
C) From small-frame .ufmf files (of unknown length).
D) From a live image generator (for indefinite periods).
E) From a point generator... |
i3-cycle-focus.py | #!/usr/bin/env python3
import os
import socket
import selectors
import threading
from argparse import ArgumentParser
import i3ipc
SOCKET_FILE = '/tmp/i3-cycle-focus'
MAX_WIN_HISTORY = 16
UPDATE_DELAY = 2.0
class FocusWatcher:
def __init__(self):
self.i3 = i3ipc.Connection()
self.i3.on('window::f... |
workset_upload.py | #!/usr/bin/env python
import argparse
from genologics.entities import Process
from genologics.lims import *
from genologics.lims_utils import *
from genologics.config import BASEURI, USERNAME, PASSWORD
import process_categories as pc
from datetime import datetime, timedelta
import statusdb.db as sdb
import multiproce... |
recover_ssp_miniters.py | import os
import threading
def scp_miniters(ip):
path = '/home/yegeyan/MXNet-G/example/image-classification/'
from_path = './ssp/miniters.log'
to_path = 'yegeyan@' + ip + ':' + path
cmd = 'scp' + ' ' + from_path + ' ' + to_path
os.system(cmd)
if __name__ == '__main__':
file = open("ssp/miniter... |
participant.py | import threading
import time
from typing import Tuple
import grpc
from numproto import ndarray_to_proto, proto_to_ndarray
from xain.grpc import coordinator_pb2, coordinator_pb2_grpc
from xain.types import History, Metrics, Theta
RETRY_TIMEOUT = 5
HEARTBEAT_TIME = 10
def heartbeat(channel, terminate_event):
stu... |
plugin.py | from binascii import hexlify, unhexlify
from electrum_safecoin.util import bfh, bh2u
from electrum_safecoin.bitcoin import (b58_address_to_hash160, xpub_from_pubkey,
TYPE_ADDRESS, TYPE_SCRIPT)
from electrum_safecoin import constants
from electrum_safecoin.i18n import _
from electrum... |
meraki_captive_portal_simulator.py | """
Cisco Meraki Captive Portal simulator
Default port: 5003
Matt DeNapoli
2018
https://developer.cisco.com/site/Meraki
"""
# Libraries
from flask import Flask, request, render_template, redirect, url_for
import random
import datetime
import time
import requests
import webview
import netifaces as nif
import dateti... |
wsdump.py | #!/Users/user1/raidenenv/bin/python2.7
import argparse
import code
import sys
import threading
import time
import ssl
import six
from six.moves.urllib.parse import urlparse
import websocket
try:
import readline
except ImportError:
pass
def get_encoding():
encoding = getattr(sys.stdin, "encoding", "")
... |
radar_viewer.py | import multiprocessing
import sys
import threading
import time
import traceback
import webbrowser
from acconeer.exptool import clients, utils
from server import http_server
def check_connection(args):
print("Checking connection to radar")
try:
if args.socket_addr:
client = clients.Socket... |
slp_dagging.py | """
Breadth-first DAG digger for colored coins.
We do a breadth-first DAG traversal starting with the transaction-of-interest
at the source, and digging into ancestors layer by layer. Along the way we
prune off some connections, invalidate+disconnect branches, etc.,
so our 'search DAG' is a subset of the transaction D... |
pigpio.py | """
pigpio is a Python module for the Raspberry which talks to
the pigpio daemon to allow control of the general purpose
input outputs (GPIO).
[http://abyz.me.uk/rpi/pigpio/python.html]
*Features*
o the pigpio Python module can run on Windows, Macs, or Linux
o controls one or more Pi's
o hardware timed PWM on any ... |
appjar.py | # -*- coding: utf-8 -*-
""" appJar.py: Provides a GUI class, for making simple tkinter GUIs. """
# Nearly everything I learnt came from: http://effbot.org/tkinterbook/
# with help from: http://infohost.nmt.edu/tcc/help/pubs/tkinter/web/index.html
# with snippets from stackexchange.com
# make print & unicode backwards ... |
appQT.py | import cgitb
import sys
from configparser import ConfigParser
from json import dumps, loads
from os import getcwd, getlogin, mkdir, path, startfile
from threading import Thread
from webbrowser import open as openUrl
from PyQt5.QtCore import Qt, pyqtSignal
from PyQt5.QtGui import QCursor, QIcon
from PyQt5.QtWidgets imp... |
track_v3.py | """
Author: Konstantinos Angelopoulos
Date: 04/02/2020
All rights reserved.
Feel free to use and modify and if you like it give it a star.
MAIN FILE
"""
import os
import sys
import threading
from functools import wraps
from pykinect2.PyKinectV2 import *
from pykinect2 import PyKinectV2
from pykinect2 import PyKinect... |
utility.py | import os
import sys
from sys import platform
from datetime import timedelta
import logging
import time
import argparse
import random as rn
import tensorflow as tf
import numpy as np
from collections import deque
from multiprocessing import Process
def softmax(x):
"""Compute softmax values for each sets of scores... |
ncm2_d_dcd.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from subprocess import Popen, PIPE, CalledProcessError, TimeoutExpired
from multiprocessing import Process
import vim
import re
import os
def start_dcd_server():
"""Start dcd server."""
def filter_nondirs(server_args):
"""Remove non existent dirs from ser... |
digitutils.py | '''
processimage.py
Author: Henry Yang (XiaoMing)
This is the file containing utility functions for processing handwritten digits into numerical numpy arrays
This file is assuming that the number is written on a white background only
'''
import os
import cv2
import numpy as np
import matplotlib.pyplot as plt
import ... |
test_bugs.py | # -*- coding: utf-8 -*-
# Copyright (c) 2009, 2019, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License, version 2.0, as
# published by the Free Software Foundation.
#
# This program is also d... |
protocol_cmdexec.py | #!/usr/bin/env python3
#-*- coding: iso-8859-1 -*-
################################################################################
#
# This module contains an implementation of resource for running OS processes
# and communicating to them via stdin/stdout/stderr. Each single process invocation
# is considered a separa... |
cameratimerbackend.py | from threading import Timer, Thread
from time import time
class RepeatedTimer():
def __init__(self, interval, function, timelimit = None, countlimit = None, callback = None):
# announce interval to class
self.interval = interval
# announce target function to class
self.function = function
#... |
irc.py | # coding=utf8
"""
irc.py - An Utility IRC Bot
Copyright 2008, Sean B. Palmer, inamidst.com
Copyright 2012, Edward Powell, http://embolalia.net
Copyright © 2012, Elad Alfassa <elad@fedoraproject.org>
Licensed under the Eiffel Forum License 2.
Willie: http://willie.dftba.net/
When working on core IRC protocol related ... |
compare_Walternating_sgd_4layers_4qubits.py | import qiskit
import numpy as np
import sys
sys.path.insert(1, '../')
import qtm.base, qtm.constant, qtm.ansatz, qtm.fubini_study, qtm.encoding
import multiprocessing
def run_walternating(num_layers, num_qubits):
thetas = np.ones(int(num_qubits*num_layers/2) + 3 * num_layers * num_qubits)
psi = 2 * np.random... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.