source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
plot_realtime.py | #!/usr/bin/env python3
import argparse
import collections
import json
import socket
import threading
import time
from typing import NamedTuple
import numpy as np
import matplotlib.pyplot as plt
class Rotation(NamedTuple):
roll: float
pitch: float
class ThreeVector(NamedTuple):
"""Basic x/y/z vector"""... |
serve.py | # Most of this code is:
# (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org)
# Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
# The server command includes the additional header:
# For discussion of daemonizing:
# http://aspn.activestate.com/ASPN/C... |
StatePlayGame.py | from ButtonClickHandler import PlayGameButtons as P
from GUI import root, tk, MyButton
from datetime import datetime
import threading
import socket
import json
import time
import sys
import GUI
class Client(object):
def __init__(self, game):
try:
self.game = game
s... |
msg.py | from utlis.rank import setrank ,isrank ,remrank ,setsudos ,remsudos ,setsudo,IDrank,GPranks
from utlis.send import send_msg, BYusers, sendM,Glang,GetLink
from handlers.delete import delete
from utlis.tg import Bot, Ckuser
from handlers.ranks import ranks
from handlers.locks import locks
from handlers.gpcmd import gpcmd... |
Main.py | import cv2
from Camera import Camera
from MovimentDetection import MovimentDetection
from ObjectDetection import ObjectDetection
from FaceDetection import FaceDetection
from TimerProcess import TimerProcess
from TelegramBot import TelegramBot
import Rectangles
from threading import Thread
import time
def showFrame(fr... |
main.py | #!/usr/bin/env python
###############################################################################
# Copyright 2017 The Apollo 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 ... |
queue.py | import copy
import multiprocessing as mp
import multiprocessing.queues as mpq
from queue import Full, Empty
import pickle
import math
# import uuid
import os
import struct
import sys
import time
import typing
import dill # type: ignore
import zlib
if sys.version_info >= (3, 8):
from multiprocessing.shared_memory... |
zooz_rgbw_light.py | import appdaemon.plugins.hass.hassapi as hass
import json
from threading import Thread
class ZoozRGBWLight(hass.Hass):
def initialize(self):
args = self.args
self.light_name = args["light_name"]
self.unique_id = args["unique_id"]
self.entity_id = "light.{}".format(self.unique_id)
... |
NitroGen.py | import requests
import string
import random
from sys import argv, exit
from threading import Thread
try:
caracteres = int(argv[1])
threads = int(argv[2])
proxys = argv[3]
except:
print('Error, Set Characters, Threads And List Proxys!!!')
exit()
proxys = open(proxys, r"D:\\GitHub\\NitroGenerator\\d... |
PyShell.py | #! /usr/bin/env python3
import getopt
import os
import os.path
import re
import socket
import subprocess
import sys
import threading
import time
import tokenize
import traceback
import types
import io
import linecache
from code import InteractiveInterpreter
from platform import python_version, system
try:
from t... |
automatic_upgrader.py | import threading
import re
import os
import datetime
import locale # To prevent import errors in thread with datetime
import time
import functools
import sublime
from .show_error import show_error
from .console_write import console_write
from .package_installer import PackageInstaller
from .package_renamer import Pa... |
binocular_measuring_cv.py | #!/usr/bin/env python3
# Francesco Marrato 2021-03-17
# Hope you like lists, multithreading, and buffers
from sensor_msgs.msg import Image # will show error but is fine
from cv_bridge import CvBridge # will show error but is fine
from binocular_p3.msg import Vision_Object # will show error but is fine
from colora... |
FederatedSDNSecurity.py | '''
Created on 12 janv. 2016
@author: phm
'''
# --------------------------------------
import yaml
import FederatedSDNAdapter
import random
class FederatedSDNSecurity:
'''
classdocs
'''
def __init__(self, name):
'''
Constructor
'''
self.name=name
... |
sensors.py | #!/usr/bin/env python
import serial
import os
import glob
import time
import RPi.GPIO as GPIO
import sqlite3
import threading
import subprocess
import sys
sys.path.append('/opt/rrdtool-1.4.3/lib/python2.7/site-packages/')
import rrdtool
config = "/data/config.py"
from config import *
global x
x = 0
... |
generate_breakpad_symbols.py | #!/usr/bin/env python
# Copyright (c) 2013 GitHub, Inc.
# Copyright (c) 2013 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.
"""A tool to generate symbols for a binary suitable for breakpad.
Currently, the tool only suppo... |
test_integration_basics.py | """Tests Nighthawk's basic functionality."""
import json
import logging
import math
import os
import pytest
import subprocess
import sys
import time
from threading import Thread
from test.integration.common import IpVersion
from test.integration.integration_test_fixtures import (
http_test_server_fixture, https_t... |
base.py | """
Code to provide a base class for processing objects in a queue in parallel.
Features:
- Generic use case for processing objects in a queue.
- Can run using either a process pool or thread pool.
- Handles and logs uncaught exceptions.
- Minimal CPU downtime.
"""
import gc
import time
import atexit
import queue
from... |
test_operator_gpu.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 u... |
myproject.py | # -*- coding: utf-8 -*-
"""
Created on Tue Nov 17 17:26:15 2020
@author: mehmet
"""
import pandas as pd
from flask import Flask ,render_template
app = Flask(__name__)
def buysell(signal):
if signal > 0:
return "buy"
elif signal == 0:
return "sell"
#### Qwerty12345-.,
@app.route('/',m... |
server.py | """TCP Server module."""
import time
import socket
import select
import threading
from testplan.common.utils.timing import wait
class Server(object):
"""
A server that can send and receive messages based on socket interface.
Supports multiple connections.
:param host: The host address the server is... |
example_topop_tb_v3_2.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Aug 9 02:58:30 2021
@author: qcao
v2 - denser structures
"""
import os
import sys
sys.path.append('../') # use bonebox from source without having to install/build
from bonebox.phantoms.TrabeculaeVoronoi import *
from bonebox.FEA.fea import *
impor... |
_mouse_tests.py | # -*- coding: utf-8 -*-
import unittest
import time
from ._mouse_event import MoveEvent, ButtonEvent, WheelEvent, LEFT, RIGHT, MIDDLE, X, X2, UP, DOWN, DOUBLE
from keyboard import mouse
class FakeOsMouse(object):
def __init__(self):
self.append = None
self.position = (0, 0)
self.queue = No... |
test_io.py | """Unit tests for the io module."""
# Tests of io are scattered over the test suite:
# * test_bufio - tests file buffering
# * test_memoryio - tests BytesIO and StringIO
# * test_fileio - tests FileIO
# * test_file - tests the file interface
# * test_io - tests everything else in the io module
# * test_univnewlines - ... |
Data_Collection_2.py | import cv2
import imageio
import pyrealsense2 as rs
import os
import shutil
import datetime
import pyaudio
import http.client
import io
import numpy as np
import json
import zlib
import base64
import datetime
import threading
import wave
import pygame as pg
import time
class CollectData:
def __init__(self):
self.dc... |
server.py | import json
import logging
import os
import random
import string
import threading
import time
from datetime import datetime
from logging.handlers import TimedRotatingFileHandler
import click
import tornado.ioloop
import tornado.websocket
os.makedirs('./logs', exist_ok=True)
logging.basicConfig(format='%(asctime)s %(... |
pyi_lib_requests.py | # -----------------------------------------------------------------------------
# Copyright (c) 2014-2021, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License (version 2
# or later) with exception for distributing the bootloader.
#
# The full license is in the file COPYING.tx... |
package_coverage.py | # coding: utf-8
from __future__ import unicode_literals, division, absolute_import, print_function
import sys
import os
import re
import threading
import imp
import time
import unittest
import sublime
import sublime_plugin
import coverage
import coverage.files
import shellenv
import sqlite3
import subprocess
import we... |
downloader.py | import os
import sqlite3
from getpass import getpass
import multiprocessing
import dropbox
from tqdm import tqdm
import pathlib
def wrapper(token: str, arg_list, queue: multiprocessing.Queue):
dbx = dropbox.Dropbox(token)
for (dropbox_path, download_path) in arg_list:
try:
dbx.files_downl... |
nanocapture.py | ###############################################################################
# CSI video capture on Jetson Nano using gstreamer
# Latency can be 100-200ms
# Urs Utzinger,
#
# 2021, Initialize
# 2020, Update Queue
# 2019, First release
###############################################################################
... |
autoreload.py | """
Autoreloading Launcher
Borrowed/adapted from Django Autoreload Utility (https://github.com/django/django/...autoreload.py)
Borrowed from Peter Hunt and the CherryPy project (http://www.cherrypy.org).
Some taken from Ian Bicking's Paste (http://pythonpaste.org/).
Portions copyright (c) 2004, CherryPy Team (team@che... |
helpers.py | """Supporting functions for polydata and grid objects."""
import signal
import collections
import ctypes
import enum
import logging
import warnings
from threading import Thread
import numpy as np
import scooby
import vtk
import vtk.util.numpy_support as nps
import pyvista
from .fileio import from_meshio
class Fiel... |
run_py_tests.py | #!/usr/bin/env python
# Copyright 2013 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.
"""End to end tests for ChromeDriver."""
# Note that to run Android tests you must have the following line in
# .gclient (in the paren... |
ui.py | # -*- coding: utf-8 -*-
# Copyright 2012 Harald Schilly <harald.schilly@univie.ac.at>
#
# 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... |
test_asyncore.py | import asyncore
import unittest
import select
import os
import socket
import sys
import time
import errno
import struct
from test import support
from io import BytesIO
if support.PGO:
raise unittest.SkipTest("test is not helpful for PGO")
try:
import threading
except ImportError:
threading = None
TIMEOU... |
postproc.py | #!/usr/bin/python3 -OO
# Copyright 2007-2019 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... |
stateful.py | from __future__ import division
import contextlib
import datetime
import os
import time
import threading
from galaxy.tools.deps import dependencies
from pulsar.client.util import filter_destination_params
from pulsar.managers import ManagerProxy
from pulsar.managers import status
from pulsar.managers.util.retry impo... |
process.py | import atexit
from datetime import timedelta
import logging
import os
from queue import Queue as PyQueue
import re
import threading
import weakref
from .utils import mp_context
from tornado import gen
from tornado.concurrent import Future
from tornado.ioloop import IOLoop
logger = logging.getLogger(__name__)
def ... |
server.py | from socketserver import *
import os, json, struct,pprint
import threading
import pexpect
test_home = "0.0.0.0"
PORT = 8875
TEST_HOME = (test_home, PORT)
base_dir = os.path.dirname((os.path.abspath(__file__)))
DISPLAY = []
PARAMS = []
flag = 0
allowToReceiveArgs=False
def compile(cmd):
os.system(cmd)
# 将用户的输入从... |
main.py | import os
import threading
import openpyxl
import kivy
from kivy.app import App
from kivy.uix.label import Label
from kivy.uix.textinput import TextInput
from kivy.uix.button import Button
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.popup import Popup
from kivy.properties import ObjectProperty
from kivy.... |
keep_alive.py | from flask import Flask
from threading import Thread
app = Flask('')
@app.route('/')
def main():
return '<meta http-equiv="refresh" content="0; URL=https://phantom.codes/credits"/>'
def run():
app.run(host="0.0.0.0", port=8080)
def keep_alive():
server = Thread(target=run)
server.start()
|
ultrasonic_hcsr04.py | # --------------------------------------------------------------------------- #
# Title: Ultrasonic measure and interpretation script
# Author: Arthur Telles, Eduardo Brizida, Balthazar Paixao
# Date: 01/07/2018 (DD/MM/YYYY)
# Description:
# --------------------------------------------------------------------------- #... |
testresult.py | # -*- coding: utf-8 -*-
#
# Tencent is pleased to support the open source community by making QTA available.
# Copyright (C) 2016THL A29 Limited, a Tencent company. All rights reserved.
# Licensed under the BSD 3-Clause License (the "License"); you may not use this
# file except in compliance with the License. You may... |
comunicationTest.py | import serial
import threading
from time import sleep
serial_port = serial.Serial()
def read():
while True:
data = serial_port.read(9999999999)
if len(data) > 0:
print('Got:{}'.format(data))
def main():
try:
serial_port.baudrate = 9600
serial_port.port = 'COM7'
... |
033.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
'''
进程间通信
'''
from multiprocessing import Process, Queue
import os, time, random
# 写数据进程执行的代码:
def write(q):
print('Process to write: %s' % os.getpid())
for value in ['A', 'B', 'C']:
print('Put %s to queue...' % value)
q.put(value)
time.sleep(... |
PFD.py |
# -*- coding: utf-8 -*-
from remi import gui
from remi import start, App
import math
import threading
import time
class AsciiContainer(gui.Container):
widget_layout_map = None
def __init__(self, *args, **kwargs):
gui.Container.__init__(self, *args, **kwargs)
self.css_position = 'relative'
... |
pmbus.py | # Copyright (c) 2016, Xilinx, Inc.
# 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. Redistributions of source code must retain the above copyright notice,
# this list of con... |
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... |
grpc_debug_test_server.py | # Copyright 2016 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... |
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... |
main.py | from multiprocessing import Process, Queue
from node import Node
NUM_NODES = 100
if __name__ == '__main__':
communal_inbox = dict((i, Queue()) for i in range(NUM_NODES))
jobs = [Process(target=Node, args=(communal_inbox, i)) for i in range(NUM_NODES)]
for j in jobs:
j.start()
for j in jobs:
... |
screen_widget.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... |
client2.py | import socket
import time
from threading import Thread
def make_request():
start_time = time.time()
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect(('localhost', 8000))
sock.send(b'GET /\n\n')
resp = sock.recv(100)
sock.close()
end_time = time.time()
print(time.str... |
test_node.py | import os
import sys
import logging
import requests
import time
import traceback
import random
import pytest
import ray
import threading
from datetime import datetime, timedelta
from ray.cluster_utils import Cluster
from ray.new_dashboard.tests.conftest import * # noqa
from ray._private.test_utils import (
format_... |
util.py | import os
import re
import shutil
import sys
import ctypes
from pathlib import Path
from colorama import Fore, Back, Style
from taichi.misc.settings import get_output_directory, get_build_directory, get_bin_directory, get_repo_directory, get_runtime_directory
from taichi.misc.util import get_os_name, get_unique_task_id... |
plotter.py | #%%
import matplotlib.animation as animation
import matplotlib.pyplot as plt
import psutil
from multiprocessing import Event, \
Process, \
SimpleQueue as SQ, \
set_start_method
from threading import Thread
from time import sl... |
main.py | import io
import os
import socket
import struct
import time
import picamera
import sys,getopt
from Thread import *
from threading import Thread
from server import Server
from server_ui import Ui_server_ui
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
from PyQt5.QtGu... |
animation.py | import os
import time
from multiprocessing import Process
import numpy as np
from pyqtgraph.Qt import QtCore
from traits.api import Button, Enum, Bool, Int, File
from traitsui.api import View, VGroup, HGroup, UItem, \
Item, FileEditor, RangeEditor
from pyface.timer.api import Timer
import ecoglib.vis.ani as ani
... |
vci_diffN.py | import numpy as np
import math
import itertools
from collections import Counter
import sys
from numpy import linalg
from numba import jit
import time
from multiprocessing import Process, Queue
import csv
from itertools import permutations
#This function is obtained from pyvci plz see github resource code
#this functio... |
exchange_rate.py | from datetime import datetime
import inspect
import requests
import sys
from threading import Thread
import time
import traceback
import csv
from decimal import Decimal
from bitcoin import COIN
from i18n import _
from util import PrintError, ThreadJob
from util import format_satoshis
# See https://en.wikipedia.org/w... |
test_unix_events.py | """Tests for unix_events.py."""
import collections
import contextlib
import errno
import io
import os
import pathlib
import signal
import socket
import stat
import sys
import tempfile
import threading
import unittest
from unittest import mock
from test import support
if sys.platform == 'win32':
raise unittest.Ski... |
generate_data.py | import cv2
from time import sleep
import os
from tkinter import *
from keras.utils import plot_model
from keras.models import Sequential
from keras.layers import Convolution2D, Dropout, Dense, Flatten, MaxPooling2D
from keras.preprocessing.image import ImageDataGenerator, load_img
from numpy import array
from keras imp... |
webdriver_w3c_executor.py | # Copyright (C) 2017 Igalia S.L.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.... |
test_stream.py | import gc
import threading
import unittest
import pytest
import cupy
from cupy._creation import from_data
from cupy import cuda
from cupy import testing
@testing.parameterize(
*testing.product({
'stream_name': ['null', 'ptds'],
}))
@testing.gpu
class TestStream(unittest.TestCase):
def setUp(sel... |
Meridian_console_v22_0418_osx.py | # #!/usr/bin/python3
# coding: UTF-8
# もしくは #!/usr/bin/env python など環境に合わせて
#2022.02.05 UDP通信動作は安定。
#2022.02.05 COMMAND WINDOWのPOWERチェックボックスでサーボ電源ON
#2022.02.05 上記サーボ電源ON中にスライドバー操作でサーボ動作(ただしスライドバーが小さいため大まかな動作確認のみに利用可)
#2022.04.05 コードを少し整理整頓
#2022.04.14 各経路でのエラーの検知と表示の機能を搭載
#2022.04.14 ROSのパブリッシュボタンを追加。ROSのサブスクライブは未実装。... |
server.py | import socket
import pickle
import threading
from NanovorCollection import*
from OnlineGame import OnlineGame
import sys, os
HOST = ""
PORT = 50500
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
s.bind((HOST, PORT))
s.listen(5)
#Contains lists of ongoi... |
main.py | from pytube import Playlist, YouTube
from googleapiclient.discovery import build
import requests
import subprocess
import os
import time
import json
import re
import threading
lock = threading.Lock()
sema = threading.Semaphore(10)
WORKDIR = os.path.dirname(os.path.realpath(__file__)) + '/tmp5/'
JSON_N... |
rdd.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... |
wsdump.py | #!/Users/jenfang/deepWordBug/Adversarial-Playground-Text-viz/virt/bin/python3
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():
encodin... |
brute_force.py | #!/usr/bin/env python3
from itertools import product
from threading import Thread
from http.client import responses
import requests, sys, os
# global var for ending script
end = False
# thread config
pool_limit = 32
threads = [Thread()] * pool_limit
# action url of form
url = "http://www.example.com/login.php"
# s... |
gammu_controller.py | import logging
import threading
from collections import namedtuple
from gammu import StateMachine
from gammu.worker import GammuWorker
from pyphone.controllers.controller import Controller
IncomingCallEvent = namedtuple("IncomingCallEvent", ["number"])
EndCallEvent = namedtuple("EndCallEvent", ["number"])
class Ga... |
scheduler.py | import time
from multiprocessing import Process
from proxypool.api import app
from proxypool.getter import Getter
from proxypool.tester import Tester
from proxypool.setting import *
from .logger_proxy import MyLogger
logger = MyLogger.get_logger('scheduler')
class Scheduler(object):
@staticmethod
def schedul... |
Gateway_v2.py | from http.server import ThreadingHTTPServer, SimpleHTTPRequestHandler
from requests_toolbelt.adapters.source import SourceAddressAdapter
from datetime import datetime, timezone
import config.config as cfg
import requests as req
import logging as log
from socket import *
import threading
import ssl
# init gateway info
... |
test_dag_serialization.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... |
test_io.py | """Unit tests for the io module."""
# Tests of io are scattered over the test suite:
# * test_bufio - tests file buffering
# * test_memoryio - tests BytesIO and StringIO
# * test_fileio - tests FileIO
# * test_file - tests the file interface
# * test_io - tests everything else in the io module
# * test_univnewlines - ... |
mqtt2db.py | #!/usr/bin/python3
from db_ingest import DBIngest
import paho.mqtt.client as mqtt
from threading import Thread, Condition, Timer
from signal import signal, SIGTERM
from configuration import env
import traceback
import json
mqtthost = env["MQTTHOST"]
scenario = env["SCENARIO"]
dbhost = env["DBHOST"]
office = list(map(... |
uploader.py | # Copyright 2020 Cognite AS
#
# 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... |
postprocess.py | """
gui/postprocess
~~~~~~~~~~~~~~~~~~~~
Data analysis of localization lists
:author: Joerg Schnitzbauer, 2015
:copyright: Copyright (c) 2015 Jungmann Lab, Max Planck Institute of Biochemistry
"""
import numpy as _np
import numba as _numba
from sklearn.cluster import DBSCAN as _DBSCAN
from scipy... |
caching.py | import datetime
import threading
import time
import cherrypy
from cherrypy.lib import cptools, http
class MemoryCache:
maxobjects = 1000
maxobj_size = 100000
maxsize = 10000000
delay = 600
def __init__(self):
self.clear()
t = threading.Thread(target=self.expire_cache, na... |
rest.py | import json
import threading
import logging
from flask import Flask, make_response, request
import requests
from .modulemanager import ModuleManager
app = Flask(__name__, static_url_path='', static_folder='./site')
def agent_to_json(agent) -> dict:
return {"name": agent.identifier,
"type": agent.ag... |
serialize_tensorboard.py | # Copyright 2015 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 a... |
experiment.py | #!/usr/bin/env python
import traceback
import logging, time, datetime, signal
import pprint, os, sys, math
pp = pprint.PrettyPrinter(indent=4).pprint
from threading import Thread
from time import sleep
import execo as EX
from string import Template
from execo import configuration
from execo.log import style
from exec... |
test_connection_observer_with_runner.py | # -*- coding: utf-8 -*-
"""
Testing connection observer with runner based on threads
- call as function (synchronous)
- call as future (asynchronous)
"""
__author__ = 'Grzegorz Latuszek'
__copyright__ = 'Copyright (C) 2018, Nokia'
__email__ = 'grzegorz.latuszek@nokia.com'
import threading
import time
import pytest... |
test_concurrency.py | """ Test """
import os
import shutil
import socket
import tempfile
import threading
import time
import unittest
from threading import Thread
from filoc import filoc
from filoc.core import LockException
# noinspection DuplicatedCode,PyMissingOrEmptyDocstring
class TestFilocConcurrency(unittest.TestCase):
def setU... |
crawler.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import calendar
import datetime
import json
import logging
import math
import re
import ssl
import threading
import urllib.request
import urllib.parse
from time import sleep, time
from queue import Queue
import requests
from geopy import Point
from geopy.distance import v... |
collect.py | #!/usr/bin/env python3
from scapy.all import sniff, IP, TCP
from scapy.layers.http import HTTPRequest, HTTPResponse
from Crypto import Random
import os
import queue
import threading
import hashlib
import json
import hmac
import base64
import ipaddress
import requests
import time
ENCODING = 'utf-8'
BYTEORDER = 'big'
... |
thread_process_multicores.py | # 对比多线程和多进程在多核CPU上执行计算密集和IO密集型任务的效率
import threading, multiprocessing
import os, time,math
# 定义计算密集型任务
def task_cpu(n):
x = 0.0
for i in range(2,n):
x += sum([math.sin(i) for i in range(i)])
# 定义IO密集型任务
def task_io(n):
for _ in range(n):
time.sleep(0.005)
if __name__ == '__main__':
# 测试... |
dylos.py | import logging
from queue import Queue, Empty
import subprocess
from threading import Thread
import Adafruit_BBIO.GPIO as GPIO
import Adafruit_BBIO.UART as UART
import serial
DYLOS_POWER_PIN = "P8_10"
TIMEOUT = 5
LOGGER = logging.getLogger(__name__)
def setup_sensor(config):
return Dylos()
class Dylos:
de... |
word2vec_tf.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... |
tests.py | # Unit tests for cache framework
# Uses whatever cache backend is set in the test settings file.
import copy
import io
import os
import pickle
import re
import shutil
import tempfile
import threading
import time
import unittest
import warnings
from unittest import mock
from django.conf import settings
from django.core... |
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... |
server.py |
from flask import Flask
from threading import Thread
from flask import send_file, send_from_directory, safe_join, abort, g, session, redirect, request, url_for, jsonify, render_template
import os
import random
import requests
import json
import string
app = Flask('')
import discord
from replit import db
import logg... |
FedLogsSDK.py | import logging
import multiprocessing
import os
import sys
import json
import threading
import time
import requests
import yaml
sys.path.insert(0, os.path.abspath(os.path.join(os.getcwd(), "../../../")))
sys.path.insert(0, os.path.abspath(os.path.join(os.getcwd(), "../../../../FedML")))
class FedLogsSDK:
FED_LO... |
cluster.py | # Standard
import ast
import inspect
import pydoc
import signal
import socket
import traceback
import uuid
from datetime import datetime
from multiprocessing import Event, Process, Value, current_process
from time import sleep
# External
import arrow
# Django
from django import core, db
from django.apps.registry impo... |
engine.py | """the interface to interact with wakeword model"""
import pyaudio
import threading
import time
import argparse
import wave
import torchaudio
import torch
import numpy as np
from neuralnet.dataset import get_featurizer
from threading import Event
class Listener:
def __init__(self, sample_rate=8000, record_second... |
test_grammar.py | import math
import re
import threading
import time
from typing import Any, Callable, List, Optional, Set, Tuple
import antlr4
from pytest import mark, param, raises, warns
from omegaconf import (
AnyNode,
Container,
DictConfig,
ListConfig,
OmegaConf,
_utils,
grammar_parser,
grammar_vis... |
command.py | # Copyright (c) 2016-present, Facebook, Inc.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import enum
import logging
import os
import re
import resource
import signal
import subprocess
import threading
from abc import abstractmethod
from ... |
accumulators.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... |
App.py | from Player import Player
from getkey import getkey, keys
import sys
from itertools import cycle
from time import sleep
import threading
import argparse
from colorama import Fore
CURSOR_UP_ONE = '\x1b[1A'
ERASE_LINE = '\x1b[2K'
QUIT_SEARCH = False
QUIT_DISPLAY = False
LINE_BUFFER = 0
# Launches chrome with YouTube la... |
pacman-log-agent.py | from datetime import datetime
from pprint import pprint
from threading import Thread
import psutil, socket, json, re
import time, sys, requests
def filterLog(line, filter_by):
if re.search(filter_by, line):
return True
return False
def parseProcessInfo():
processDict = psutil.Process().as_dict(attrs=... |
UR_Monitoring_CSV.py | # This script creates a thread to monitor the position and other variables from a real UR robot and stores the data to a CSV file
# With this script running, RoboDK will save a CSV file of the robot status
#
# Press F5 to run the script
# Or visit: http://www.robodk.com/doc/en/PythonAPI/
from robodk.robolink import * ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.