source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
DEWModel.py | #!/usr/bin/env python
# coding: utf-8
## Package Imports
# Equation imports
import numpy as np
from DEWPython import DEWEquations
# Pandas is used for the custom sheet reading
import pandas as pd
# sys, threading, subprocess, and os all correspond to uses within the supcrt functions
import sys
import... |
BuildConsolidatedFeaturesFile.py | # python-3
# coding: utf-8
'''
Script Name: BuildConsolidatedFeaturesFile.py
Created date : Sunday, 27th March
Author : Sreejith Menon
Description :
buildFeatureFl(input file,output file)
Reads from a csv file (taken as a parameter) containing a list of image GIDs.
Extracts the below features from the IBEIS datas... |
test_server_proxy.py | #!/usr/bin/env python
# encoding: utf-8
from __future__ import print_function
import threading
import logging
import socket
import select
import paramiko
import os
import unittest
import stat
from shutil import rmtree
from pysftpserver.tests.stub_sftp import StubServer, StubSFTPServer
from pysftpserver.tests.utils i... |
random_shuffle_queue_test.py | # Copyright 2015 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... |
iam.py | #!/usr/bin/env python3
import threading
import ldap
import os
import sqlite3
import threading
import queue
import atexit
import subprocess
import multiprocessing
import json
from datetime import datetime
from io import StringIO
from flask import Flask, request, redirect, url_for, flash, render_template, abort, Response... |
parse-log.py | #!/usr/bin/env python3
import re
import subprocess
import sys
import threading
from datetime import datetime, timezone
from queue import Queue
# Required due to Python's standard library lacking any canonical way to refer to timezones directly besides UTC
import pytz
"""
Parse out player login/logout and death/respa... |
automaton.py | # This file is part of Scapy
# See http://www.secdev.org/projects/scapy for more information
# Copyright (C) Philippe Biondi <phil@secdev.org>
# Copyright (C) Gabriel Potter <gabriel@potter.fr>
# This program is published under a GPLv2 license
"""
Automata with states, transitions and actions.
"""
from __future__ imp... |
server.py | import socket
from threading import Thread
from dan_socket.event import Event
from dan_socket.base import BaseConnection
class ClientConnection:
def __init__(self, client_sock, server):
self.client_sock = client_sock
self.server = server
self.handle_connection()
def send(self, message... |
installwizard.py | # Copyright (C) 2018 The Electrum developers
# Distributed under the MIT software license, see the accompanying
# file LICENCE or http://www.opensource.org/licenses/mit-license.php
import os
import json
import sys
import threading
import traceback
from typing import Tuple, List, Callable, NamedTuple, Optional, TYPE_CH... |
start.py | import os
import threading
threading.Thread(target=os.system("python spider_main2.py"))
threading.Thread(target=os.system("python spider_main3.py"))
threading.Thread(target=os.system("python spider_main4.py"))
threading.Thread(target=os.system("python spider_main5.py"))
threading.Thread(target=os.system("python spide... |
aerialbot.py | import io
import math
import os
import re
import random
import sys
import time
from datetime import datetime
import argparse
import logging
import logging.config
import traceback
import concurrent.futures
import threading
import requests
from configobj import ConfigObj
import shapefile
import shapely.geometry
fr... |
dataloader.py | # Copyright (c) 2020 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 appli... |
locate_remote_file_test_alone.py | # Copyright (c) 2018 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 app... |
test_reify.py | '''
Test cases for the reify module.
'''
import os
from tempfile import NamedTemporaryFile
from multiprocessing import Process
from unittest import TestCase
from typing import Any, Callable, Dict, Set, Union, cast
from clingo.control import Control
from clingo.symbolic_atoms import SymbolicAtom
from clingo.symbol im... |
pipeline_ops_test.py | # Copyright 2020 Google LLC. 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 applicable law or a... |
joomla_killer.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import urllib2
import urllib
import cookielib
import threading
import sys
import Queue
from HTMLParser import HTMLParser
# 共通の設定
user_thread = 10
username = "admin"
wordlist_file = "/tmp/cain.txt"
resume = None
# ターゲットに合わせた設定
target_url = "http://192.168... |
test_threading.py | """
Tests for the threading module.
"""
import test.support
from test.support import threading_helper
from test.support import verbose, cpython_only
from test.support.import_helper import import_module
from test.support.script_helper import assert_python_ok, assert_python_failure
import random
import sys
import _thre... |
smart_system.py | import json
import logging
from contextlib import contextmanager
from json.decoder import JSONDecodeError
from oauthlib.oauth2 import LegacyApplicationClient
from requests_oauthlib import OAuth2Session
from requests.adapters import HTTPAdapter
from requests.packages.urllib3.util.retry import Retry
import websocket
fr... |
monitoring.py | import os
import socket
import pickle
import logging
import time
import datetime
import zmq
import queue
from multiprocessing import Process, Queue
from parsl.utils import RepresentationMixin
from parsl.monitoring.message_type import MessageType
from typing import Optional
try:
from parsl.monitoring.db_manager ... |
p2p_stress.py | import testUtils
import p2p_test_peers
import random
import time
import copy
import threading
from core_symbol import CORE_SYMBOL
class StressNetwork:
speeds=[1,5,10,30,60,100,500]
sec=10
maxthreads=100
trList=[]
def maxIndex(self):
return len(self.speeds)
def randAcctName(self):
... |
server.py | # Copyright 2015 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... |
moveGoogle.py | #!/usr/bin/env python
import os
import os.path
import yaml
import time
import random
import multiprocessing
import RPi.GPIO as GPIO
from talk import say
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
from adafruit_servokit import ServoKit
Motor1 = {'EN': 27, 'input1': 19, 'input2': 16}
Motor2 = {'EN': 22, 'input1': 2... |
MLfirewallServer.py | # Based on sample in Python documentation at:
# https://docs.python.org/3/library/socketserver.html#asynchronous-mixins
import socket
import threading
import socketserver
DEBUGMODE = True
# SERVER PARAMETERS
SERVER_IP = "0.0.0.0"
SERVER_PORT = 5678
NUM_CONNECTIONS = 10
def printDebugMsg(msg):
if DEBUGMODE:
print... |
consumer.py | # Copyright (c) 2014 Rackspace, 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... |
nicofox2bookmarks_gui.py | # -*- coding: UTF-8 -*-
import configparser
import gettext
import itertools
import pathlib
import subprocess
import threading
import tkinter as tk
import tkinter.messagebox
import tkinter.ttk
import firefox_helper
import nicofox2bookmarks
__title__ = 'NicoFox to Firefox Bookmarks'
__version__ = '0.1.0'... |
linux_gadgetfs.py | # Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Linux gadgetfs glue.
Exposes a USB gadget using a USB peripheral controller on Linux. The userspace
ABI is documented here:
https://github.com/torvalds/... |
util.py | # -*- coding: utf-8 -*-
"""
syslog2irc.util
~~~~~~~~~~~~~~~
Various utilities
:Copyright: 2007-2015 Jochen Kupperschmidt
:License: MIT, see LICENSE for details.
"""
import logging
from threading import Thread
logging.basicConfig(format='%(asctime)s | %(message)s', level=logging.INFO)
def log(message, *args, **k... |
xpath_d2.py | import requests
import sys
from urllib.parse import unquote,quote
import multiprocessing
headers=dict()
post_parameters=dict()
cookies=dict()
iparam=sys.argv[1]
true_string=sys.argv[2].strip("\"")
element_range = 20
element_length = 40
value_length = 40
data_length=40
req = open("request.r","r").read().split("\n")
ur... |
test_worker.py | # -*- encoding: utf-8 -*-
#
# 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 ... |
utils.py | """Utilities module for the textbook "What Can Be Computed?" (WCBC)
This "utils" module provides various supporting functions for use with
the programs provided is online materials for the textbook "What Can
Be Computed?" (WCBC). (For an overview of the entire collection of
programs, see the file README.txt in this di... |
blockly_tool.py | #!/usr/bin/env python3
# Software License Agreement (BSD License)
#
# Copyright (c) 2019, UFACTORY, Inc.
# All rights reserved.
#
# Author: Vinman <vinman.wen@ufactory.cc> <vinman.cub@gmail.com>
try:
import xml.etree.cElementTree as ET
except ImportError:
import xml.etree.ElementTree as ET
import re
import sys
imp... |
ipythonwidget.py | import os
import csv
import time
from threading import Thread
from IPython.core.display import display, HTML
from traitlets import Unicode, Dict, default
from ipywidgets import DOMWidget, Layout, widget_serialization
class CatboostIpythonWidget(DOMWidget):
_view_name = Unicode('CatboostIpythonWidgetView').tag(syn... |
apollo_client.py | # -*- coding: utf-8 -*-
import json
import logging
import sys
import threading
import time
import requests
class ApolloClient(object):
def __init__(self, app_id, cluster='default', config_server_url='http://localhost:8080', timeout=35):
self.config_server_url = config_server_url
self.appId = app_... |
step_checksum.py | """Batching file prepare requests to our API."""
import collections
import os
import shutil
import threading
import wandb.util
from wandb.filesync import step_upload
RequestUpload = collections.namedtuple(
"RequestUpload",
(
"path",
"save_name",
"artifact_id",
"copy",
... |
process.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: leeyoshinari
import time
import json
import threading
import influxdb
from logger import logger, cfg, handle_exception
from request import Request
class Process(object):
def __init__(self):
self.request = Request()
self._slaves = {'ip': [], '... |
main.py | from __future__ import absolute_import
import argparse
import logging
import logging.config
import docker
import multiprocessing.pool
import os
import psutil
import random
import shutil
import sys
import traceback
from ann_benchmarks.datasets import get_dataset, DATASETS
from ann_benchmarks.constants import INDEX_DIR... |
EmRestServer.py | #! /usr/bin/env python
# _*_ coding: utf-8 _*_
# Copyright(c) 2019 Nippon Telegraph and Telephone Corporation
# Filename: EmRestServer.py
'''
Rest Server function.
'''
import os
import imp
import traceback
import threading
import functools
import signal
from datetime import datetime, timedelta
from copy i... |
cronjobs.py | #!/usr/bin/env python
"""Cron management classes."""
import logging
import random
import threading
import time
from grr import config
from grr.lib import rdfvalue
from grr.lib import registry
from grr.lib import stats
from grr.lib import utils
from grr.lib.rdfvalues import cronjobs as rdf_cronjobs
from grr.lib.rdfval... |
job_dispatcher.py | import os
import time
from multiprocessing import Lock
from multiprocessing import Manager
from multiprocessing import Process
from multiprocessing import Value
from typing import Optional
from bugswarm.common import log
from bugswarm.common.json import read_json
from termcolor import colored
from reproducer.config ... |
audio_part.py | import speech_recognition as sr
import pyaudio
import wave
import time
import threading
import os
def read_audio(stream, filename):
chunk = 1024 # Record in chunks of 1024 samples
sample_format = pyaudio.paInt16 # 16 bits per sample
channels = 2
fs = 44100 # Record at 44100 samples per se... |
proton_test.py | #!/usr/bin/env python
# Copyright (c) 2017-2020 The Zcash developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or https://www.opensource.org/licenses/mit-license.php.
#
# Test Proton interface (provides AMQP 1.0 messaging support).
#
# Requirements:
# Python library for Qpid P... |
tun_server2.py | #!/usr/bin/env python3
#coding=utf-8
ADDR = ''
PORT = 6789
READ_BUF = 4096
IP_PKG_FORWARD_SIZE = 128
import socket
from time import ctime,time
from queue import Queue
from struct import pack,unpack
from threading import Thread
from selectors import DefaultSelector,EVENT_READ,EVENT_WRITE
from multiprocessing imp... |
comms.py | import select
import threading
import time
import csv
from bluetooth import *
from constants import *
msgHeader = "[CAR COMMS]: "
BT_LOOP_SLEEP = 25
def read_cars_csv():
file = csv.DictReader(open(os.path.join(ZENWHEELS_DIR, 'cars.csv')))
cars = []
for row in file:
cars.append(row)
return cars
class CarCom... |
auto_run_script.py | from runpy import run_path
from tkinter import *
import multiprocessing
import os
def make_app():
app = Tk()
Label(app, text='Available script for run', font=('Hack', 20, 'bold')).pack()
Listbox(app, name='listb', bg='#FFF68F',fg='Aquamarine').pack(fill=BOTH, expand=True)
# Listbox(name='listb').pack(... |
session_test.py | # Copyright 2015 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... |
rpi_led_clock.py | #!/usr/bin/env python3
import argparse
import datetime
import time
import threading
import sys
try:
import RPi.GPIO as GPIO
gpio_present = True
except ModuleNotFoundError:
print("RPi.GPIO module not present, forcing a dry run")
gpio_present = False
from flask import Flask, request, render_template
gl... |
server.py | __author__ = 'ziyan.yin'
import logging
import socket
import threading
TIMEOUT = 1000
BUF_SIZE = 4096
HOST = '0.0.0.0'
PORT = 11212
_logger = logging.getLogger('proxy')
def get_addr(package):
data = package.split(b'\r\n')
method = data[0]
is_ssl = False
if method.startswith(b'CONNECT'):
add... |
test_ibmq_job.py | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017, 2020.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivat... |
BaseModule.py | """
Created by Danil Lykov @danlkv on 14/02/19
"""
import zmq, os, time
import json
from pprint import pprint
import multiprocessing as prc
from goalnet.helpers.log_init import log
from goalnet.core.utils import themify, dethemify, get_network_config
import trio
class BaseModule:
"""
A base class for Goal Net ... |
SpiderMan.py | from multiprocessing import Queue, Process
from distributedSpider.NodeManager import NodeManager
if __name__=='__main__':
#初始化4个队列
url_q = Queue()
result_q = Queue()
store_q = Queue()
conn_q = Queue()
#创建分布式管理器
node = NodeManager()
manager = node.start_Manager(url_q,result_q)
#创建URL... |
taskmanager.py | import datetime
import glob
import json
import multiprocessing
import os
import math
import random
import lxml
import requests
import subprocess
from time import sleep
from urllib.request import urlopen
import wikipedia
from bs4 import BeautifulSoup as soup
from pytube import YouTube
from youtubesear... |
bbox_regression.py | """
This file has functions about generating bounding box regression targets
"""
from ..pycocotools.mask import encode
import numpy as np
from ..logger import logger
from .bbox_transform import bbox_overlaps, bbox_transform
from rcnn.config import config
import math
import cv2
import PIL.Image as Image
import threadi... |
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 numpy as np
import tensorflow as tf
import gym
import logz
import os
import time
im... |
systray.py | import time
from io import StringIO
from threading import Lock, Thread
from typing import List
from PyQt5.QtCore import QThread, pyqtSignal, QCoreApplication, Qt
from PyQt5.QtGui import QIcon
from PyQt5.QtWidgets import QSystemTrayIcon, QMenu
from bauh import __app_name__
from bauh.api.abstract.controller import Soft... |
ng.py | #!/usr/bin/env python
#
# Copyright 2004-2015, Martian Software, 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 app... |
f_monitor.py | '''
Tested on python3
About : File Moitor
pre-req : pywin32 wmi(http://sourceforge.net/projects/pywin32/)
common set of vulnerabilities(http://www.nostarch.com/blackhatpython/ http://www.nostarch.com/blackhatpython/)
'''
import tempfile
import threading
import win32file
import win32con
import os
#tmp file dir... |
remove_silence.py | import librosa
import tensorflow as tf
from tqdm import tqdm
from glob import glob
from threading import Thread
FLAGS = tf.compat.v1.flags.FLAGS
def remove_silence(file, bar):
y, sr = librosa.load(file)
yt, index = librosa.effects.trim(y, top_db=10)
librosa.output.write_wav(file, yt, sr)
bar.update(1... |
cache.py | '''Caching utilities'''
import io
import os
import re
import six
import sys
import json
import time
import atexit
import inspect
import requests
import tempfile
import mimetypes
import subprocess # nosec
import pandas as pd
import tornado.template
from lxml import etree
from threading import Thread
from six.moves... |
wizard.py | """The wizard application allows the implication of a Wizard-like GUI.
Authors:
* Carl Simon Adorf <simon.adorf@epfl.ch>
"""
from enum import Enum
from time import sleep
from time import time
from threading import Thread
import traitlets
import ipywidgets as ipw
class WizardAppWidgetStep(traitlets.HasTraits):
... |
TournamentGame.py | import random
import sys
from PyQt5.QtWidgets import QApplication
from client.Game import Game
from multiprocessing import Queue, Process
from client.TournamentWinner import DisplayWinner
def _start_tournament_(player1_id: str, player1_spacecraft: str,
player2_id: str, player2_spacecraft: st... |
wsdump.py | #!/usr/share/nginx/html/appbot2/bin/python
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", ... |
trezor.py | from binascii import hexlify, unhexlify
import traceback
import sys
from btn_electrum.util import bfh, bh2u, versiontuple, UserCancelled
from btn_electrum.btn import (b58_address_to_hash160, xpub_from_pubkey,
TYPE_ADDRESS, TYPE_SCRIPT, btn_addr_to_bitcoin_addr)
from btn_electrum import ... |
mock.py | import contextlib
import threading
import cobald.daemon
from cobald.daemon.runners.service import ServiceRunner
from cobald.interfaces import Pool, Controller
class MockController(Controller):
@property
def demand(self):
return self.target.demand
@demand.setter
def demand(self, value: float)... |
report_server.py | # -*- coding: utf-8 -*-
# Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the MIT License.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the... |
server.py | import socket
from threading import Thread
from client_handler import ClientHandler
class Server(object):
"""
The server class implements a server socket that can handle multiple client connections.
It is really important to handle any exceptions that may occur because other clients
are using the ser... |
kafka_rpc_server_multiple_topics_demo.py | # Copyright (c) 2017-2020, Carl Cheung
# All rights reserved.
"""
Two Basic Kafka RPC Server
"""
import time
from multiprocessing import Process
from kafka_rpc import KRPCServer
def start_server1():
# Part1: define a class
class Sum:
def add(self, x, y):
return x + y
# Part2: instan... |
main.py | import os
import sys
import argparse
from timeit import default_timer
import yaml
import hashlib
import socket
# ======== PLEASE MODIFY ========
# where is the repo
repoRoot = r'.'
# to CUDA\vX.Y\bin
os.environ['PATH'] = r'path\to\your\NVIDIA GPU Computing Toolkit\CUDA\v9.0\bin' + ';' + os.environ['PATH']
# Flying C... |
main.py | import requests
from PIL import Image
from bs4 import BeautifulSoup
import copy
import time
import re
import os
import json
import threading
import csv
class Spider:
class Lesson:
def __init__(self, name, code, teacher_name, Time, number):
self.name = name
self.code = code
... |
server.py | # Taken from https://github.com/waveform80/pistreaming/blob/master/server.py.
# Moved classes to it's own files
from subprocess import Popen, PIPE
from string import Template
from struct import Struct
from threading import Thread
from time import sleep, time
from http.server import HTTPServer, BaseHTTPRequestHandler
fr... |
prepare_imagenet.py | # Copyright 2019-2020 Stanislav Pidhorskyi
#
# 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 i... |
context.py | # coding=utf-8
# Licensed Materials - Property of IBM
# Copyright IBM Corp. 2015,2017
"""Context for submission of applications.
The main function is :py:func:`submit` to submit
a :py:class:`~streamsx.topology.topology.Topology`
to a Streaming Analytics service or IBM® Streams instance for execution.
"""
from __futur... |
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_... |
duang.py | # -*- coding: utf-8 -*-
# duang duang 的持续访问某个 url
import getopt
import threading
import time
import tkinter.messagebox as messagebox
import urllib
import logging
from tkinter import *
from urllib import request
from urllib.request import HTTPRedirectHandler
class OpenerHTTPRedirectHandler(HTTPRedirectHandler):
d... |
trezor.py | import traceback
import sys
from typing import NamedTuple, Any
from electrum_trc.util import bfh, bh2u, versiontuple, UserCancelled, UserFacingException
from electrum_trc.bitcoin import TYPE_ADDRESS, TYPE_SCRIPT
from electrum_trc.bip32 import BIP32Node, convert_bip32_path_to_list_of_uint32 as parse_path
from electrum_... |
spidev.py |
import os
import socket
_SPI_CPHA = 0x01
_SPI_CPOL = 0x02
# _SPI_MODE_0 = 0
# _SPI_MODE_1 = SPI_CPHA
# _SPI_MODE_2 = SPI_CPOL
# _SPI_MODE_3 = SPI_CPOL | SPI_CPHA
# _SPI_MODES = [_SPI_MODE_0, _SPI_MODE_1, _SPI_MODE_2, _SPI_MODE_3]
_SPI_CS_HIGH = 0x04
_SPI_LSB_FIRST = 0x08
_SPI_3WIRE = 0x10
_SPI_LOOP = 0x20
_SPI_NO_C... |
message_server.py | import socket
import select
import threading
import time
import message
class MessageServer(object):
def __init__(self, host, port, timeout=1):
self.host = host
self.port = port
self.timeout = timeout
self.epoll = select.epoll()
self.fd_to_socket = {}
self.client... |
httpd.py | from .server import EasyServer
from .datastruct import *
import threading
__server = None
def start_serve(port: int = 8090, address: str = "0.0.0.0", blocking=True):
global __server
if __server is None:
try:
__server = EasyServer(port, address)
if not blocking:
... |
__init__.py | import json
from datetime import datetime
from threading import Thread
from outdated import utils
from outdated.mywarnings import *
from outdated.utils import warn_with_ignore
__version__ = '0.2.0'
def check_outdated(package, version):
"""
Given the name of a package on PyPI and a version (both strings), ch... |
standalone.py | #
# Copyright Cloudlab URV 2020
#
# 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 writin... |
team_manager.py | # -*- coding: utf-8 -*-
"""
This file is covered by the LICENSING file in the root of this project.
"""
import sys
from werkzeug.exceptions import Forbidden
sys.path.append("..")
import uuid
import time
from flask import g
import threading
from mongoengine import Q, ValidationError
from os.path import realpath, absp... |
test_engine_unittest.py | # -*- coding: utf-8 -*-
## Copyright 2009-2022 NTESS. Under the terms
## of Contract DE-NA0003525 with NTESS, the U.S.
## Government retains certain rights in this software.
##
## Copyright (c) 2009-2022, NTESS
## All rights reserved.
##
## This file is part of the SST software package. For license
## information, see... |
kegdata.py | #!/usr/bin/python
# coding: UTF-8
# kegdata service to read about key status
# Written by: Ron Ritchey
from __future__ import unicode_literals
import json, threading, logging, Queue, time, getopt, sys, logging, datetime
import RPi.GPIO as GPIO
import pymysql.cursors
from hx711 import HX711
# HOW TO CALCULATE THE R... |
test_cache.py | # This file is part of the MapProxy project.
# Copyright (C) 2010 Omniscale <http://omniscale.de>
#
# 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... |
ring.py | #!/usr/bin/env python
import sys, getopt
import time
import pychromecast
import threading
def playAudio(cast, mediaList, mediaformat, repeat):
try:
cast.wait()
mc = cast.media_controller;
mc.stop();
print(cast.device)
for ii in xrange(repeat):
if repeat != 1:
print ii
for media in mediaList:
... |
p2p_client.py |
from threading import Thread
import time, uuid
import numpy as np
from ..utils.flags import DEBUG
class VCROperation:
def __init__(self, type, speed, offset) -> None:
self.type = type
self.speed = speed
self.seek_offset = offset
@property
def is_forward(self):
return self.type == "farwor... |
update_repository_manager.py | """
Determine if installed tool shed repositories have updates available in their respective tool sheds.
"""
import logging
import threading
from sqlalchemy import false
from galaxy import util
from galaxy.tool_shed.util.repository_util import get_tool_shed_status_for_installed_repository
from galaxy.tool_shed.util.s... |
MsgPublisher.tpl.py | {% block meta %}
name: MsgPublisher
description:
SMACH template that provides a MsgPublisher helper class for
PublishMsgState.
language: Python
framework: SMACH
type: None
tags: [core]
includes: []
extends: []
variables: []
input_keys: []
output_keys: []
{% endblock meta %}
{% from "Utils.tpl.py" import import_mod... |
conftest.py | import requests_mock
import os
from click.testing import CliRunner
import pytest
from wandb.history import History
from tests.api_mocks import *
import wandb
from wandb import wandb_run
from wandb.apis import InternalApi
import six
import json
import sys
import time
import threading
import logging
from multiprocessing ... |
model.py | from google.cloud import datastore
from google.cloud.datastore import Query, Client
from google.cloud.datastore.query import Iterator
from google.cloud.datastore import helpers
from google.cloud.datastore import Key
import datetime
from time import sleep
from typing import get_type_hints, List, Union
import copy
import... |
priority_queue.py | # coding=utf-8
import time
import threading
from random import randint
from Queue import PriorityQueue
q = PriorityQueue()
def double(n):
return n * 2
def producer():
count = 0
while 1:
if count > 5:
break
pri = randint(0, 100)
print 'put :{}'.format(pri)
q.... |
pantsd_integration_test.py | # Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import glob
import os
import signal
import threading
import time
import unittest
from textwrap import dedent
from typing import List, Optional, Tuple
import psutil
import pytest
from pan... |
randomizer.py | import spotipy
import os
import spotipy.util as util
from http.server import HTTPServer, BaseHTTPRequestHandler
from threading import Thread
from random import shuffle
import requests
# os.environ["SPOTIPY_CLIENT_ID"] = ""
# os.environ["SPOTIPY_CLIENT_SECRET"] = ""
# os.environ["USER"] = ""
# os.environ["PLAYLISTS"] =... |
manager.py | #!/usr/bin/env python
# vim: set expandtab shiftwidth=4:
"""
Python Interface for Asterisk Manager
This module provides a Python API for interfacing with the asterisk manager.
import py_star.manager
import sys
def handle_shutdown(event, manager):
print ("Received shutdown event")
manager.close()... |
server.py | #/usr/bin/env python3.4
from threading import Threads
import time
from socket import *
host = ''
port = 50007
sockobj = socket(AF_INET, SOCK_STREAM)
sockobj.bind((host, bind))
sockobj.listen(5)
def run():
return time.ctime(time.time())
def handleClient():
time.sleep(5)
while True :
data = connection.recv(102... |
test_runner.py | #!/usr/bin/env python3
# Copyright (c) 2014-2016 The Bitcoin Core developers
# Copyright (c) 2017 The Bitcoin developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Run regression test suite.
This module calls down into ind... |
piman.py | import logging
import logging.config
import os
from zipfile import ZipFile
import io
import time
# create the logger before doing imports since everyone is going
# to use them
local_logfile = './logging.conf'
if os.path.isfile(local_logfile):
logging.config.fileConfig(local_logfile)
else:
zipfile = os.path.dir... |
p_bfgs.py | # -*- coding: utf-8 -*-
# Copyright 2018 IBM.
#
# 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 agre... |
data_store.py | #!/usr/bin/env python
"""The main data store abstraction.
The data store is responsible for storing AFF4 objects permanently. This file
defines the basic interface of the data store, but there is no specific
implementation. Concrete implementations should extend the DataStore class and
provide non-abstract methods.
T... |
main.py | import pdb
import time
import os
import subprocess
import re
import random
import json
import numpy as np
import glob
from tensorboard.backend.event_processing.event_accumulator import EventAccumulator
import socket
import argparse
import threading
import _thread
import signal
from datetime import datetime
import csv
f... |
device_serve.py | import argparse
import json
import threading
import time
from queue import Queue, Empty
from copy import deepcopy
import jax
import numpy as np
import optax
from mesh_transformer import util
from mesh_transformer.checkpoint import read_ckpt
from mesh_transformer.sampling import nucleaus_sample
from mesh_transformer.t... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.