source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
server.py | import socket
import threading
# running locally
from message import Message
import json
class Servidor:
HOST = socket.gethostbyname(socket.gethostname())
PORT = 10098
SERVER = (HOST, PORT)
BUFFERSIZE = 1024
def __init__(self):
self.UDPServerSocket = socket.socket(socket.AF_INET, socket... |
stream_server.py | import threading
import SocketServer
import cv2
import numpy as np
class VideoStreamHandler(SocketServer.StreamRequestHandler):
def handle(self):
stream_bytes = ' '
# stream video frames one by one
try:
while True:
stream_bytes += self.rfile.read(1024)... |
mainwindow.py | from serial.tools import list_ports
from mainwindow_ui import Ui_MainWindow
from PyQt5.QtWidgets import QMainWindow, QFileDialog
import nserial
import time
import threading
import codecs
class MainWindow(QMainWindow, Ui_MainWindow):
'''
界面文件的各种操作方法实现,此类继承了 mainwindiw_ui,并对其进行操作,防止界面修改之后再次转化成 .py 代码丢失的问题
'... |
statusmodel.py | #!/usr/bin/python3
""" DIYHA MQTT CPU and OS monitor """
# The MIT License (MIT)
#
# Copyright (c) 2019 parttimehacker@gmail.com
#
# 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 res... |
service.py | # Copyright (c) 2010-2013 OpenStack, LLC.
#
# 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 ... |
upnp.py | import logging
import threading
from queue import Queue
try:
import miniupnpc
except ImportError:
pass
log = logging.getLogger(__name__)
class UPnP:
def __init__(self):
self.queue = Queue()
def run():
try:
self.upnp = miniupnpc.UPnP()
self.up... |
LBCollector.py | import datetime
import logging
import os
import subprocess
import time
from threading import Thread
import GlobalConfig
from DataWriter import DataWriter
from FanCollector import FanCollector
from UPSCollector import UPSCollector
from SensorCollector import SensorCollector
LOG_FORMAT = "%(levelname)s - %(message)s"
l... |
bpr.py | import pypresence
import threading
import time
import bpy
import jinja2
import typing
VERSION = 'v0.0.1.fuck'
class BlenderPresence():
def __init__(self, bpy, *, app_id = 922018802168889394):
self.lastActivity = {'obj': '', 'objsel': ''}
self.started = round(time.time())
self.py... |
test_comms.py | import asyncio
import types
from functools import partial
import os
import sys
import threading
import warnings
import pkg_resources
import pytest
from tornado import ioloop
from tornado.concurrent import Future
import distributed
from distributed.metrics import time
from distributed.utils import get_ip, get_ipv6
fr... |
plugs_test.py | # Copyright 2016 Google Inc. 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 agre... |
tornado.py | import asyncio
import fnmatch
import json
import logging
import os
import threading
import time
import webbrowser
from functools import partial
from typing import Dict
from urllib.parse import urlparse
import tornado
import tornado.httpserver
import tornado.ioloop
from tornado.web import StaticFileHandler
from tornado... |
model.py | import json
import logging
import os
import socket
import subprocess
import sys
import threading
import time
import uuid
import pika
import shutil
rabbitmq_uri = os.getenv('RABBITMQ_URI', 'amqp://guest:guest@rabbitmq/%2F')
default_application = os.getenv('APPLICATION', 'job.sh')
model_info = None
class Worker:
... |
fido.py | import sys
import pydle
import time, requests, threading
import logging
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from config import IRC, Logging, SQLAlchemy
from models import SessionManager, config, monitor
from models.config import Config
from modules import noticehandler, chann... |
port_scanner.py | import socket
from queue import Queue
import threading
target = "127.0.0.1"
q = Queue()
for x in range(1, 501):
q.put(x)
def portscan(port):
try:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
conn = s.connect((target, port))
return True
except:
return Fals... |
remote.py | import os
import time
import signal
import atexit
import weakref
import logging
import subprocess
import concurrent
from threading import Thread
import multiprocessing as mp
from distributed import Client
from .ssh_helper import start_scheduler, start_worker
__all__ = ['Remote']
logger = logging.getLogger(__name__)... |
plugin.py | import threading
from binascii import hexlify, unhexlify
from recrypt_electrum.util import bfh, bh2u
from recrypt_electrum.bitcoin import (b58_address_to_hash160, xpub_from_pubkey,
TYPE_ADDRESS, TYPE_SCRIPT,
is_segwit_address, TESTNET)
from recrypt... |
km20_mp.py | import numpy as np
from multiprocessing import Process , Array
import math
from matplotlib import pyplot as plt
def dist(V,U):
return math.sqrt( (V[0]-U[0])**2+(V[1]-U[1])**2)
def calc_dist(Pt,Ct,kc,D):
#Dist=np.zeros((Pt.shape[0],1))
for i in range(Pt.shape[0]):
D[i]=dist(Pt[i],Ct[kc])
#return Dist
def... |
run_moto.py | import RPi.GPIO as gpio
gpio.setmode(gpio.BCM)
class Moto(object):
IN1 = 26
IN2 = 19
IN3 = 13 # GPIO.23
IN4 = 6 # GPIO.22
FNA = 21 # PIN 40
def __init__(self):
gpio.setmode(gpio.BCM)
for pin in (self.IN1, self.IN2, self.IN3, self.IN4, self.FNA):
gpio.setup(pin, ... |
collections_quorum_loss.py | import threading
import time
from collections_helper.collections_spec_constants import MetaCrudParams
from pytests.failover.AutoFailoverBaseTest import AutoFailoverBaseTest
from membase.api.rest_client import RestConnection
from sdk_exceptions import SDKException
class CollectionsQuorumLoss(AutoFailoverBaseTest):
... |
sensor.py | #!/usr/bin/env python
"""
Copyright (c) 2014-2021 Maltrail developers (https://github.com/stamparm/maltrail/)
See the file 'LICENSE' for copying permission
"""
from __future__ import print_function # Requires: Python >= 2.6
import sys
sys.dont_write_bytecode = True
import cProfile
import inspect
import math
impor... |
test_cmd2.py | # coding=utf-8
# flake8: noqa E302
"""
Cmd2 unit/functional testing
"""
import builtins
import io
import os
import signal
import sys
import tempfile
from code import (
InteractiveConsole,
)
from unittest import (
mock,
)
import pytest
import cmd2
from cmd2 import (
COMMAND_NAME,
ansi,
clipboard,
... |
J-Bdork.py | print("""
/$$$$$ /$$$$$$$ /$$ /$$
|__ $$ | $$__ $$ | $$ | $$
| $$ | $$ \ $$ /$$$$$$$ /$$$$$$ /$$$$$$ | $$ /$$
| $$ /$$$$$$| $$$$$$$ /$$__ $$ /$$__ $$ /$$__ $$| $$ /$$/
/$$ | $$|______/| $$__ $$| $$ ... |
app.py | from gevent import monkey
monkey.patch_all()
import serial
import time
from threading import Thread
from flask import Flask, render_template
from flask.ext.socketio import SocketIO, emit, join_room, leave_room
app = Flask(__name__)
app.debug = True
app.config['SECRET_KEY'] = 'hihihihi'
socketio = SocketIO(app)
thread... |
sample.py | #!/usr/bin/python
# coding: UTF-8
###########################################################################
# (C) Mono Wireless Inc. - all rights reserved.
# 利用条件:
# - 本ソースコードは、別途ソースコードライセンス記述が無い限りモノワイヤレス株式会社が
# 著作権を保有しています。
# - 本ソースコードは、無保証・無サポートです。本ソースコードや生成物を用いたいかなる損害
# についてもモノワイヤレス株式会社は保証致しません。不具合等の... |
analog_sensors.py | from .sensorinfo import SensorInfo, SensorApi
from threading import Thread, Event, Lock
try:
from spidev import SpiDev
except:
class SpiDev:
def open(self, *args):
pass
def xfer2(self, *args): # @UnusedVariable
return [0, 0, -1]
class AnalogSens... |
test_emr.py | import copy
import gzip
import io
import threading
import time
import boto3
import pytest
from dagster_aws.emr import EmrClusterState, EmrError, EmrJobRunner
from dagster_aws.utils.mrjob.utils import _boto3_now
from moto import mock_emr, mock_s3
from dagster.seven import mock
from dagster.utils.test import create_tes... |
main_menu_view.py | from views.loading_view import LoadingView
from tkinter.font import Font
from tkinter import *
import threading
import json
import os
class MainMenuView():
def __init__(self, _parent, _ui_textures_list, _size_x, _size_y):
self.parent = _parent
self.ui_textures_list = _ui_textures_list
self.... |
imaging.py | # Future
from __future__ import annotations
# Standard Library
import multiprocessing
import sys
from multiprocessing.connection import Connection
from typing import Any, Callable, Literal
# Packages
import aiohttp
import bs4
import humanize
import yarl
from wand.color import Color
from wand.image import Image
# My ... |
pyminer.py | #!/usr/bin/python
#
# Copyright (c) 2011 The Bitcoin developers
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
import time
import json
import pprint
import hashlib
import struct
import re
import base64
import httplib
import... |
BiliSpider.py | #coding=utf-8
import requests
import time
import threading
import os
import queue
import logging
class spider():
'''
爬虫类
'''
#构造函数
def __init__(self,rid,config={}):
'''
爬虫类构造函数,接受参数:
\t tid:分区id
\t config:设置参数(dict类型)
'''
#更新状态
self.status = {'progress' : '__init__'}
from .ver... |
run.py | import os
import threading
import time
import sys, getopt
# this script should be executed in parent dir of scripts
def client(i,results,loopTimes):
print("client %d start" %i)
command = "./scripts/run-single.sh -R -t " + str(loopTimes)
r = os.popen(command)
text = r.read()
results[i] = text
... |
lifespan.py | import logging
import os
import signal
import subprocess
import threading
from os.path import isdir, isfile, splitext
import opsi
from opsi.backend.network import dhcpcd_writable
from opsi.manager import Program
from opsi.manager.manager_schema import ModulePath
from opsi.util.concurrency import AsyncThread, ShutdownT... |
__init__.py |
import os
import sys
# We want to use the fibre package that is included with the odrive package
# in order to avoid any version mismatch issues,
sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(__file__)), "pyfibre"))
import fibre
# Standard convention is to add a __version__ attribute to the packa... |
uds.py | #!/usr/bin/env python
import sys
import time
import cancat
import struct
import threading
import cancat.iso_tp as cisotp
NEG_RESP_CODES = {
0x10:'GeneralReject',
0x11:'ServiceNotSupported',
0x12:'SubFunctionNotSupported',
0x13:'IncorrectMesageLengthOrInvalidFormat',
0x14:'Respo... |
rotation.py | # -*- coding: utf-8 -*-
import threading
import traceback
import time
from airtest.core.error import AirtestError
from airtest.utils.snippet import reg_cleanup, on_method_ready
from airtest.utils.logger import get_logger
from airtest.core.ios.wda_client import LANDSCAPE, PORTRAIT, LANDSCAPE_RIGHT, PORTRAIT_UPSIDEDOWN
... |
TincanInterface.py | # EdgeVPNio
# Copyright 2020, University of Florida
#
# 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, copy, modify, merg... |
test_deploy_app.py | # -*- coding: utf-8 -*-
# Script to start deployment api and make request to it.
import argparse
import base64
import datetime
import logging
import os
import errno
import shutil
import subprocess
import tempfile
import threading
from functools import partial
from multiprocessing import Process
from time import sleep
f... |
tests.py | """Tests related to django.db.backends that haven't been organized."""
import datetime
import threading
import unittest
import warnings
from unittest import mock
from django.core.management.color import no_style
from django.db import (
DEFAULT_DB_ALIAS,
DatabaseError,
IntegrityError,
connection,
co... |
pvapplication_tk.py | # -*- coding: utf-8 -*-
"""
Created on Jul 29, 2012
@author: marko
"""
from PIL import Image, ImageTk
from Tkconstants import RIGHT, LEFT, BOTH, E, W, HORIZONTAL
from Tkinter import Frame, Label, Button, Toplevel, OptionMenu, Scale, Entry, \
Message, Spinbox, IntVar, StringVar, DoubleVar
from matplotlib.backends.b... |
ddqn_nstep_per_verup_rnd_lstm_.py |
import math, random
import gym
import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
import visdom
import time
import os
vis = visdom.Visdom(port = 8097)
import torch.multiprocessing as mp
#win_4 = vis.line(Y=torch.tensor([0]),opts=dict(title='reward'))
im... |
app.py | #! /usr/bin/env python3
"""
Title: Hoomaluo - Cool - No IR
Project: Alternative Cooling Controller
Author: Hoomaluo Labs
Version: 1.1
Date: 10-08-2018
Overview:
* Communicate with a server over MQTT:
- report temperature and energy
* store locally if disconnected
* report local data once back onl... |
chat_stream.py | from DiscordZero import get_key, get_messages, post_message
import threading
import time
if __name__=='__main__':
login=get_key('Zero')
test_channel='798778169888210944'
all_messages=get_messages(login,test_channel)
class Chatbox:
def update(login, location):
# Update the list of messages every 3 ... |
decorator.py | # -*-coding:utf-8 -*-
from functools import wraps
from traceback import format_tb
from db.basic_db import db_session
from logger.log import parser, crawler, storage
from utils.util_cls import Timeout, KThread
from db.basic_db import proxy_db_session
# timeout decorator
def timeout_decorator(func):
@wraps(func)
... |
main.py | from random import shuffle
from cv2 import *
import time
import threading
import os, glob
import re
images_folder = "imgs"
seconds_between_pic = 15
def check_if_seconds_have_passed(ts, secods):
return time.time() - ts >= secods
def remove_files_from_folder(folder):
files = glob.glob(f"{folder}/*")
for ... |
test_from_worker_address_error.py | import asyncio
import multiprocessing as mp
import os
import time
import numpy as np
import pytest
import ucp
mp = mp.get_context("spawn")
def _test_from_worker_address_error_server(q1, q2, error_type):
async def run():
address = bytearray(ucp.get_worker_address())
if error_type == "unreachabl... |
postproc.py | #!/usr/bin/python3 -OO
# Copyright 2007-2021 The SABnzbd-Team <team@sabnzbd.org>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any late... |
tryit.py | import signal, time, threading, os
#from queue import Queue # this locks up because it uses a threading.Lock
from signal_queue import SimpleQueue
#from queue import SimpleQueue
q = SimpleQueue()
count = 0;
def handle_signal(signum, stack):
time.sleep(.0001)
q.put(stack)
def worker():
global count
... |
jump.py | #!/usr/bin/env python
"""
Use raspbery pi to :
- download 30 second clips from a specific playlist.
- Play the track
- use xiloborg board to detect sudden shocks.
- Change track playing on sudden shocks
"""
# coding: latin-1
import threading
import logging
import XLoBorg
from random import choice
import pygame
import... |
timeout_run_function.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
import time
from threading import Thread, current_thread
class User:
def __init__(self, name):
self.name = name
def post_msg(self):
time.sleep(3)
# Написать пользователю
print('Hi, {}! current_thread: {... |
mmal_clock_splitter.py | import io
import datetime as dt
from threading import Thread, Lock
from collections import namedtuple
from math import sin, cos, pi
from time import sleep
from picamerax import mmal, mmalobj as mo, PiCameraPortDisabled
from PIL import Image, ImageDraw
class Coord(namedtuple('Coord', ('x', 'y'))):
@classmethod
... |
presenter_socket_server.py | # =======================================================================
#
# Copyright (C) 2018, Hisilicon Technologies Co., Ltd. All Rights Reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1 Redistrib... |
fault_tolerance_test.py | # Lint as: python3
# Copyright 2020 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 requ... |
comm_channel_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... |
c_test.py | import threading
from flask import jsonify
from dophon_cloud import enhance
c = enhance(import_name=__name__, properties={'service_name': 'xxx-service', 'host': '0.0.0.0', 'port': 8001,
'reg_url': 'http://127.0.0.1:8300/reg/service/'})
@c.route('/c/test/another/test')
... |
VoiceAssistant v2.0.py | import os
import time
import sys
import threading as thread
from functools import wraps
try:
import webbrowser as wb
import speech_recognition as sr
from fuzzywuzzy import fuzz
import pyautogui as pg
from pycaw.pycaw import AudioUtilities, ISimpleAudioVolume
except ImportError:
print... |
MSC-RL_3_1.py | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
from __future__ import division
"""
ily
"""
import threading
import numpy as np
import os
import tensorflow as tf
import tensorflow.contrib.slim as slim
import gym
from atari_wrappers import wrap_deepmind
from time import sleep
import random
from replaymemory import Repla... |
use-tcp-server.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import socket, threading, time
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
#监听端口
s.bind(('127.0.0.1', 9999))
s.listen(5)
print('Watting for connection...')
def tcplink(sock, addr):
print('Accept new connection from %s:%s...' %addr)
sock.send(b'Welcome!')
... |
HomoProtReader.py | import os, sys
"""Fasta files are expected to look like this ("..." to indicate amino acids omitted for space)...
>34e6ee6_34e6ee6
MAKE...KA*
>34e6ee6_f2648d
MAKE...RT*
>34e6ee6_f10e9a
MAKD...RI*
>34e6ee6_10b54d2
MIKD...KA*
>3646962_3646962
MFLK...DE*
>3646962_21cf7e3
MWIK...ED*
So each ID is composed of two parts..... |
connect.py | import socketio
import json
import threading
from urllib.parse import urlencode
#************************************************************************
#* Private Functions
#***********************************************************************/
def normalize_consumer(consumer):
if consumer is None:
... |
train_12ECG_classifier.py | import csv
import json
import multiprocessing
import os
import queue
import subprocess
import warnings
from datetime import datetime, timedelta
from glob import glob
from time import time
import joblib
import numpy as np
import pandas as pd
import psutil
# import wfdb
from sklearn.model_selection import train_test_sp... |
main.py | import random
import sys
import threading
import pygame
from copy import deepcopy
import time
import math
pygame.font.init()
#defaults
sizes=[30,60,75,90,100,150,180,225,300]
currentsize=1
size=60
diff=60
windowsize=900
searchx=size-1
searchy=size-1
speeds=['deep','stochastic','forward','combined... |
lpf.py | import os
import sys
sys.path.append(os.path.abspath('.'))
from piclap import *
import numpy as np # 1.19.1
import matplotlib.pyplot as plt # 3.3.1
from scipy import signal # 1.5.2
from array import array
import multiprocessing as mp
import random
import pprint
import time
import itertools
# use ggplot style for m... |
test_itertools.py | import unittest
from test import support
from itertools import *
import weakref
from decimal import Decimal
from fractions import Fraction
import operator
import random
import copy
import pickle
from functools import reduce
import sys
import struct
import threading
import gc
maxsize = support.MAX_Py_ssize_t
minsize = ... |
pollers.py | """Poller Components for asynchronous file and socket I/O.
This module contains Poller components that enable polling of file or socket
descriptors for read/write events. Pollers:
- Select
- Poll
- EPoll
"""
import os
import platform
import select
from errno import EBADF, EINTR
from select import error as SelectError
... |
__init__.py | # Copyright (c) 2014 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Test harness for testing chrome apps / extensions."""
import cStringIO
import contextlib
import hashlib
import logging
import optparse
import os... |
pybot.py | import inspect
import logging
import sqlite3
import ssl
import time
import textwrap
import sys
import random
import atexit
import os
import plugin
import msg_parser
import irc.bot
import irc.connection
import irc.client
import utils
import signal
from typing import Optional
from queue import Queue
from threading impor... |
index.py | import telebot
import schedule
import time as t
from telebot import *
from telebot.types import InlineKeyboardMarkup, InlineKeyboardButton
from assets.functions import *
from assets.controller import *
from assets.currentWeather import currentweather
from assets.forecastWeather import *
from assets.position import p... |
views.py | # -*- coding: utf-8 -*-
from datetime import datetime
from imp import reload
import requests
from flask_uploads import configure_uploads
from markdown import markdown
from apps import app,db,pagedown,loginmanager,creat_folder,STATIC_DIR
from flask import render_template, url_for, flash, request, redirect, session, js... |
tests.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... |
wikisourcetext.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
This bot applies to wikisource sites to upload text.
Text is uploaded to pages in Page ns, for a specified Index.
Text to be stored, if the page is not-existing, is preloaded from the file used
to create the Index page, making the upload feature independent from the forma... |
helpers.py | """
This file contains various helpers and basic variables for the test suite.
Defining them here rather than in conftest.py avoids issues with circular imports
between test/conftest.py and test/backend/<backend>/conftest.py files.
"""
import functools
import logging
import multiprocessing
import os
import subprocess... |
testing_enron_attranse.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys
if '../src' not in sys.path:
sys.path.append('../src')
import os
import numpy as np
from numpy import linalg as LA
import tensorflow as tf
import time
if '../../utils' not in sys.path:
sys... |
cmdserver.py | #!/usr/bin/env python
"""Cmd server."""
server_debug = open("server.debug", 'w') ## TODO: handle multiple ports
def debug(message):
server_debug.write(message+"\n")
server_debug.flush()
from flask import Flask, request, jsonify
import logging
from logging.handlers import RotatingFileHandler
import inspect
impor... |
server.py | """RPC server implementation.
Note
----
Server is TCP based with the following protocol:
- Initial handshake to the peer
- [RPC_MAGIC, keysize(int32), key-bytes]
- The key is in format
- {server|client}:device-type[:random-key] [-timeout=timeout]
"""
# pylint: disable=invalid-name
from __future__ import absolute... |
binary_manager.py | import zmq
import time
import argparse
import os
import itertools
import subprocess
import socket
import signal
from contextlib import closing
from threading import Thread
class BinaryManager:
"""
Binary manager that launches TDW binaries for use with remote and local controllers.
Usage: ... |
cpuinfo.py | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
# Copyright (c) 2014-2018, Matthew Brennan Jones <matthew.brennan.jones@gmail.com>
# Py-cpuinfo gets CPU info with pure Python 2 & 3
# It uses the MIT License
# It is hosted at: https://github.com/workhorsy/py-cpuinfo
#
# Permission is hereby granted, free of charge, to an... |
test_http.py | """Tests for managing HTTP issues (malformed requests, etc).
Some of these tests check timeouts, etcetera, and therefore take a long
time to run. Therefore, this module should probably not be included in
the 'comprehensive' test suite (test.py).
"""
from cherrypy.test import test
test.prefer_parent_path()
import gc
... |
wallUnit.py | #!/usr/bin/python
import sys, os, time, urllib, datetime, socket, sched, threading
basepath = os.path.split(os.path.dirname(os.path.abspath(__file__)))[0]
sys.path.append(basepath + '/libs/Adafruit_Python_CharLCD')
import Adafruit_CharLCD as LCD
sys.path.append(basepath + '/libs/requests')
sys.path.append(basepath +... |
header_verification.py | # Minimize imports to decrease overhead
# Changes to blockchain.py must be reflected here
import hashlib
import multiprocessing
import struct
import kawpow
import x16r_hash
import x16rv2_hash
import warnings
warnings.filterwarnings("ignore", category=DeprecationWarning)
def to_bytes(something, encoding='utf8') ->... |
web.py | import logging
from transitions.extensions.markup import MarkupMachine
from transitions.extensions.nesting import HierarchicalMachine, NestedTransition
from transitions.core import Transition
_LOGGER = logging.getLogger(__name__)
_LOGGER.addHandler(logging.NullHandler())
class WebTransition(Transition):
def _ch... |
base.py | # Copyright (C) 2016 Nippon Telegraph and Telephone Corporation.
#
# 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... |
parallel.py | #!/usr/bin/env python
import iqueue as queue
import sys
import threading
import socket
import pickle
import os
import sys
import traceback
import time
__version__ = "1.0"
def timestamp(t=None):
t = time.time() if t is None else t
ms = 1000 * t % 1000
ymdhms = time.localtime(t)
tz = time.altzone if ymd... |
test_build_alignments.py | #!/usr/bin/env python
"""Test trainModels.py"""
########################################################################
# File: test_trainModels.py
# executable: test_trainModels.py
#
# Author: Andrew Bailey
# History: 5/21/18 Created
########################################################################
import u... |
bme280xively.py | #!/usr/bin/python
import sys
import time
import smbus
import urllib2
import requests
import json
import datetime
import threading
import traceback
API_KEY = "********************" # Xively API Key
FEED_ID = "********************" # Xively Feed ID
INTERVAL = 60 # second
# class Xively
class Xively:
# ... |
streamLatestFrame.py | # ref : https://www.pyimagesearch.com/2017/02/06/faster-video-file-fps-with-cv2-videocapture-and-opencv/
from threading import Thread
import cv2
# TO KEEP LATENCY AT A MINIMUM WE SKIP A FEW FRAMES AND ONLY USE THE LATEST FRAME AVAILABLE
class LatestFrame:
def __init__(self, path):
self.stream = cv2.Vide... |
CasesSolver.py | import os
import cv2
import sys
import time
import yaml
import random
import signal
import argparse
import itertools
import subprocess
import numpy as np
import matplotlib.cm as cm
import drawSvg as draw
import scipy.io as sio
from PIL import Image
from multiprocessing import Queue, Pool, Lock, Manager, Process
from o... |
WordCount.py | import sublime, sublime_plugin, re
import time
import threading
from math import ceil as ceil
from os.path import basename
Pref = {}
s = {}
wsd = {'modified':True, 'selection':True, 'syntax':'plain text','changes':-1,'status':-1}
def plugin_loaded():
global s, Pref
s = sublime.load_settings('WordCount.sublime-setti... |
time_sleep.py | import threading
import time
def threadWorker():
print('Running State') # Runnable -> Running
time.sleep(3) # Running -> Not-running
print('Terminating')
myThread = threading.Thread(target=threadWorker) # New Thread
myThread.start() # New Thread - start -> Runnable
myThread.join()
print('Dead') # ... |
knative_native.py | import logging
import os
import threading
from decimal import Decimal
from json import dumps
from time import sleep
from flask import Flask, request
from pyfaasm.core import getOutput, setEmulatorMessage, emulatorSetStatus, emulatorGetAsyncResponse, setLocalInputOutput
app = Flask(__name__)
request_count = 0
loggin... |
bot.py | from __future__ import annotations
import sys
from re import search
from os import environ, execl
from asyncio import (
gather,
wait_for,
new_event_loop,
iscoroutinefunction,
run_coroutine_threadsafe,
AbstractEventLoop,
TimeoutError,
Future
)
from dotenv import load_dotenv
from typing ... |
async_thread.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@ Author: qinbaoshuai
@ Date: 2019-08-23 15:24:11
@ Email: qinbaoshuai@cloudwalk.cn
@ LastEditors: qinbaoshuai
@ LastEditTime: 2019-09-20 15:16:20
@ Description: 异步线程的开始与停止
"""
from threading import Thread
import threading
import time
import inspect
import ctypes
import... |
runner.py | """Run Home Assistant."""
from __future__ import annotations
import asyncio
import dataclasses
import logging
import threading
import traceback
from typing import Any
from . import bootstrap
from .core import callback
from .helpers.frame import warn_use
from .util.executor import InterruptibleThreadPoolExecutor
from ... |
__init__.py | from __future__ import print_function, division, absolute_import
import os
import sys
import shutil
import subprocess
import optparse
import math
import signal
import threading
import atexit
import types
import re
import pprint
import time
import traceback
import locale
import inspect
import getpass
import tempfile
im... |
mqtt_tcp_example_test.py | import re
import os
import sys
import socket
from threading import Thread
import struct
import time
from tiny_test_fw import DUT
import ttfw_idf
msgid = -1
def get_my_ip():
s1 = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s1.connect(("8.8.8.8", 80))
my_ip = s1.getsockname()[0]
s1.close()
re... |
Animator.py | """
ASCII Animator
"""
import os
import sys
import json
import threading
from time import sleep
class Animation:
def __init__(self, frames, cfg):
self._state = "stopped"
self._frame = cfg["Start"]
self._frames = frames
self._duration = cfg["Duration"] or 1 / len(frames)
def play(self, playCo... |
run.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from mysql_connection_pool import MysqlPool
import random
from threading import Thread
from time import sleep
def worker(pool, thread_num):
while True:
print('\nThread: %i \n' % (thread_num))
cnx = pool.get_connection()
cursor = cnx.cursor(dic... |
dfs.py | # coding=utf-8
import os
import socket
import time
import sys
# import json
import commands
# import subprocess
sys.path.append('/home/dsjxtjc/2018211149/')
import utils.io_utils as iou
import math
from multiprocessing import Process
# 默认的配置文件路径
DEFAULT_DFS_PATH = '/home/dsjxtjc/2018211149/dfs_sqy/dfs.py'
DEFAUL... |
remote.py | '''
Buildozer remote
================
.. warning::
This is an experimental tool and not widely used. It might not fit for you.
Pack and send the source code to a remote SSH server, bundle buildozer with it,
and start the build on the remote.
You need paramiko to make it work.
'''
__all__ = ["BuildozerRemote"]
... |
server.py | from avista_iot import api
from avista_base.service import Service
# from multiprocessing import Process
class IoTServer(Service):
def __init__(self):
""" instantiate the app """
super().__init__()
self.sensor_sweep = None
def _setup_endpoints(self):
super()._setup_endpoints(... |
N_Queen.py | import pygame
import time
from threading import *
from ExtraWidgits import *
import StartProcess
RunClock=True
class N_queen:
def __init__(self, v, speed):
pygame.init()
pygame.display.set_caption("N-Queens")
self.diagonal1 = {}
self.diagonal2 = {}
self.col = {}
se... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.