source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
sensordb.py | from datetime import datetime, timedelta
import boto3
import json
from pybluemo.aws_srp import AWSSRP
from python_graphql_client import GraphqlClient
import os
import threading
import time
class GetOrCreateDataSourceInput(object):
DEVICE_ID_COHORT = "1e340cc4-ee98-4617-a96f-1ea6ecc19e79"
def __init__(self, o... |
PhidgetsAdvancedServo8MotorRCC0004_ReubenPython2and3Class.py | # -*- coding: utf-8 -*-
'''
Reuben Brewer, Ph.D.
reuben.brewer@gmail.com
www.reubotics.com
Apache 2 License
Software Revision F, 03/13/2022
Verified working on: Python 2.7, 3.8 for Windows 8.1, 10 64-bit and Raspberry Pi Buster (no Mac testing yet).
'''
__author__ = 'reuben.brewer'
import os, sys, p... |
test_store_sparqlstore.py | import re
import socket
import unittest
from http.server import BaseHTTPRequestHandler, HTTPServer
from test.utils import helper
from test.utils.httpservermock import (
MethodName,
MockHTTPResponse,
ServedBaseHTTPServerMock,
)
from threading import Thread
from typing import Callable, ClassVar, Type
from uni... |
main.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Multiprocess with mqtt example
@author: jev
"""
import multiprocessing
import time
import paho.mqtt.client as mqtt
import asyncio
class Process():
""" process to run separately """
running = True
counter = 0
def __init__(self,name):
... |
test.py | import subprocess
from hop import Stream
from hop.auth import Auth
from hop import auth
from hop.io import StartPosition
from hop.models import GCNCircular
import argparse
import random
import threading
import time
from functools import wraps
import datetime
import numpy
import uuid
from dotenv import load_dotenv
impor... |
middleware.py | # -*- coding: utf-8 -*-
import inspect
import time
import redis
from threading import Thread
from django.db import connection
from watchtower.db import dispatch
from watchtower import serializer, conf as CONF
try:
from django.utils.deprecation import MiddlewareMixin
except ImportError:
MiddlewareMixin = object... |
pyImageDownloader.py | """
识别文件下的MD文件,并将MD文件中的图片下载到本地,同时替换MD文件的图片引用路径到本地
"""
import os
import os.path
import threading
import urllib.request
from tkinter import *
from tkinter import filedialog
import re
class Article:
def __init__(self, path):
self.article_path = path
self.article_pic_dir = path.replace(".md", "_Imag... |
cep_control.py | import torch
import torch.autograd as autograd
import numpy as np
from cep.utils import torch2numpy, numpy2torch
import torch.nn as nn
from cep.optimizer import RWR
from cep.maps import Map
import time, copy
# from torch.multiprocessing import Pool
# torch.multiprocessing.set_start_method('fork', force=True)
# ... |
memory_tools.py | import time
import tracemalloc
from threading import Thread
class MemoryPoller:
"""
Example usage.
with MemoryPoller() as mp:
do some stuff here
print('initial memory usage', mp.initial_memory)
print('max memory usage', mp.max_memory)
excess_memory_used = mp.max_memory - m... |
test_remote2.py | import os
import time
import unittest
from multiprocessing import Process
from jina.parser import set_gateway_parser, set_pea_parser, set_pod_parser
from jina.peapods.pod import GatewayPod, BasePod
from jina.peapods.remote import RemotePea, PodSpawnHelper, PeaSpawnHelper, MutablePodSpawnHelper, RemotePod, \
Remote... |
reltestbase.py | # -*- coding: utf-8; -*-
##############################################################################
#
# Copyright (c) 2008 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this... |
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.dashboard.modules.node.node_consts import (
LOG_PRUNE_THREASHOLD,
MAX_LOGS_TO_CACHE,
)
... |
shell.py | import os
import platform
import shlex
import subprocess
import codecs
import sys
import locale
import threading
class Shell:
class ResultDTO:
def __init__(self):
self.stderr = None
self.data = None
self.retval = None
def __init__(self):
encoding = local... |
process_executor.py | ###############################################################################
# Re-implementation of the ProcessPoolExecutor more robust to faults
#
# author: Thomas Moreau and Olivier Grisel
#
# adapted from concurrent/futures/process_pool_executor.py (17/02/2017)
# * Backport for python2.7/3.3,
# * Add an extra m... |
kb_AssemblyUtilitiesServer.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import datetime
import json
import os
import random as _random
import sys
import traceback
from getopt import getopt, GetoptError
from multiprocessing import Process
from os import environ
from wsgiref.simple_server import make_server
import requests as _requests
from json... |
test_generator_mt19937.py | import sys
import hashlib
import pytest
import numpy as np
from numpy.linalg import LinAlgError
from numpy.testing import (
assert_, assert_raises, assert_equal, assert_allclose,
assert_warns, assert_no_warnings, assert_array_equal,
assert_array_almost_equal, suppress_warnings)
from numpy.random import G... |
server_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... |
thread_local.py | ###################################
# File Name : thread_local.py
###################################
#!/usr/bin/python3
import logging
import threading
logging.basicConfig(level=logging.DEBUG, format="(%(threadName)s) %(message)s")
def print_local_data(local_data):
try:
data = local_data.index
exc... |
test_generator_mt19937.py | import sys
import pytest
import numpy_demo as np
from numpy_demo.linalg import LinAlgError
from numpy_demo.testing import (
assert_, assert_raises, assert_equal, assert_allclose,
assert_warns, assert_no_warnings, assert_array_equal,
assert_array_almost_equal, suppress_warnings)
from numpy_demo.random imp... |
decorators.py | import threading
def run_in_thread(fn, daemon: bool = True):
def run(*args, **kwargs):
t = threading.Thread(target=fn, args=args, kwargs=kwargs, daemon=daemon)
t.start()
return t
return run
def set_interval(interval):
def decorator(function):
def wrapper(*args, **kwargs):... |
mongo.py | from typing import List
from datetime import datetime
import paho.mqtt.client as mqtt
import pymongo
import pymongo.database
import pymongo.collection
import pymongo.errors
import threading
import os
MONGO_URI = "mongodb://127.0.0.1:27017" # mongodb://user:pass@ip:port || mongodb://ip:port
MONGO_DB = "domotics"
MONG... |
core.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 1999-2020 Alibaba Group Holding Ltd.
#
# 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-... |
utils.py | # Copyright 2012-2019 CERN for the benefit of the ATLAS collaboration.
#
# 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... |
sample_fake_binaries_test.py | from multiprocessing import Process, Manager
from imageio import imread
import pickle
import numpy as np
import cv2
fake_path = 'dataset-dist/phase-01/training/fake/'
pristine_path = 'dataset-dist/phase-01/training/pristine/'
mask_path = fake_path + 'masks/'
def count_255(mask):
i=0
for row in ran... |
protocol.py | # See protocol.hpp for an overview of the protocol
import time
import struct
import sys
import threading
import traceback
#import fibre.utils
from fibre.utils import Event, wait_any, TimeoutError
import abc
if sys.version_info >= (3, 4):
ABC = abc.ABC
else:
ABC = abc.ABCMeta('ABC', (), {})
if sys.version_inf... |
test_failure.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import json
import os
import pytest
import sys
import tempfile
import threading
import time
import numpy as np
import redis
import ray
import ray.ray_constants as ray_constants
from ray.tests.cluster_utils im... |
Server.py | from flask import Flask, render_template, request
from threading import Thread
from sys import argv
import logging, time, sys
logging.getLogger('werkzeug').setLevel(logging.ERROR)
tokens = {'tokens':[],'used':[]}
app = Flask(__name__)
def tokenremoval(token):
tokens['tokens'].append(token)
time.sleep(110)
... |
CaseCreateDlg.py | # coding: utf-8
#!/usr/bin/python
from InternalModules.pfp_sdk.PFPUtil import *
import sys
reload(sys)
sys.setdefaultencoding('cp949')
class Util(object):
def DummyCyber(self, secret, plaintext, ciphertext):
# the block size for the cipher object; must be 16, 24, or 32 for AES
BLOC... |
gmail.py | import base64
import functools
import json
import signal
import time
from datetime import date
from queue import Queue
from threading import Event, Thread
from typing import Any, Callable, Generator, Iterable, Tuple, Type, Union
from googleapiclient.errors import HttpError
from typing_extensions import Literal
from .... |
socketserver.py |
#socketserver
"""
A simple alternative to the over-engineered one in the stdlib
"""
import socket
import logging
import threading
from contextlib import closing
from . import tools
from .tools import released
logger = logging.getLogger(__name__)
class Server(object):
def __init__(self, in_factory, in_addr, ... |
test_multi_process_db.py | from multiprocessing import Process
import lmdb
import os
import pytest
import rocksdb
from pathlib import Path
from rocksdb.errors import RocksIOError
from shutil import rmtree
from time import sleep
class TestDBPath:
rocksdb = 'test_rocksdb'
lmdb = 'test_lmdb'
def print_process_info(title):
print("\n... |
mi_c.py | from base import *
from multiprocessing import Pool
import progressbar
text_utils = {'PREP', 'CONJ', 'INTJ', 'PRED', 'PRCL', 'NPRO'}
def create(classname, arr, cursor, conn, gname):
if len(arr) == 0:
return
command = ''
for i in arr:
command += "INSERT into " + gname + " values (" + "'" ... |
App_gen.py | from PyQt5 import QtWidgets, QtCore, QtGui
from playsound import playsound
from threading import Thread
from random import randint
from time import sleep
col_circle_btn = """QPushButton::!hover
{
border-radius:25px;
border : 2px solid black;
... |
mcmc.py |
"""
.. moduleauthor:: Chris Bowman <chris.bowman.physics@gmail.com>
"""
import sys
from warnings import warn
from copy import copy, deepcopy
from multiprocessing import Process, Pipe, Event, Pool
from time import time
from random import choice
import matplotlib.pyplot as plt
from numpy import array, arange, zeros
fr... |
devices.py | import json
import logging
import random
import threading
import urllib
from datetime import datetime, timedelta
from time import sleep
import phue
import blinkytape
import colorhelp
RGB_OFF = (0, 0, 0)
class Device(object):
def __init__(self):
super(Device, self).__init__()
self.logger = logg... |
soundtools.py | #!/usr/bin/python
# This file will handle everything to do with sound
import speech_recognition as sr
import pyaudio
import subprocess
import os
from threading import Thread, ThreadError, Event
from base64 import b64encode
import wave
from math import ceil
class Listener:
"""
CHAS Listener class
Manages... |
manager.py | # ===============================================================================
# Copyright 2011 Jake Ross
#
# 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/licens... |
notify.py | import platform
import os
import pathlib
import threading
from loguru import logger
from .exceptions import (
UnsupportedPlatform,
InvalidAudioPath,
InvalidIconPath,
NotificationFailure,
BinaryNotFound,
InvalidAudioFormat,
)
from .os_notifiers import LinuxNotifier, MacOSNotifier, WindowsNotif... |
common_process.py | # Copyright 2017 theloop, 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 writing... |
mirror.py | import requests
from telegram.ext import CommandHandler
from telegram import InlineKeyboardMarkup
from bot import Interval, INDEX_URL, BUTTON_FOUR_NAME, BUTTON_FOUR_URL, BUTTON_FIVE_NAME, BUTTON_FIVE_URL, BUTTON_SIX_NAME, BUTTON_SIX_URL, BLOCK_MEGA_FOLDER, BLOCK_MEGA_LINKS, VIEW_LINK, aria2
from bot import dispatcher,... |
test_cli_task.py | # Copyright 2013: Mirantis 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 b... |
liveProcessor.py | import socket
import traceback
from threading import Thread
from multiprocessing import Process, Value, Queue
from .cameraAPI import RecordMode
import time
from ctypes import c_bool
from constants import framerate_delay
class LiveProcessor:
def __init__(self, cameraManager, queue):
self.cameraManager = ca... |
tests.py | import threading
import time
from unittest import mock
from multiple_database.routers import TestRouter
from django.core.exceptions import FieldError
from django.db import (
DatabaseError, NotSupportedError, connection, connections, router,
transaction,
)
from django.test import (
TransactionTestCase, ove... |
app.py | # -*- coding: utf-8 -*-
from pyrcm.models.message import Message
# MIT License
#
# Copyright (c) 2018 Justin Bewley Lo (justinbewley.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 wi... |
base_camera.py | import time
import threading
try:
from greenlet import getcurrent as get_ident
except ImportError:
try:
from thread import get_ident
except ImportError:
from _thread import get_ident
class CameraEvent(object):
"""An Event-like class that signals all active clients when a new frame is
... |
threadpool.py | #!/usr/bin/env python
# -- Content-Encoding: UTF-8 --
"""
Pelix Utilities: Cached thread pool
:author: Thomas Calmant
:copyright: Copyright 2020, Thomas Calmant
:license: Apache License 2.0
:version: 1.0.1
..
Copyright 2020 Thomas Calmant
Licensed under the Apache License, Version 2.0 (the "License");
y... |
managed_window.py | from __future__ import print_function, division
from pyglet.window import Window
from pyglet.clock import Clock
from threading import Thread, Lock
gl_lock = Lock()
class ManagedWindow(Window):
"""
A pyglet window with an event loop which executes automatically
in a separate thread. Behavior is added by... |
ExecutionContext_test.py | # Copyright 2015 Ufora 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 i... |
image_build.py | """
Copyright (c) 2017 Cyberhaven
Copyright (c) 2017 Dependable Systems Laboratory, EPFL
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 right... |
bookmybus.py | from threading import *
class BookMyBus:
def __init__(self,availableSeats):
self.availableSeats = availableSeats
self.l = Semaphore()
def buy(self,seatsRequested):
self.l.acquire()
print("Total seats available:",self.availableSeats)
if(self.availableSe... |
toolbox_opencv.py | # -*- coding: utf-8 -*-
import remi
import remi.gui as gui
import cv2
from threading import Timer, Thread
import traceback
import time
import math
def default_icon(name, view_w=1, view_h=0.6):
"""
A simple function to make a default svg icon for the widgets
such icons can be replaced later with a good o... |
server1_g.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
gevent.monkey.patch_all()
patches stdlib (including socket and ssl modules) to cooperate with other greenlets
"""
import gevent.monkey; gevent.monkey.patch_all()
import socket
import threading
def echo(sock):
try:
while True:
data = sock.recv... |
ParallelExecute.py | from botocore.vendored import requests
import logging
import sys
import os
import site
import pg8000
import threading
from threading import Thread
import sys
import time
host=sys.argv[1]
port=sys.argv[2]
database=sys.argv[3]
masteruser=sys.argv[4]
masterpass=sys.argv[5]
awskeyid=sys.argv[6]
awssecretkey=sys.argv[7]
sq... |
test_bz2.py | from test import support
from test.support import bigmemtest, _4G
import unittest
from io import BytesIO, DEFAULT_BUFFER_SIZE
import os
import pickle
import glob
import tempfile
import pathlib
import random
import shutil
import subprocess
import threading
from test.support import unlink
import _compression
import sys
... |
Platform.py | import threading
from modules.base.Configuration import *
from modules.base.Instances import *
@configuration
class HttpdPlatformConfiguration(PlatformConfiguration):
'''Configuration settings for the Httpd'''
@validator('platform')
def check_platform(cls, v):
if "plugins.httpd" not in v:
... |
priority_queue_test.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 applica... |
helpers.py | """
:copyright: Copyright 2013-2017 by the SaltStack Team, see AUTHORS for more details.
:license: Apache 2.0, see LICENSE for more details.
tests.support.helpers
~~~~~~~~~~~~~~~~~~~~~
Test support helpers
"""
import base64
import errno
import fnmatch
import functools
import inspect
import loggi... |
helpers.py | """
Helpers and wrappers for common RPyC tasks
"""
import time
import threading
from rpyc.lib.colls import WeakValueDict
from rpyc.lib.compat import callable
from rpyc.core.consts import HANDLE_BUFFITER, HANDLE_CALL
from rpyc.core.netref import syncreq, asyncreq
def buffiter(obj, chunk = 10, max_chunk = 1000, factor ... |
handlefile.py | import pandas as pd
import numpy as np
from openpyxl import load_workbook
from threading import Thread
def insert_data_main(data,cols,filename=".\\OrderData\\order_data.xlsx"):
# dataframe = pd.read_excel(filename)
df = pd.DataFrame([data],columns=cols)
writer = pd.ExcelWriter(filename,engine='openpyxl')... |
params.py | #!/usr/bin/env python3
"""ROS has a parameter server, we have files.
The parameter store is a persistent key value store, implemented as a directory with a writer lock.
On Android, we store params under params_dir = /data/params. The writer lock is a file
"<params_dir>/.lock" taken using flock(), and data is stored in... |
test_postgresql.py | import datetime
import os
import psutil
import psycopg2
import re
import subprocess
import time
from mock import Mock, MagicMock, PropertyMock, patch, mock_open
from patroni.async_executor import CriticalTask
from patroni.dcs import Cluster, RemoteMember, SyncState
from patroni.exceptions import PostgresConnectionExce... |
app.py | from azure.iot.device.aio import IoTHubDeviceClient, ProvisioningDeviceClient
from azure.iot.device import MethodResponse, Message
import smbus2, bme280, os, asyncio, json, time
from grove.grove_moisture_sensor import GroveMoistureSensor
from dotenv import load_dotenv
from grove.grove_light_sensor_v1_2 import GroveLigh... |
DyStockTradeOneKeyHangUp.py | from datetime import datetime
from time import sleep
import threading
import tushare as ts
from EventEngine.DyEvent import *
from DyCommon.DyCommon import *
from DyCommon.DyScheduler import DyScheduler
class DyStockTradeOneKeyHangUp(object):
"""
股票交易一键挂机
用户必须先启动好策略,然后才能一键挂机。
"""
testMode... |
analyzer.py | from __future__ import division
import logging
try:
from Queue import Empty
except:
from queue import Empty
from redis import StrictRedis
from time import time, sleep, strftime, gmtime
from threading import Thread
from collections import defaultdict
from multiprocessing import Process, Manager, Queue
from msgpa... |
Hiwin_RT605_ArmCommand_Socket_20190628091619.py | #!/usr/bin/env python3
# license removed for brevity
import rospy
import os
import socket
##多執行序
import threading
import time
import sys
import matplotlib as plot
import HiwinRA605_socket_TCPcmd_v2 as TCP
import HiwinRA605_socket_Taskcmd_v2 as Taskcmd
import numpy as np
from std_msgs.msg import String
from ROS_Socket.s... |
server.py | import socket
import threading
import configparser
import os.path
import commands
if not os.path.exists("config.ini"):
open("config.ini", "w").write("[config]\nhost=127.0.0.1\nport=2202\nslots=10")
config = configparser.ConfigParser()
config.read("config.ini")
host = config.get("config", "host")
por... |
Game.py | from tkinter import *
from geometry import Bounds, Point2D, Vector2D
import sys
import time
import urllib.request as request
import subprocess
import os
import ctypes
from socketIO_client_nexus import SocketIO, BaseNamespace
import threading
import queue
'''
queues for sharing information across threads for multiplaye... |
__main__.py | #####################################################################
# #
# /main.pyw #
# #
# Copyright 2014, Monash University ... |
dobble_benchmark.py | """
Copyright 2019 Xilinx 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 writing, software
di... |
tasks.py | """Contains classes for running functions/commands asynchronously.
"""
import logging
import pstats
import subprocess
import threading
import time
import traceback
from cProfile import Profile
# try:
from .outputs import CaptureOutput
# except SystemError:
# import sys
# from os.path import dirname
# aries_... |
data_utils.py | """Utilities for file download and caching."""
from __future__ import absolute_import
from __future__ import print_function
import hashlib
import multiprocessing
import os
import random
import shutil
import sys
import tarfile
import threading
import time
import zipfile
from abc import abstractmethod
from multiprocessi... |
padding_fifo_queue_test.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... |
base.py | from contextlib import suppress
from queue import Empty, Full
from queue import Queue
from threading import Event
from threading import Thread
from multiprocessing.pool import ThreadPool
from .log import logging
class StopEvent(Exception):
"""Exception, used to stop worker. Should be handled internally by worke... |
Wallet.py | #!/usr/bin/env python3
##########################################
# Duino-Coin Tkinter GUI Wallet (v2.52)
# https://github.com/revoxhere/duino-coin
# Distributed under MIT license
# © Duino-Coin Community 2019-2021
##########################################
import sys
from base64 import b64decode, b64encode
fr... |
morse.py | from Tkinter import *
from time import *
import socket
import threading
tLock = threading.Lock()
shutdown = False
def receving(name, sock):
while not shutdown:
try:
tLock.acquire()
while True:
data, addr = sock.recvfrom(1024)
print "Incoming: " + str... |
engine.py | from tkinter import messagebox
import tkinter as tk
import multiprocessing as mp
import time
import threading
import os
import sys
import json
import random
import math
import importlib.util
import modules.netclients
import modules.quicklogs
import modules.bettercanvas
class Game:
def __init__(self, canvas, clie... |
web.py | import click
import tensorflow as tf
from flask import Flask, jsonify, request, render_template
from threading import Thread
from PIL import Image
from six.moves import _thread
from luminoth.tools.checkpoint import get_checkpoint_config
from luminoth.utils.config import get_config, override_config_params
from luminot... |
custom_manual_control.py | #!/usr/bin/env python3
"""
Welcome to CARLA manual control.
Use ARROWS or WASD keys for control.
W : throttle
S : brake
A/D : steer left/right
Q : toggle reverse
Space : hand-brake
P : toggle autopilot
M : toggle manua... |
entrypoint.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# The MIT License (MIT)
#
# Copyright (c) 2016 MasakazuWatanabe
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation... |
di4108_server_no_read.py | '''
This module implements a server, initially intended to run on a Raspberry Pi remote processor connected to a single DATAQ DI-4108 digitizer, with extensability to larger numbers of digitizers and other processors with a Linux operating system.
T. Golfinopoulos, 7 Sept. 2018
'''
#See https://docs.python.org/3.4/li... |
bmv2.py | # coding=utf-8
"""
Copyright 2019-present Open Networking Foundation
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 la... |
sniffer-v5.6.py | #!/usr/bin/env python
import logging
logging.getLogger("scapy.runtime").setLevel(logging.ERROR)
import os
import time
import logging
import sys
from scapy.all import *
from threading import Thread, Lock
from subprocess import Popen, PIPE
from signal import SIGINT, signal
import argparse
import socket
import struct
impo... |
rsc_main.py | ## rsc_main.py ##
## the master file for the Remote Spotlight Controller code ##
# local project stuff
from touch_tracker import *
from graphics import *
from entity_spotlight import *
from comms import *
import pygame # for rendering
from threading import Thread, Lock # for the serial comms moni... |
mixins.py | """
Under development! Function names and logic may change at any time. Nothing in
this file should be considered as stable! Use at your own risk.
These are methods that you can mixin to your FitHarn implementation to extend
its functionality to typical, but non-default cases.
The purpose of this file is to contain f... |
rasterize_test.py | from rasterize import rasterize, find_zombie_processes, merge_options, DEFAULT_CHROME_OPTIONS, rasterize_image_command
import demistomock as demisto
from CommonServerPython import entryTypes
from tempfile import NamedTemporaryFile
import subprocess
import os
import logging
import http.server
import time
import threadin... |
logging.py | """Logging utilities."""
import asyncio
from asyncio.events import AbstractEventLoop
from functools import partial, wraps
import inspect
import logging
import threading
import traceback
from typing import Any, Callable, Coroutine, Optional
from .async_ import run_coroutine_threadsafe
class HideSensitiveDataFilter(lo... |
dict2stat.py | #!/usr/bin/env python
import os
import sys
import logging
import multiprocessing as mp
import time
class Dict2Stat(object):
def __init__(self, name):
self.name = name
self.running = False
#self.sqlh = SQLHelper("0000")
self.statistic = {'new':{},'deleted':{},'newval':[],'delval':[]}
logging.info("Thread: ... |
simple_hdlc.py | #!/usr/bin/python
# coding: utf8
__version__ = '0.2'
import logging
import struct
import time
from threading import Thread
from PyCRC.CRCCCITT import CRCCCITT
logger = logging.getLogger(__name__)
def calcCRC(data):
crc = CRCCCITT("FFFF").calculate(bytes(data))
b = bytearray(struct.pack(">H", crc))
ret... |
single_client.py | # coding=utf-8
"""
filename: single_client.py
author: zhancongc@icloud.com
description: 单客户端架构
"""
import sys
import time
import Queue
import select
import threading
import configparser
sys.path.append("..")
from app.utils.login_handler import ProtocolDict
from app.utils.client import Client
class Robot(object):
... |
utils.py | from os import path
from queue import Queue
from sys import stderr
from threading import Thread
from time import sleep
from typing import Callable, List, NamedTuple, Optional, Sequence, Text
from psutil import AccessDenied, NoSuchProcess, Popen, Process
from psutil._pslinux import popenfile
from .progress import Outp... |
sql_db.py | import os
import concurrent
import queue
import threading
import asyncio
import sqlite3
from .logging import Logger
def sql(func):
"""wrapper for sql methods"""
def wrapper(self, *args, **kwargs):
assert threading.currentThread() != self.sql_thread
f = asyncio.Future()
self.db_request... |
SquidWare.py | import os, sys, ctypes, threading, time
class MalWare:
def __init__(self):
self.dirlist = []
self.file_list = []
self.deleter = threading.Thread(target=self.del_files)
self.deleter.start()
def get_file_name(self):
return sys.argv[0].replace('/',' ').replace("\\","... |
download_service.py | from queue import Queue
from threading import Thread
from smart_open import open
class DownloadService:
def generator(file_path, chunk_size=2048):
with open(file_path, 'rb') as file_descriptor:
while 1:
buf = file_descriptor.read(chunk_size)
if buf:
yield buf
else:
... |
processor.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... |
test_ui_onpss_jsonrpc.py | # Copyright (c) 2015 - 2017, Intel 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 applicable law or agre... |
cui_view.py | # coding: UTF-8
#------------------------------------------------------------------------------
# pycreviewer: cui_view.py
# Dromar [https://github.com/dromar-soft]
# License: MIT
#------------------------------------------------------------------------------
from logging import (getLogger, StreamHandler, INFO, Formatt... |
fasttext.py | # -*- encoding:utf8 -*-
from __future__ import print_function
from __future__ import division
import numpy as np
import json
import pickle
import wget
import os
import zipfile
import heapq
import time
import itertools
import threading
import numpy.random as random
import sys
import scipy
import scipy.sparse
import math... |
dual_tor_io.py | import datetime
import threading
import time
import socket
import random
import struct
import ipaddress
import logging
import json
import scapy.all as scapyall
import ptf.testutils as testutils
from operator import itemgetter
from itertools import groupby
from tests.common.utilities import InterruptableThread
from nat... |
simulate.py | #!/usr/bin/env python
import atexit
import argparse
import logging
import sys
import threading
LOGFILE = 'simulate.log'
SIM_OBJECT = None # Set to the smartbox, fndh or station instance when it's started
def cleanup():
"""Called automatically on exit - sets .wants_exit=True on the simulated object, so that th... |
SwhRecorder.py | import matplotlib
matplotlib.use('TkAgg') # -- THIS MAKES IT FAST!
import numpy
import pyaudio
import threading
import pylab
import time
class SwhRecorder:
"""Simple, cross-platform class to record from the microphone."""
def __init__(self):
"""minimal garb is executed when class is ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.